oxidized-web 0.13.1 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of oxidized-web might be problematic. Click here for more details.

Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/.github/PULL_REQUEST_TEMPLATE.md +12 -0
  3. data/.github/dependabot.yml +25 -0
  4. data/.github/workflows/codeql.yml +76 -0
  5. data/.github/workflows/ruby.yml +41 -0
  6. data/.github/workflows/stale.yml +20 -0
  7. data/.gitignore +3 -0
  8. data/.rubocop.yml +38 -3
  9. data/.rubocop_todo.yml +27 -211
  10. data/CHANGELOG.md +46 -0
  11. data/README.md +8 -5
  12. data/Rakefile +49 -5
  13. data/docs/development.md +182 -0
  14. data/lib/oxidized/web/public/css/oxidized.css +59 -0
  15. data/lib/oxidized/web/public/scripts/oxidized.js +1 -48
  16. data/lib/oxidized/web/public/weblibs/bootstrap-icons.css +2078 -0
  17. data/lib/oxidized/web/public/weblibs/bootstrap.bundle.js +6314 -0
  18. data/lib/oxidized/web/public/weblibs/bootstrap.bundle.js.map +1 -0
  19. data/lib/oxidized/web/public/weblibs/bootstrap.css +12057 -0
  20. data/lib/oxidized/web/public/weblibs/bootstrap.css.map +1 -0
  21. data/lib/oxidized/web/public/weblibs/bootstrap.js +4494 -0
  22. data/lib/oxidized/web/public/weblibs/bootstrap.js.map +1 -0
  23. data/lib/oxidized/web/public/weblibs/buttons.bootstrap5.css +395 -0
  24. data/lib/oxidized/web/public/weblibs/buttons.bootstrap5.js +114 -0
  25. data/lib/oxidized/web/public/weblibs/buttons.colVis.js +256 -0
  26. data/lib/oxidized/web/public/weblibs/dataTables.bootstrap5.css +517 -0
  27. data/lib/oxidized/web/public/weblibs/dataTables.bootstrap5.js +122 -0
  28. data/lib/oxidized/web/public/weblibs/dataTables.buttons.js +2936 -0
  29. data/lib/oxidized/web/public/weblibs/dataTables.js +13843 -0
  30. data/lib/oxidized/web/public/weblibs/fonts/bootstrap-icons.woff +0 -0
  31. data/lib/oxidized/web/public/weblibs/fonts/bootstrap-icons.woff2 +0 -0
  32. data/lib/oxidized/web/public/weblibs/jquery.js +10716 -0
  33. data/lib/oxidized/web/version.rb +7 -0
  34. data/lib/oxidized/web/views/conf_search.haml +14 -13
  35. data/lib/oxidized/web/views/diffs.haml +5 -5
  36. data/lib/oxidized/web/views/footer.haml +5 -4
  37. data/lib/oxidized/web/views/head.haml +21 -7
  38. data/lib/oxidized/web/views/layout.haml +25 -34
  39. data/lib/oxidized/web/views/node.haml +10 -8
  40. data/lib/oxidized/web/views/nodes.haml +45 -35
  41. data/lib/oxidized/web/views/stats.haml +32 -24
  42. data/lib/oxidized/web/views/version.haml +8 -6
  43. data/lib/oxidized/web/views/versions.haml +23 -24
  44. data/lib/oxidized/web/webapp.rb +117 -113
  45. data/lib/oxidized/web.rb +10 -7
  46. data/oxidized-web.gemspec +32 -18
  47. data/package-lock.json +104 -0
  48. data/package.json +21 -0
  49. data/spec/node_spec.rb +99 -0
  50. data/spec/node_version_spec.rb +102 -0
  51. data/spec/nodes_spec.rb +57 -0
  52. data/spec/root_spec.rb +18 -0
  53. data/spec/spec_helper.rb +11 -0
  54. data/spec/webapp_spec.rb +28 -0
  55. metadata +183 -74
  56. data/lib/oxidized/web/mig.rb +0 -150
  57. data/lib/oxidized/web/public/css/bootstrap.min.css +0 -5
  58. data/lib/oxidized/web/public/css/buttons.bootstrap.min.css +0 -1
  59. data/lib/oxidized/web/public/css/dataTables.bootstrap.css +0 -299
  60. data/lib/oxidized/web/public/css/dataTables.colVis.css +0 -171
  61. data/lib/oxidized/web/public/css/oxidized_custom.css +0 -19
  62. data/lib/oxidized/web/public/fonts/glyphicons-halflings-regular.eot +0 -0
  63. data/lib/oxidized/web/public/fonts/glyphicons-halflings-regular.svg +0 -229
  64. data/lib/oxidized/web/public/fonts/glyphicons-halflings-regular.ttf +0 -0
  65. data/lib/oxidized/web/public/fonts/glyphicons-halflings-regular.woff +0 -0
  66. data/lib/oxidized/web/public/images/diff_15x17.png +0 -0
  67. data/lib/oxidized/web/public/images/sort_asc.png +0 -0
  68. data/lib/oxidized/web/public/images/sort_asc_disabled.png +0 -0
  69. data/lib/oxidized/web/public/images/sort_both.png +0 -0
  70. data/lib/oxidized/web/public/images/sort_desc.png +0 -0
  71. data/lib/oxidized/web/public/images/sort_desc_disabled.png +0 -0
  72. data/lib/oxidized/web/public/images/versioning_18px.png +0 -0
  73. data/lib/oxidized/web/public/scripts/bootstrap.min.js +0 -6
  74. data/lib/oxidized/web/public/scripts/dataTables.bootstrap.js +0 -186
  75. data/lib/oxidized/web/public/scripts/dataTables.colVis.js +0 -1123
  76. data/lib/oxidized/web/public/scripts/jquery-2.1.1.min.js +0 -4
  77. data/lib/oxidized/web/public/scripts/jquery.dataTables.min.js +0 -157
  78. data/lib/oxidized/web/public/scripts/jquery.min.js +0 -6
  79. data/lib/oxidized/web/public/scripts/script-migration.js +0 -15
  80. data/lib/oxidized/web/views/migration.haml +0 -46
  81. data/lib/oxidized/web/views/sass/oxidized.sass +0 -113
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'bundler/gem_tasks'
2
2
  require 'rake/testtask'
