From 5e33eee5c8661755789d5c4fa78d40437303947a Mon Sep 17 00:00:00 2001 From: sirferl Date: Tue, 8 Dec 2020 10:53:28 +0100 Subject: [PATCH 01/10] make options for sources optional --- lemur/sources/views.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/lemur/sources/views.py b/lemur/sources/views.py index 3b4deab7..bc104e33 100644 --- a/lemur/sources/views.py +++ b/lemur/sources/views.py @@ -156,12 +156,19 @@ class SourcesList(AuthenticatedResource): :reqheader Authorization: OAuth token to authenticate :statuscode 200: no error """ - return service.create( - data["label"], - data["plugin"]["slug"], - data["plugin"]["plugin_options"], - data["description"], - ) + if "plugin_options" in data["plugin"]: + return service.create( + data["label"], + data["plugin"]["slug"], + data["plugin"]["plugin_options"], + data["description"], + ) + else: + return service.create( + data["label"], + data["plugin"]["slug"], + data["description"], + ) class Sources(AuthenticatedResource): From 9a380528683814132d78e797a594ceff7ba9ef48 Mon Sep 17 00:00:00 2001 From: sirferl Date: Tue, 8 Dec 2020 11:03:08 +0100 Subject: [PATCH 02/10] Lint - whitespace error fixed --- lemur/sources/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lemur/sources/views.py b/lemur/sources/views.py index bc104e33..9c31bdb7 100644 --- a/lemur/sources/views.py +++ b/lemur/sources/views.py @@ -156,7 +156,7 @@ class SourcesList(AuthenticatedResource): :reqheader Authorization: OAuth token to authenticate :statuscode 200: no error """ - if "plugin_options" in data["plugin"]: + if "plugin_options" in data["plugin"]: return service.create( data["label"], data["plugin"]["slug"], From 8a10b861be65f7913d5041cc90027e20b7f32719 Mon Sep 17 00:00:00 2001 From: sirferl Date: Tue, 8 Dec 2020 11:05:55 +0100 Subject: [PATCH 03/10] options not needed any more --- lemur/plugins/lemur_entrust/plugin.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/lemur/plugins/lemur_entrust/plugin.py b/lemur/plugins/lemur_entrust/plugin.py index 83547a20..a4cb9a12 100644 --- a/lemur/plugins/lemur_entrust/plugin.py +++ b/lemur/plugins/lemur_entrust/plugin.py @@ -319,15 +319,6 @@ class EntrustSourcePlugin(SourcePlugin): author = "sirferl" author_url = "https://github.com/sirferl/lemur" - options = [ - { - "name": "dummy", - "type": "str", - "required": False, - "validation": "/^[0-9]{12,12}$/", - "helpMessage": "Just to prevent error", - } - ] def __init__(self, *args, **kwargs): """Initialize the issuer with the appropriate details.""" From b93c0282150a567cc16b706ac2583bc5cfb1002d Mon Sep 17 00:00:00 2001 From: sirferl Date: Tue, 8 Dec 2020 11:07:09 +0100 Subject: [PATCH 04/10] source plugin: options not needed any more --- lemur/plugins/lemur_adcs/plugin.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/lemur/plugins/lemur_adcs/plugin.py b/lemur/plugins/lemur_adcs/plugin.py index d2efe83f..495885a0 100644 --- a/lemur/plugins/lemur_adcs/plugin.py +++ b/lemur/plugins/lemur_adcs/plugin.py @@ -77,15 +77,6 @@ class ADCSSourcePlugin(SourcePlugin): author = "sirferl" author_url = "https://github.com/sirferl/lemur" - options = [ - { - "name": "dummy", - "type": "str", - "required": False, - "validation": "/^[0-9]{12,12}$/", - "helpMessage": "Just to prevent error", - } - ] def get_certificates(self, options, **kwargs): adcs_server = current_app.config.get("ADCS_SERVER") From 22d9ef77988f45db24a1059274ec28306723b8b5 Mon Sep 17 00:00:00 2001 From: sayali Date: Tue, 8 Dec 2020 19:20:28 -0800 Subject: [PATCH 05/10] Upgrade gulp to 4.0.2 --- gulp/build.js | 93 +++++++++++++++++++++++++------------------------- gulp/server.js | 17 ++++++--- gulp/watch.js | 12 ------- package.json | 2 +- 4 files changed, 60 insertions(+), 64 deletions(-) delete mode 100644 gulp/watch.js diff --git a/gulp/build.js b/gulp/build.js index 5aca8094..11919d7f 100644 --- a/gulp/build.js +++ b/gulp/build.js @@ -29,24 +29,24 @@ var gulp = require('gulp'), replace = require('gulp-replace'), argv = require('yargs').argv; -gulp.task('default', ['clean'], function () { - gulp.start('fonts', 'styles'); -}); - -gulp.task('clean', function (cb) { +gulp.task('clean', async function (cb) { del(['.tmp', 'lemur/static/dist'], cb); }); -gulp.task('test', function (done) { +gulp.task('default', gulp.series('clean', function () { + gulp.start('fonts', 'styles'); +})); + +gulp.task('test', gulp.series(function (done) { new karma.Server({ configFile: __dirname + '/karma.conf.js', singleRun: true }, function() { done(); }).start(); -}); +})); -gulp.task('dev:fonts', function () { +gulp.task('dev:fonts', async function () { var fileList = [ 'bower_components/bootstrap/dist/fonts/*', 'bower_components/fontawesome/fonts/*' @@ -56,7 +56,7 @@ gulp.task('dev:fonts', function () { .pipe(gulp.dest('.tmp/fonts')); }); -gulp.task('dev:styles', function () { +gulp.task('dev:styles', async function () { var baseContent = '@import "bower_components/bootstrap/less/bootstrap.less";@import "bower_components/bootswatch/$theme$/variables.less";@import "bower_components/bootswatch/$theme$/bootswatch.less";@import "bower_components/bootstrap/less/utilities.less";'; var isBootswatchFile = function (file) { @@ -74,7 +74,6 @@ gulp.task('dev:styles', function () { var fileList = [ 'bower_components/bootswatch/sandstone/bootswatch.less', 'bower_components/fontawesome/css/font-awesome.css', - 'bower_components/angular-spinkit/src/angular-spinkit.css', 'bower_components/angular-chart.js/dist/angular-chart.css', 'bower_components/angular-loading-bar/src/loading-bar.css', 'bower_components/angular-ui-switch/angular-ui-switch.css', @@ -100,7 +99,7 @@ gulp.task('dev:styles', function () { // http://stackoverflow.com/questions/21719833/gulp-how-to-add-src-files-in-the-middle-of-a-pipe // https://github.com/gulpjs/gulp/blob/master/docs/recipes/using-multiple-sources-in-one-task.md - return merge(stream, gulp.src(['.tmp/styles/font-awesome.css', '.tmp/styles/lemur.css'])) + return merge(stream, gulp.src(['.tmp/styles/font-awesome.css', '.tmp/styles/lemur.css'], { allowEmpty: true })) .pipe(concat('style-' + themeName + '.css')); }))) .pipe(plumber()) @@ -129,14 +128,14 @@ function string_src(filename, string) { return src; } -gulp.task('dev:scripts', function () { +gulp.task('dev:scripts', async function () { return gulp.src(['lemur/static/app/angular/**/*.js']) .pipe(jshint()) .pipe(jshint.reporter('jshint-stylish')) .pipe(size()); }); -gulp.task('build:extras', function () { +gulp.task('build:extras', async function () { return gulp.src(['lemur/static/app/*.*', '!lemur/static/app/*.html']) .pipe(gulp.dest('lemur/static/dist')); }); @@ -162,7 +161,7 @@ function injectHtml(isDev) { })) .pipe( gulpif(!isDev, - inject(gulp.src('lemur/static/dist/ngviews/ngviews.min.js'), { + inject(gulp.src('lemur/static/dist/ngviews/ngviews.min.js', { allowEmpty: true }), { starttag: '', addRootSlash: false }) @@ -170,15 +169,11 @@ function injectHtml(isDev) { ).pipe(gulp.dest('.tmp/')); } -gulp.task('dev:inject', ['dev:styles', 'dev:scripts'], function () { +gulp.task('dev:inject', gulp.series(gulp.parallel('dev:styles', 'dev:scripts'), function () { return injectHtml(true); -}); +})); -gulp.task('build:inject', ['dev:styles', 'dev:scripts', 'build:ngviews'], function () { - return injectHtml(false); -}); - -gulp.task('build:ngviews', function () { +gulp.task('build:ngviews', async function () { return gulp.src(['lemur/static/app/angular/**/*.html']) .pipe(minifyHtml({ empty: true, @@ -189,7 +184,11 @@ gulp.task('build:ngviews', function () { .pipe(size()); }); -gulp.task('build:html', ['dev:styles', 'dev:scripts', 'build:ngviews', 'build:inject'], function () { +gulp.task('build:inject', gulp.series(gulp.parallel('dev:styles', 'dev:scripts', 'build:ngviews'), function () { + return injectHtml(false); +})); + +gulp.task('build:html', gulp.series(gulp.parallel('dev:styles', 'dev:scripts', 'build:ngviews', 'build:inject'), function () { var jsFilter = filter(['**/*.js'], {'restore': true}); var cssFilter = filter(['**/*.css'], {'restore': true}); @@ -203,14 +202,14 @@ gulp.task('build:html', ['dev:styles', 'dev:scripts', 'build:ngviews', 'build:in .pipe(useref()) .pipe(gulp.dest('lemur/static/dist')) .pipe(size()); -}); +})); -gulp.task('build:fonts', ['dev:fonts'], function () { +gulp.task('build:fonts', gulp.series('dev:fonts', function () { return gulp.src('.tmp/fonts/**/*') .pipe(gulp.dest('lemur/static/dist/fonts')); -}); +})); -gulp.task('build:images', function () { +gulp.task('build:images', async function () { return gulp.src('lemur/static/app/images/**/*') .pipe(cache(imagemin({ optimizationLevel: 3, @@ -221,8 +220,8 @@ gulp.task('build:images', function () { .pipe(size()); }); -gulp.task('package:strip', function () { - return gulp.src(['lemur/static/dist/scripts/main*']) +gulp.task('package:strip', async function () { + return gulp.src('lemur/static/dist/scripts/main*') .pipe(replace('http:\/\/localhost:3000', '')) .pipe(replace('http:\/\/localhost:8000', '')) .pipe(useref()) @@ -230,7 +229,22 @@ gulp.task('package:strip', function () { .pipe(size()); }); -gulp.task('addUrlContextPath',['addUrlContextPath:revreplace'], function(){ +gulp.task('addUrlContextPath:revision', async function(){ + return gulp.src(['lemur/static/dist/**/*.css','lemur/static/dist/**/*.js']) + .pipe(rev()) + .pipe(gulp.dest('lemur/static/dist')) + .pipe(rev.manifest()) + .pipe(gulp.dest('lemur/static/dist')) +}); + +gulp.task('addUrlContextPath:revreplace', gulp.series('addUrlContextPath:revision', function(){ + // var manifest = gulp.src("lemur/static/dist/rev-manifest.json"); + // var urlContextPathExists = argv.urlContextPath ? true : false; + return gulp.src( "lemur/static/dist/index.html") + .pipe(gulp.dest('lemur/static/dist')); +})); + +gulp.task('addUrlContextPath', gulp.series('addUrlContextPath:revreplace', async function(){ var urlContextPathExists = argv.urlContextPath ? true : false; ['lemur/static/dist/scripts/main*.js', 'lemur/static/dist/angular/**/*.html'] @@ -242,23 +256,8 @@ gulp.task('addUrlContextPath',['addUrlContextPath:revreplace'], function(){ return file.base; })) }) -}); - -gulp.task('addUrlContextPath:revision', function(){ - return gulp.src(['lemur/static/dist/**/*.css','lemur/static/dist/**/*.js']) - .pipe(rev()) - .pipe(gulp.dest('lemur/static/dist')) - .pipe(rev.manifest()) - .pipe(gulp.dest('lemur/static/dist')) -}) - -gulp.task('addUrlContextPath:revreplace', ['addUrlContextPath:revision'], function(){ - var manifest = gulp.src("lemur/static/dist/rev-manifest.json"); - var urlContextPathExists = argv.urlContextPath ? true : false; - return gulp.src( "lemur/static/dist/index.html") - .pipe(gulp.dest('lemur/static/dist')); -}) +})); -gulp.task('build', ['build:ngviews', 'build:inject', 'build:images', 'build:fonts', 'build:html', 'build:extras']); -gulp.task('package', ['addUrlContextPath', 'package:strip']); +gulp.task('build', gulp.series(gulp.parallel('build:ngviews', 'build:inject', 'build:images', 'build:fonts', 'build:html', 'build:extras'))); +gulp.task('package', gulp.series(gulp.parallel('addUrlContextPath', 'package:strip'))); diff --git a/gulp/server.js b/gulp/server.js index 6c61273e..804ca115 100644 --- a/gulp/server.js +++ b/gulp/server.js @@ -38,7 +38,16 @@ function browserSyncInit(baseDir, files, browser) { } -gulp.task('serve', ['watch'], function () { +gulp.task('watch', gulp.series(['dev:styles', 'dev:scripts', 'dev:inject', 'dev:fonts'], function (done) { + gulp.watch('app/styles/**/*.less', gulp.parallel('dev:styles')); + gulp.watch('app/styles/**/*.css', gulp.parallel('dev:styles')); + gulp.watch('app/**/*.js', gulp.parallel('dev:scripts')); + gulp.watch('app/images/**/*', gulp.parallel('build:images')); + gulp.watch('bower.json', gulp.parallel('dev:inject')); + done(); +})); + +gulp.task('serve', gulp.series('watch', function () { browserSyncInit([ '.tmp', 'lemur/static/app' @@ -51,9 +60,9 @@ gulp.task('serve', ['watch'], function () { 'lemur/static/app/angular/**/*', 'lemur/static/app/index.html' ]); -}); +})); -gulp.task('serve:dist', ['build'], function () { +gulp.task('serve:dist', gulp.series('build', function () { browserSyncInit('lemur/static/dist'); -}); +})); diff --git a/gulp/watch.js b/gulp/watch.js deleted file mode 100644 index 460a935b..00000000 --- a/gulp/watch.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -var gulp = require('gulp'); - - -gulp.task('watch', ['dev:styles', 'dev:scripts', 'dev:inject', 'dev:fonts'] ,function () { - gulp.watch('app/styles/**/*.less', ['dev:styles']); - gulp.watch('app/styles/**/*.css', ['dev:styles']); - gulp.watch('app/**/*.js', ['dev:scripts']); - gulp.watch('app/images/**/*', ['build:images']); - gulp.watch('bower.json', ['dev:inject']); -}); diff --git a/package.json b/package.json index c4105e01..962d0a69 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "test": "gulp test" }, "devDependencies": { - "gulp": "^3.9.1", + "gulp": "^4.0.2", "jshint": "^2.11.0", "karma-chrome-launcher": "^2.0.0" } From 8bab89262cc668f08b70c59f486781cb789c2de0 Mon Sep 17 00:00:00 2001 From: sayali Date: Tue, 8 Dec 2020 19:21:03 -0800 Subject: [PATCH 06/10] lodash upgrade 4.17.20 --- bower.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bower.json b/bower.json index 8a042a8d..ed6d6bf6 100644 --- a/bower.json +++ b/bower.json @@ -29,7 +29,7 @@ "satellizer": "~0.13.4", "angular-ui-router": "~0.2.15", "font-awesome": "~4.5.0", - "lodash": "~4.0.1", + "lodash": "~4.17.20", "underscore": "~1.8.3", "angular-smart-table": "2.1.8", "angular-strap": ">= 2.2.2", From cf652952ff2807f66ddb0108558a3f356e1e0497 Mon Sep 17 00:00:00 2001 From: sayali Date: Tue, 8 Dec 2020 19:21:38 -0800 Subject: [PATCH 07/10] karma version update ^5.2.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 962d0a69..17dc98e3 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "gulp-util": "^3.0.1", "http-proxy": ">=1.18.1", "jshint-stylish": "^2.2.1", - "karma": "^4.4.1", + "karma": "^5.2.3", "karma-jasmine": "^1.1.0", "main-bower-files": "^2.13.1", "merge-stream": "^1.0.1", From 856c2da15c18ba92e594f6eda344b3220e2cd51a Mon Sep 17 00:00:00 2001 From: sayali Date: Tue, 8 Dec 2020 19:22:01 -0800 Subject: [PATCH 08/10] yargs version update ^16.0.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 17dc98e3..2f1e8f84 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "require-dir": "~0.3.0", "streamqueue": "^1.1.1", "uglify-save-license": "^0.4.1", - "yargs": "^7.0.2" + "yargs": "^16.0.0" }, "scripts": { "postinstall": "node_modules/.bin/bower install --allow-root --config.interactive=false", From e62e07c9291328462c74dbb31fb1630c43809ffd Mon Sep 17 00:00:00 2001 From: sayali Date: Tue, 8 Dec 2020 20:02:57 -0800 Subject: [PATCH 09/10] remove gulp-replace-task --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 2f1e8f84..f2d87ab7 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,6 @@ "gulp-print": "^2.0.1", "gulp-protractor": "^4.1.1", "gulp-replace": "~0.5.3", - "gulp-replace-task": "~0.11.0", "gulp-rev": "^7.1.2", "gulp-rev-replace": "^0.4.3", "gulp-serve": "~1.4.0", From 6e41f74908f944b39e162caea8e690f060803f0c Mon Sep 17 00:00:00 2001 From: sayali Date: Wed, 9 Dec 2020 14:32:06 -0800 Subject: [PATCH 10/10] Remove parallel task fixing issue of CSS not loading, though it works in dev --- gulp/build.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gulp/build.js b/gulp/build.js index 11919d7f..653a1f1c 100644 --- a/gulp/build.js +++ b/gulp/build.js @@ -169,7 +169,7 @@ function injectHtml(isDev) { ).pipe(gulp.dest('.tmp/')); } -gulp.task('dev:inject', gulp.series(gulp.parallel('dev:styles', 'dev:scripts'), function () { +gulp.task('dev:inject', gulp.series(['dev:styles', 'dev:scripts'], function () { return injectHtml(true); })); @@ -184,11 +184,11 @@ gulp.task('build:ngviews', async function () { .pipe(size()); }); -gulp.task('build:inject', gulp.series(gulp.parallel('dev:styles', 'dev:scripts', 'build:ngviews'), function () { +gulp.task('build:inject', gulp.series(['dev:styles', 'dev:scripts', 'build:ngviews'], function () { return injectHtml(false); })); -gulp.task('build:html', gulp.series(gulp.parallel('dev:styles', 'dev:scripts', 'build:ngviews', 'build:inject'), function () { +gulp.task('build:html', gulp.series(['dev:styles', 'dev:scripts', 'build:ngviews', 'build:inject'], function () { var jsFilter = filter(['**/*.js'], {'restore': true}); var cssFilter = filter(['**/*.css'], {'restore': true}); @@ -259,5 +259,5 @@ gulp.task('addUrlContextPath', gulp.series('addUrlContextPath:revreplace', async })); -gulp.task('build', gulp.series(gulp.parallel('build:ngviews', 'build:inject', 'build:images', 'build:fonts', 'build:html', 'build:extras'))); -gulp.task('package', gulp.series(gulp.parallel('addUrlContextPath', 'package:strip'))); +gulp.task('build', gulp.series(['build:ngviews', 'build:inject', 'build:images', 'build:fonts', 'build:html', 'build:extras'])); +gulp.task('package', gulp.series(['addUrlContextPath', 'package:strip']));