cyclid-ui 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9814c8d110ccfe013e04cea146f6ff28b25ccd3c
4
- data.tar.gz: f3501d1380185c9a772b61e3df0947031974fee2
3
+ metadata.gz: 7c825bc53e4d80b21910dc57748dbc5fd875eb7f
4
+ data.tar.gz: ea890e1cc6d3f8ec89652cec593e57555dbc25b2
5
5
  SHA512:
6
- metadata.gz: f1ababb60d429b122929875c5b9299c5b75af95c9e50422ecadf694ad7938bb6a8c5de4ca7a4c1ee5044daa85280fcbb56880a0f673052a243489a940215ba15
7
- data.tar.gz: 73792917cfe866677dc6a3960da9e8547627d87294727724b0e2a30874b9531ece5c668839d4a55fcdd79ccfb010b59fa51dcf2d0fd2664a640764540fd3e0d4
6
+ metadata.gz: 43f2bbd8bad9a2e0b0e73a40202fce843c05b3179db44d3cb60aa487eff9e184236baeb1ad1af85dd375b92f603b519055cf2fb7e9197222bc93866457bac342
7
+ data.tar.gz: b7c8add78e315865b33af006ff5e026ee93eb536be156bc7f277c654e9c770c740f6eb90c6d720800f050d582a0899b63d4039ff93942a37a43b541cd154c72e
@@ -119,6 +119,7 @@ module Cyclid
119
119
  use Controllers::Organization
120
120
  use Controllers::User
121
121
  use Controllers::Health
122
+ use Controllers::Default
122
123
  end
123
124
  end
124
125
  end
@@ -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-4 text-muted pad-5">
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-8 text-muted pad-5">
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>
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+ module Cyclid
3
+ module UI
4
+ VERSION = '0.1.1'
5
+ end
6
+ end
@@ -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>&nbsp;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>&nbsp;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
- var duration = ji_calculate_duration(job.started, job.ended);
156
- $('#ji_job_duration').text(duration);
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.0
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-08-20 00:00:00.000000000 Z
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