3
3
 
4
4
  gemspec = eval(File.read(Dir['*.gemspec'].first))
5
- gemfile = [gemspec.name, gemspec.version].join('-') + '.gem'
5
+ gemfile = "#{[gemspec.name, gemspec.version].join('-')}.gem"
6
6
 
7
7
  # Integrate Rubocop if available
8
8
  begin
@@ -26,6 +26,7 @@ task :test do
26
26
  Rake::TestTask.new do |t|
27
27
  t.libs << 'spec'
28
28
  t.test_files = FileList['spec/**/*_spec.rb']
29
+ t.ruby_opts = ['-W:deprecated']
29
30
  t.warning = true
30
31
  t.verbose = true
31
32
  end
@@ -44,18 +45,17 @@ end
44
45
 
45
46
  desc 'Tag the release'
46
47
  task :tag do
47
- system "git tag #{gemspec.version}"
48
+ system "git tag #{gemspec.version} -m 'Release #{gemspec.version}'"
48
49
  end
49
50
 
50
51
  desc 'Push to rubygems'
51
- task :push => :tag do
52
+ task push: :tag do
52
53
  system "gem push pkg/#{gemfile}"
53
54
  end
54
55
 
55
56
  desc 'Normalise file permissions'
56
57
  task :chmod do
57
- xbit = %w[
58
- ]
58
+ xbit = %w[]
59
59
  dirs = []
60
60
  %x(git ls-files -z).split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }.each do |file|
61
61
  dirs.push(File.dirname(file))
@@ -64,4 +64,48 @@ task :chmod do
64
64
  dirs.sort.uniq.each { |dir| File.chmod(0o0755, dir) }
65
65
  end
66
66
 
