cyclid-ui 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/cyclid_ui.rb +1 -0
- data/app/cyclid_ui/controllers/default.rb +43 -0
- data/app/cyclid_ui/models/user.rb +3 -1
- data/app/cyclid_ui/templates/user.mustache +2 -2
- data/lib/cyclid_ui/version.rb +6 -0
- data/public/js/job.js +11 -4
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c825bc53e4d80b21910dc57748dbc5fd875eb7f
|
4
|
+
data.tar.gz: ea890e1cc6d3f8ec89652cec593e57555dbc25b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43f2bbd8bad9a2e0b0e73a40202fce843c05b3179db44d3cb60aa487eff9e184236baeb1ad1af85dd375b92f603b519055cf2fb7e9197222bc93866457bac342
|
7
|
+
data.tar.gz: b7c8add78e315865b33af006ff5e026ee93eb536be156bc7f277c654e9c770c740f6eb90c6d720800f050d582a0899b63d4039ff93942a37a43b541cd154c72e
|
data/app/cyclid_ui.rb
CHANGED
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# Copyright 2016 Liqwyd Ltd.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
module Cyclid
|
17
|
+
module UI
|
18
|
+
module Controllers
|
19
|
+
# Sinatra controller for default routes
|
20
|
+
class Default < Base
|
21
|
+
# Default route; redirect depending on the current session status
|
22
|
+
get '/' do
|
23
|
+
# Non-authenticated users will automatically redirect to the login page
|
24
|
+
authenticate!
|
25
|
+
|
26
|
+
# Authenticated users will redirect to one of two potential locations
|
27
|
+
user = current_user
|
28
|
+
|
29
|
+
# Pick the first organization from the users membership and
|
30
|
+
# redirect; if the user doesn't belong to any organizations,
|
31
|
+
# redirect them to their user page
|
32
|
+
initial_page = if user.organizations.empty?
|
33
|
+
"/user/#{user.username}"
|
34
|
+
else
|
35
|
+
user.organizations.first
|
36
|
+
end
|
37
|
+
|
38
|
+
redirect to initial_page
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -20,11 +20,12 @@ module Cyclid
|
|
20
20
|
# Cyclid user data that is returned from the API, with the added layer
|
21
21
|
# of Memecached caching of the object to avoid API calls.
|
22
22
|
class User
|
23
|
-
attr_reader :username, :email, :organizations, :id
|
23
|
+
attr_reader :username, :email, :name, :organizations, :id
|
24
24
|
|
25
25
|
def initialize(args = {})
|
26
26
|
@username = args['username'] || nil
|
27
27
|
@email = args['email'] || nil
|
28
|
+
@name = args['name'] || nil
|
28
29
|
@organizations = args['organizations'] || []
|
29
30
|
@id = args['id'] || nil
|
30
31
|
end
|
@@ -32,6 +33,7 @@ module Cyclid
|
|
32
33
|
def to_hash
|
33
34
|
{ 'username' => @username,
|
34
35
|
'email' => @email,
|
36
|
+
'name' => @name,
|
35
37
|
'organizations' => @organizations,
|
36
38
|
'id' => @id }
|
37
39
|
end
|
@@ -28,10 +28,10 @@
|
|
28
28
|
|
29
29
|
<div class="col-md-6 pad-20">
|
30
30
|
<div class="row">
|
31
|
-
<div class="col-md-
|
31
|
+
<div class="col-md-5 text-muted pad-5">
|
32
32
|
<button type="button" class="btn btn-default" style="width:100%;" data-toggle="modal" data-target="#user_password_modal">Change password</button>
|
33
33
|
</div>
|
34
|
-
<div class="col-md-
|
34
|
+
<div class="col-md-7 text-muted pad-5">
|
35
35
|
<small>Change your password and reset your client token.</small>
|
36
36
|
</div>
|
37
37
|
</div>
|
data/public/js/job.js
CHANGED
@@ -113,11 +113,11 @@ function ji_update_status(job) {
|
|
113
113
|
var waiting = '<h6>Unknown</h6>';
|
114
114
|
switch(job.status) {
|
115
115
|
case 1:
|
116
|
-
case 2:
|
117
116
|
waiting = '<h6><i class="fa fa-spinner fa-pulse"></i> Waiting for job to start...</h6>'
|
118
117
|
$('#ji_job_waiting').html(waiting);
|
119
118
|
$('#ji_job_waiting').removeClass('hidden');
|
120
119
|
break;
|
120
|
+
case 2:
|
121
121
|
case 3:
|
122
122
|
case 4:
|
123
123
|
waiting = '<h6><i class="fa fa-cog fa-spin"></i> Waiting for job to complete...</h6>';
|
@@ -133,6 +133,13 @@ function ji_update_status(job) {
|
|
133
133
|
// Update the status indicator, if there is one
|
134
134
|
var indicator = ji_job_status_to_indicator(job.status);
|
135
135
|
$(`#row${job.job_id} > #status`).html(indicator);
|
136
|
+
|
137
|
+
if (job.ended) {
|
138
|
+
// Update the duration, if there is one
|
139
|
+
var duration = ji_calculate_duration(job.started, job.ended);
|
140
|
+
console.log(`duration is ${duration}`)
|
141
|
+
$(`#row${job.job_id} > #duration`).text(duration);
|
142
|
+
}
|
136
143
|
}
|
137
144
|
|
138
145
|
// Set & show the job details
|
@@ -150,10 +157,10 @@ function ji_update_details(job) {
|
|
150
157
|
if (job.ended) {
|
151
158
|
var ended = new Date(job.ended);
|
152
159
|
$('#ji_job_ended').text(ended.toUTCString());
|
153
|
-
}
|
154
160
|
|
155
|
-
|
156
|
-
|
161
|
+
var duration = ji_calculate_duration(job.started, job.ended);
|
162
|
+
$('#ji_job_duration').text(duration);
|
163
|
+
}
|
157
164
|
|
158
165
|
$('#ji_details').removeClass('hidden');
|
159
166
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cyclid-ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kristian Van Der Vliet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: require_all
|
@@ -205,6 +205,7 @@ files:
|
|
205
205
|
- app/cyclid_ui/config.rb
|
206
206
|
- app/cyclid_ui/controllers/auth.rb
|
207
207
|
- app/cyclid_ui/controllers/base.rb
|
208
|
+
- app/cyclid_ui/controllers/default.rb
|
208
209
|
- app/cyclid_ui/controllers/health.rb
|
209
210
|
- app/cyclid_ui/controllers/organization.rb
|
210
211
|
- app/cyclid_ui/controllers/user.rb
|
@@ -225,6 +226,7 @@ files:
|
|
225
226
|
- app/cyclid_ui/views/user.rb
|
226
227
|
- bin/cyclid-ui-assets
|
227
228
|
- lib/cyclid_ui/app.rb
|
229
|
+
- lib/cyclid_ui/version.rb
|
228
230
|
- public/images/LICENSE
|
229
231
|
- public/images/cyclid-logo-large.png
|
230
232
|
- public/images/favicon16.png
|