From 74156909cedfbfa0f3dcacce2b1cd5f356a975cc Mon Sep 17 00:00:00 2001 From: Tiago Melo Date: Wed, 27 Feb 2019 11:39:52 +0000 Subject: [PATCH] mgr/dashboard: Update npm packages Fix some npm packages vulnerabilities. Since we don't use the same npm packages anymore, it's not possible to backport this changes from master to mimic. Fixes: http://tracker.ceph.com/issues/39080 Signed-off-by: Tiago Melo --- .../mgr/dashboard/frontend/.angular-cli.json | 66 -------- .../mgr/dashboard/frontend/angular.json | 144 ++++++++++++++++++ .../mgr/dashboard/frontend/karma.conf.js | 10 +- .../mgr/dashboard/frontend/package.json | 87 ++++++----- .../ceph/block/rbd-list/rbd-list.component.ts | 2 +- .../copy2clipboard-button.directive.ts | 2 +- .../directives/password-button.directive.ts | 2 +- .../mgr/dashboard/frontend/src/polyfills.ts | 10 -- .../dashboard/frontend/src/tsconfig.spec.json | 3 +- .../mgr/dashboard/frontend/tsconfig.json | 5 +- src/pybind/mgr/dashboard/frontend/tslint.json | 1 - 11 files changed, 202 insertions(+), 130 deletions(-) delete mode 100644 src/pybind/mgr/dashboard/frontend/.angular-cli.json create mode 100644 src/pybind/mgr/dashboard/frontend/angular.json diff --git a/src/pybind/mgr/dashboard/frontend/.angular-cli.json b/src/pybind/mgr/dashboard/frontend/.angular-cli.json deleted file mode 100644 index f268010bdde80..0000000000000 --- a/src/pybind/mgr/dashboard/frontend/.angular-cli.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "$schema": "./node_modules/@angular/cli/lib/config/schema.json", - "project": { - "name": "ceph-dashboard" - }, - "apps": [ - { - "root": "src", - "outDir": "dist", - "assets": [ - "assets", - "favicon.ico" - ], - "index": "index.html", - "main": "main.ts", - "polyfills": "polyfills.ts", - "test": "test.ts", - "tsconfig": "tsconfig.app.json", - "testTsconfig": "tsconfig.spec.json", - "prefix": "cd", - "styles": [ - "../node_modules/bootstrap/dist/css/bootstrap.css", - "../node_modules/ng2-toastr/bundles/ng2-toastr.min.css", - "../node_modules/fork-awesome/css/fork-awesome.css", - "../node_modules/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css", - "styles.scss" - ], - "scripts": [ - "../node_modules/chart.js/dist/Chart.bundle.js" - ], - "environmentSource": "environments/environment.ts", - "environments": { - "dev": "environments/environment.ts", - "prod": "environments/environment.prod.ts" - } - } - ], - "e2e": { - "protractor": { - "config": "./protractor.conf.js" - } - }, - "lint": [ - { - "project": "src/tsconfig.app.json", - "exclude": "**/node_modules/**" - }, - { - "project": "src/tsconfig.spec.json", - "exclude": "**/node_modules/**" - }, - { - "project": "e2e/tsconfig.e2e.json", - "exclude": "**/node_modules/**" - } - ], - "test": { - "karma": { - "config": "./karma.conf.js" - } - }, - "defaults": { - "styleExt": "scss", - "component": {} - } -} diff --git a/src/pybind/mgr/dashboard/frontend/angular.json b/src/pybind/mgr/dashboard/frontend/angular.json new file mode 100644 index 0000000000000..35e14f9ed9e8d --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/angular.json @@ -0,0 +1,144 @@ +{ + "$schema": "./node_modules/@angular/cli/lib/config/schema.json", + "version": 1, + "newProjectRoot": "projects", + "projects": { + "ceph-dashboard": { + "root": "", + "sourceRoot": "src", + "projectType": "application", + "architect": { + "build": { + "builder": "@angular-devkit/build-angular:browser", + "options": { + "outputPath": "dist", + "index": "src/index.html", + "main": "src/main.ts", + "tsConfig": "src/tsconfig.app.json", + "polyfills": "src/polyfills.ts", + "assets": [ + "src/assets", + "src/favicon.ico" + ], + "styles": [ + "node_modules/bootstrap/dist/css/bootstrap.css", + "node_modules/ng2-toastr/bundles/ng2-toastr.min.css", + "node_modules/fork-awesome/css/fork-awesome.css", + "node_modules/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css", + "src/styles.scss" + ], + "scripts": [ + "node_modules/chart.js/dist/Chart.bundle.js" + ] + }, + "configurations": { + "production": { + "optimization": true, + "outputHashing": "all", + "sourceMap": false, + "extractCss": true, + "namedChunks": false, + "aot": true, + "extractLicenses": true, + "vendorChunk": false, + "buildOptimizer": true, + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.prod.ts" + } + ] + } + } + }, + "serve": { + "builder": "@angular-devkit/build-angular:dev-server", + "options": { + "browserTarget": "ceph-dashboard:build" + }, + "configurations": { + "production": { + "browserTarget": "ceph-dashboard:build:production" + } + } + }, + "extract-i18n": { + "builder": "@angular-devkit/build-angular:extract-i18n", + "options": { + "browserTarget": "ceph-dashboard:build" + } + }, + "test": { + "builder": "@angular-devkit/build-angular:karma", + "options": { + "main": "src/test.ts", + "karmaConfig": "./karma.conf.js", + "polyfills": "src/polyfills.ts", + "tsConfig": "src/tsconfig.spec.json", + "scripts": [ + "node_modules/chart.js/dist/Chart.bundle.js" + ], + "styles": [ + "node_modules/bootstrap/dist/css/bootstrap.css", + "node_modules/ng2-toastr/bundles/ng2-toastr.min.css", + "node_modules/fork-awesome/css/fork-awesome.css", + "node_modules/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css", + "src/styles.scss" + ], + "assets": [ + "src/assets", + "src/favicon.ico" + ] + } + }, + "lint": { + "builder": "@angular-devkit/build-angular:tslint", + "options": { + "tsConfig": [ + "src/tsconfig.app.json", + "src/tsconfig.spec.json" + ], + "exclude": [ + "**/node_modules/**" + ] + } + } + } + }, + "ceph-dashboard-e2e": { + "root": "e2e", + "sourceRoot": "e2e", + "projectType": "application", + "architect": { + "e2e": { + "builder": "@angular-devkit/build-angular:protractor", + "options": { + "protractorConfig": "./protractor.conf.js", + "devServerTarget": "ceph-dashboard:serve" + } + }, + "lint": { + "builder": "@angular-devkit/build-angular:tslint", + "options": { + "tsConfig": [ + "e2e/tsconfig.e2e.json" + ], + "exclude": [ + "**/node_modules/**" + ] + } + } + } + } + }, + "defaultProject": "ceph-dashboard", + "schematics": { + "@schematics/angular:component": { + "prefix": "cd", + "styleext": "scss" + }, + "@schematics/angular:directive": { + "prefix": "cd" + } + } +} \ No newline at end of file diff --git a/src/pybind/mgr/dashboard/frontend/karma.conf.js b/src/pybind/mgr/dashboard/frontend/karma.conf.js index f86ab20aa5fd6..07276206c25bc 100644 --- a/src/pybind/mgr/dashboard/frontend/karma.conf.js +++ b/src/pybind/mgr/dashboard/frontend/karma.conf.js @@ -4,13 +4,13 @@ module.exports = function (config) { config.set({ basePath: '', - frameworks: ['jasmine', '@angular/cli'], + frameworks: ['jasmine', '@angular-devkit/build-angular'], plugins: [ require('karma-jasmine'), require('karma-chrome-launcher'), require('karma-jasmine-html-reporter'), require('karma-coverage-istanbul-reporter'), - require('@angular/cli/plugins/karma'), + require('@angular-devkit/build-angular/plugins/karma'), require('karma-phantomjs-launcher'), require('karma-junit-reporter') ], @@ -18,12 +18,10 @@ module.exports = function (config) { clearContext: false // leave Jasmine Spec Runner output visible in browser }, coverageIstanbulReporter: { - reports: [ 'html', 'lcovonly', 'cobertura' ], + dir: require('path').join(__dirname, 'coverage'), reports: [ 'html', 'lcovonly', 'cobertura' ], fixWebpackSourcePaths: true }, - angularCli: { - environment: 'dev' - }, + reporters: ['progress', 'kjhtml', 'junit'], junitReporter: { 'outputFile': 'junit.frontend.xml', diff --git a/src/pybind/mgr/dashboard/frontend/package.json b/src/pybind/mgr/dashboard/frontend/package.json index 9f0e148d236a9..9df41c3bec1a1 100644 --- a/src/pybind/mgr/dashboard/frontend/package.json +++ b/src/pybind/mgr/dashboard/frontend/package.json @@ -12,53 +12,56 @@ }, "private": true, "dependencies": { - "@angular/animations": "^5.0.0", - "@angular/common": "^5.0.0", - "@angular/compiler": "^5.0.0", - "@angular/core": "^5.0.0", - "@angular/forms": "^5.0.0", - "@angular/http": "^5.0.0", - "@angular/platform-browser": "^5.0.0", - "@angular/platform-browser-dynamic": "^5.0.0", - "@angular/router": "^5.0.0", - "@swimlane/ngx-datatable": "^11.1.7", - "@types/lodash": "4.14.95", + "@angular/animations": "7.2.10", + "@angular/common": "7.2.10", + "@angular/compiler": "7.2.10", + "@angular/core": "7.2.10", + "@angular/forms": "7.2.10", + "@angular/http": "7.2.10", + "@angular/platform-browser": "7.2.10", + "@angular/platform-browser-dynamic": "7.2.10", + "@angular/router": "7.2.10", + "@swimlane/ngx-datatable": "11.3.2", "awesome-bootstrap-checkbox": "0.3.7", - "bootstrap": "^3.3.7", - "chart.js": "^2.7.1", - "core-js": "^2.4.1", + "bootstrap": "3.4.1", + "chart.js": "2.8.0", + "core-js": "2.6.5", "fork-awesome": "1.0.11", - "lodash": "4.17.4", + "lodash": "4.17.11", "moment": "2.20.1", - "ng2-charts": "^1.6.0", - "ng2-toastr": "4.1.2", - "ngx-bootstrap": "^2.0.1", - "rxjs": "^5.5.2", - "zone.js": "^0.8.14" + "ng2-charts": "1.6.0", + "ng2-toastr": "github:zzakir/ng2-toastr#0eafd72", + "ngx-bootstrap": "2.0.5", + "rxjs": "6.4.0", + "rxjs-compat": "6.4.0", + "tslib": "1.9.3", + "zone.js": "0.8.29" }, "devDependencies": { - "@angular/cli": "^1.6.5", - "@angular/compiler-cli": "^5.0.0", - "@angular/language-service": "^5.0.0", - "@types/jasmine": "~2.5.53", - "@types/jasminewd2": "~2.0.2", - "@types/node": "~6.0.60", - "codelyzer": "4.3.0", + "@angular-devkit/build-angular": "0.13.6", + "@angular/cli": "7.3.6", + "@angular/compiler-cli": "7.2.10", + "@angular/language-service": "7.2.10", + "@types/jasmine": "2.5.54", + "@types/jasminewd2": "2.0.6", + "@types/lodash": "4.14.122", + "@types/node": "6.0.118", + "codelyzer": "4.5.0", "copy-webpack-plugin": "4.3.0", - "jasmine-core": "~2.6.2", - "jasmine-spec-reporter": "~4.1.0", - "karma": "~1.7.0", - "karma-chrome-launcher": "~2.1.1", - "karma-cli": "~1.0.1", - "karma-coverage-istanbul-reporter": "^1.2.1", - "karma-jasmine": "~1.1.0", - "karma-jasmine-html-reporter": "^0.2.2", - "karma-junit-reporter": "^1.2.0", - "karma-phantomjs-launcher": "^1.0.4", - "protractor": "~5.3.0", - "ts-node": "~3.2.0", - "tslint": "~5.9.1", - "tslint-eslint-rules": "^4.1.1", - "typescript": "~2.4.2" + "jasmine-core": "2.6.4", + "jasmine-spec-reporter": "4.1.1", + "karma": "4.0.1", + "karma-chrome-launcher": "2.1.1", + "karma-cli": "1.0.1", + "karma-coverage-istanbul-reporter": "1.4.3", + "karma-jasmine": "1.1.2", + "karma-jasmine-html-reporter": "0.2.2", + "karma-junit-reporter": "1.2.0", + "karma-phantomjs-launcher": "1.0.4", + "protractor": "5.4.2", + "ts-node": "3.2.2", + "tslint": "5.9.1", + "tslint-eslint-rules": "4.1.1", + "typescript": "3.2.4" } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.ts index 41a0c03e59f7b..458b930034913 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.ts @@ -148,7 +148,7 @@ export class RbdListComponent implements OnInit, OnDestroy { images = images.concat(pool.value); }); const viewCacheStatusList = []; - _.forEach(viewCacheStatusMap, (value, key) => { + _.forEach(viewCacheStatusMap, (value: [], key) => { viewCacheStatusList.push({ status: parseInt(key, 10), statusFor: (value.length > 1 ? 'pools ' : 'pool ') + diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/copy2clipboard-button.directive.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/copy2clipboard-button.directive.ts index 7421a3c35975f..4ee8a26596a2f 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/copy2clipboard-button.directive.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/copy2clipboard-button.directive.ts @@ -7,7 +7,7 @@ import { ToastsManager } from 'ng2-toastr'; }) export class Copy2ClipboardButtonDirective implements OnInit { - @Input('cdCopy2ClipboardButton') private cdCopy2ClipboardButton: string; + @Input() cdCopy2ClipboardButton: string; constructor(private elementRef: ElementRef, private renderer: Renderer2, diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/password-button.directive.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/password-button.directive.ts index 3e152a3334ade..3a849a567c6c4 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/password-button.directive.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/password-button.directive.ts @@ -6,7 +6,7 @@ import { Directive, ElementRef, HostListener, Input, OnInit, Renderer2 } from '@ export class PasswordButtonDirective implements OnInit { private iElement: HTMLElement; - @Input('cdPasswordButton') private cdPasswordButton: string; + @Input() private cdPasswordButton: string; constructor(private elementRef: ElementRef, private renderer: Renderer2) {} diff --git a/src/pybind/mgr/dashboard/frontend/src/polyfills.ts b/src/pybind/mgr/dashboard/frontend/src/polyfills.ts index caac2e0875de1..396e0e63beef6 100644 --- a/src/pybind/mgr/dashboard/frontend/src/polyfills.ts +++ b/src/pybind/mgr/dashboard/frontend/src/polyfills.ts @@ -35,16 +35,6 @@ import 'core-js/es6/symbol'; import 'core-js/es6/weak-map'; import 'core-js/es7/object'; -/** IE10 and IE11 requires the following for NgClass support on SVG elements */ -// import 'classlist.js'; // Run `npm install --save classlist.js`. - -/** IE10 and IE11 requires the following for the Reflect API. */ -// import 'core-js/es6/reflect'; - -/** Evergreen browsers require these. **/ -// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove. -import 'core-js/es7/reflect'; - /** * Required to support Web Animations `@angular/platform-browser/animations`. * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation diff --git a/src/pybind/mgr/dashboard/frontend/src/tsconfig.spec.json b/src/pybind/mgr/dashboard/frontend/src/tsconfig.spec.json index 63d89ff283f6a..18bad40ed42a3 100644 --- a/src/pybind/mgr/dashboard/frontend/src/tsconfig.spec.json +++ b/src/pybind/mgr/dashboard/frontend/src/tsconfig.spec.json @@ -11,7 +11,8 @@ ] }, "files": [ - "test.ts" + "test.ts", + "polyfills.ts" ], "include": [ "**/*.spec.ts", diff --git a/src/pybind/mgr/dashboard/frontend/tsconfig.json b/src/pybind/mgr/dashboard/frontend/tsconfig.json index a6c016bf38ad7..4ad3a431d83cf 100644 --- a/src/pybind/mgr/dashboard/frontend/tsconfig.json +++ b/src/pybind/mgr/dashboard/frontend/tsconfig.json @@ -1,6 +1,7 @@ { "compileOnSave": false, "compilerOptions": { + "importHelpers": true, "outDir": "./dist/out-tsc", "sourceMap": true, "declaration": false, @@ -14,6 +15,8 @@ "lib": [ "es2017", "dom" - ] + ], + "module": "es2015", + "baseUrl": "./" } } diff --git a/src/pybind/mgr/dashboard/frontend/tslint.json b/src/pybind/mgr/dashboard/frontend/tslint.json index 8a462673dcda9..2e64a8d381e69 100644 --- a/src/pybind/mgr/dashboard/frontend/tslint.json +++ b/src/pybind/mgr/dashboard/frontend/tslint.json @@ -19,7 +19,6 @@ "forin": true, "import-blacklist": [ true, - "rxjs", "rxjs/Rx" ], "import-spacing": true, -- 2.39.5