67
+ desc 'Copy web packages from npm into public'
68
+ task :weblibs do
69
+ weblibs = []
70
+ fonts = []
71
+
72
+ # jQuery
73
+ weblibs << 'node_modules/jquery/dist/jquery.js'
74
+
75
+ # Bootstrap
76
+ weblibs << 'node_modules/bootstrap/dist/js/bootstrap.js'
77
+ weblibs << 'node_modules/bootstrap/dist/js/bootstrap.js.map'
78
+ weblibs << 'node_modules/bootstrap/dist/css/bootstrap.css'
79
+ weblibs << 'node_modules/bootstrap/dist/css/bootstrap.css.map'
80
+ weblibs << 'node_modules/bootstrap/dist/js/bootstrap.bundle.js'
81
+ weblibs << 'node_modules/bootstrap/dist/js/bootstrap.bundle.js.map'
82
+
83
+ # Bootstrap-icons
84
+ weblibs << 'node_modules/bootstrap-icons/font/bootstrap-icons.css'
85
+ fonts << 'node_modules/bootstrap-icons/font/fonts/bootstrap-icons.woff'
86
+ fonts << 'node_modules/bootstrap-icons/font/fonts/bootstrap-icons.woff2'
87
+
88
+ # Datatables
89
+ weblibs << 'node_modules/datatables.net/js/dataTables.js'
90
+
91
+ # Datatables + Bootstrap
92
+ weblibs << 'node_modules/datatables.net-bs5/js/dataTables.bootstrap5.js'
93
+ weblibs << 'node_modules/datatables.net-bs5/css/dataTables.bootstrap5.css'
94
+
95
+ # Datatables Buttons + Bootstrap
96
+ weblibs << 'node_modules/datatables.net-buttons-bs5/js/buttons.bootstrap5.js'
97
+ weblibs << 'node_modules/datatables.net-buttons-bs5/css/buttons.bootstrap5.css'
98
+ # colVis
99
+ weblibs << 'node_modules/datatables.net-buttons/js/dataTables.buttons.js'
100
+ weblibs << 'node_modules/datatables.net-buttons/js/buttons.colVis.js'
101
+
102
+ weblibs.each do |w|
103
+ cp(w, 'lib/oxidized/web/public/weblibs')
104
+ end
105
+
106
+ fonts.each do |f|
107
+ cp(f, 'lib/oxidized/web/public/weblibs/fonts')
108
+ end
109
+ end
110
+
67
111
  task default: :test
