puppetfactory 0.6.2 → 0.6.3

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.
data/public/js/scripts.js CHANGED
@@ -16,6 +16,10 @@ $(document).ready(function(){
16
16
  return keepLoading;
17
17
  },
18
18
  });
19
+
20
+ $('article').on('click', '.toggle', function(event){
21
+ $("#" + $(this).data('target')).toggle();
22
+ });
19
23
  });
20
24
 
21
25
  function updatePage(name) {
@@ -35,6 +35,17 @@ $(document).ready(function(){
35
35
  close();
36
36
  });
37
37
 
38
+ $('.tab').on('click', function(event) {
39
+ event.preventDefault();
40
+ var tabs = $(this).closest('.tabs-wrapper');
41
+
42
+ tabs.find('.tab.active').removeClass('active');
43
+ $(this).addClass('active');
44
+
45
+ tabs.find('.tab-content.current').removeClass('current');
46
+ $('#' + this.dataset.tabcontent).addClass('current');
47
+ });
48
+
38
49
  $('article').on('click', '#users .select a, #user-logout', function(event){
39
50
  event.preventDefault();
40
51
  var action = $(this).attr('href');
@@ -50,10 +61,16 @@ $(document).ready(function(){
50
61
 
51
62
  $('#login-submit').click(function (event) {
52
63
  event.preventDefault();
53
- var action = $(this).attr('href');
54
- var user = $('#login-user').val();
64
+ var action = $(this).attr('href') + $('#login-user').val();
55
65
 
56
- $.get(action, {user: user});
66
+ $.get(action, function(data) {
67
+ var results = $.parseJSON(data);
68
+ if (results.status == 'ok') {
69
+ location.replace('/');
70
+ } else {
71
+ alert('User selection failed');
72
+ }
73
+ });
57
74
  });
58
75
 
59
76
  // save the new user
@@ -1,44 +1,59 @@
1
- <div id="currentuser-wrapper">
2
1
  <% if @current %>
3
- <h3>Selected User</h3>
4
- <table id="currentuser">
5
- <tr><th class="header">Username:</th> <td><%= @current[:username] %></td></tr>
6
- <tr><th class="header">Certname:</th> <td><%= @current[:certname] %></td></tr>
7
- <% if @current[:port] -%>
8
- <tr><th class="header">Webserver URL:</th> <td><a href="/port/<%= @current[:port] %>/"><%= @current[:url] %></a></td></tr>
9
- <% end -%>
10
- <% if @current[:container_status] -%>
11
- <tr><th class="header">Container:</th> <td><%= @current[:container_status]['Description'] %></td></tr>
12
- <% end -%>
13
- <% if @current[:node_group_url] -%>
14
- <tr><th class="header">Node Group:</th> <td><a href="https://<%= request.host %>/<%= @current[:node_group_url] %>" target="_console">Console login</a></td></tr>
15
- <% end -%>
16
- <% if @current[:controlrepo] -%>
17
- <tr><th class="header">Control Repo:</th> <td><a href="<%= @current[:controlrepo] %>" target="_repository"><%= @current[:controlrepo] %></a></td></tr>
18
- <% end -%>
19
- <% if @current[:latestcommit] -%>
20
- <tr><th class="header">Latest Commit:</th>
21
- <td>
22
- <a href="<%= @current[:latestcommit][:url] %>" target="_repository"><%= @current[:latestcommit][:message] %></a>
23
- <small>(<%= @current[:latestcommit][:time] %>)</small>
24
- </td></tr>
25
- <% end -%>
26
- <% if settings.plugins.include? :Dashboard -%>
27
- <tr><th class="header">Spec Tests:</th> <td><a href="/dashboard/details/<%= @current[:username] %>" target="_results">results</a> <small>(may not always be available)</small></td></tr>
28
- <% end -%>
29
- <% if @current[:tree] -%>
30
- <tr>
31
- <th class="header">Environment Structure:</th>
32
- <td><div id="tree"></div></td>
33
- </tr>
34
- <% end -%>
35
- </table>
2
+ <div id="currentuser">
3
+ <div>
4
+ <label for="">Username</label>
5
+ <div><%= @current[:username] %> <a id="user-logout" class="pull-right" href="/users/deactive">Logout</a></div>
6
+ </div>
7
+ <div>
8
+ <label for="">Certname</label>
9
+ <div><%= @current[:certname] %></div>
10
+ </div>
11
+ <% if @current[:port] -%>
12
+ <div>
13
+ <label for="">Webserver URL</label>
14
+ <div><a href="/port/<%= @current[:port] %>/"><%= @current[:url] %></a></div>
15
+ </div>
16
+ <% end -%>
17
+ <% if @current[:container_status] -%>
18
+ <div>
19
+ <label for="">Container</label>
20
+ <div><%= @current[:container_status]['Description'] %></div>
21
+ </div>
22
+ <% end -%>
23
+ <% if @current[:node_group_url] -%>
24
+ <div>
25
+ <label for="">Node Group</label>
26
+ <div><a href="https://<%= request.host %>/<%= @current[:node_group_url] %>" target="_console">Console login</a></div>
27
+ </div>
28
+ <% end -%>
29
+ <% if @current[:controlrepo] -%>
30
+ <div>
31
+ <label for="">Control Repo</label>
32
+ <div><a href="<%= @current[:controlrepo] %>" target="_repository"><%= @current[:controlrepo] %></a></div>
33
+ </div>
34
+ <% end -%>
35
+ <% if @current[:latestcommit] -%>
36
+ <div>
37
+ <label for="">Latest Commit</label>
38
+ <div><a href="<%= @current[:latestcommit][:url] %>" target="_repository"><%= @current[:latestcommit][:message] %></a>
39
+ <small>(<%= @current[:latestcommit][:time] %>)</small></div>
40
+ </div>
41
+ <% end -%>
42
+ <% if settings.plugins.include? :Dashboard -%>
43
+ <div>
44
+ <label for="">Spec Tests</label>
45
+ <div><a href="/dashboard/details/<%= @current[:username] %>" target="_results">results</a> <small>(may not always be available)</small></div>
46
+ </div>
47
+ <% end -%>
48
+ <% if @current[:tree] -%>
49
+ <div>
50
+ <label for="">Environment Structure:</label>
51
+ <div id="tree"></div>
52
+ </div>
53
+ <% end -%>
36
54
  <% if action_enabled? :deploy -%>
37
- <i class="fa"></i><input type="button" id="deploy" data-user="<%= @current[:username] %>" value="Deploy Environment">
55
+ <input type="button" id="deploy" data-user="<%= @current[:username] %>" value="Deploy Environment">
38
56
  <% end -%>
39
- <div>
40
- <a class="user-logout" href="/users/deactive">Logout</a>
41
- </div>
42
57
  <% end %>
43
58
 
44
59
  <% if @current and @current[:tree] %>
@@ -47,5 +62,4 @@
47
62
  $('#tree').jstree({ 'core': { 'data': <%= @current[:tree] %> } });
48
63
  });
49
64
  </script>
50
- <% end %>
51
- </div>
65
+ <% end %>
data/views/index.erb CHANGED
@@ -14,7 +14,7 @@
14
14
  <body>
15
15
  <div id="tabs">
16
16
  <header>
17
- <img src="/images/Puppet-Logo-Mark-Amber-sm.png" alt="logo" id="nav-logo">
17
+ <img src="/images/Puppet-Logo-Mark-Amber-sm.png" alt="logo" id="nav-logo"> Classroom
18
18
  <ul>
19
19
  <li><a href="#home" class="cache">Home</a></li>
20
20
  <% if privileged? %>
@@ -36,19 +36,16 @@
36
36
  <% end %>
37
37
  </header>
38
38
  <article>
39
- <h2>Puppet Classroom</h2>
40
39
  <div id="home">
41
40
  <div class="flexrow">
42
- <div class="flex-7 flex-left">
41
+ <div class="flex-6 flex-left">
43
42
  <%= erb :shell %>
44
43
  </div>
45
- <div id="user-wrapper" class="flex-3 flex-right">
44
+ <div class="flex-2 flex-right">
46
45
  <% if @current %>
47
46
  <%= erb :currentuser %>
48
47
  <% else %>
49
48
  <%= erb :newuser %>
50
- <hr>
51
- <%= erb :userlogin %>
52
49
  <% end -%>
53
50
  </div>
54
51
  </div>
data/views/logs.erb CHANGED
@@ -9,7 +9,7 @@
9
9
  var elem = $(this)[0]
10
10
  // track the bottom of the logs, unless we've scrolled away
11
11
  if(force || (elem.scrollHeight - elem.scrollTop - elem.clientHeight < 100)) {
12
- $(this).animate({scrollTop: elem.scrollHeight}, 500);
12
+ $('body').animate({scrollTop: elem.scrollHeight}, 500);
13
13
  }
14
14
 
15
15
  // use timeout instead of an interval so that in case of network error
data/views/newuser.erb CHANGED
@@ -1,19 +1,39 @@
1
- <div id="newuser">
2
- <h3>Create a new user</h3>
3
- <div>
4
- <label for="user">Username:</label><input type="text" id="user" value="" />
1
+ <div class="tabs-wrapper">
2
+ <div class="tabs">
3
+ <div class="tab active" data-tabcontent="newuser">
4
+ New User
5
+ </div>
6
+ <div class="tab" data-tabcontent="login">
7
+ Login
8
+ </div>
5
9
  </div>
6
- <div>
7
- <label for="password">Password:</label><input type="password" id="password" value="" />
10
+
11
+ <div id="newuser" class="tab-content current">
12
+ <div>
13
+ <label for="user">Username:</label><input type="text" id="user" value="" />
14
+ </div>
15
+ <div>
16
+ <label for="password">Password:</label><input type="password" id="password" value="" />
17
+ </div>
18
+ <div>
19
+ <label for="password2">Repeat:</label><input type="password" id="password2" value="" />
20
+ </div>
21
+ <div>
22
+ <label for="session">Session ID:</label><input type="text" id="session" value="" />
23
+ <p></p>
24
+ </div>
25
+ <div>
26
+ <input type="button" id="save" value="Submit" />
27
+ </div>
8
28
  </div>
9
- <div>
10
- <label for="password2">Repeat:</label><input type="password" id="password2" value="" />
11
- </div>
12
- <div>
13
- <label for="session">Session ID:</label><input type="text" id="session" value="" />
14
- <p></p>
15
- </div>
16
- <div>
17
- <input type="button" id="save" value="Submit" />
29
+
30
+ <div id="login" class="tab-content">
31
+ <div>
32
+ <label for="login-user">Username:</label><input type="text" id="login-user" value="" />
33
+ </div>
34
+ <div>
35
+ <a href="/users/active/" id="login-submit" class="button">Login</a>
36
+ </div>
18
37
  </div>
38
+
19
39
  </div>
data/views/shell.erb CHANGED
@@ -1,35 +1,45 @@
1
1
  <div id="shell">
2
- <% if @current %>
3
- <iframe id="console" src="/shell/login/"></iframe>
4
- <% else %>
5
- <p>
6
- Welcome to the Puppet Classroom. Please log in or create a user account.
7
- </p>
8
- <p>
9
- We will provision a Puppet agent node for you and you'll use it to complete labs and
10
- exercises. This node can be accessed through a web terminal once you've logged in.
11
- </p>
12
- <p>
13
- If you prefer, you may also use any standard SSH client using the username
14
- and password you specified. Some common SSH clients include:
15
- <p>
16
- <ul>
17
- <li>
18
- Built-in to Mac OSX and Linux:
19
- <ol>
20
- <li>Start Terminal.app or any terminal emulator to get to the command line</li>
21
- <li>Run <code>ssh <%= request.host %></code></li>
22
- </ol>
23
- </li>
24
- <li>
25
- Windows:
2
+ <% if @current %>
3
+ <iframe id="console" src="/shell/login/"></iframe>
4
+ <div>
5
+ <i id="instruction-toggle" class="fa fa-question-circle-o toggle" data-target="instruction"></i>
6
+ </div>
7
+ <script>
8
+ $(document).ready(function() {
9
+ $("#instruction").hide();
10
+ });
11
+ </script>
12
+
13
+ <% else %>
14
+ <h2>Welcome to the Puppet Classroom.</h2>
15
+ <p>Please log in or create a user account.</p>
16
+ <% end -%>
17
+ <div id="instruction">
18
+ <p>
19
+ We will provision a Puppet agent node for you and you'll use it to complete labs and
20
+ exercises. This node can be accessed through a web terminal once you've logged in.
21
+ </p>
22
+ <p>
23
+ If you prefer, you may also use any standard SSH client using the username
24
+ and password you specified. Some common SSH clients include:
25
+ <p>
26
26
  <ul>
27
- <li><a href="https://github.com/PowerShell/Win32-OpenSSH/wiki/Install-Win32-OpenSSH">OpenSSH</a></li>
28
- <li><a href="http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe">PuTTY</a></li>
29
- <li><a href="http://winscp.net/eng/download.php#download2" target="_new">WinSCP</a></li>
30
- <li><a href="http://www.vandyke.com/download/securecrt/download.html" target="_new">SecureCRT</a></li>
27
+ <li>
28
+ Built-in to Mac OSX and Linux:
29
+ <ol>
30
+ <li>Start Terminal.app or any terminal emulator to get to the command line</li>
31
+ <li>Run <code>ssh <%= request.host %></code></li>
32
+ </ol>
33
+ </li>
34
+ <li>
35
+ Windows:
36
+ <ul>
37
+ <li><a href="https://github.com/PowerShell/Win32-OpenSSH/wiki/Install-Win32-OpenSSH">OpenSSH</a></li>
38
+ <li><a href="http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe">PuTTY</a></li>
39
+ <li><a href="http://winscp.net/eng/download.php#download2" target="_new">WinSCP</a></li>
40
+ <li><a href="http://www.vandyke.com/download/securecrt/download.html" target="_new">SecureCRT</a></li>
41
+ </ul>
42
+ </li>
31
43
  </ul>
32
- </li>
33
- </ul>
34
- <% end -%>
44
+ </div>
35
45
  </div>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppetfactory
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Ford
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-11-13 00:00:00.000000000 Z
13
+ date: 2018-01-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: sinatra
@@ -253,7 +253,6 @@ files:
253
253
  - views/logs.erb
254
254
  - views/newuser.erb
255
255
  - views/shell.erb
256
- - views/userlogin.erb
257
256
  - views/users.erb
258
257
  homepage: https://github.com/puppetlabs/puppetfactory
259
258
  licenses:
@@ -275,7 +274,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
275
274
  version: '0'
276
275
  requirements: []
277
276
  rubyforge_project:
278
- rubygems_version: 2.6.10
277
+ rubygems_version: 2.5.2
279
278
  signing_key:
280
279
  specification_version: 4
281
280
  summary: Stands up a graphical classroom manager with containerized puppet agents.
data/views/userlogin.erb DELETED
@@ -1,9 +0,0 @@
1
- <div id="login">
2
- <h3>Login</h3>
3
- <div>
4
- <label for="login-user">Username:</label><input type="text" id="login-user" value="" />
5
- </div>
6
- <div>
7
- <a href="#" id="login-submit" class="button">Login</a>
8
- </div>
9
- </div>