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
18937cec
Commit
18937cec
authored
Apr 04, 2016
by
Evren Kutar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
menu rename to dashboard and get it with socket
parent
5c4f12cc
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
35 additions
and
15 deletions
+35
-15
auth_controller.js
app/components/auth/auth_controller.js
+4
-1
auth_service.js
app/components/auth/auth_service.js
+1
-0
crud_controller.js
app/components/crud/crud_controller.js
+7
-3
form.html
app/components/crud/templates/form.html
+1
-1
list.html
app/components/crud/templates/list.html
+2
-1
socket.js
app/zetalib/socket.js
+15
-5
app.js
dist/app.js
+2
-2
templates.js
dist/templates.js
+3
-2
No files found.
app/components/auth/auth_controller.js
View file @
18937cec
...
...
@@ -25,10 +25,13 @@ angular.module('ulakbus.auth', ['ngRoute', 'ngCookies'])
* @description LoginCtrl responsible to handle login process.<br>
* Using 'ulakbus.formService.get_form' function generates the login form and post it to the API with input datas.
*/
.
controller
(
'LoginController'
,
function
(
$scope
,
$q
,
$timeout
,
$location
,
$routeParams
,
$rootScope
,
$log
,
Generator
,
AuthService
)
{
.
controller
(
'LoginController'
,
function
(
$scope
,
$q
,
$timeout
,
$location
,
$routeParams
,
$rootScope
,
$log
,
WSOps
,
Generator
,
AuthService
)
{
$scope
.
url
=
'login'
;
$scope
.
form_params
=
{};
$scope
.
form_params
[
'clear_wf'
]
=
1
;
// if websocket status is open ---> ws close
try
{
WSOps
.
close
()}
catch
(
e
)
{
$log
.
error
(
e
.
message
)}
AuthService
.
get_form
(
$scope
).
then
(
function
(
data
)
{
if
(
data
.
login
)
{
$location
.
path
(
'/'
);
}
$scope
.
form
=
[
...
...
app/components/auth/auth_service.js
View file @
18937cec
...
...
@@ -87,6 +87,7 @@ angular.module('ulakbus.auth')
$rootScope
.
loginAttempt
=
0
;
WSOps
.
request
({
wf
:
'logout'
}).
then
(
function
(
data
)
{
$rootScope
.
loggedInUser
=
false
;
$rootScope
.
current_user
=
true
;
$log
.
debug
(
"loggedout"
);
$location
.
path
(
"/login"
);
WSOps
.
close
();
...
...
app/components/crud/crud_controller.js
View file @
18937cec
...
...
@@ -95,6 +95,9 @@ angular.module('ulakbus.crud', ['schemaForm', 'ui.bootstrap', 'ulakbus.formServi
if
(
scope
.
meta
[
'selective_listing'
]
===
true
)
{
angular
.
forEach
(
scope
.
objects
,
function
(
_v
,
_k
)
{
angular
.
forEach
(
_v
.
objects
,
function
(
value
,
key
)
{
if
(
_v
.
selected
===
true
)
{
scope
.
selected_key
=
_k
;
}
if
(
key
>
0
)
{
var
linkIndexes
=
{};
angular
.
forEach
(
value
.
actions
,
function
(
v
,
k
)
{
...
...
@@ -296,7 +299,7 @@ angular.module('ulakbus.crud', ['schemaForm', 'ui.bootstrap', 'ulakbus.formServi
// selective listing for list page todo: add to documentation
$scope
.
update_selective_list
=
function
(
key
)
{
$scope
.
objects
=
$scope
.
all_objects
[
key
]
[
"objects"
];
$scope
.
objects
=
key
[
"objects"
];
};
// end of selective listing
$scope
.
listFormCmd
=
function
()
{
...
...
@@ -330,9 +333,10 @@ angular.module('ulakbus.crud', ['schemaForm', 'ui.bootstrap', 'ulakbus.formServi
}
// if selective listing then change objects key to its first item
if
(
$scope
.
meta
.
selective_listing
)
{
if
(
angular
.
isDefined
(
$scope
.
meta
.
selective_listing
)
)
{
$scope
.
all_objects
=
angular
.
copy
(
$scope
.
objects
);
$scope
.
objects
=
$scope
.
all_objects
[
0
][
"objects"
];
$scope
.
selective_list_key
=
$scope
.
all_objects
[
$scope
.
selected_key
];
$scope
.
objects
=
$scope
.
selective_list_key
[
"objects"
];
}
};
$scope
.
reloadCmd
=
function
()
{
...
...
app/components/crud/templates/form.html
View file @
18937cec
...
...
@@ -20,7 +20,7 @@
</div>
<div
ng-repeat=
"node in ListNode"
>
<h3>
{{ node.title }}
<span>
<span
ng-if=
"meta.allow_add_listnode !== false"
>
<a
modal-for-nodes=
"{{node.schema.model_name}},ListNode,add"
>
<i
class=
"fa fa-plus-circle fa-fw"
></i>
</a>
...
...
app/components/crud/templates/list.html
View file @
18937cec
...
...
@@ -14,8 +14,9 @@
<select
name=
"selective_list"
id=
"selective_list"
ng-change=
"update_selective_list(selective_list_key)"
ng-model=
"selective_list_key"
ng-options=
"item as item.key for item in all_objects"
class=
"form-control"
>
<
option
ng-repeat=
"item in all_objects"
value=
"{{$index}}"
ng-selected=
"selective_list_key"
>
{{item.key}}
</option
>
<
!--<option ng-repeat="item in all_objects" value="{{$index}}">{{item.key}}</option>--
>
</select>
</div>
<div
class=
"tablescroll"
ng-if=
"objects[1]"
>
...
...
app/zetalib/socket.js
View file @
18937cec
...
...
@@ -31,7 +31,6 @@ angular.module('ulakbus')
});
var
websocket
;
var
ws_is_generated
;
var
refresh_count
=
0
;
var
refresh_websocket
=
refresh_count
<
5
?
1000
:
5000
;
var
isSupported
=
function
()
{
...
...
@@ -59,7 +58,6 @@ angular.module('ulakbus')
websocket
.
onerror
=
function
(
evt
)
{
wsOps
.
onError
(
evt
)
};
ws_is_generated
=
true
;
}
else
{
var
error
=
{
error
:
"Tarayıcınız websocket desteklememektedir. Lütfen güncel bir tarayıcı kullanınız."
,
...
...
@@ -73,10 +71,22 @@ angular.module('ulakbus')
};
var
wsOps
=
{};
var
keepAlivePing
=
function
(
interval
)
{
return
setInterval
(
function
()
{
if
(
$rootScope
.
websocketIsOpen
)
{
wsOps
.
doSend
(
angular
.
toJson
({
data
:
{
view
:
"ping"
}}));
}
else
{
$timeout
(
function
()
{
this
(
interval
);
},
1000
);
}
},
interval
);
};
wsOps
.
onOpen
=
function
(
evt
)
{
$rootScope
.
websocketIsOpen
=
true
;
$log
.
info
(
"CONNECTED"
,
evt
);
wsOps
.
loggedOut
===
false
;
keepAlivePing
(
30000
);
wsOps
.
loggedOut
=
false
;
};
wsOps
.
onClose
=
function
(
event
)
{
$rootScope
.
websocketIsOpen
=
false
;
...
...
@@ -136,7 +146,7 @@ angular.module('ulakbus')
};
// reactor with promise
wsOps
.
request
=
function
(
data
)
{
if
(
ws_is_generated
)
{
if
(
$rootScope
.
websocketIsOpen
)
{
var
request
=
{
callbackID
:
Math
.
random
().
toString
(
36
).
substring
(
7
),
data
:
data
...
...
@@ -152,7 +162,7 @@ angular.module('ulakbus')
}
);
}
else
{
// is
ws_is_generated
is not true try again in one second
// is
$rootScope.websocketIsOpen
is not true try again in one second
$timeout
(
function
()
{
wsOps
.
request
(
data
);
},
1000
);
...
...
dist/app.js
View file @
18937cec
This source diff could not be displayed because it is too large. You can
view the blob
instead.
dist/templates.js
View file @
18937cec
...
...
@@ -200,7 +200,7 @@ angular.module("components/crud/templates/form.html", []).run(["$templateCache",
" </div>
\n
"
+
" <div ng-repeat=
\"
node in ListNode
\"
>
\n
"
+
" <h3>{{ node.title }}
\n
"
+
" <span>
\n
"
+
" <span
ng-if=
\"
meta.allow_add_listnode !== false
\"
>
\n
"
+
" <a modal-for-nodes=
\"
{{node.schema.model_name}},ListNode,add
\"
>
\n
"
+
" <i class=
\"
fa fa-plus-circle fa-fw
\"
></i>
\n
"
+
" </a>
\n
"
+
...
...
@@ -266,8 +266,9 @@ angular.module("components/crud/templates/list.html", []).run(["$templateCache",
" <select name=
\"
selective_list
\"
id=
\"
selective_list
\"\n
"
+
" ng-change=
\"
update_selective_list(selective_list_key)
\"\n
"
+
" ng-model=
\"
selective_list_key
\"\n
"
+
" ng-options=
\"
item as item.key for item in all_objects
\"\n
"
+
" class=
\"
form-control
\"
>
\n
"
+
" <
option ng-repeat=
\"
item in all_objects
\"
value=
\"
{{$index}}
\"
ng-selected=
\"
selective_list_key
\"
>{{item.key}}</option
>
\n
"
+
" <
!--<option ng-repeat=
\"
item in all_objects
\"
value=
\"
{{$index}}
\"
>{{item.key}}</option>--
>
\n
"
+
" </select>
\n
"
+
" </div>
\n
"
+
" <div class=
\"
tablescroll
\"
ng-if=
\"
objects[1]
\"
>
\n
"
+
...
...
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