@@ -0,0 +1,182 @@
1
+ # Index
2
+ 1. [Run from git](#how-to-run--develop-oxidized-web-from-git)
3
+ 2. [Update weblibs](#update-the-weblibs)
4
+ 3. [Release](#how-to-release-a-new-version-of-oxidized-web)
5
+
6
+ # How to run / develop oxidized-web from git
7
+ ## Using the latest oxidized package
8
+ When you develop oxidized-web, it is quite simple to run it from git. As it depends on oxidized,
9
+ oxidized will be included in `bundle install`, and you just have to run `bundle exec oxidized`.
10
+ You need bundler, if not installed yet. On debian-based systems, you can run `sudo apt install ruby-bundler` to install it.
11
+
12
+ All steps in one to copy & pase:
13
+ ```shell
14
+ git clone git@github.com:ytti/oxidized-web.git
15
+ cd oxidized-web
16
+ bundle config set --local path 'vendor/bundle'
17
+ bundle install
18
+ bundle exec oxidized
19
+ ```
20
+
21
+ Changes to haml templates are reloaded on the fly. For changes to the ruby
22
+ scripts, you have to stop an restart `bundle exec oxidized`.
23
+
24
+ ## Paralell development between oxidized and oxidized-web
25
+ You may need to make some changes in oxidized **and** oxidized-web. For this,
26
+ git clone oxidized and oxidized-web in a common root directory.
27
+
28
+ Then you can link your oxidized-web with the oxidized, add the direct
29
+ dependency to ../oxidized-web in oxidized and run oxidized from the oxidized
30
+ repo:
31
+
32
+ ```shell
33
+ git clone git@github.com:ytti/oxidized-web.git
34
+ git clone git@github.com:ytti/oxidized.git
35
+ cd oxidized
36
+ bundle config set --local path 'vendor/bundle'
37
+ echo "gem 'oxidized-web', path: '../oxidized-web'" >> Gemfile
38
+ bundle install
39
+ bundle exec bin/oxidized
40
+ ```
41
+
42
+ Be careful when commiting your work in oxidized *NOT* to include the changes to
43
+ Gemfile, as this is a local change for development. I (@robertcheramy) didn't
44
+ find a better way to do this, better ideas are welcome :-)
45
+
46
+ If your changes to oxidized **AND** oxidzed-web are dependent from another, make
47
+ sure you document this in the respectives CHANGELOG.md, so that everyone is
48
+ informed at the next release.
49
+
50
+ Note: you can also add the dependency to oxidized in oxidized-web, in the same
51
+ fashion:
52
+ ```shell
53
+ git clone git@github.com:ytti/oxidized-web.git
54
+ git clone git@github.com:ytti/oxidized.git
55
+ cd oxidized-web
56
+ bundle config set --local path 'vendor/bundle'
57
+ echo "gem 'oxidized', path: '../oxidized'" >> Gemfile
58
+ bundle install
59
+ bundle exec oxidized
60
+ ```
61
+
62
+
63
+ # Update the weblibs
64
+ The weblibs are beeing downloaded and maintained by `npm`.
65
+
66
+ Run `npm install` to download the weblibs. They will be stored under
67
+ `node_modules`.
68
+ The file `package-lock.json` (wich is tracked in git) ensures that every
69
+ developer gets the same versions.
70
+
71
+ Run `npm outdated` to get a list of new releases:
72
+
73
+ ```shell
74
+ oxidized-web$ npm outdated
75
+ Package Current Wanted Latest Location Depended by
76
+ datatables.net-bs5 2.0.7 2.0.8 2.0.8 node_modules/datatables.net-bs5 oxidized-web
77
+ ```
78
+
79
+ Run `npm update` to get the latest releases. They still are not used
80
+ oxidzed-web. Run `rake weblibs` to sync `node_modules` with
81
+ `lib/oxidized/web/public/weblibs`.
82
+
83
+ Test, and commit the changes to the weblibs **and** package-lock.json. Don't
84
+ forget to document your changes in CHANGELOG.md.
85
+
86
+ # How to release a new version of Oxidized-web?
87
+
88
+ ## Review changes
89
+ Run `git diff 0.xx.yy..master` (where `0.xx.yy` is to be changed to the last
90
+ release) and review all the changes that have been done. Have a specific look
91
+ at changes you don't understand.
92
+
93
+ It is nicer to read in a GUI, so you can use something like
94
+ `git difftool --tool=kdiff3 -d 0.xx.yy..master` to see it in kdiff3.
95
+
96
+ ## Update the gem dependencies to the latest versions
97
+ ```
98
+ bundle outaded
99
+ bundle update
100
+ bundle outaded
101
+ ```
102
+
103
+ Retest after updating!
104
+
105
+ ## Update the weblibs to the latest versions
106
+ ```
107
+ npm outdated
108
+ ```
109
+
110
+ Retest after updating!
111
+
112
+ ## Update rubocup .rubocop_todo.yml
113
+ Run `bundle exec rubocop --auto-gen-config`,
114
+ and make sure `bundle exec rake` passes after it.
115
+
116
+ If you change some code => Restart the release process at the beginning ;-)
117
+
118
+ ## Make sure the file permissions are correct
119
+ Run `bundle exec rake chmod`
120
+
121
+ ## Test, test test!
122
+ Run `bundle exec rake` on the git repository to check the code against rubocop and rund the
123
+ defined tests in `/spec`.
124
+
125
+ Run Oxidized-web from git against the latest Oxidized version `bundle exec oxdized`
126
+
127
+ Run Oxidized-web from git against the latest git of Oxidized (see above).
128
+
129
+ Do not integrate late PRs into master if they do not fix issues for the release. The must wait for the next release.
130
+
131
+ ## Version numbering
132
+ Oxidized-web versions are nummered like 0.major.minor
133
+ - major is incremented when releasing new features. minor is then set to 0
134
+ - minor is incremented when releasing fixes only, just after a major version.
135
+
136
+ ## Release
137
+ 1. Checkout the master branch of oxidized-web. Make sure you are up to date with origin.
138
+ 2. Change the version in lib/oxidized/web/version.rb
139
+ 3. Change CHANGELOG.md to replace [Unreleased] with [0.xx.yy – 202Y-MM-DD]
140
+ 4. Run `git diff` to check your changes
141
+ 5. Commit the changes to the local git repository with a commit message “chore(release): release version 0.xx.yy”
142
+ 6. Tag the commit with `git tag -a 0.xx.yy -m "Release 0.xx.yy"`
143
+ 7. Build the gem with ‘rake build’
144
+ 8. Install an test the gem locally:
145
+ ```
146
+ gem install --user-install pkg/oxidized-web-0.xx.yy.gem
147
+ ~/.local/share/gem/ruby/3.1.0/bin/oxidized
148
+ ```
149
+ ## Release in github
150
+ 1. Push the commit and the tag to github:
151
+ ```
152
+ git push
153
+ git push origin 0.xx.yy
154
+ ```
155
+
156
+ 2. Make a release from the tag in github
157
+ - Thank the contributors
158
+ - Only describe major changes, and refer to CHANGELOG.md
159
+ - List new contributors (generated automatically)
160
+
161
+ ## Release in rubygems
162
+ Push the gem with ‘rake push’
163
+
164
+ You need an account at rubygems which is allowed to push oxidized
165
+
166
+ ## Update CHANGELOG.md for next release
167
+ Add
168
+ ```
169
+ ## [Unreleased]
170
+
171
+ ### Added
172
+
173
+ ### Changed
174
+
175
+ ### Fixed
176
+
177
+ ```
178
+ And push to github
179
+
180
+ ## Congratulate yourself
181
+ Great job! Treat yourself to your favorite drink, you deserve it!
182
+
@@ -0,0 +1,59 @@
1
+ /* Display status of device in /nodes and /stats */
2
+ .status, .success, .no_connection, .never {
3
+ float: right;
4
+ width: 15px;
5
+ height: 15px;
6
+ border: 1px solid;
7
+ margin-right: 70%;
8
+ margin-bottom: 0px;
9
+ border-radius: 2px; }
10
+
11
+ .success {
12
+ background-color: #64FE2E; }
13
+
14
+ .no_connection {
15
+ background-color: #FF0000; }
16
+
17
+ .never {
18
+ background-color: #58ACFA; }
19
+
20
+ /* node/version/diffs */
21
+ .added {
22
+ background-color: #DBFFDB; }
23
+
24
+ .deleted {
25
+ background-color: #FFDDDD; }
26
+
27
+
28
+ .diff-index {
29
+ background-color: #FFFF99; }
30
+
31
+ .diff-empty {
32
+ background-color: #F0F0F0; }
33
+
34
+ .diffs, .diffs_old, .diffs_new {
35
+ background-color: #FAFAFA;
36
+ border: 2px solid #ccc;
37
+ border-radius: 5px;
38
+ padding: 3px;
39
+ font-family: Consolas, "Lucida Console", monospace;
40
+ white-space: pre; }
41
+
42
+ .diffs_old {
43
+ float: left;
44
+ width: 49%;
45
+ overflow: auto; }
46
+
47
+ .diffs_new {
48
+ margin-left: 51%;
49
+ width: 49%;
50
+ overflow: auto; }
51
+
52
+ .old_version_title {
53
+ float: left;
54
+ width: 49%;
55
+ font-weight: bold; }
56
+
57
+ .new_version_title {
58
+ margin-left: 51%;
59
+ font-weight: bold; }
@@ -1,40 +1,3 @@
1
- // Add a line for a new file to upload
2
- var add_file_upload = function() {
3
- var rancidDbDiv = $("div[id^='rancidDb']:last");
4
- var num = parseInt(rancidDbDiv.prop("id").match(/\d+/g)) + 1;
5
- rancidDbDiv.clone(true)
6
- .prop("id", "rancidDb" + num)
7
- .insertAfter(rancidDbDiv);
8
- $("input[id^='file']:last")
9
- .prop("id", "file" + num)
10
- .prop("name", "file" + num)
11
- .parents('.input-group')
12
- .find(':text')
13
- .val('');
14
- $("input[id^='group']:last")
15
- .prop("id", "group" + num)
16
- .prop("name", "group" + num);
17
- };
18
-
19
- var onFileSelected = function() {
20
- $(document).on('change', '.btn-file :file', function() {
21
- var input = $(this),
22
- numFiles = input.get(0).files ? input.get(0).files.length : 1,
23
- label = input.val().replace(/\\/g, '/').replace(/.*\//, '');
24
- input.trigger('fileSelect', [numFiles, label]);
25
- });
26
- };
27
-
28
- // fix colvis buttons
29
- var fixColVisBtn = function() {
30
- $('.ColVis_Button').each(function() {
31
- $(this).addClass('btn btn-default');
32
- });
33
- $('.ColVis_MasterButton').each(function() {
34
- $(this).addClass('pull-right');
35
- });
36
- };
37
-
38
1
  var convertTime = function() {
39
2
  /* Convert UTC times to local browser times
40
3
  * Requires that the times on the server are UTC
@@ -53,24 +16,14 @@ var convertTime = function() {
53
16
  var hour = ("0" + date.getHours()).slice(-2);
54
17
  var minute = ("0" + date.getMinutes()).slice(-2);
55
18
  var second = ("0" + date.getSeconds()).slice(-2);
56
- var timeZone = date.toString().match(/\(.*\)/)[0].match(/[A-Z]/g).join('');
19
+ var timeZone = date.toString().match(/[A-Z]{3,4}[+-][0-9]{4}/)[0];
57
20
  $(this).text(year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second + ' ' + timeZone);
58
21
  });
59
22
  };
60
23
 
61
24
  $(function() {
62
25
  onFileSelected();
63
- fixColVisBtn();
64
26
  convertTime();
65
- // Add a row to the migration form
66
- $("#add").click(function() {
67
- add_file_upload();
68
- });
69
-
70
- // Updates textbox with filename on fileSelect event
71
- $('.btn-file :file').on('fileSelect', function(e, numFiles, label) {
72
- $(this).parents('.input-group').find(':text').val(label);
73
- });
74
27
 
75
28
  // Reloads the nodes from a source by calling the /reload.json URI
76
29
  $('#reload').click(function() {