Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
ulakbus-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ulakbus
ulakbus-ui
Commits
5840d749
Commit
5840d749
authored
Jul 15, 2016
by
Vladimir Baranov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rref #5392. Show public channels list
parent
2619b847
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
93 additions
and
6 deletions
+93
-6
app.css
app/app.css
+8
-1
index.html
app/index.html
+1
-0
main.html
app/main.html
+1
-0
directives.js
app/shared/directives.js
+13
-0
index.html
app/shared/templates/directives/messaging/index.html
+2
-3
messagingService.js
app/zetalib/messagingService.js
+41
-2
utils_service.js
app/zetalib/utils_service.js
+27
-0
No files found.
app/app.css
View file @
5840d749
...
...
@@ -2579,6 +2579,13 @@ table.dataTable thead .sorting:after {
outline
:
none
;
}
.chat-app-close-btn
{
display
:
block
;
position
:
absolute
;
right
:
5px
;
top
:
5px
;
}
/* END OF CHAT APPLICATION */
...
...
app/index.html
View file @
5840d749
...
...
@@ -118,6 +118,7 @@
<script
src=
"zetalib/action_service.js"
></script>
<script
src=
"zetalib/error_service.js"
></script>
<script
src=
"zetalib/socket.js"
></script>
<script
src=
"zetalib/utils_service.js"
></script>
<!-- components -->
...
...
app/main.html
View file @
5840d749
...
...
@@ -125,6 +125,7 @@
<script
src=
"zetalib/action_service.js"
></script>
<script
src=
"zetalib/error_service.js"
></script>
<script
src=
"zetalib/socket.js"
></script>
<script
src=
"zetalib/utils_service.js"
></script>
<!-- components -->
...
...
app/shared/directives.js
View file @
5840d749
...
...
@@ -673,6 +673,19 @@ angular.module('ulakbus')
replace
:
true
,
scope
:
{},
controller
:
function
(
$scope
)
{
var
dismissWatcher
=
$scope
.
$watch
(
function
(){
return
$rootScope
.
websocketIsOpen
},
function
(
isOpen
){
if
(
isOpen
){
dismissWatcher
();
MessagingService
.
list_channels
().
then
(
function
(
groupedChannels
){
$scope
.
publicChannels
=
groupedChannels
[
MessagingService
.
CHANNEL_TYPE
.
PUBLIC
];
$scope
.
notificationsChannels
=
groupedChannels
[
MessagingService
.
CHANNEL_TYPE
.
NOTIFICATION
];
$scope
.
directChannels
=
groupedChannels
[
MessagingService
.
CHANNEL_TYPE
.
DIRECT
];
});
}
});
$scope
.
messages
=
[];
$scope
.
$on
(
"messages"
,
function
(
event
,
data
)
{
$log
.
debug
(
"Message List Received"
,
data
);
...
...
app/shared/templates/directives/messaging/index.html
View file @
5840d749
<div
class=
"chat-app"
>
<div
class=
"chat-app"
ng-hide=
"hidden"
>
<div
class=
"chat-app-container"
>
<div
class=
"side-navigation"
>
...
...
@@ -55,6 +55,5 @@
</div>
</div>
<!-- end of create-new-message-window -->
</div>
</div>
app/zetalib/messagingService.js
View file @
5840d749
...
...
@@ -15,8 +15,15 @@ angular.module('ulakbus.messagingService', ['ui.bootstrap'])
* @name Generator
* @description form service's Generator factory service handles all generic form operations
*/
.
factory
(
'MessagingService'
,
function
(
$q
,
$timeout
,
$sce
,
$location
,
$route
,
$compile
,
$log
,
$rootScope
,
Moment
,
WSOps
)
{
.
factory
(
'MessagingService'
,
function
(
$q
,
$timeout
,
$sce
,
$location
,
$route
,
$compile
,
$log
,
$rootScope
,
Moment
,
WSOps
,
Utils
)
{
var
msg
=
{};
msg
.
CHANNEL_TYPE
=
{
"PUBLIC"
:
15
,
"DIRECT"
:
10
,
"NOTIFICATION"
:
5
};
msg
.
send
=
function
(
msg
)
{
/**
* send the message as following structure;
...
...
@@ -157,5 +164,37 @@ angular.module('ulakbus.messagingService', ['ui.bootstrap'])
return
data
;
});
};
msg
.
list_channels
=
function
list_channels
(){
/**
* request channels list as below;
* {
* 'view':'_zops_list_channels',
* }
*
* wait for response
*
* {
* 'channels': [
* {'name': string, // name of channel
* 'key': key, // key of channel
* 'unread': int, // unread message count
* 'type': int, // channel type,
* // 15: public channels (chat room/broadcast channel distinction comes from "read_only" flag)
* // 10: direct channels
* // 5: one and only private channel which can be "Notifications"
* 'read_only': boolean, // true if this is a read-only subscription to a broadcast channel
* // false if it's a public chat room
*
* 'actions':[('action name', 'view name'),]
* }
*
*/
var
outgoing
=
{
view
:
'_zops_list_channels'
};
return
WSOps
.
request
(
outgoing
).
then
(
function
(
data
)
{
return
Utils
.
groupBy
(
data
.
channels
||
[],
"type"
);
});
};
return
msg
;
});
app/zetalib/utils_service.js
0 → 100644
View file @
5840d749
/**
* Copyright (C) 2015 ZetaOps Inc.
*
* This file is licensed under the GNU General Public License v3
* (GPLv3). See LICENSE.txt for details.
*
* @author Vladimir Baranov
*/
angular
.
module
(
"ulakbus"
)
.
service
(
"Utils"
,
function
(){
var
self
=
this
;
/**
* @param list {Array} Array of objects to group
* @param propName {String} property name to group array by
* @returns {Object}
*/
this
.
groupBy
=
function
(
list
,
propName
)
{
return
list
.
reduce
(
function
(
acc
,
item
)
{
(
acc
[
item
[
propName
]]
=
acc
[
item
[
propName
]]
||
[]).
push
(
item
);
return
acc
;
},
{});
};
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment