From 0a34dfa32165036b380ec6ac493469b34007df0a Mon Sep 17 00:00:00 2001 From: "SANDHYA.JS" Date: Tue, 25 Apr 2023 23:59:41 +0530 Subject: [PATCH] Fix Bug 2121: NG-UI uses unmaintained Chokidar version - Upgraded Angular from 11 to 14 version to remove chokidar unmaintained version. - Changed linting tool tslint to eslint for angular 14 as tslint is depreacted after angular 12 - Resolved linting issues from code Change-Id: I00e908ab651db0f080e0d18a9d1c9711f4e36b91 Signed-off-by: SANDHYA.JS --- .eslintrc.json | 293 +++++++++++++++++ .gitignore | 1 + angular.json | 72 +++-- build-debpkg.sh | 2 +- package.json | 108 ++++--- src/.eslintrc.json | 16 + src/app/AppComponent.ts | 2 +- src/app/AppModule.ts | 71 +---- src/app/approutes.module.ts | 23 +- src/app/dashboard/DashboardComponent.ts | 59 ++-- src/app/dashboard/DashboardModule.ts | 4 +- src/app/instances/InstancesComponent.ts | 4 +- src/app/instances/InstancesModule.ts | 17 +- .../NetsliceInstancesComponent.ts | 9 +- .../HistoryOperationsComponent.ts | 13 +- .../ns-instances/NSInstancesComponent.ts | 9 +- .../ns-primitive/NSPrimitiveComponent.ts | 13 +- .../ns-topology/NSTopologyComponent.ts | 33 +- .../pdu-instances/PDUInstancesComponent.ts | 9 +- .../AddPDUInstancesComponent.ts | 2 - .../vnf-instances/VNFInstancesComponent.ts | 4 +- .../vnf-link/VNFLinkComponent.ts | 1 - src/app/k8s/K8sComponent.ts | 5 +- src/app/k8s/K8sModule.ts | 3 +- src/app/k8s/k8s-action/K8sActionComponent.ts | 6 +- .../k8s-add-cluster/K8sAddClusterComponent.ts | 6 +- .../k8s/k8s-add-repo/K8sAddRepoComponent.ts | 1 - src/app/k8s/k8scluster/K8sClusterComponent.ts | 6 +- .../k8srepository/K8sRepositoryComponent.ts | 7 +- .../layouts/breadcrumb/BreadcrumbComponent.ts | 4 +- src/app/layouts/header/HeaderComponent.ts | 1 + src/app/layouts/sidebar/SidebarComponent.ts | 3 +- src/app/login/LoginComponent.ts | 2 +- .../OperationalViewComponent.ts | 20 +- .../OperationalViewAppActionsComponent.ts | 3 +- .../OperationalViewAppConfigsComponent.ts | 7 +- ...rationalViewAppExecutedActionsComponent.ts | 2 +- .../OsmRepositoriesComponent.ts | 4 +- .../osm-repositories/OsmRepositoriesModule.ts | 4 - .../OsmRepositoriesDetailsComponent.ts | 9 +- src/app/packages/PackagesComponent.ts | 4 +- src/app/packages/PackagesModule.ts | 3 +- .../InstantiateNetSliceTemplateComponent.ts | 13 +- .../instantiate-ns/InstantiateNsComponent.ts | 13 +- .../ns-packages/NSPackagesComponent.ts | 1 + .../ns-composer/NSComposerComponent.ts | 87 ++--- .../vnf-composer/VNFComposerComponent.ts | 79 ++--- .../vnf-packages/VNFPackagesComponent.ts | 1 + .../page-not-found/PageNotFoundComponent.ts | 1 - src/app/projects/ProjectsComponent.ts | 11 +- src/app/projects/ProjectsModule.ts | 4 - .../ProjectCreateUpdateComponent.ts | 3 +- src/app/roles/RolesComponent.ts | 5 +- src/app/roles/RolesModule.ts | 3 +- .../RolesCreateEditComponent.ts | 19 +- .../roles-details/RolesDetailsComponent.ts | 7 +- .../sdn-controller/SDNControllerComponent.ts | 4 +- src/app/sdn-controller/SDNControllerModule.ts | 7 +- .../SDNControllerDetailsComponent.ts | 10 +- .../user-settings/UserSettingsComponent.ts | 2 - src/app/users/UsersComponent.ts | 4 +- src/app/users/UsersModule.ts | 9 +- .../users/add-user/AddEditUserComponent.ts | 3 +- .../project-role/ProjectRoleComponent.ts | 3 - .../user-details/UserDetailsComponent.ts | 11 +- .../ChangePasswordComponent.ts | 2 +- .../change-password/ChangePasswordModule.ts | 3 +- .../clone-package/ClonePackageComponent.ts | 1 - .../compose-packages/ComposePackages.ts | 6 +- .../ConfirmationTopologyComponent.ts | 1 - .../utilities/dragDropUpload/DragDirective.ts | 2 +- .../edit-packages/EditPackagesComponent.ts | 16 +- src/app/utilities/loader/LoaderComponent.ts | 1 - src/app/utilities/loader/LoaderModule.ts | 4 +- .../NetsliceInstancesActionComponent.ts | 6 +- .../NetslicePackagesActionComponent.ts | 7 +- .../NSInstancesActionComponent.html | 2 +- .../NSInstancesActionComponent.ts | 53 +++- .../NsPackagesActionComponent.ts | 13 +- .../utilities/ns-update/NsUpdateComponent.ts | 23 +- .../OsmRepositoriesActionComponent.ts | 10 +- src/app/utilities/page-per-row/PagePerRow.ts | 2 + .../page-per-row/PagePerRowModule.ts | 6 +- src/app/utilities/page-reload/PageReload.ts | 2 + .../utilities/page-reload/PageReloadModule.ts | 6 +- .../PDUInstancesActionComponent.ts | 6 +- .../project-link/ProjectLinkComponent.ts | 2 +- .../ProjectsActionComponent.ts | 10 +- .../roles-action/RolesActionComponent.ts | 6 +- src/app/utilities/scaling/ScalingComponent.ts | 7 +- .../SDNControllerActionComponent.ts | 6 +- .../utilities/show-info/ShowInfoComponent.ts | 1 + .../StartStopRebuildComponent.ts | 14 +- .../switch-project/SwitchProjectComponent.ts | 4 +- .../users-action/UsersActionComponent.ts | 15 +- .../VerticalScalingComponent.ts | 16 +- .../VimAccountsActionComponent.ts | 6 +- .../vm-migration/VmMigrationComponent.ts | 17 +- .../VNFInstancesActionComponent.ts | 1 + .../VNFPackagesActionComponent.ts | 16 +- .../WIMAccountsActionComponent.ts | 6 +- .../ResourcesOverviewComponent.html | 8 +- .../ResourcesOverviewComponent.scss | 6 +- .../ResourcesOverviewComponent.ts | 24 +- .../Resources-Overview/SharedModule.ts | 7 +- src/app/vim-accounts/VimAccountsComponent.ts | 4 +- src/app/vim-accounts/VimAccountsModule.ts | 3 +- .../vim-accounts/info-vim/InfoVimComponent.ts | 43 +-- .../new-vimaccount/NewVimaccountComponent.ts | 6 +- .../VimAccountDetailsComponent.ts | 10 +- src/app/wim-accounts/WIMAccountsComponent.ts | 4 +- src/app/wim-accounts/WIMAccountsModule.ts | 3 +- .../new-wim-account/NewWIMAccountComponent.ts | 3 +- .../WIMAccountDetailsComponent.ts | 9 +- src/assets/i18n/de.json | 4 +- src/assets/i18n/en.json | 4 +- src/assets/i18n/es.json | 4 +- src/assets/i18n/pt.json | 4 +- src/assets/scss/app.scss | 5 +- src/assets/scss/mixins/_rem.scss | 4 +- src/assets/scss/style.scss | 34 +- src/assets/scss/variable.scss | 29 +- src/directive/GoToTopDirective.ts | 3 +- src/environments/environment.prod.ts | 7 +- src/environments/environment.ts | 7 +- src/models/CommonModel.ts | 3 +- src/models/NSDModel.ts | 1 - src/models/NSInstanceModel.ts | 4 +- src/models/NetworkSliceModel.ts | 1 - src/models/OperationalModel.ts | 1 - src/models/VNFDModel.ts | 1 - src/models/VimAccountModel.ts | 9 +- src/polyfills.ts | 17 +- src/services/AuthGuardService.ts | 5 +- src/services/AuthInterceptorService.ts | 6 +- src/services/AuthenticationService.ts | 10 +- src/services/DataService.ts | 1 + src/services/DeviceCheckService.ts | 12 +- src/services/ProjectService.ts | 1 + src/services/RestService.ts | 3 +- src/services/SharedService.ts | 33 +- src/test.ts | 8 +- src/tslint.json | 17 - tsconfig.json | 3 +- tslint.json | 299 ------------------ 145 files changed, 1198 insertions(+), 936 deletions(-) create mode 100644 .eslintrc.json create mode 100644 src/.eslintrc.json delete mode 100644 src/tslint.json delete mode 100644 tslint.json diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..1e17cd7 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,293 @@ +{ + "root": true, + "ignorePatterns": [ + "package.json" + ], + "overrides": [ + { + "files": [ + "*.ts" + ], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "project": [ + "**/tsconfig.json" + ], + "createDefaultProgram": true + }, + "env": { + "browser": true, + "es6": true + }, + "extends": [ + "plugin:@angular-eslint/ng-cli-compat", + "plugin:@angular-eslint/ng-cli-compat--formatting-add-on", + "plugin:@angular-eslint/template/process-inline-templates", + "plugin:@typescript-eslint/recommended", + "plugin:@typescript-eslint/recommended-requiring-type-checking", + "plugin:@microsoft/sdl/required", + "plugin:@microsoft/sdl/typescript", + "plugin:jsx-a11y/recommended", + "plugin:security/recommended", + "eslint:recommended", + "plugin:node/recommended-module" + ], + "plugins": [ + "eslint-plugin-jest", + "eslint-plugin-no-null", + "jsdoc", + "@microsoft/sdl", + "jsx-a11y", + "security", + "deprecation", + "lodash", + "prefer-arrow" + ], + "rules": { + "@typescript-eslint/await-thenable": "error", + "@typescript-eslint/consistent-type-definitions": "error", + "@typescript-eslint/explicit-member-accessibility": [ + "off", + { + "accessibility": "explicit" + } + ], + "@typescript-eslint/no-empty-function": "error", + "@typescript-eslint/no-explicit-any": "warn", + "@typescript-eslint/no-floating-promises": "warn", + "@typescript-eslint/no-for-in-array": "error", + "@typescript-eslint/no-inferrable-types": "off", + "@typescript-eslint/no-parameter-properties": "error", + "@typescript-eslint/no-require-imports": "error", + "@typescript-eslint/no-unnecessary-qualifier": "error", + "@typescript-eslint/no-var-requires": "error", + "@typescript-eslint/promise-function-async": "error", + "@typescript-eslint/restrict-plus-operands": "off", + "@typescript-eslint/strict-boolean-expressions": "off", + "@typescript-eslint/triple-slash-reference": "error", + "@typescript-eslint/type-annotation-spacing": "off", + "arrow-parens": [ + "error", + "always" + ], + "brace-style": [ + "off", + "off" + ], + "comma-dangle": "error", + "complexity": "error", + "default-case": "error", + "id-blacklist": "error", + "import/no-default-export": "error", + "import/order": [ + "error", + { + "alphabetize": { + "order": "asc", + "caseInsensitive": true + } + } + ], + "jest/no-focused-tests": "error", + "linebreak-style": "off", + "max-classes-per-file": [ + "error", + 3 + ], + "max-lines": [ + "error", + { + "max": 1000, + "skipComments": true, + "skipBlankLines": true + } + ], + "no-constant-condition": "error", + "no-control-regex": "error", + "no-empty": "error", + "no-extra-semi": "error", + "no-invalid-regexp": "error", + "no-invalid-this": "error", + "no-multi-str": "error", + "no-multiple-empty-lines": "error", + "no-null/no-null": "off", + "no-octal": "error", + "no-octal-escape": "error", + "no-redeclare": "error", + "no-regex-spaces": "error", + "no-sparse-arrays": "error", + "no-void": "error", + "space-before-function-paren": "off", + "valid-typeof": "error", + "require-jsdoc": [ + "error", + { + "require": { + "FunctionDeclaration": true, + "MethodDefinition": false, + "ClassDeclaration": false, + "ArrowFunctionExpression": false, + "FunctionExpression": false + } + } + ], + "max-statements": [ + "error", + 100 + ], + "max-len": [ + "error", + 500 + ], + "@microsoft/sdl/no-cookies": "error", + "@typescript-eslint/no-dynamic-delete": "error", + "@microsoft/sdl/no-msapp-exec-unsafe": "error", + "@microsoft/sdl/no-winjs-html-unsafe": "error", + "constructor-super": "error", + "padded-blocks": [ + "error", + "never" + ], + "func-style": "error", + "@microsoft/sdl/no-insecure-url": [ + "error", + { + "blocklist": [ + "^(http|ftp):\\/\\/", + "^https:\\/\\/www\\.disallow-example\\.com" + ], + "exceptions": [ + "^http:\\/\\/schemas\\.microsoft\\.com\\/\\/?.*" + ] + } + ], + "@microsoft/sdl/no-insecure-random": "off", + "@microsoft/sdl/no-inner-html": "error", + "@microsoft/sdl/no-html-method": "error", + "@typescript-eslint/no-implied-eval": "error", + "no-undef-init": "error", + "no-with": "error", + "security/detect-non-literal-require": "error", + "security/detect-possible-timing-attacks": "error", + "@typescript-eslint/no-array-constructor": "error", + "@typescript-eslint/method-signature-style": "error", + "jsx-a11y/anchor-is-valid": [ + "off", + { + "components": [ + "Link" + ], + "specialLink": [ + "hrefLeft", + "hrefRight" + ], + "aspects": [ + "noHref", + "invalidHref", + "preferButton" + ] + } + ], + "jsx-a11y/aria-unsupported-elements": "error", + "jsx-a11y/no-static-element-interactions": "error", + "jsx-a11y/alt-text": "error", + "jsx-a11y/lang": "error", + "jsx-a11y/aria-props": "error", + "jsx-a11y/aria-proptypes": "error", + "jsx-a11y/aria-role": "error", + "jsx-a11y/role-has-required-aria-props": "error", + "jsx-a11y/role-supports-aria-props": "error", + "jsx-a11y/tabindex-no-positive": "error", + "react/jsx-no-target-blank": "error", + "@microsoft/sdl/react-iframe-missing-sandbox": "error", + "react/no-danger": "error", + "react/jsx-curly-spacing": "error", + "react/no-unused-state": "error", + "lodash/chaining": "error", + "@typescript-eslint/ban-types": "off", + "deprecation/deprecation": "warn", + "@typescript-eslint/naming-convention": [ + "warn", + { + "selector": "variableLike", + "format": null + } + ], + "@typescript-eslint/member-ordering": [ + "error", + { + "default": [ + "field" + ] + } + ], + "@typescript-eslint/no-unsafe-member-access": "off", + "@typescript-eslint/no-unused-vars": "off", + "no-unused-vars": "off", + "no-unsafe-finally": "error", + "jsdoc/newline-after-description": [ + "warn", + "never" + ], + "@typescript-eslint/unbound-method": "off", + "no-underscore-dangle": "off", + "no-magic-numbers": "off", + "@typescript-eslint/no-magic-numbers": [ + "warn", + { + "ignore": [ + -1, + 0, + 1 + ], + "ignoreArrayIndexes": true, + "ignoreDefaultValues": true + } + ], + "@typescript-eslint/no-unsafe-assignment": "off", + "prefer-arrow/prefer-arrow-functions": [ + "warn", + { + "disallowPrototype": true, + "singleReturnOnly": false, + "classPropertiesAllowed": false + } + ], + "@angular-eslint/use-lifecycle-interface": "off", + "security/detect-non-literal-fs-filename": "error", + "@typescript-eslint/no-unsafe-call": "off", + "@typescript-eslint/no-unsafe-return": "off", + "security/detect-unsafe-regex": "off", + "security/detect-non-literal-regexp": "error", + "no-console": "error", + "sort-keys": "off", + "node/no-deprecated-api": [ + "warn", + { + "ignoreModuleItems": [ + "util.isNullOrUndefined" + ] + } + ], + "node/no-missing-import": [ + "off" + ], + "@typescript-eslint/member-delimiter-style": "off", + "node/no-unsupported-features/node-builtins": [ + "off" + ], + "security/detect-object-injection": "warn" + } + }, + { + "files": [ + "*.html" + ], + "extends": [ + "plugin:@angular-eslint/template/recommended", + "plugin:node/recommended-module" + ], + "rules": {} + } + ] +} diff --git a/.gitignore b/.gitignore index 3ff03e0..ed13e3d 100644 --- a/.gitignore +++ b/.gitignore @@ -48,6 +48,7 @@ speed-measure-plugin.json .history/* # misc +/.angular/cache /.sass-cache /connect.lock /coverage diff --git a/angular.json b/angular.json index a8eb6a6..60abb89 100644 --- a/angular.json +++ b/angular.json @@ -10,7 +10,6 @@ "prefix": "app", "schematics": { "@schematics/angular:component": { - "styleext": "scss", "style": "scss" } }, @@ -23,6 +22,20 @@ "main": "src/main.ts", "polyfills": "src/polyfills.ts", "tsConfig": "src/tsconfig.app.json", + "allowedCommonJsDependencies": [ + "chart.js", + "ng-sidebar", + "@ctrl/ngx-codemirror", + "rbush", + "lodash", + "jsonpath", + "codemirror", + "pako", + "js-untar", + "util", + "http-status-codes", + "js-yaml" + ], "assets": [ "src/favicon.ico", "src/assets" @@ -34,7 +47,12 @@ ], "scripts": [ "src/assets/js/tar.js" - ] + ], + "stylePreprocessorOptions": { + "includePaths": [ + "node_modules/" + ] + } }, "configurations": { "production": { @@ -97,15 +115,26 @@ ] } }, + "e2e": { + "builder": "@cypress/schematic:cypress", + "options": { + "devServerTarget": "osm:serve", + "watch": true, + "headless": false, + "configFile": "e2e//cypress.config.js" + }, + "configurations": { + "production": { + "devServerTarget": "osm:serve:production" + } + } + }, "lint": { - "builder": "@angular-devkit/build-angular:tslint", + "builder": "@angular-eslint/builder:lint", "options": { - "tsConfig": [ - "src/tsconfig.app.json", - "src/tsconfig.spec.json" - ], - "exclude": [ - "**/node_modules/**" + "lintFilePatterns": [ + "src/**/*.ts", + "src/**/*.html" ] } } @@ -117,28 +146,25 @@ "prefix": "", "architect": { "e2e": { - "builder": "@angular-devkit/build-angular:protractor", + "builder": "@cypress/schematic:cypress", "options": { - "protractorConfig": "e2e/protractor.conf.js", - "devServerTarget": "osm:serve" + "devServerTarget": "osm-e2e:serve", + "watch": true, + "headless": false, + "configFile": "e2e//cypress.config.js" }, "configurations": { "production": { - "devServerTarget": "osm:serve:production" + "devServerTarget": "osm-e2e:serve:production" } } - }, - "lint": { - "builder": "@angular-devkit/build-angular:tslint", - "options": { - "tsConfig": "e2e/tsconfig.e2e.json", - "exclude": [ - "**/node_modules/**" - ] - } } } } }, - "defaultProject": "osm" + "cli": { + "schematicCollections": [ + "@angular-eslint/schematics" + ] + } } \ No newline at end of file diff --git a/build-debpkg.sh b/build-debpkg.sh index 75ffeca..6101635 100755 --- a/build-debpkg.sh +++ b/build-debpkg.sh @@ -16,7 +16,7 @@ PKG_DIRECTORIES="nginx src" -PKG_FILES="angular.json .browserslistrc CONTRIBUTING.md package.json proxy.conf.json tsconfig.json tslint.json LICENSE README.md" +PKG_FILES=".eslintrc.json angular.json .browserslistrc CONTRIBUTING.md package.json proxy.conf.json tsconfig.json LICENSE README.md" MDG_NAME=ngui DEB_INSTALL=debian/osm-${MDG_NAME}.install export DEBEMAIL="gerardo.garciadeblas@telefonica.com" diff --git a/package.json b/package.json index 3f16dec..d4b4cb4 100644 --- a/package.json +++ b/package.json @@ -1,55 +1,58 @@ { "name": "osm", - "version": "9.0.0", + "version": "14.0.0", + "engines": { + "node": ">=14.0.0" + }, "scripts": { "ng": "ng", "start": "ng serve", - "build": "ng build --prod --aot", + "build": "ng build --configuration production --aot", "test": "ng test", - "lint": "tslint --type-check --project tsconfig.json -c tslint.json", + "lint": "eslint --ext ts,tsx .", "e2e": "ng e2e", "proxy": "ng serve --proxy-config proxy.conf.json" }, "private": true, "dependencies": { "@akveo/ng2-completer": "^9.0.1", - "@angular/animations": "~11.0.2", - "@angular/cdk": "^7.3.7", - "@angular/common": "~11.0.2", - "@angular/compiler": "~11.0.2", - "@angular/core": "~11.0.2", + "@angular/animations": "^14.2.12", + "@angular/cdk": "^13.3.9", + "@angular/common": "^14.2.12", + "@angular/compiler": "^14.2.12", + "@angular/core": "^14.2.12", "@angular/flex-layout": "^9.0.0-beta.29", - "@angular/forms": "~11.0.2", - "@angular/localize": "^11.0.2", - "@angular/platform-browser": "~11.0.2", - "@angular/platform-browser-dynamic": "~11.0.2", - "@angular/router": "~11.0.2", - "@ctrl/ngx-codemirror": "^2.2.1", + "@angular/forms": "^14.2.12", + "@angular/localize": "^14.2.12", + "@angular/platform-browser": "^14.2.12", + "@angular/platform-browser-dynamic": "^14.2.12", + "@angular/router": "^14.2.12", + "@ctrl/ngx-codemirror": "^5.1.1", "@fortawesome/fontawesome-free": "^5.13.0", - "@ng-bootstrap/ng-bootstrap": "^5.3.0", - "@ng-idle/core": "^8.0.0-beta.4", - "@ng-idle/keepalive": "^8.0.0-beta.4", - "@ng-select/ng-select": "^3.7.3", - "@ngx-translate/core": "^12.1.2", + "@ng-bootstrap/ng-bootstrap": "^11.0.1", + "@ng-idle/core": "^11.0.3", + "@ng-idle/keepalive": "^11.0.3", + "@ng-select/ng-select": "^8.0.0", + "@ngx-translate/core": "^13.0.0", "@ngx-translate/http-loader": "^4.0.0", "@nomadreservations/ngx-codemirror": "^2.0.0", "@types/d3": "^5.7.2", "@types/js-yaml": "^3.12.1", "@types/jsonpath": "^0.2.0", "@types/ol": "^5.3.5", - "angular-notifier": "^6.0.1", - "bootstrap": "^4.4.1", - "chart.js": "^2.8.0", - "chartjs-plugin-labels": "^1.1.0", + "angular-notifier": "^9.1.0", + "bootstrap": "^4.6.2", + "chart.js": "^3.9.1", + "chartjs-plugin-datalabels": "^2.2.0", "codemirror": "^5.51.0", - "core-js": "^2.5.4", + "core-js": "^3.27.2", "d3": "^5.9.2", "http-status-codes": "^1.3.2", "js-untar": "^2.0.0", "js-yaml": "^3.13.1", "jsonpath": "^1.0.2", "ng-sidebar": "~9.2.0", - "ng2-charts": "^2.4.2", + "ng2-charts": "^3.0.0-rc.7", "ng2-file-upload": "^1.3.0", "ng2-smart-table": "~1.6.0", "ol": "^5.3.3", @@ -58,34 +61,51 @@ "rxjs": "^6.5.4", "rxjs-compat": "^6.5.5", "stream": "0.0.2", - "tslib": "^2.0.0", - "web-animations-js": "^2.3.2", - "zone.js": "~0.10.0" + "tslib": "^2.5.0", + "util": "^0.12.4", + "zone.js": "~0.11.8", + "@popperjs/core": "~2.10.1" }, "devDependencies": { - "@angular-devkit/build-angular": "^0.1100.2", - "@angular/cli": "~11.0.2", - "@angular/compiler-cli": "~11.0.2", - "@angular/language-service": "~11.0.2", - "@types/jasmine": "~3.6.0", + "@angular-devkit/build-angular": "^14.2.10", + "@angular-eslint/builder": "13.5.0", + "@angular-eslint/eslint-plugin": "13.5.0", + "@angular-eslint/eslint-plugin-template": "13.5.0", + "@angular-eslint/schematics": "13.5.0", + "@angular-eslint/template-parser": "13.5.0", + "@angular/cli": "^14.2.10", + "@angular/compiler-cli": "^14.2.12", + "@angular/language-service": "^14.2.12", + "@cypress/schematic": "^2.3.0", + "@microsoft/eslint-plugin-sdl": "~0.2.0", + "@types/jasmine": "~3.10.0", "@types/jasminewd2": "~2.0.3", "@types/jquery": "^3.3.31", "@types/node": "^8.10.59", - "codelyzer": "^6.0.0", - "jasmine-core": "~3.6.0", + "@typescript-eslint/eslint-plugin": "4.28.2", + "@typescript-eslint/parser": "4.28.2", + "cypress": "^12.10.0", + "eslint": "^7.26.0", + "eslint-plugin-compat": "~4.0.2", + "eslint-plugin-deprecation": "~1.3.2", + "eslint-plugin-import": "~2.26.0", + "eslint-plugin-jest": "~27.1.5", + "eslint-plugin-jsdoc": "~39.6.2", + "eslint-plugin-jsx-a11y": "~6.6.1", + "eslint-plugin-lodash": "~7.4.0", + "eslint-plugin-no-null": "~1.0.2", + "eslint-plugin-prefer-arrow": "~1.2.3", + "eslint-plugin-security": "~1.5.0", + "jasmine-core": "~4.0.0", "jasmine-spec-reporter": "~5.0.0", - "karma": "~5.0.0", + "karma": "~6.3.0", "karma-chrome-launcher": "~3.1.0", - "karma-coverage-istanbul-reporter": "~3.0.2", + "karma-coverage": "~2.1.0", "karma-jasmine": "~4.0.0", - "karma-jasmine-html-reporter": "^1.5.0", + "karma-jasmine-html-reporter": "~1.7.0", "ng2-completer": "^3.0.3", - "node-sass": "^5.0.0", - "protractor": "~7.0.0", + "sass": "^1.58.0", "ts-node": "~7.0.0", - "tslint": "~6.1.0", - "tslint-html-report": "^2.0.3", - "tslint-microsoft-contrib": "^6.1.1", - "typescript": "~4.0.5" + "typescript": "~4.6.2" } } diff --git a/src/.eslintrc.json b/src/.eslintrc.json new file mode 100644 index 0000000..9c4ba8c --- /dev/null +++ b/src/.eslintrc.json @@ -0,0 +1,16 @@ +{ + "extends": "../.eslintrc.json", + "rules": { + "no-restricted-syntax": [ + "error", + "ForInStatement" + ], + "@typescript-eslint/array-type": [ + "error", + { + "default": "array" + } + ] + } + } + \ No newline at end of file diff --git a/src/app/AppComponent.ts b/src/app/AppComponent.ts index 04ad8d8..4567671 100644 --- a/src/app/AppComponent.ts +++ b/src/app/AppComponent.ts @@ -19,13 +19,13 @@ /** * @file App Components */ +import { isNullOrUndefined } from 'util'; import { Component, HostListener, Injector } from '@angular/core'; import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; import { DEFAULT_INTERRUPTSOURCES, Idle } from '@ng-idle/core'; import { AuthenticationService } from 'AuthenticationService'; import { DeviceCheckService } from 'DeviceCheckService'; import { SharedService } from 'SharedService'; -import { isNullOrUndefined } from 'util'; /** * Creating component diff --git a/src/app/AppModule.ts b/src/app/AppModule.ts index 5244bb2..8a4ebaf 100644 --- a/src/app/AppModule.ts +++ b/src/app/AppModule.ts @@ -25,44 +25,34 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { BrowserModule } from '@angular/platform-browser'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { RouterModule } from '@angular/router'; +import { CodemirrorModule } from '@ctrl/ngx-codemirror'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; +import { NgIdleKeepaliveModule } from '@ng-idle/keepalive'; +import { NgSelectModule } from '@ng-select/ng-select'; import { TranslateLoader, TranslateModule, TranslateService } from '@ngx-translate/core'; import { TranslateHttpLoader } from '@ngx-translate/http-loader'; import { NotifierModule, NotifierOptions } from 'angular-notifier'; -import { AuthInterceptorService } from 'AuthInterceptorService'; -import { HeaderComponent } from 'HeaderComponent'; -import { LayoutComponent } from 'LayoutComponent'; -import { Ng2SmartTableModule } from 'ng2-smart-table'; -import { RestService } from 'RestService'; -import { SidebarComponent } from 'SidebarComponent'; -import { AppComponent } from './AppComponent'; - -import { appRoutes } from './approutes.module'; - -import { DataService } from 'DataService'; -import { ProjectService } from 'ProjectService'; -import { SharedService } from 'SharedService'; - -import { CodemirrorModule } from '@ctrl/ngx-codemirror'; -import { NgSelectModule } from '@ng-select/ng-select'; - -import { NgIdleKeepaliveModule } from '@ng-idle/keepalive'; import { AuthenticationService } from 'AuthenticationService'; import { AuthGuardService } from 'AuthGuardService'; +import { AuthInterceptorService } from 'AuthInterceptorService'; import { BreadcrumbComponent } from 'BreadCrumb'; import { ChangePasswordComponent } from 'ChangePasswordComponent'; import { ChangePasswordModule } from 'ChangePasswordModule'; import { ComposePackages } from 'ComposePackages'; import { ConfirmationTopologyComponent } from 'ConfirmationTopology'; +import { DataService } from 'DataService'; import { DeleteComponent } from 'DeleteComponent'; import { DeviceCheckService } from 'DeviceCheckService'; import { GoToTopDirective } from 'GoToTopDirective'; +import { HeaderComponent } from 'HeaderComponent'; import { InstantiateNetSliceTemplateComponent } from 'InstantiateNetSliceTemplate'; import { InstantiateNsComponent } from 'InstantiateNs'; +import { LayoutComponent } from 'LayoutComponent'; import { LoaderModule } from 'LoaderModule'; import { LoginComponent } from 'LoginComponent'; import { NetsliceInstancesActionComponent } from 'NetsliceInstancesActionComponent'; import { NetslicePackagesActionComponent } from 'NetslicePackagesAction'; +import { Ng2SmartTableModule } from 'ng2-smart-table'; import { NSInstancesActionComponent } from 'NSInstancesActionComponent'; import { NsPackagesActionComponent } from 'NsPackagesAction'; import { NsUpdateComponent } from 'NsUpdateComponent'; @@ -70,10 +60,14 @@ import { PageNotFoundComponent } from 'PageNotFound'; import { PDUInstancesActionComponent } from 'PDUInstancesActionComponent'; import { ProjectLinkComponent } from 'ProjectLinkComponent'; import { ProjectsActionComponent } from 'ProjectsAction'; +import { ProjectService } from 'ProjectService'; +import { RestService } from 'RestService'; import { ScalingComponent } from 'ScalingComponent'; import { SDNControllerActionComponent } from 'SDNControllerActionComponent'; import { SharedModule } from 'SharedModule'; +import { SharedService } from 'SharedService'; import { ShowInfoComponent } from 'ShowInfoComponent'; +import { SidebarComponent } from 'SidebarComponent'; import { StartStopRebuildComponent } from 'StartStopRebuildComponent'; import { SwitchProjectComponent } from 'SwitchProjectComponent'; import { UsersActionComponent } from 'UsersActionComponent'; @@ -86,6 +80,8 @@ import { VNFLinkComponent } from 'VNFLinkComponent'; import { VNFPackagesActionComponent } from 'VNFPackagesAction'; import { WarningComponent } from 'WarningComponent'; import { WIMAccountsActionComponent } from 'WIMAccountsAction'; +import { AppComponent } from './AppComponent'; +import { appRoutes } from './approutes.module'; /** * Custom angular notifier options @@ -185,39 +181,7 @@ const customNotifierOptions: NotifierOptions = { SharedService, DeviceCheckService ], - bootstrap: [AppComponent], - entryComponents: [ - VNFPackagesActionComponent, - NsPackagesActionComponent, - NSInstancesActionComponent, - VNFInstancesActionComponent, - VNFLinkComponent, - NetsliceInstancesActionComponent, - BreadcrumbComponent, - DeleteComponent, - NetslicePackagesActionComponent, - UsersActionComponent, - VimAccountsActionComponent, - ProjectsActionComponent, - ProjectLinkComponent, - UserSettingsComponent, - ShowInfoComponent, - InstantiateNetSliceTemplateComponent, - InstantiateNsComponent, - ConfirmationTopologyComponent, - ComposePackages, - WIMAccountsActionComponent, - PDUInstancesActionComponent, - SDNControllerActionComponent, - SwitchProjectComponent, - ScalingComponent, - ChangePasswordComponent, - VmMigrationComponent, - NsUpdateComponent, - WarningComponent, - StartStopRebuildComponent, - VerticalScalingComponent - ] + bootstrap: [AppComponent] }) /** Exporting a class @exports AppModule */ @@ -229,7 +193,7 @@ export class AppModule { /** * HttpLoaderFactory is for translate service of the application. */ -// tslint:disable:function-name +/* eslint-disable */ export function HttpLoaderFactory(http: HttpClient): TranslateHttpLoader { const now: number = new Date().getTime(); return new TranslateHttpLoader(http, './assets/i18n/', '.json?locale=' + now); @@ -237,9 +201,8 @@ export function HttpLoaderFactory(http: HttpClient): TranslateHttpLoader { /** * HttpLoaderFactory is for translate service of the application. */ -// tslint:disable:function-name export function appInitializerFactory(translate: TranslateService, injector: Injector): Object { - // tslint:disable-next-line: no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any return async (): Promise => { await injector.get(LOCATION_INITIALIZED, Promise.resolve(null)); translate.setDefaultLang('en'); diff --git a/src/app/approutes.module.ts b/src/app/approutes.module.ts index e75416e..537dc94 100644 --- a/src/app/approutes.module.ts +++ b/src/app/approutes.module.ts @@ -15,6 +15,7 @@ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in) */ +/* eslint-disable @typescript-eslint/no-explicit-any */ /** * @file Routing Module */ @@ -38,77 +39,77 @@ export const appRoutes: Routes = [ children: [ { path: '', - // tslint:disable-next-line: no-any + // eslint-disable-next-line node/no-unsupported-features/es-syntax loadChildren: async (): Promise => import('./dashboard/DashboardModule') .then((m: typeof import('./dashboard/DashboardModule')) => m.DashboardModule), canActivate: [AuthGuardService] }, { path: 'packages', - // tslint:disable-next-line: no-any + // eslint-disable-next-line node/no-unsupported-features/es-syntax loadChildren: async (): Promise => import('./packages/PackagesModule') .then((m: typeof import('./packages/PackagesModule')) => m.PackagesModule), canActivate: [AuthGuardService] }, { path: 'instances', - // tslint:disable-next-line: no-any + // eslint-disable-next-line node/no-unsupported-features/es-syntax loadChildren: async (): Promise => import('./instances/InstancesModule') .then((m: typeof import('./instances/InstancesModule')) => m.InstancesModule), canActivate: [AuthGuardService] }, { path: 'vim', - // tslint:disable-next-line: no-any + // eslint-disable-next-line node/no-unsupported-features/es-syntax loadChildren: async (): Promise => import('./vim-accounts/VimAccountsModule') .then((m: typeof import('./vim-accounts/VimAccountsModule')) => m.VimAccountsModule), canActivate: [AuthGuardService] }, { path: 'wim', - // tslint:disable-next-line: no-any + // eslint-disable-next-line node/no-unsupported-features/es-syntax loadChildren: async (): Promise => import('./wim-accounts/WIMAccountsModule') .then((m: typeof import('./wim-accounts/WIMAccountsModule')) => m.WIMAccountsModule), canActivate: [AuthGuardService] }, { path: 'sdn', - // tslint:disable-next-line: no-any + // eslint-disable-next-line node/no-unsupported-features/es-syntax loadChildren: async (): Promise => import('./sdn-controller/SDNControllerModule') .then((m: typeof import('./sdn-controller/SDNControllerModule')) => m.SDNControllerModule), canActivate: [AuthGuardService] }, { path: 'users', - // tslint:disable-next-line: no-any + // eslint-disable-next-line node/no-unsupported-features/es-syntax loadChildren: async (): Promise => import('./users/UsersModule') .then((m: typeof import('./users/UsersModule')) => m.UsersModule), canActivate: [AuthGuardService] }, { path: 'projects', - // tslint:disable-next-line: no-any + // eslint-disable-next-line node/no-unsupported-features/es-syntax loadChildren: async (): Promise => import('./projects/ProjectsModule') .then((m: typeof import('./projects/ProjectsModule')) => m.ProjectsModule), canActivate: [AuthGuardService] }, { path: 'roles', - // tslint:disable-next-line: no-any + // eslint-disable-next-line node/no-unsupported-features/es-syntax loadChildren: async (): Promise => import('./roles/RolesModule') .then((m: typeof import('./roles/RolesModule')) => m.RolesModule), canActivate: [AuthGuardService] }, { path: 'k8s', - // tslint:disable-next-line: no-any + // eslint-disable-next-line node/no-unsupported-features/es-syntax loadChildren: async (): Promise => import('./k8s/K8sModule') .then((m: typeof import('./k8s/K8sModule')) => m.K8sModule), canActivate: [AuthGuardService] }, { path: 'repos', - // tslint:disable-next-line: no-any + // eslint-disable-next-line node/no-unsupported-features/es-syntax loadChildren: async (): Promise => import('./osm-repositories/OsmRepositoriesModule') .then((m: typeof import('./osm-repositories/OsmRepositoriesModule')) => m.OsmRepositoriesModule), canActivate: [AuthGuardService] diff --git a/src/app/dashboard/DashboardComponent.ts b/src/app/dashboard/DashboardComponent.ts index b3e48e4..23e928f 100644 --- a/src/app/dashboard/DashboardComponent.ts +++ b/src/app/dashboard/DashboardComponent.ts @@ -18,12 +18,14 @@ /** * @file Dashboard Component */ +import { isNullOrUndefined } from 'util'; import { Component, Injector, OnInit } from '@angular/core'; import { TranslateService } from '@ngx-translate/core'; import { NotifierService } from 'angular-notifier'; import { AuthenticationService } from 'AuthenticationService'; -import { Chart } from 'chart.js'; -import 'chartjs-plugin-labels'; +import { Chart, ChartType, LineController, LineElement, PointElement, LinearScale, Title, ChartEvent, ActiveElement } from 'chart.js'; +import ChartDataLabels from 'chartjs-plugin-datalabels'; +Chart.register(LineController, LineElement, PointElement, LinearScale, Title, ChartDataLabels); import { ERRORDATA, TYPESECTION, VIM_TYPES } from 'CommonModel'; import { environment } from 'environment'; import { NSDDetails } from 'NSDModel'; @@ -35,7 +37,6 @@ import { Observable, Subscription } from 'rxjs'; import { SDNControllerModel } from 'SDNControllerModel'; import { SharedService } from 'SharedService'; import { ProjectRoleMappings, UserDetail } from 'UserModel'; -import { isNullOrUndefined } from 'util'; import { VimAccountDetails } from 'VimAccountModel'; import { VNFInstanceDetails } from 'VNFInstanceModel'; @@ -172,12 +173,15 @@ export class DashboardComponent implements OnInit { private createdTimes: string[] = []; /** Contains slice limit const @private */ + // eslint-disable-next-line @typescript-eslint/no-magic-numbers private sliceLimit: number = 10; /** Contians hour converter @private */ + // eslint-disable-next-line @typescript-eslint/no-magic-numbers private hourConverter: number = 3600; /** Converter used to round off time to one decimal point @private */ + // eslint-disable-next-line @typescript-eslint/no-magic-numbers private converter: number = 10; /** Notifier service to popup notification @private */ @@ -321,7 +325,7 @@ export class DashboardComponent implements OnInit { /** Prepare and sketch NS instance chart */ public drawNsChart(): void { this.charts = new Chart('canvas', { - type: 'bar', + type: 'bar' as ChartType, data: { labels: this.nsRunningInstance, datasets: [{ @@ -329,46 +333,48 @@ export class DashboardComponent implements OnInit { label: this.translateService.instant('NOOFHOURS'), borderColor: this.backgroundColor, fill: false, - backgroundColor: this.backgroundColor + backgroundColor: this.backgroundColor, + hoverBackgroundColor: this.backgroundColor }] }, options: { layout: { padding: { - top: 20 + top: 25 } }, - hover: { - onHover(evt: Event, item: {}): void { - const el: HTMLElement = document.getElementById('canvas'); - el.style.cursor = item[0] ? 'pointer' : 'default'; - } + animation: false, + // eslint-disable-next-line prefer-arrow/prefer-arrow-functions + onHover(event: ChartEvent, item: ActiveElement[], chart: Chart): void { + const el: HTMLElement = document.getElementById('canvas'); + el.style.cursor = item[0] ? 'pointer' : 'default'; }, plugins: { - labels: { - // render 'label', 'value', 'percentage', 'image' or custom function, default is 'percentage' - render: 'value' + legend: { display: false }, + datalabels: { + anchor: 'end', + align: 'top', + font: { + weight: 'bold' + } } }, - legend: { display: false }, scales: { - xAxes: [{ + x: { display: true, - scaleLabel: { + title: { display: true, - labelString: this.translateService.instant('NSINSTANCES') + text: this.translateService.instant('NSINSTANCES') } - }], - yAxes: [{ - ticks: { - beginAtZero: true - }, + }, + y: { + beginAtZero: true, display: true, - scaleLabel: { + title: { display: true, - labelString: this.translateService.instant('NOOFHOURS') + text: this.translateService.instant('NOOFHOURS') } - }] + } } } }); @@ -412,7 +418,6 @@ export class DashboardComponent implements OnInit { if (this.vimList.length === 0) { this.vimListData = null; } - } /** Get Selected VIM details @public */ diff --git a/src/app/dashboard/DashboardModule.ts b/src/app/dashboard/DashboardModule.ts index 82b27c0..19aae28 100644 --- a/src/app/dashboard/DashboardModule.ts +++ b/src/app/dashboard/DashboardModule.ts @@ -30,7 +30,7 @@ import { NgSelectModule } from '@ng-select/ng-select'; import { TranslateModule } from '@ngx-translate/core'; import { DashboardComponent } from 'DashboardComponent'; import { LoaderModule } from 'LoaderModule'; -import { ChartsModule } from 'ng2-charts'; +import { NgChartsModule } from 'ng2-charts'; import { SharedModule } from 'SharedModule'; /** To halndle project information */ @@ -53,7 +53,7 @@ const routes: Routes = [ */ @NgModule({ imports: [FormsModule, CommonModule, HttpClientModule, FlexLayoutModule, TranslateModule, NgSelectModule, - ChartsModule, RouterModule.forChild(routes), NgbModule, LoaderModule, SharedModule], + NgChartsModule, RouterModule.forChild(routes), NgbModule, LoaderModule, SharedModule], declarations: [DashboardComponent] }) /** Exporting a class @exports DashboardModule */ diff --git a/src/app/instances/InstancesComponent.ts b/src/app/instances/InstancesComponent.ts index fe46d8c..4186078 100644 --- a/src/app/instances/InstancesComponent.ts +++ b/src/app/instances/InstancesComponent.ts @@ -49,7 +49,9 @@ export class InstancesComponent { /** Return to list NS Package List */ public redirectToList(getURL: string): void { if (getURL === '/instances') { - this.router.navigate(['/instances/ns']).catch(); + this.router.navigate(['/instances/ns']).catch((): void => { + // Catch Navigation Error + }); } } } diff --git a/src/app/instances/InstancesModule.ts b/src/app/instances/InstancesModule.ts index 18c733c..0d41509 100644 --- a/src/app/instances/InstancesModule.ts +++ b/src/app/instances/InstancesModule.ts @@ -138,23 +138,14 @@ const routes: Routes = [ NetsliceInstancesComponent, HistoryOperationsComponent, NSTopologyComponent, NSPrimitiveComponent, OperationalViewComponent, OperationalViewAppConfigsComponent, OperationalViewAppActionsComponent, OperationalViewAppExecutedActionsComponent], schemas: [CUSTOM_ELEMENTS_SCHEMA], - providers: [DataService], - entryComponents: [ - NSPrimitiveComponent, - AddPDUInstancesComponent, - OperationalViewAppConfigsComponent, - OperationalViewAppActionsComponent, - OperationalViewAppExecutedActionsComponent - ] + providers: [DataService] }) /** Exporting a class @exports InstancesModule */ export class InstancesModule { - /** Resolves state-less class */ - private instancesModule: string; /** * Lifecyle Hooks the trigger before component is instantiate */ - public ngOnInit(): void { - this.instancesModule = ''; - } + constructor() { + //Empty + } } diff --git a/src/app/instances/netslice-instances/NetsliceInstancesComponent.ts b/src/app/instances/netslice-instances/NetsliceInstancesComponent.ts index 3b9564a..e04fc20 100644 --- a/src/app/instances/netslice-instances/NetsliceInstancesComponent.ts +++ b/src/app/instances/netslice-instances/NetsliceInstancesComponent.ts @@ -138,12 +138,15 @@ export class NetsliceInstancesComponent implements OnInit { /** Instantiate Net Slice using modalservice @public */ public instantiateNetSlice(): void { + // eslint-disable-next-line security/detect-non-literal-fs-filename const modalRef: NgbModalRef = this.modalService.open(InstantiateNetSliceTemplateComponent, { backdrop: 'static' }); modalRef.result.then((result: MODALCLOSERESPONSEDATA) => { if (result) { this.generateData(); } - }).catch(); + }).catch((): void => { + // Catch Navigation Error + }); } /** Generate smart table row title and filters @public */ @@ -267,7 +270,9 @@ export class NetsliceInstancesComponent implements OnInit { } this.dataSource.load(this.nstInstanceData).then((data: {}) => { this.isLoadingResults = false; - }).catch(); + }).catch((): void => { + // Catch Navigation Error + }); }, (error: ERRORDATA) => { this.restService.handleError(error, 'get'); this.isLoadingResults = false; diff --git a/src/app/instances/ns-history-operations/HistoryOperationsComponent.ts b/src/app/instances/ns-history-operations/HistoryOperationsComponent.ts index 7f268d1..afbefdb 100644 --- a/src/app/instances/ns-history-operations/HistoryOperationsComponent.ts +++ b/src/app/instances/ns-history-operations/HistoryOperationsComponent.ts @@ -18,6 +18,7 @@ /** * @file NS History Of Operations Component */ +import { isNullOrUndefined } from 'util'; import { Component, Injector, OnInit } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { Router } from '@angular/router'; @@ -33,7 +34,6 @@ import { RestService } from 'RestService'; import { Subscription } from 'rxjs'; import { SharedService } from 'SharedService'; import { ShowInfoComponent } from 'ShowInfoComponent'; -import { isNullOrUndefined } from 'util'; /** * Creating component @@ -130,9 +130,7 @@ export class HistoryOperationsComponent implements OnInit { /** Lifecyle Hooks the trigger before component is instantiate @public */ public ngOnInit(): void { - // tslint:disable-next-line:no-backbone-get-set-outside-model this.paramsID = this.activatedRoute.snapshot.paramMap.get('id'); - // tslint:disable-next-line:no-backbone-get-set-outside-model this.paramsType = this.activatedRoute.snapshot.paramMap.get('type'); if (this.paramsType === 'ns') { this.historyURL = environment.NSHISTORYOPERATIONS_URL + '/?nsInstanceId=' + this.paramsID; @@ -215,6 +213,7 @@ export class HistoryOperationsComponent implements OnInit { } /** show information methods modal with ns history info */ public showInformation(event: MessageEvent): void { + // eslint-disable-next-line security/detect-non-literal-fs-filename this.modalService.open(ShowInfoComponent, { backdrop: 'static' }).componentInstance.params = { id: event.data.id, page: this.page, @@ -256,12 +255,16 @@ export class HistoryOperationsComponent implements OnInit { } this.dataSource.load(this.nsAndnstInstanceData).then((data: {}): void => { //empty block - }).catch(); + }).catch((): void => { + // Catch Navigation Error + }); this.isLoadingResults = false; }, (error: ERRORDATA): void => { this.isLoadingResults = false; if (error.error.status === HttpStatus.NOT_FOUND || error.error.status === HttpStatus.UNAUTHORIZED) { - this.router.navigateByUrl('404', { skipLocationChange: true }).catch(); + this.router.navigateByUrl('404', { skipLocationChange: true }).catch((): void => { + // Catch Navigation Error + }); } else { this.restService.handleError(error, 'get'); } diff --git a/src/app/instances/ns-instances/NSInstancesComponent.ts b/src/app/instances/ns-instances/NSInstancesComponent.ts index c44fa9b..5cc5519 100644 --- a/src/app/instances/ns-instances/NSInstancesComponent.ts +++ b/src/app/instances/ns-instances/NSInstancesComponent.ts @@ -255,7 +255,9 @@ export class NSInstancesComponent implements OnInit { } this.dataSource.load(this.nsInstanceData).then((data: {}): void => { this.isLoadingResults = false; - }).catch(); + }).catch((): void => { + // Catch Navigation Error + }); }, (error: ERRORDATA): void => { this.restService.handleError(error, 'get'); this.isLoadingResults = false; @@ -275,12 +277,15 @@ export class NSInstancesComponent implements OnInit { /** Instantiate NS using modalservice @public */ public instantiateNS(): void { + // eslint-disable-next-line security/detect-non-literal-fs-filename const modalRef: NgbModalRef = this.modalService.open(InstantiateNsComponent, { backdrop: 'static' }); modalRef.result.then((result: MODALCLOSERESPONSEDATA): void => { if (result) { this.generateData(); } - }).catch(); + }).catch((): void => { + // Catch Navigation Error + }); } /** diff --git a/src/app/instances/ns-primitive/NSPrimitiveComponent.ts b/src/app/instances/ns-primitive/NSPrimitiveComponent.ts index bcce057..8f39a20 100644 --- a/src/app/instances/ns-primitive/NSPrimitiveComponent.ts +++ b/src/app/instances/ns-primitive/NSPrimitiveComponent.ts @@ -18,6 +18,7 @@ /** * @file NS Instance Primitive Component */ +import { isNullOrUndefined } from 'util'; import { Component, Injector, Input, OnInit } from '@angular/core'; import { AbstractControl, FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; @@ -30,7 +31,6 @@ import { KDUPRIMITIVELEVEL, NSData, VDUPRIMITIVELEVEL, VNFPROFILE } from 'NSDMod import { NSPrimitiveParams } from 'NSInstanceModel'; import { RestService } from 'RestService'; import { SharedService } from 'SharedService'; -import { isNullOrUndefined } from 'util'; import { CONFIGPRIMITIVE, DF, VDUCONFIG, VDUPROFILE, VNFCONFIG, VNFD } from 'VNFDModel'; import { VNFInstanceDetails } from 'VNFInstanceModel'; @@ -217,19 +217,19 @@ export class NSPrimitiveComponent implements OnInit { primitive_params: this.objectPrimitiveParams }; if (this.primitiveType === 'VNF_Primitive') { - // tslint:disable-next-line: no-string-literal + // eslint-disable-next-line @typescript-eslint/dot-notation primitiveParamsPayLoads['member_vnf_index'] = this.primitiveForm.value.member_vnf_index; } if (this.primitiveType === 'VDU_Primitive') { - // tslint:disable-next-line: no-string-literal + // eslint-disable-next-line @typescript-eslint/dot-notation primitiveParamsPayLoads['member_vnf_index'] = this.primitiveForm.value.member_vnf_index; - // tslint:disable-next-line: no-string-literal + // eslint-disable-next-line @typescript-eslint/dot-notation primitiveParamsPayLoads['vdu_id'] = this.primitiveForm.value.vdu_id; } if (this.primitiveType === 'KDU_Primitive') { - // tslint:disable-next-line: no-string-literal + // eslint-disable-next-line @typescript-eslint/dot-notation primitiveParamsPayLoads['member_vnf_index'] = this.primitiveForm.value.member_vnf_index; - // tslint:disable-next-line: no-string-literal + // eslint-disable-next-line @typescript-eslint/dot-notation primitiveParamsPayLoads['kdu_name'] = this.primitiveForm.value.kdu_name; } const apiURLHeader: APIURLHEADER = { @@ -439,6 +439,7 @@ export class NSPrimitiveComponent implements OnInit { } /** Used to get the AbstractControl of controlName passed @private */ private getFormControl(controlName: string): AbstractControl { + // eslint-disable-next-line security/detect-object-injection return this.primitiveForm.controls[controlName]; } } diff --git a/src/app/instances/ns-topology/NSTopologyComponent.ts b/src/app/instances/ns-topology/NSTopologyComponent.ts index 668f251..8981e26 100644 --- a/src/app/instances/ns-topology/NSTopologyComponent.ts +++ b/src/app/instances/ns-topology/NSTopologyComponent.ts @@ -18,7 +18,7 @@ /** * @file NS Topology Component */ -/* tslint:disable:no-increment-decrement */ +/* eslint-disable */ import { Component, ElementRef, Injector, ViewChild, ViewEncapsulation } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { Router } from '@angular/router'; @@ -87,22 +87,22 @@ export class NSTopologyComponent { /** Holds the NS Id @private */ private nsIdentifier: string; /** Contains SVG attributes @private */ - // tslint:disable-next-line:no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private svg: any; /** Contains forced node animations @private */ - // tslint:disable-next-line:no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private force: any; /** Contains path information of the node */ - // tslint:disable-next-line:no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private path: any; /** Contains node network @private */ - // tslint:disable-next-line:no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private network: any; /** Contains node square @private */ - // tslint:disable-next-line:no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private square: any; /** Contains node circle @private */ - // tslint:disable-next-line:no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private circle: any; /** Contains the NS information @private */ private nsData: NSInstanceDetails; @@ -123,13 +123,13 @@ export class NSTopologyComponent { /** Set timeout @private */ private TIMEOUT: number = 2000; /** Rendered nodes represent vnf @private */ - // tslint:disable-next-line:no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private gSquare: any; /** Rendered nodes represent network @private */ - // tslint:disable-next-line:no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private gNetwork: any; /** Rendered nodes represent network @private */ - // tslint:disable-next-line:no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private gCircle: any; /** Service holds the router information @private */ private router: Router; @@ -146,7 +146,6 @@ export class NSTopologyComponent { * Lifecyle Hooks the trigger before component is instantiate @public */ public ngOnInit(): void { - // tslint:disable-next-line:no-backbone-get-set-outside-model this.nsIdentifier = this.activatedRoute.snapshot.paramMap.get('id'); this.generateData(); } @@ -238,7 +237,9 @@ export class NSTopologyComponent { }, (error: ERRORDATA): void => { this.isLoadingResults = false; if (error.error.status === HttpStatus.NOT_FOUND || error.error.status === HttpStatus.UNAUTHORIZED) { - this.router.navigateByUrl('404', { skipLocationChange: true }).catch(); + this.router.navigateByUrl('404', { skipLocationChange: true }).catch((): void => { + // Catch Navigation Error + }); } else { this.restService.handleError(error, 'get'); } @@ -411,7 +412,7 @@ export class NSTopologyComponent { this.square.exit().remove(); this.network.exit().remove(); this.circle.exit().remove(); - // tslint:disable-next-line:no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any const gPath: any = this.path.enter().append('svg:path').attr('class', 'link'); this.getgSquare(); this.getgNetwork(); @@ -422,12 +423,12 @@ export class NSTopologyComponent { this.circle = this.gCircle.merge(this.circle); } /** Events handles when Shift Click to perform create cp @private */ - // tslint:disable-next-line: no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private singleClick(nodeSelected: any, d: COMPOSERNODES): void { this.selectNodeExclusive(nodeSelected, d); } /** Selected nodes @private */ - // tslint:disable-next-line: no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private selectNodeExclusive(nodeSelected: any, d: COMPOSERNODES): void { const alreadyIsActive: boolean = nodeSelected.select('#' + d.selectorId).classed(this.activeClass); this.deselectAllNodes(); @@ -513,7 +514,7 @@ export class NSTopologyComponent { .text((d: COMPOSERNODES): string => d.name); } /** drag event @private */ - // tslint:disable-next-line: no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private onDragDrop(): any { return d3.drag().filter(this.dragFilter) .on('start', this.dragstarted) diff --git a/src/app/instances/pdu-instances/PDUInstancesComponent.ts b/src/app/instances/pdu-instances/PDUInstancesComponent.ts index 20b44df..5c25279 100644 --- a/src/app/instances/pdu-instances/PDUInstancesComponent.ts +++ b/src/app/instances/pdu-instances/PDUInstancesComponent.ts @@ -159,7 +159,9 @@ export class PDUInstancesComponent implements OnInit, OnDestroy { } this.dataSource.load(this.pduInstanceData).then((data: {}) => { this.isLoadingResults = false; - }).catch(); + }).catch((): void => { + // Catch Navigation Error + }); }, (error: ERRORDATA) => { this.restService.handleError(error, 'get'); this.isLoadingResults = false; @@ -179,13 +181,16 @@ export class PDUInstancesComponent implements OnInit, OnDestroy { /** Add PDU Instance modal using modalservice @public */ public addPDUInstanceModal(): void { + // eslint-disable-next-line security/detect-non-literal-fs-filename const modalRef: NgbModalRef = this.modalService.open(AddPDUInstancesComponent, { backdrop: 'static' }); modalRef.componentInstance.title = this.translateService.instant('PAGE.PDUINSTANCE.NEWPDUINSTANCE'); modalRef.result.then((result: MODALCLOSERESPONSEDATA) => { if (result) { this.generateData(); } - }).catch(); + }).catch((): void => { + // Catch Navigation Error + }); } /** diff --git a/src/app/instances/pdu-instances/add-pdu-instances/AddPDUInstancesComponent.ts b/src/app/instances/pdu-instances/add-pdu-instances/AddPDUInstancesComponent.ts index 644b83d..2efe244 100644 --- a/src/app/instances/pdu-instances/add-pdu-instances/AddPDUInstancesComponent.ts +++ b/src/app/instances/pdu-instances/add-pdu-instances/AddPDUInstancesComponent.ts @@ -145,13 +145,11 @@ export class AddPDUInstancesComponent implements OnInit { /** Handle FormArray Controls @public */ public getControls(): AbstractControl[] { - // tslint:disable-next-line:no-backbone-get-set-outside-model return (this.pduInstancesForm.get('interfaces') as FormArray).controls; } /** Push all primitive params on user's action @public */ public createInterfaces(): void { - // tslint:disable-next-line:no-backbone-get-set-outside-model this.pduInterfaces = this.pduInstancesForm.get('interfaces') as FormArray; this.pduInterfaces.push(this.interfacesBuilder()); } diff --git a/src/app/instances/vnf-instances/VNFInstancesComponent.ts b/src/app/instances/vnf-instances/VNFInstancesComponent.ts index fdfe9fa..90bb6fe 100644 --- a/src/app/instances/vnf-instances/VNFInstancesComponent.ts +++ b/src/app/instances/vnf-instances/VNFInstancesComponent.ts @@ -160,7 +160,9 @@ export class VNFInstancesComponent implements OnInit { } this.dataSource.load(this.vnfInstanceData).then((data: {}) => { this.isLoadingResults = false; - }).catch(); + }).catch((): void => { + // Catch Navigation Error + }); }, (error: ERRORDATA) => { this.restService.handleError(error, 'get'); this.isLoadingResults = false; diff --git a/src/app/instances/vnf-instances/vnf-link/VNFLinkComponent.ts b/src/app/instances/vnf-instances/vnf-link/VNFLinkComponent.ts index 15ea6ff..b582774 100644 --- a/src/app/instances/vnf-instances/vnf-link/VNFLinkComponent.ts +++ b/src/app/instances/vnf-instances/vnf-link/VNFLinkComponent.ts @@ -42,5 +42,4 @@ export class VNFLinkComponent implements OnInit { public ngOnInit(): void { //empty } - } diff --git a/src/app/k8s/K8sComponent.ts b/src/app/k8s/K8sComponent.ts index 5427a8f..07aa901 100644 --- a/src/app/k8s/K8sComponent.ts +++ b/src/app/k8s/K8sComponent.ts @@ -49,8 +49,9 @@ export class K8sComponent { /** Return to list NS Package List */ public redirectToList(getURL: string): void { if (getURL === '/k8s') { - this.router.navigate(['/k8s/cluster']).catch(); + this.router.navigate(['/k8s/cluster']).catch((): void => { + // Catch Navigation Error + }); } } - } diff --git a/src/app/k8s/K8sModule.ts b/src/app/k8s/K8sModule.ts index 51f27b2..14d8165 100644 --- a/src/app/k8s/K8sModule.ts +++ b/src/app/k8s/K8sModule.ts @@ -96,8 +96,7 @@ const routes: Routes = [ K8sAddRepoComponent ], providers: [DataService], - schemas: [CUSTOM_ELEMENTS_SCHEMA], - entryComponents: [K8sActionComponent, K8sAddClusterComponent, K8sAddRepoComponent] + schemas: [CUSTOM_ELEMENTS_SCHEMA] }) /** Exporting a class @exports K8sModule */ export class K8sModule { diff --git a/src/app/k8s/k8s-action/K8sActionComponent.ts b/src/app/k8s/k8s-action/K8sActionComponent.ts index a524277..f68eff6 100644 --- a/src/app/k8s/k8s-action/K8sActionComponent.ts +++ b/src/app/k8s/k8s-action/K8sActionComponent.ts @@ -75,12 +75,15 @@ export class K8sActionComponent{ /** Delete User Account @public */ public deleteK8s(pageType: string): void { + // eslint-disable-next-line security/detect-non-literal-fs-filename const modalRef: NgbModalRef = this.modalService.open(DeleteComponent, { backdrop: 'static' }); modalRef.result.then((result: MODALCLOSERESPONSEDATA) => { if (result) { this.sharedService.callData(); } - }).catch(); + }).catch((): void => { + // Catch Navigation Error + }); } /** Shows information using modalservice @public */ @@ -94,6 +97,7 @@ export class K8sActionComponent{ pageName = 'k8s-cluster'; title = 'PAGE.K8S.K8SCLUSTERDETAILS'; } + // eslint-disable-next-line security/detect-non-literal-fs-filename this.modalService.open(ShowInfoComponent, { backdrop: 'static' }).componentInstance.params = { id: this.instanceID, page: pageName, diff --git a/src/app/k8s/k8s-add-cluster/K8sAddClusterComponent.ts b/src/app/k8s/k8s-add-cluster/K8sAddClusterComponent.ts index aa33193..bad533f 100644 --- a/src/app/k8s/k8s-add-cluster/K8sAddClusterComponent.ts +++ b/src/app/k8s/k8s-add-cluster/K8sAddClusterComponent.ts @@ -18,6 +18,7 @@ /** * @file K8sAddClusterComponent.ts. */ +import { isNullOrUndefined } from 'util'; import { HttpHeaders } from '@angular/common/http'; import { Component, ElementRef, Injector, OnInit, ViewChild } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; @@ -29,7 +30,6 @@ import { environment } from 'environment'; import * as jsyaml from 'js-yaml'; import { RestService } from 'RestService'; import { SharedService } from 'SharedService'; -import { isNullOrUndefined } from 'util'; import { VimAccountDetails } from 'VimAccountModel'; /** * Creating Component @@ -209,6 +209,7 @@ export class K8sAddClusterComponent implements OnInit { // Transform Map to json object const jsonDMObject: {} = {}; this.deploymentMethodsSubmit.forEach((value: boolean, key: string): void => { + // eslint-disable-next-line security/detect-object-injection jsonDMObject[key] = value; }); @@ -232,7 +233,6 @@ export class K8sAddClusterComponent implements OnInit { if (files && files.length === 1) { this.sharedService.getFileString(files, 'json').then((fileContent: string): void => { const getNetsJson: string = jsyaml.load(fileContent, { json: true }); - // tslint:disable-next-line: no-backbone-get-set-outside-model this.k8sclusterForm.get('nets').setValue(JSON.stringify(getNetsJson)); }).catch((err: string): void => { if (err === 'typeError') { @@ -255,7 +255,6 @@ export class K8sAddClusterComponent implements OnInit { if (files && files.length === 1) { this.sharedService.getFileString(files, 'yaml').then((fileContent: string): void => { const getCredentialsJson: string = jsyaml.load(fileContent, { json: true }); - // tslint:disable-next-line: no-backbone-get-set-outside-model this.k8sclusterForm.get('credentials').setValue(JSON.stringify(getCredentialsJson)); }).catch((err: string): void => { if (err === 'typeError') { @@ -272,5 +271,4 @@ export class K8sAddClusterComponent implements OnInit { this.fileInputCredentialsLabel.nativeElement.innerText = files[0].name; this.fileInputCredentials.nativeElement.value = null; } - } diff --git a/src/app/k8s/k8s-add-repo/K8sAddRepoComponent.ts b/src/app/k8s/k8s-add-repo/K8sAddRepoComponent.ts index c8b96bb..700a0c3 100644 --- a/src/app/k8s/k8s-add-repo/K8sAddRepoComponent.ts +++ b/src/app/k8s/k8s-add-repo/K8sAddRepoComponent.ts @@ -130,5 +130,4 @@ export class K8sAddRepoComponent implements OnInit { this.restService.handleError(error, 'post'); }); } - } diff --git a/src/app/k8s/k8scluster/K8sClusterComponent.ts b/src/app/k8s/k8scluster/K8sClusterComponent.ts index 7ab7583..88a4fb6 100644 --- a/src/app/k8s/k8scluster/K8sClusterComponent.ts +++ b/src/app/k8s/k8scluster/K8sClusterComponent.ts @@ -180,12 +180,15 @@ export class K8sClusterComponent implements OnInit, OnDestroy { /** Compose new K8s Cluster Accounts @public */ public addK8sCluster(): void { + // eslint-disable-next-line security/detect-non-literal-fs-filename const modalRef: NgbModalRef = this.modalService.open(K8sAddClusterComponent, { backdrop: 'static' }); modalRef.result.then((result: MODALCLOSERESPONSEDATA) => { if (result) { this.sharedService.callData(); } - }).catch(); + }).catch((): void => { + // Catch Navigation Error + }); } /** @@ -232,5 +235,4 @@ export class K8sClusterComponent implements OnInit, OnDestroy { this.isLoadingResults = false; }); } - } diff --git a/src/app/k8s/k8srepository/K8sRepositoryComponent.ts b/src/app/k8s/k8srepository/K8sRepositoryComponent.ts index 1b6c9f7..a9626d2 100644 --- a/src/app/k8s/k8srepository/K8sRepositoryComponent.ts +++ b/src/app/k8s/k8srepository/K8sRepositoryComponent.ts @@ -141,12 +141,15 @@ export class K8sRepositoryComponent implements OnInit, OnDestroy { /** Compose new K8s Repo Accounts @public */ public addK8sRepo(): void { + // eslint-disable-next-line security/detect-non-literal-fs-filename const modalRef: NgbModalRef = this.modalService.open(K8sAddRepoComponent, { backdrop: 'static' }); modalRef.result.then((result: MODALCLOSERESPONSEDATA) => { if (result) { this.sharedService.callData(); } - }).catch(); + }).catch((): void => { + // Catch Navigation Error + }); } /** @@ -157,7 +160,6 @@ export class K8sRepositoryComponent implements OnInit, OnDestroy { } /** Generate nsData object from loop and return for the datasource @public */ - // tslint:disable-next-line: typedef public generateK8sRepoData(k8sRepodata: K8SREPODATA): K8SREPODATADISPLAY { return { name: k8sRepodata.name, @@ -194,5 +196,4 @@ export class K8sRepositoryComponent implements OnInit, OnDestroy { this.isLoadingResults = false; }); } - } diff --git a/src/app/layouts/breadcrumb/BreadcrumbComponent.ts b/src/app/layouts/breadcrumb/BreadcrumbComponent.ts index e273cda..2b7ca54 100644 --- a/src/app/layouts/breadcrumb/BreadcrumbComponent.ts +++ b/src/app/layouts/breadcrumb/BreadcrumbComponent.ts @@ -18,13 +18,13 @@ /** * @file Bread Crumb component. */ +import { isNullOrUndefined } from 'util'; import { Component, Injector, OnInit } from '@angular/core'; import { Title } from '@angular/platform-browser'; import { ActivatedRoute, NavigationEnd, Router, RouterEvent, UrlSegment } from '@angular/router'; import { TranslateService } from '@ngx-translate/core'; import { BREADCRUMBITEM } from 'CommonModel'; import { filter, startWith } from 'rxjs/operators'; -import { isNullOrUndefined } from 'util'; /** * Creating component @@ -72,6 +72,7 @@ export class BreadcrumbComponent implements OnInit { /** Lifecyle Hooks the trigger before component is instantiate @public */ public ngOnInit(): void { this.router.events + // eslint-disable-next-line deprecation/deprecation .pipe(filter((event: RouterEvent) => event instanceof NavigationEnd), startWith(undefined)) .subscribe(() => this.menuItems = this.createBreadcrumbs(this.activatedRoute.root)); } @@ -153,5 +154,4 @@ export class BreadcrumbComponent implements OnInit { return this.translateService.instant('PAGE.DASHBOARD.NETSLICEINSTANCE'); } } - } diff --git a/src/app/layouts/header/HeaderComponent.ts b/src/app/layouts/header/HeaderComponent.ts index b496ff1..9b4fca6 100644 --- a/src/app/layouts/header/HeaderComponent.ts +++ b/src/app/layouts/header/HeaderComponent.ts @@ -120,6 +120,7 @@ export class HeaderComponent implements OnInit { /** Implementation of model for UserSettings options.@public */ public userSettings(): void { + // eslint-disable-next-line security/detect-non-literal-fs-filename this.modalService.open(UserSettingsComponent, { backdrop: 'static' }); } } diff --git a/src/app/layouts/sidebar/SidebarComponent.ts b/src/app/layouts/sidebar/SidebarComponent.ts index 9cae634..c328778 100644 --- a/src/app/layouts/sidebar/SidebarComponent.ts +++ b/src/app/layouts/sidebar/SidebarComponent.ts @@ -19,10 +19,10 @@ /** * @file Sidebar Component */ +import { isNullOrUndefined } from 'util'; import { Component, Injector, OnInit } from '@angular/core'; import { DeviceCheckService } from 'DeviceCheckService'; import { MENU_ITEMS, MENUITEMS } from 'src/models/MenuModel'; -import { isNullOrUndefined } from 'util'; /** * Creating component @@ -133,6 +133,7 @@ export class SidebarComponent implements OnInit { } /** Hide / Show Menus based on the clicking in the menus @public */ public checkAndCloseSideBar(childExists: boolean): void { + // eslint-disable-next-line deprecation/deprecation event.stopPropagation(); if (this.isMobile$ && !childExists) { this.sideBarOpenClose(); diff --git a/src/app/login/LoginComponent.ts b/src/app/login/LoginComponent.ts index 8c6f5a3..fae3d20 100644 --- a/src/app/login/LoginComponent.ts +++ b/src/app/login/LoginComponent.ts @@ -19,6 +19,7 @@ /** * @file Page for Login component */ +import { isNullOrUndefined } from 'util'; import { HttpErrorResponse } from '@angular/common/http'; import { Component, Injector, OnInit } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; @@ -27,7 +28,6 @@ import { AuthenticationService } from 'AuthenticationService'; import { RestService } from 'RestService'; import { Observable } from 'rxjs'; import { SharedService } from 'SharedService'; -import { isNullOrUndefined } from 'util'; /** * Creating component diff --git a/src/app/operational-view/OperationalViewComponent.ts b/src/app/operational-view/OperationalViewComponent.ts index ae2a13c..edb972a 100644 --- a/src/app/operational-view/OperationalViewComponent.ts +++ b/src/app/operational-view/OperationalViewComponent.ts @@ -1,3 +1,4 @@ +/* eslint-disable security/detect-object-injection */ /* Copyright 2020 TATA ELXSI @@ -19,6 +20,7 @@ /** * @file Page for Operational View Component */ +import { isNullOrUndefined } from 'util'; import { Component, Injector, OnInit } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; @@ -35,7 +37,6 @@ import { Observable } from 'rxjs'; import { Subscription } from 'rxjs'; import { map } from 'rxjs/operators'; import { SharedService } from 'SharedService'; -import { isNullOrUndefined } from 'util'; /** * Creating component * @Component takes OperationalViewComponent.html as template url @@ -77,19 +78,22 @@ export class OperationalViewComponent implements OnInit { public timeOutDefaultSeconds: number = CONSTANTNUMBER.timeOutDefaultSeconds; /** variables contains minimum seconds for the timeout @public */ + // eslint-disable-next-line @typescript-eslint/no-magic-numbers public minSeconds: number = 5; /** variables contains maximum seconds for the timeout @public */ + // eslint-disable-next-line @typescript-eslint/no-magic-numbers public maxSeconds: number = 60; /** variables contains timer calculation value of milliseconds @public */ + // eslint-disable-next-line @typescript-eslint/no-magic-numbers public timeDefaultCal: number = 1000; /** variables contains timeout @public */ public timeOut: number; /** Set the timer button @public */ - // tslint:disable-next-line: no-magic-numbers + // eslint-disable-next-line no-magic-numbers public setSeconds: SETTIMER[] = SET_TIMER; /** Instance of subscriptions @private */ @@ -118,7 +122,6 @@ export class OperationalViewComponent implements OnInit { * Lifecyle Hooks the trigger before component is instantiate */ public ngOnInit(): void { - // tslint:disable-next-line:no-backbone-get-set-outside-model this.instancesID = this.activatedRoute.snapshot.paramMap.get('id'); this.generateData(); this.generateDataSub = this.sharedService.dataEvent.subscribe((): void => { this.generateData(); }); @@ -186,9 +189,7 @@ export class OperationalViewComponent implements OnInit { if (liveData) { NSURL = NSURL + '?vcaStatusRefresh=true'; } - return this.restService.getResource(NSURL).pipe(map((operationalList: VCASTATUS): VCADETAILS => { - return this.vcaDetailsData(operationalList, liveData, timeOutSeconds); - })); + return this.restService.getResource(NSURL).pipe(map((operationalList: VCASTATUS): VCADETAILS => this.vcaDetailsData(operationalList, liveData, timeOutSeconds))); } /** * Form the VCA Details for each NS Instances @@ -235,7 +236,9 @@ export class OperationalViewComponent implements OnInit { list.vcaStatus[key].units = vcaUnits; list.vcaStatus[key].applications = vcaApplication; list.vcaStatus[key].machines = vcaMachines; + // eslint-disable-next-line no-self-assign list.vcaStatus[key].relations = list.vcaStatus[key].relations; + // eslint-disable-next-line no-self-assign list.vcaStatus[key].model = list.vcaStatus[key].model; const getEachModelData: SETMODELS = this.assignVCAStatusOfEachModel(list.vcaStatus[key]); setModels.push(getEachModelData); @@ -258,7 +261,9 @@ export class OperationalViewComponent implements OnInit { Object.keys(applicationData).forEach((applicationKey: string): void => { const charmSplitlist: string[] = applicationData[applicationKey].charm.split('/'); const status: string = applicationData[applicationKey].status.status; + // eslint-disable-next-line deprecation/deprecation const charm: string = charmSplitlist[1].substr(0, charmSplitlist[1].lastIndexOf('-')); + // eslint-disable-next-line deprecation/deprecation const store: string = charmSplitlist[0].substr(0, charmSplitlist[0].lastIndexOf(':')); applicationData[applicationKey].app_id = applicationKey; applicationData[applicationKey].charm = charm; @@ -298,16 +303,19 @@ export class OperationalViewComponent implements OnInit { } /** Show the Config list in modal using modalservice @public */ public showExecutedActionsList(executeActionsList: EXECUTEDACTIONS[]): void { + // eslint-disable-next-line security/detect-non-literal-fs-filename this.modalService.open(OperationalViewAppExecutedActionsComponent, { size: 'xl', backdrop: 'static' }) .componentInstance.params = { executedActions: executeActionsList }; } /** Show the Config list in modal using modalservice @public */ public showConfigList(configList: object): void { + // eslint-disable-next-line security/detect-non-literal-fs-filename this.modalService.open(OperationalViewAppConfigsComponent, { size: 'xl', backdrop: 'static' }) .componentInstance.params = { configs: configList }; } /** Show the Config list in modal using modalservice @public */ public showActionsList(actionsList: object): void { + // eslint-disable-next-line security/detect-non-literal-fs-filename this.modalService.open(OperationalViewAppActionsComponent, { size: 'xl', backdrop: 'static' }) .componentInstance.params = { actions: actionsList }; } diff --git a/src/app/operational-view/operational-view-app-actions/OperationalViewAppActionsComponent.ts b/src/app/operational-view/operational-view-app-actions/OperationalViewAppActionsComponent.ts index 5a4f48e..acee5ed 100644 --- a/src/app/operational-view/operational-view-app-actions/OperationalViewAppActionsComponent.ts +++ b/src/app/operational-view/operational-view-app-actions/OperationalViewAppActionsComponent.ts @@ -19,10 +19,10 @@ /** * @file Page for Operational View App actions Component */ +import { isNullOrUndefined } from 'util'; import { Component, Injector, Input, OnInit } from '@angular/core'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { URLPARAMS } from 'CommonModel'; -import { isNullOrUndefined } from 'util'; /** * Creating component * @Component takes OperationalViewAppActionsComponent.html as template url @@ -60,6 +60,7 @@ export class OperationalViewAppActionsComponent implements OnInit { this.actionsData = Object.keys(this.params.actions).map((key: string): Object => ( { actions: key, + // eslint-disable-next-line security/detect-object-injection description: this.params.actions[key] })); } diff --git a/src/app/operational-view/operational-view-app-configs/OperationalViewAppConfigsComponent.ts b/src/app/operational-view/operational-view-app-configs/OperationalViewAppConfigsComponent.ts index 1e1b453..4d40d2c 100644 --- a/src/app/operational-view/operational-view-app-configs/OperationalViewAppConfigsComponent.ts +++ b/src/app/operational-view/operational-view-app-configs/OperationalViewAppConfigsComponent.ts @@ -19,10 +19,10 @@ /** * @file Page for Operational View App configs Component */ +import { isNullOrUndefined } from 'util'; import { Component, Injector, Input, OnInit } from '@angular/core'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { URLPARAMS } from 'CommonModel'; -import { isNullOrUndefined } from 'util'; /** * Creating component * @Component takes OperationalViewAppConfigsComponent.html as template url @@ -60,10 +60,15 @@ export class OperationalViewAppConfigsComponent implements OnInit { this.configData = Object.keys(this.params.configs).map((key: string): Object => ( { name: key, + // eslint-disable-next-line security/detect-object-injection default: this.params.configs[key].default, + // eslint-disable-next-line security/detect-object-injection description: this.params.configs[key].description, + // eslint-disable-next-line security/detect-object-injection source: this.params.configs[key].source, + // eslint-disable-next-line security/detect-object-injection type: this.params.configs[key].type, + // eslint-disable-next-line security/detect-object-injection value: this.params.configs[key].value })); } diff --git a/src/app/operational-view/operational-view-app-executed-actions/OperationalViewAppExecutedActionsComponent.ts b/src/app/operational-view/operational-view-app-executed-actions/OperationalViewAppExecutedActionsComponent.ts index af39f79..d761653 100644 --- a/src/app/operational-view/operational-view-app-executed-actions/OperationalViewAppExecutedActionsComponent.ts +++ b/src/app/operational-view/operational-view-app-executed-actions/OperationalViewAppExecutedActionsComponent.ts @@ -19,11 +19,11 @@ /** * @file Page for Operational View App Executed actions Component */ +import { isNullOrUndefined } from 'util'; import { Component, Injector, Input, OnInit } from '@angular/core'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { URLPARAMS } from 'CommonModel'; import { EXECUTEDACTIONS } from 'OperationalModel'; -import { isNullOrUndefined } from 'util'; /** * Creating component * @Component takes OperationalViewAppExecutedActionsComponent.html as template url diff --git a/src/app/osm-repositories/OsmRepositoriesComponent.ts b/src/app/osm-repositories/OsmRepositoriesComponent.ts index 5f42eee..4c85f8c 100644 --- a/src/app/osm-repositories/OsmRepositoriesComponent.ts +++ b/src/app/osm-repositories/OsmRepositoriesComponent.ts @@ -49,7 +49,9 @@ export class OsmRepositoriesComponent{ /** Return to osm Repo Details list */ public redirectToList(getURL: string): void { if (getURL === '/repos') { - this.router.navigate(['/repos/details']).catch(); + this.router.navigate(['/repos/details']).catch((): void => { + // Catch Navigation Error + }); } } } diff --git a/src/app/osm-repositories/OsmRepositoriesModule.ts b/src/app/osm-repositories/OsmRepositoriesModule.ts index 20901e4..a630f5d 100644 --- a/src/app/osm-repositories/OsmRepositoriesModule.ts +++ b/src/app/osm-repositories/OsmRepositoriesModule.ts @@ -62,16 +62,12 @@ const routes: Routes = [ /** * Creating @NgModule component for Modules */ -// tslint:disable-next-line: no-stateless-class @NgModule({ imports: [FormsModule, ReactiveFormsModule, CommonModule, HttpClientModule, TranslateModule, RouterModule.forChild(routes), NgbModule, PagePerRowModule, Ng2SmartTableModule, LoaderModule, PageReloadModule, NgSelectModule], declarations: [OsmRepositoriesComponent, OsmRepositoriesDetailsComponent, OsmRepositoriesActionComponent, OsmRepoCreateUpdateComponent], providers: [ DataService - ], - entryComponents: [ - OsmRepoCreateUpdateComponent ] }) /** Exporting a class @exports OsmRepositoriesModule */ diff --git a/src/app/osm-repositories/osm-repositories-details/OsmRepositoriesDetailsComponent.ts b/src/app/osm-repositories/osm-repositories-details/OsmRepositoriesDetailsComponent.ts index 3415484..f249470 100644 --- a/src/app/osm-repositories/osm-repositories-details/OsmRepositoriesDetailsComponent.ts +++ b/src/app/osm-repositories/osm-repositories-details/OsmRepositoriesDetailsComponent.ts @@ -167,13 +167,16 @@ export class OsmRepositoriesDetailsComponent implements OnInit { /** Create a osm repo @public */ public addOsmrepo(): void { + // eslint-disable-next-line security/detect-non-literal-fs-filename const modalRef: NgbModalRef = this.modalService.open(OsmRepoCreateUpdateComponent, { backdrop: 'static' }); modalRef.componentInstance.createupdateType = 'Add'; modalRef.result.then((result: MODALCLOSERESPONSEDATA) => { if (result) { this.generateData(); } - }).catch(); + }).catch((): void => { + // Catch Navigation Error + }); } /** @@ -194,7 +197,9 @@ export class OsmRepositoriesDetailsComponent implements OnInit { }); this.dataSource.load(this.osmRepoData).then((data: boolean) => { this.isLoadingResults = false; - }).catch(); + }).catch((): void => { + // Catch Navigation Error + }); }, (error: ERRORDATA) => { this.restService.handleError(error, 'get'); this.isLoadingResults = false; diff --git a/src/app/packages/PackagesComponent.ts b/src/app/packages/PackagesComponent.ts index eb9991d..6dcf10e 100644 --- a/src/app/packages/PackagesComponent.ts +++ b/src/app/packages/PackagesComponent.ts @@ -49,7 +49,9 @@ export class PackagesComponent{ /** Return to list NS Package List */ public redirectToList(getURL: string): void { if (getURL === '/packages') { - this.router.navigate(['/packages/ns']).catch(); + this.router.navigate(['/packages/ns']).catch((): void => { + // Catch Navigation Error + }); } } } diff --git a/src/app/packages/PackagesModule.ts b/src/app/packages/PackagesModule.ts index e6c6628..5a8ea2e 100644 --- a/src/app/packages/PackagesModule.ts +++ b/src/app/packages/PackagesModule.ts @@ -117,8 +117,7 @@ const routes: Routes = [ declarations: [PackagesComponent, NSPackagesComponent, VNFPackagesComponent, NetsliceTemplateComponent, DragDirective, ShowContentComponent, NSComposerComponent, VNFComposerComponent, EditPackagesComponent, ClonePackageComponent], providers: [DataService], - schemas: [CUSTOM_ELEMENTS_SCHEMA], - entryComponents: [ShowContentComponent, ClonePackageComponent] + schemas: [CUSTOM_ELEMENTS_SCHEMA] }) /** Exporting a class @exports PackagesModule */ export class PackagesModule { diff --git a/src/app/packages/instantiate-net-slice-template/InstantiateNetSliceTemplateComponent.ts b/src/app/packages/instantiate-net-slice-template/InstantiateNetSliceTemplateComponent.ts index 330edf8..fb0abda 100644 --- a/src/app/packages/instantiate-net-slice-template/InstantiateNetSliceTemplateComponent.ts +++ b/src/app/packages/instantiate-net-slice-template/InstantiateNetSliceTemplateComponent.ts @@ -18,6 +18,7 @@ /** * @file Instantiate NS Modal Component. */ +import { isNullOrUndefined } from 'util'; import { HttpHeaders } from '@angular/common/http'; import { Component, ElementRef, Injector, OnInit, ViewChild } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; @@ -33,7 +34,6 @@ import { NetworkSliceData } from 'NetworkSliceModel'; import { NSICREATEPARAMS } from 'NSDModel'; import { RestService } from 'RestService'; import { SharedService } from 'SharedService'; -import { isNullOrUndefined } from 'util'; import { VimAccountDetails } from 'VimAccountModel'; /** * Creating component @@ -193,7 +193,6 @@ export class InstantiateNetSliceTemplateComponent implements OnInit { delete this.netSliceInstantiateForm.value.ssh_keys; } else { this.copySSHKey = JSON.parse(JSON.stringify(this.netSliceInstantiateForm.value.ssh_keys)); - // tslint:disable-next-line: no-backbone-get-set-outside-model this.netSliceInstantiateForm.get('ssh_keys').setValue(this.copySSHKey); } if (isNullOrUndefined(this.netSliceInstantiateForm.value.config) || this.netSliceInstantiateForm.value.config === '') { @@ -203,12 +202,14 @@ export class InstantiateNetSliceTemplateComponent implements OnInit { if (validJSON) { this.netSliceInstantiateForm.value.config = JSON.parse(this.netSliceInstantiateForm.value.config); Object.keys(this.netSliceInstantiateForm.value.config).forEach((item: string) => { + // eslint-disable-next-line security/detect-object-injection this.netSliceInstantiateForm.value[item] = this.netSliceInstantiateForm.value.config[item]; }); delete this.netSliceInstantiateForm.value.config; } else { const getConfigJson: string = jsyaml.load(this.netSliceInstantiateForm.value.config, { json: true }); Object.keys(getConfigJson).forEach((item: string) => { + // eslint-disable-next-line security/detect-object-injection this.netSliceInstantiateForm.value[item] = getConfigJson[item]; }); delete this.netSliceInstantiateForm.value.config; @@ -225,11 +226,12 @@ export class InstantiateNetSliceTemplateComponent implements OnInit { this.isLoadingResults = false; this.notifierService.notify('success', this.netSliceInstantiateForm.value.nsiName + this.translateService.instant('PAGE.NETSLICE.CREATEDSUCCESSFULLY')); - this.router.navigate(['/instances/netslice']).catch(); + this.router.navigate(['/instances/netslice']).catch((): void => { + // Catch Navigation Error + }); }, (error: ERRORDATA) => { this.restService.handleError(error, 'post'); if (!isNullOrUndefined(this.copySSHKey)) { - // tslint:disable-next-line: no-backbone-get-set-outside-model this.netSliceInstantiateForm.get('ssh_keys').setValue(this.copySSHKey); } this.isLoadingResults = false; @@ -241,7 +243,6 @@ export class InstantiateNetSliceTemplateComponent implements OnInit { if (files && files.length === 1) { this.sharedService.getFileString(files, 'pub').then((fileContent: string): void => { const getSSHJson: string = jsyaml.load(fileContent, { json: true }); - // tslint:disable-next-line: no-backbone-get-set-outside-model this.netSliceInstantiateForm.get('ssh_keys').setValue(getSSHJson); }).catch((err: string): void => { if (err === 'typeError') { @@ -266,7 +267,6 @@ export class InstantiateNetSliceTemplateComponent implements OnInit { if (fileFormat === 'yaml' || fileFormat === 'yml') { this.sharedService.getFileString(files, 'yaml').then((fileContent: string): void => { const getConfigJson: string = jsyaml.load(fileContent, { json: true }); - // tslint:disable-next-line: no-backbone-get-set-outside-model this.netSliceInstantiateForm.get('config').setValue(JSON.stringify(getConfigJson)); }).catch((err: string): void => { if (err === 'typeError') { @@ -280,7 +280,6 @@ export class InstantiateNetSliceTemplateComponent implements OnInit { } else if (fileFormat === 'json') { this.sharedService.getFileString(files, 'json').then((fileContent: string): void => { const getConfigJson: string = jsyaml.load(fileContent, { json: true }); - // tslint:disable-next-line: no-backbone-get-set-outside-model this.netSliceInstantiateForm.get('config').setValue(JSON.stringify(getConfigJson)); }).catch((err: string): void => { if (err === 'typeError') { diff --git a/src/app/packages/instantiate-ns/InstantiateNsComponent.ts b/src/app/packages/instantiate-ns/InstantiateNsComponent.ts index 1043f9a..e0798d1 100644 --- a/src/app/packages/instantiate-ns/InstantiateNsComponent.ts +++ b/src/app/packages/instantiate-ns/InstantiateNsComponent.ts @@ -18,6 +18,7 @@ /** * @file Instantiate NS Modal Component. */ +import { isNullOrUndefined } from 'util'; import { Component, ElementRef, Injector, OnInit, ViewChild } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { Router } from '@angular/router'; @@ -31,7 +32,6 @@ import * as jsyaml from 'js-yaml'; import { NSCREATEPARAMS, NSData, NSDDetails } from 'NSDModel'; import { RestService } from 'RestService'; import { SharedService } from 'SharedService'; -import { isNullOrUndefined } from 'util'; import { VimAccountDetails } from 'VimAccountModel'; /** @@ -186,7 +186,6 @@ export class InstantiateNsComponent implements OnInit { delete this.instantiateForm.value.ssh_keys; } else { this.copySSHKey = JSON.parse(JSON.stringify(this.instantiateForm.value.ssh_keys)); - // tslint:disable-next-line: no-backbone-get-set-outside-model this.instantiateForm.get('ssh_keys').setValue([this.copySSHKey]); } if (isNullOrUndefined(this.instantiateForm.value.config) || this.instantiateForm.value.config === '') { @@ -196,12 +195,14 @@ export class InstantiateNsComponent implements OnInit { if (validJSON) { this.instantiateForm.value.config = JSON.parse(this.instantiateForm.value.config); Object.keys(this.instantiateForm.value.config).forEach((item: string) => { + // eslint-disable-next-line security/detect-object-injection this.instantiateForm.value[item] = this.instantiateForm.value.config[item]; }); delete this.instantiateForm.value.config; } else { const getConfigJson: string = jsyaml.load(this.instantiateForm.value.config, { json: true }); Object.keys(getConfigJson).forEach((item: string) => { + // eslint-disable-next-line security/detect-object-injection this.instantiateForm.value[item] = getConfigJson[item]; }); delete this.instantiateForm.value.config; @@ -215,12 +216,13 @@ export class InstantiateNsComponent implements OnInit { this.activeModal.close(modalData); this.notifierService.notify('success', this.instantiateForm.value.nsName + this.translateService.instant('PAGE.NSINSTANCE.CREATEDSUCCESSFULLY')); - this.router.navigate(['/instances/ns']).catch(); + this.router.navigate(['/instances/ns']).catch((): void => { + // Catch Navigation Error + }); }, (error: ERRORDATA) => { this.isLoadingResults = false; this.restService.handleError(error, 'post'); if (!isNullOrUndefined(this.copySSHKey)) { - // tslint:disable-next-line: no-backbone-get-set-outside-model this.instantiateForm.get('ssh_keys').setValue(this.copySSHKey); } }); @@ -231,7 +233,6 @@ export class InstantiateNsComponent implements OnInit { if (files && files.length === 1) { this.sharedService.getFileString(files, 'pub').then((fileContent: string): void => { const getSSHJson: string = jsyaml.load(fileContent, { json: true }); - // tslint:disable-next-line: no-backbone-get-set-outside-model this.instantiateForm.get('ssh_keys').setValue(getSSHJson); }).catch((err: string): void => { if (err === 'typeError') { @@ -255,7 +256,6 @@ export class InstantiateNsComponent implements OnInit { const fileFormat: string = this.sharedService.fetchFileExtension(files).toLocaleLowerCase(); if (fileFormat === 'yaml' || fileFormat === 'yml') { this.sharedService.getFileString(files, 'yaml').then((fileContent: string): void => { - // tslint:disable-next-line: no-backbone-get-set-outside-model this.instantiateForm.get('config').setValue(fileContent); }).catch((err: string): void => { if (err === 'typeError') { @@ -269,7 +269,6 @@ export class InstantiateNsComponent implements OnInit { } else if (fileFormat === 'json') { this.sharedService.getFileString(files, 'json').then((fileContent: string): void => { const getConfigJson: string = jsyaml.load(fileContent, { json: true }); - // tslint:disable-next-line: no-backbone-get-set-outside-model this.instantiateForm.get('config').setValue(JSON.stringify(getConfigJson)); }).catch((err: string): void => { if (err === 'typeError') { diff --git a/src/app/packages/ns-packages/NSPackagesComponent.ts b/src/app/packages/ns-packages/NSPackagesComponent.ts index 7302ea4..8960497 100644 --- a/src/app/packages/ns-packages/NSPackagesComponent.ts +++ b/src/app/packages/ns-packages/NSPackagesComponent.ts @@ -246,6 +246,7 @@ export class NSPackagesComponent implements OnInit { } /** Handle compose new ns package method @public */ public composeNSPackage(): void { + // eslint-disable-next-line security/detect-non-literal-fs-filename this.modalService.open(ComposePackages, { backdrop: 'static' }).componentInstance.params = { page: 'ns-package' }; } diff --git a/src/app/packages/ns-packages/ns-composer/NSComposerComponent.ts b/src/app/packages/ns-packages/ns-composer/NSComposerComponent.ts index d771123..8d28f3a 100644 --- a/src/app/packages/ns-packages/ns-composer/NSComposerComponent.ts +++ b/src/app/packages/ns-packages/ns-composer/NSComposerComponent.ts @@ -18,6 +18,7 @@ /** * @file NS Compose Component */ +import { isNullOrUndefined } from 'util'; import { HttpHeaders } from '@angular/common/http'; import { Component, ElementRef, Injector, ViewChild, ViewEncapsulation } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; @@ -43,7 +44,6 @@ import { } from 'NSDModel'; import { RestService } from 'RestService'; import { SharedService } from 'SharedService'; -import { isNullOrUndefined } from 'util'; import { VNFD, VNFData } from 'VNFDModel'; /** @@ -124,31 +124,31 @@ export class NSComposerComponent { /** Contains sidebar open status @public */ public sideBarOpened: boolean = false; /** Contains SVG attributes @private */ - // tslint:disable-next-line:no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private svg: any; /** Contains the Drag line */ - // tslint:disable-next-line: no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private dragLine: any; /** Contains VL node @private */ - // tslint:disable-next-line:no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private vlNode: any; /** Contains VNFD node @private */ - // tslint:disable-next-line:no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private vnfdnode: any; /** Contains CP node @private */ - // tslint:disable-next-line:no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private cpnode: any; /** Rendered nodes represent VL @private */ - // tslint:disable-next-line:no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private gvlNode: any; /** Rendered nodes represent VL @private */ - // tslint:disable-next-line:no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private gvnfdNode: any; /** Rendered nodes represent VL @private */ - // tslint:disable-next-line:no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private gcpNode: any; /** Contains forced node animations @private */ - // tslint:disable-next-line:no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private force: any; /** Contains all the selected node @private */ private selectedNode: COMPOSERNODES[] = []; @@ -161,7 +161,7 @@ export class NSComposerComponent { /** Contains the VNFD copy @private */ private vnfdCopy: string; /** Contains path information of the node */ - // tslint:disable-next-line:no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private path: any; /** Contains the node information @private */ private nodes: COMPOSERNODES[] = []; @@ -209,7 +209,6 @@ export class NSComposerComponent { } /** Lifecyle Hooks the trigger before component is instantiated @public */ public ngOnInit(): void { - // tslint:disable-next-line:no-backbone-get-set-outside-model this.identifier = this.activatedRoute.snapshot.paramMap.get('id'); this.generateData(); this.headers = new HttpHeaders({ @@ -219,7 +218,7 @@ export class NSComposerComponent { }); } /** Events handles at drag on D3 region @public */ - // tslint:disable-next-line:no-any + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any public drag(ev: any): void { if (ev.target.id === 'vl') { ev.dataTransfer.setData('text', ev.target.id); @@ -385,6 +384,7 @@ export class NSComposerComponent { } /** Show Info @public */ public showInfo(): void { + // eslint-disable-next-line security/detect-non-literal-fs-filename const modalRef: NgbModalRef = this.modalService.open(ConfirmationTopologyComponent, { backdrop: 'static' }); modalRef.componentInstance.topologyType = 'Info'; modalRef.componentInstance.topologytitle = this.translateService.instant('PAGE.TOPOLOGY.INFO'); @@ -392,7 +392,9 @@ export class NSComposerComponent { if (result) { // empty } - }).catch(); + }).catch((): void => { + // Catch Navigation Error + }); } /** Event to freeze the animation @public */ public onFreeze(): void { @@ -459,7 +461,9 @@ export class NSComposerComponent { this.separateAndCreatenode(); }, (error: ERRORDATA): void => { if (error.error.status === HttpStatus.NOT_FOUND || error.error.status === HttpStatus.UNAUTHORIZED) { - this.router.navigateByUrl('404', { skipLocationChange: true }).catch(); + this.router.navigateByUrl('404', { skipLocationChange: true }).catch((): void => { + // Catch Navigation Error + }); } else { this.restService.handleError(error, 'get'); } @@ -535,16 +539,20 @@ export class NSComposerComponent { resultVLC['constituent-cpd-id'].forEach((resultCCI: CCI): void => { this.vnfdCopy = resultVLC['virtual-link-profile-id']; this.connectionPoint = resVNF.id + ':' + resultCCI['constituent-base-element-id'] + index + ':' + resultCCI['constituent-cpd-id']; - const connectionPointPos: number = this.nodes.map((e: COMPOSERNODES): string => { return e.id; }).indexOf(this.connectionPoint); - const nsdPos: number = this.nodes.map((e: COMPOSERNODES): string => { return e.id; }).indexOf(this.nsdCopy); - const vnfdPos: number = this.nodes.map((e: COMPOSERNODES): string => { return e.id; }).indexOf(this.vnfdCopy); + const connectionPointPos: number = this.nodes.map((e: COMPOSERNODES): string => e.id).indexOf(this.connectionPoint); + const nsdPos: number = this.nodes.map((e: COMPOSERNODES): string => e.id).indexOf(this.nsdCopy); + const vnfdPos: number = this.nodes.map((e: COMPOSERNODES): string => e.id).indexOf(this.vnfdCopy); this.links.push( { + // eslint-disable-next-line security/detect-object-injection source: this.nodes[connectionPointPos], + // eslint-disable-next-line security/detect-object-injection target: this.nodes[nsdPos] }, { + // eslint-disable-next-line security/detect-object-injection source: this.nodes[connectionPointPos], + // eslint-disable-next-line security/detect-object-injection target: this.nodes[vnfdPos] }); }); @@ -681,7 +689,7 @@ export class NSComposerComponent { .attr('x', graphContainerAttr.imageX) .attr('y', graphContainerAttr.imageY) .call(this.onDragDrop()) - .attr('id', (d: COMPOSERNODES): string => { return d.selectorId; }) + .attr('id', (d: COMPOSERNODES): string => d.selectorId) .attr('class', 'node').attr('width', graphContainerAttr.nodeWidth).attr('height', graphContainerAttr.nodeHeight) .attr('xlink:href', 'assets/images/VL.svg') .on('mousedown', (d: COMPOSERNODES): void => { this.mouseDown(d); }) @@ -703,7 +711,7 @@ export class NSComposerComponent { .attr('x', graphContainerAttr.imageX) .attr('y', graphContainerAttr.imageY) .call(this.onDragDrop()) - .attr('id', (d: COMPOSERNODES): string => { return d.selectorId; }) + .attr('id', (d: COMPOSERNODES): string => d.selectorId) .attr('class', 'node').attr('width', graphContainerAttr.nodeWidth).attr('height', graphContainerAttr.nodeHeight) .attr('xlink:href', 'assets/images/VNFD.svg') .on('mousedown', (d: COMPOSERNODES): void => { this.mouseDown(d); }) @@ -725,7 +733,7 @@ export class NSComposerComponent { .attr('x', graphContainerAttr.imageX) .attr('y', graphContainerAttr.imageY) .call(this.onDragDrop()) - .attr('id', (d: COMPOSERNODES): string => { return d.selectorId; }) + .attr('id', (d: COMPOSERNODES): string => d.selectorId) .attr('class', 'node').attr('width', graphContainerAttr.nodeWidth).attr('height', graphContainerAttr.nodeHeight) .attr('xlink:href', 'assets/images/CP.svg') .on('mousedown', (d: COMPOSERNODES): void => { this.mouseDown(d); }) @@ -767,6 +775,7 @@ export class NSComposerComponent { }); } if (this.vlName !== undefined && this.setVnfdName !== undefined && this.setVnfdConnectionPointRef !== undefined) { + // eslint-disable-next-line security/detect-non-literal-fs-filename const modalRef: NgbModalRef = this.modalService.open(ConfirmationTopologyComponent, { backdrop: 'static' }); modalRef.componentInstance.topologyType = 'Add'; modalRef.componentInstance.cpDetails = this.getVNFSelectedData['ext-cpd']; @@ -785,7 +794,9 @@ export class NSComposerComponent { } else { this.deselectPath(); } - }).catch(); + }).catch((): void => { + // Catch Navigation Error + }); } else { this.deselectPath(); this.notifierService.notify('error', this.translateService.instant('ERROR')); @@ -819,6 +830,7 @@ export class NSComposerComponent { } /** Events handles when mousedown click it will capture the selected node data @private */ private mouseDown(d: COMPOSERNODES): void { + // eslint-disable-next-line deprecation/deprecation event.preventDefault(); if (d3.event.ctrlKey) { return; } if (d3.event.shiftKey) { @@ -895,12 +907,12 @@ export class NSComposerComponent { this.isShowCPDetails = cpDetails; } /** Events handles when Shift Click to perform create cp @private */ - // tslint:disable-next-line: no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private singleClick(nodeSelected: any, d: COMPOSERNODES): void { this.selectNodeExclusive(nodeSelected, d); } /** Selected nodes @private */ - // tslint:disable-next-line: no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private selectNodeExclusive(nodeSeleced: any, d: COMPOSERNODES): void { const alreadyIsActive: boolean = nodeSeleced.select('#' + d.selectorId).classed(this.activeClass); this.deselectAllNodes(); @@ -949,6 +961,7 @@ export class NSComposerComponent { } /** Get confirmation Before Deleting the Link in Topology @private */ private getDeleteLinkConfirmation(d: Tick): void { + // eslint-disable-next-line security/detect-non-literal-fs-filename const modalRef: NgbModalRef = this.modalService.open(ConfirmationTopologyComponent, { backdrop: 'static' }); modalRef.componentInstance.topologyType = 'Delete'; modalRef.componentInstance.topologyname = this.translateService.instant('PAGE.TOPOLOGY.LINK') + ' - ' + d.source.id; @@ -957,7 +970,9 @@ export class NSComposerComponent { if (result) { this.doubleClickLink(d); } - }).catch(); + }).catch((): void => { + // Catch Navigation Error + }); } /** Events handles when Double Click to Delete the link @private */ private doubleClickLink(d: Tick): void { @@ -995,6 +1010,7 @@ export class NSComposerComponent { } /** Get confirmation Before Deleting the Node in Topology @private */ private getDeleteConfirmation(d: COMPOSERNODES): void { + // eslint-disable-next-line security/detect-non-literal-fs-filename const modalRef: NgbModalRef = this.modalService.open(ConfirmationTopologyComponent, { backdrop: 'static' }); modalRef.componentInstance.topologyType = 'Delete'; modalRef.componentInstance.topologyname = d.name; @@ -1009,7 +1025,9 @@ export class NSComposerComponent { if (result) { this.doubleClick(d); } - }).catch(); + }).catch((): void => { + // Catch Navigation Error + }); } /** Events handles when Double Click to Delete @private */ private doubleClick(d: COMPOSERNODES): void { @@ -1018,7 +1036,7 @@ export class NSComposerComponent { if (res.id === d.id) { if (deletedNode.type === 'vld') { /** Remove the virtual-link-desc related to VL */ - const pos: number = this.nsData['virtual-link-desc'].map((e: VLD): string => { return e.id; }).indexOf(d.id); + const pos: number = this.nsData['virtual-link-desc'].map((e: VLD): string => e.id).indexOf(d.id); this.nsData['virtual-link-desc'].splice(pos, 1); /** Remove the virtual-link-connectivity between VL and VNFD */ this.nsData.df.forEach((resultDF: DF): void => { @@ -1032,6 +1050,7 @@ export class NSComposerComponent { if (getVLArray.length > 0) { getVLArray.forEach((removeIndex: number): void => { const index: string = removeIndex.toString(); + // eslint-disable-next-line security/detect-object-injection resVNF['virtual-link-connectivity'].splice(resVNF['virtual-link-connectivity'][index], 1); }); } @@ -1043,19 +1062,13 @@ export class NSComposerComponent { this.nsData.df.forEach((resultDF: DF): void => { if (resultDF['vnf-profile'] !== undefined) { /** Remove the vnf-profile related to VNFD */ - const posVNF: number = resultDF['vnf-profile'].findIndex((e: VNFPROFILE): boolean => { - return e['vnfd-id'] === d.name && e.id === d.nodeIndex; - }); + const posVNF: number = resultDF['vnf-profile'].findIndex((e: VNFPROFILE): boolean => e['vnfd-id'] === d.name && e.id === d.nodeIndex); resultDF['vnf-profile'].splice(posVNF, 1); /** Check the VNFD exists in any vnf-profile */ - const isVNFDExists: boolean = resultDF['vnf-profile'].some((e: VNFPROFILE): boolean => { - return e['vnfd-id'] === d.name; - }); + const isVNFDExists: boolean = resultDF['vnf-profile'].some((e: VNFPROFILE): boolean => e['vnfd-id'] === d.name); /** If VNFD not exists in the vnf-profile remove from vnfd-id */ if (!isVNFDExists) { - const posVNFD: number = this.nsData['vnfd-id'].findIndex((e: string): boolean => { - return e === d.name; - }); + const posVNFD: number = this.nsData['vnfd-id'].findIndex((e: string): boolean => e === d.name); this.nsData['vnfd-id'].splice(posVNFD, 1); } } @@ -1090,7 +1103,7 @@ export class NSComposerComponent { }); } /** drag event @private */ - // tslint:disable-next-line: no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private onDragDrop(): any { return d3.drag().filter(this.dragFilter) .on('start', this.dragstarted) diff --git a/src/app/packages/ns-packages/vnf-composer/VNFComposerComponent.ts b/src/app/packages/ns-packages/vnf-composer/VNFComposerComponent.ts index 55c5070..eabd2b7 100644 --- a/src/app/packages/ns-packages/vnf-composer/VNFComposerComponent.ts +++ b/src/app/packages/ns-packages/vnf-composer/VNFComposerComponent.ts @@ -18,6 +18,7 @@ /** * @file VNFComposerComponent */ + import { isNullOrUndefined } from 'util'; import { HttpHeaders } from '@angular/common/http'; import { Component, ElementRef, Injector, ViewChild, ViewEncapsulation } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; @@ -73,30 +74,30 @@ export class VNFComposerComponent { /** Contains sidebar open status @public */ public sideBarOpened: boolean = false; /** Contains SVG attributes @private */ - // tslint:disable-next-line:no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private svg: any; /** Contains forced node animations @private */ - // tslint:disable-next-line:no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private force: any; /** Contains the Drag line */ - // tslint:disable-next-line: no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private dragLine: any; /** Contains id of the node @private */ private identifier: string; /** Contains path information of the node */ - // tslint:disable-next-line:no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private path: any; /** Contains node network @private */ - // tslint:disable-next-line:no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private network: any; /** Contains node network @private */ - // tslint:disable-next-line:no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private virutualDeploymentUnit: any; /** Contains node connectionPoint @private */ - // tslint:disable-next-line:no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private connectionPoint: any; /** Contains node intConnectionPoint @private */ - // tslint:disable-next-line:no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private intConnectionPoint: any; /** Contains the node information @private */ private nodes: COMPOSERNODES[] = []; @@ -117,16 +118,16 @@ export class VNFComposerComponent { /** Contains tranlsate instance @private */ private translateService: TranslateService; /** Rendered nodes represent network @private */ - // tslint:disable-next-line:no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private gNetwork: any; /** Rendered nodes represent VDU @private */ - // tslint:disable-next-line:no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private gVirutualDeploymentUnit: any; /** Rendered nodes represent connection point @private */ - // tslint:disable-next-line:no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private gConnectionPoint: any; /** Rendered nodes represent internal connection point @private */ - // tslint:disable-next-line:no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private gIntConnectionPoint: any; /** Contains all the information about VNF Details @private */ private vnfdPackageDetails: VNFD; @@ -172,7 +173,6 @@ export class VNFComposerComponent { * Lifecyle Hooks the trigger before component is instantiate */ public ngOnInit(): void { - // tslint:disable-next-line:no-backbone-get-set-outside-model this.identifier = this.activatedRoute.snapshot.paramMap.get('id'); this.generateData(); this.headers = new HttpHeaders({ @@ -208,7 +208,9 @@ export class VNFComposerComponent { }, (error: ERRORDATA): void => { error.error = typeof error.error === 'string' ? jsyaml.load(error.error) : error.error; if (error.error.status === HttpStatus.NOT_FOUND || error.error.status === HttpStatus.UNAUTHORIZED) { - this.router.navigateByUrl('404', { skipLocationChange: true }).catch(); + this.router.navigateByUrl('404', { skipLocationChange: true }).catch((): void => { + // Catch Navigation Error + }); } else { this.restService.handleError(error, 'get'); } @@ -225,7 +227,7 @@ export class VNFComposerComponent { this.vnfdInfo.provider = vnfdPackageDetails.provider; } /** Events handles at drag on D3 region @public */ - // tslint:disable-next-line:no-any + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any public drag(ev: any): void { ev.dataTransfer.setData('text', ev.target.id); } @@ -409,10 +411,13 @@ export class VNFComposerComponent { } /** Edit topology @public */ public onEdit(): void { - this.router.navigate(['/packages/vnf/edit/', this.identifier]).catch(); + this.router.navigate(['/packages/vnf/edit/', this.identifier]).catch((): void => { + // Catch Navigation Error + }); } /** Show Info @public */ public showInfo(): void { + // eslint-disable-next-line security/detect-non-literal-fs-filename const modalRef: NgbModalRef = this.modalService.open(ConfirmationTopologyComponent, { backdrop: 'static' }); modalRef.componentInstance.topologyType = 'Info'; modalRef.componentInstance.topologytitle = this.translateService.instant('PAGE.TOPOLOGY.INFO'); @@ -420,7 +425,9 @@ export class VNFComposerComponent { if (result) { // empty } - }).catch(); + }).catch((): void => { + // Catch Navigation Error + }); } /** Event to freeze the animation @public */ public onFreeze(): void { @@ -562,7 +569,7 @@ export class VNFComposerComponent { .attr('x', graphContainerAttr.imageX) .attr('y', graphContainerAttr.imageY) .call(this.onDragDrop()) - .attr('id', (d: COMPOSERNODES): string => { return d.id; }) + .attr('id', (d: COMPOSERNODES): string => d.id) .attr('class', 'node').attr('width', graphContainerAttr.nodeWidth).attr('height', graphContainerAttr.nodeHeight) .attr('xlink:href', 'assets/images/INTVL.svg') .on('mousedown', (d: COMPOSERNODES): void => { this.mouseDown(d); }) @@ -584,7 +591,7 @@ export class VNFComposerComponent { .attr('x', graphContainerAttr.imageX) .attr('y', graphContainerAttr.imageY) .call(this.onDragDrop()) - .attr('id', (d: COMPOSERNODES): string => { return d.id; }) + .attr('id', (d: COMPOSERNODES): string => d.id) .attr('class', 'node').attr('width', graphContainerAttr.nodeWidth).attr('height', graphContainerAttr.nodeHeight) .attr('xlink:href', 'assets/images/VDU.svg') .on('mousedown', (d: COMPOSERNODES): void => { this.mouseDown(d); }) @@ -606,7 +613,7 @@ export class VNFComposerComponent { .attr('x', graphContainerAttr.imageX) .attr('y', graphContainerAttr.imageY) .call(this.onDragDrop()) - .attr('id', (d: COMPOSERNODES): string => { return d.id; }) + .attr('id', (d: COMPOSERNODES): string => d.id) .attr('class', 'node').attr('width', graphContainerAttr.nodeWidth).attr('height', graphContainerAttr.nodeHeight) .attr('xlink:href', 'assets/images/CP-VNF.svg') .on('mousedown', (d: COMPOSERNODES): void => { this.mouseDown(d); }) @@ -628,7 +635,7 @@ export class VNFComposerComponent { .attr('x', graphContainerAttr.imageX) .attr('y', graphContainerAttr.imageY) .call(this.onDragDrop()) - .attr('id', (d: COMPOSERNODES): string => { return d.id; }) + .attr('id', (d: COMPOSERNODES): string => d.id) .attr('class', 'node').attr('width', graphContainerAttr.nodeWidth).attr('height', graphContainerAttr.nodeHeight) .attr('xlink:href', 'assets/images/INTCP.svg') .on('mousedown', (d: COMPOSERNODES): void => { this.mouseDown(d); }) @@ -716,6 +723,7 @@ export class VNFComposerComponent { } /** Events handles when mousedown click it will capture the selected node data @private */ private mouseDown(d: COMPOSERNODES): void { + // eslint-disable-next-line deprecation/deprecation event.preventDefault(); if (d3.event.ctrlKey) { return; } if (d3.event.shiftKey) { @@ -828,6 +836,7 @@ export class VNFComposerComponent { } ] }); + // eslint-disable-next-line security/detect-object-injection this.vnfdPackageDetails['ext-cpd'][index] = { id: extcpd.id, 'int-cpd': { @@ -882,7 +891,7 @@ export class VNFComposerComponent { this.mouseupNode = null; } /** drag event @private */ - // tslint:disable-next-line: no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private onDragDrop(): any { return d3.drag().filter(this.dragFilter) .on('start', this.dragstarted) @@ -915,12 +924,13 @@ export class VNFComposerComponent { this.dragLine.classed('hidden', true).attr('d', 'M0,0L0,0'); } /** Events handles when Shift Click to perform create cp @private */ - // tslint:disable-next-line: no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private singleClick(nodeSelected: any, d: COMPOSERNODES): void { this.selectedNode(nodeSelected, d); } /** Get confirmation Before Deleting the Node in Topology @private */ private getDeleteNodeConfirmation(d: COMPOSERNODES): void { + // eslint-disable-next-line security/detect-non-literal-fs-filename const modalRef: NgbModalRef = this.modalService.open(ConfirmationTopologyComponent, { backdrop: 'static' }); modalRef.componentInstance.topologyType = 'Delete'; modalRef.componentInstance.topologyname = d.name; @@ -937,11 +947,12 @@ export class VNFComposerComponent { if (result) { this.deleteNode(d); } - }).catch(); + }).catch((): void => { + // Catch Navigation Error + }); } /** Delete nodes @private */ private deleteNode(d: COMPOSERNODES): void { - // tslint:disable-next-line: max-func-body-length this.nodes.forEach((node: VNFD): void => { if (node.id === d.id) { if (d.type === 'cp') { @@ -963,9 +974,7 @@ export class VNFComposerComponent { if (getRelatedVDUCPD !== undefined && getRelatedVDUID !== undefined) { this.vnfdPackageDetails.vdu.forEach((vdu: VDU): void => { if (vdu.id === getRelatedVDUID) { - const posINTCPD: number = vdu['int-cpd'].findIndex((intCPD: VDUINTCPD): boolean => { - return intCPD.id === getRelatedVDUCPD; - }); + const posINTCPD: number = vdu['int-cpd'].findIndex((intCPD: VDUINTCPD): boolean => intCPD.id === getRelatedVDUCPD); if (posINTCPD !== -1) { vdu['int-cpd'].splice(posINTCPD, 1); } @@ -975,26 +984,20 @@ export class VNFComposerComponent { } } else if (d.type === 'intcp') { this.vnfdPackageDetails.vdu.forEach((vdu: VDU): void => { - const posINTCPD: number = vdu['int-cpd'].findIndex((intCPD: VDUINTCPD): boolean => { - return intCPD.id === d.id; - }); + const posINTCPD: number = vdu['int-cpd'].findIndex((intCPD: VDUINTCPD): boolean => intCPD.id === d.id); if (posINTCPD !== -1) { vdu['int-cpd'].splice(posINTCPD, 1); } }); } else if (d.type === 'intvl') { - const posINTVLD: number = this.vnfdPackageDetails['int-virtual-link-desc'].findIndex((intVLD: IVLD): boolean => { - return intVLD.id === d.id; - }); + const posINTVLD: number = this.vnfdPackageDetails['int-virtual-link-desc'].findIndex((intVLD: IVLD): boolean => intVLD.id === d.id); if (posINTVLD !== -1) { this.vnfdPackageDetails['int-virtual-link-desc'].splice(posINTVLD, 1); } if (this.vnfdPackageDetails.vdu !== undefined) { this.vnfdPackageDetails.vdu.forEach((vduDetails: VDU): void => { if (vduDetails['int-cpd'] !== undefined) { - const newVDUintCPDArray: VDUINTCPD[] = vduDetails['int-cpd'].filter((item: VDUINTCPD): boolean => { - return item['int-virtual-link-desc'] !== undefined ? item['int-virtual-link-desc'] !== d.id ? true : false : true; - }); + const newVDUintCPDArray: VDUINTCPD[] = vduDetails['int-cpd'].filter((item: VDUINTCPD): boolean => item['int-virtual-link-desc'] !== undefined ? item['int-virtual-link-desc'] !== d.id ? true : false : true); vduDetails['int-cpd'] = newVDUintCPDArray; } }); @@ -1039,7 +1042,7 @@ export class VNFComposerComponent { this.notifierService.notify('warning', this.translateService.instant('PAGE.VNFPACKAGE.VNFCOMPOSE.YOUCANNOTDELETELINK')); } /** Selected nodes @private */ - // tslint:disable-next-line: no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any private selectedNode(nodeSeleced: any, d: COMPOSERNODES): void { const alreadyIsActive: boolean = nodeSeleced.select('#' + d.id).classed(this.activeNode); this.deselectAllNodes(); diff --git a/src/app/packages/vnf-packages/VNFPackagesComponent.ts b/src/app/packages/vnf-packages/VNFPackagesComponent.ts index 8169782..fc85d71 100644 --- a/src/app/packages/vnf-packages/VNFPackagesComponent.ts +++ b/src/app/packages/vnf-packages/VNFPackagesComponent.ts @@ -238,6 +238,7 @@ export class VNFPackagesComponent implements OnInit { } /** Handle compose new ns package method @public */ public composeVNFPackage(): void { + // eslint-disable-next-line security/detect-non-literal-fs-filename this.modalService.open(ComposePackages, { backdrop: 'static' }).componentInstance.params = { page: 'vnf-package' }; } diff --git a/src/app/page-not-found/PageNotFoundComponent.ts b/src/app/page-not-found/PageNotFoundComponent.ts index ef515ec..2842f0e 100644 --- a/src/app/page-not-found/PageNotFoundComponent.ts +++ b/src/app/page-not-found/PageNotFoundComponent.ts @@ -38,5 +38,4 @@ export class PageNotFoundComponent implements OnInit { public ngOnInit(): void { //donothing } - } diff --git a/src/app/projects/ProjectsComponent.ts b/src/app/projects/ProjectsComponent.ts index 052e639..982421e 100644 --- a/src/app/projects/ProjectsComponent.ts +++ b/src/app/projects/ProjectsComponent.ts @@ -18,6 +18,7 @@ /** * @file Project details Component. */ +import { isNullOrUndefined } from 'util'; import { Component, Injector, OnDestroy, OnInit } from '@angular/core'; import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; import { TranslateService } from '@ngx-translate/core'; @@ -32,7 +33,6 @@ import { ProjectsActionComponent } from 'ProjectsAction'; import { RestService } from 'RestService'; import { Subscription } from 'rxjs'; import { SharedService } from 'SharedService'; -import { isNullOrUndefined } from 'util'; /** * Creating component @@ -146,13 +146,16 @@ export class ProjectsComponent implements OnInit, OnDestroy { /** Modal service to initiate the project add @private */ public projectAdd(): void { + // eslint-disable-next-line security/detect-non-literal-fs-filename const modalRef: NgbModalRef = this.modalService.open(ProjectCreateUpdateComponent, { size: 'lg', backdrop: 'static' }); modalRef.componentInstance.projectType = 'Add'; modalRef.result.then((result: MODALCLOSERESPONSEDATA) => { if (result) { this.generateData(); } - }).catch(); + }).catch((): void => { + // Catch Navigation Error + }); } /** smart table listing manipulation @private */ @@ -197,7 +200,9 @@ export class ProjectsComponent implements OnInit, OnDestroy { }); this.dataSource.load(this.projectData).then((data: boolean) => { this.isLoadingResults = false; - }).catch(); + }).catch((): void => { + // Catch Navigation Error + }); }, (error: ERRORDATA) => { this.restService.handleError(error, 'get'); this.isLoadingResults = false; diff --git a/src/app/projects/ProjectsModule.ts b/src/app/projects/ProjectsModule.ts index 16147b9..22bbc27 100644 --- a/src/app/projects/ProjectsModule.ts +++ b/src/app/projects/ProjectsModule.ts @@ -52,7 +52,6 @@ const routes: Routes = [ /** * Creating @NgModule component for Modules */ -// tslint:disable-next-line: no-stateless-class @NgModule({ imports: [ FormsModule, @@ -75,9 +74,6 @@ const routes: Routes = [ ], providers: [ DataService - ], - entryComponents: [ - ProjectCreateUpdateComponent ] }) /** Exporting a class @exports ProjectsModule */ diff --git a/src/app/projects/project-create-update/ProjectCreateUpdateComponent.ts b/src/app/projects/project-create-update/ProjectCreateUpdateComponent.ts index bb1207a..9f8cc83 100644 --- a/src/app/projects/project-create-update/ProjectCreateUpdateComponent.ts +++ b/src/app/projects/project-create-update/ProjectCreateUpdateComponent.ts @@ -18,6 +18,7 @@ /** * @file Project Add Modal */ +import { isNullOrUndefined } from 'util'; import { Component, Injector, Input, OnInit } from '@angular/core'; import { AbstractControl, FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; @@ -30,7 +31,6 @@ import { ProjectData, ProjectDetails, QUOTAITEM, QUOTA_ITEMS } from 'ProjectMode import { ProjectService } from 'ProjectService'; import { RestService } from 'RestService'; import { SharedService } from 'SharedService'; -import { isNullOrUndefined } from 'util'; /** * Creating component @@ -245,6 +245,7 @@ export class ProjectCreateUpdateComponent implements OnInit { /** Used to get the AbstractControl of controlName passed @private */ private getFormControl(controlName: string): AbstractControl { + // eslint-disable-next-line security/detect-object-injection return this.projectForm.controls[controlName]; } diff --git a/src/app/roles/RolesComponent.ts b/src/app/roles/RolesComponent.ts index 82f20b4..49819b4 100644 --- a/src/app/roles/RolesComponent.ts +++ b/src/app/roles/RolesComponent.ts @@ -51,8 +51,9 @@ export class RolesComponent { /** Return to role datails list */ public redirectToList(getURL: string): void { if (getURL === '/roles') { - this.router.navigate(['/roles/details']).catch(); + this.router.navigate(['/roles/details']).catch((): void => { + // Catch Navigation Error + }); } } - } diff --git a/src/app/roles/RolesModule.ts b/src/app/roles/RolesModule.ts index 88e1225..1e2c7ff 100644 --- a/src/app/roles/RolesModule.ts +++ b/src/app/roles/RolesModule.ts @@ -75,8 +75,7 @@ const routes: Routes = [ @NgModule({ imports: [FormsModule, ReactiveFormsModule, CommonModule, HttpClientModule, TranslateModule, RouterModule.forChild(routes), NgbModule, PagePerRowModule, Ng2SmartTableModule, LoaderModule, PageReloadModule], - declarations: [RolesComponent, RolesDetailsComponent, RolesActionComponent, RolesCreateEditComponent], - entryComponents: [RolesActionComponent] + declarations: [RolesComponent, RolesDetailsComponent, RolesActionComponent, RolesCreateEditComponent] }) /** * AppModule is the Root module for application diff --git a/src/app/roles/roles-create-edit/RolesCreateEditComponent.ts b/src/app/roles/roles-create-edit/RolesCreateEditComponent.ts index 0419c5f..87e1b86 100644 --- a/src/app/roles/roles-create-edit/RolesCreateEditComponent.ts +++ b/src/app/roles/roles-create-edit/RolesCreateEditComponent.ts @@ -18,6 +18,7 @@ /** * @file Roles Create and Edit Component */ +import { isNullOrUndefined } from 'util'; import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Component, Injector, Input, OnInit } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; @@ -30,7 +31,6 @@ import * as jsonpath from 'jsonpath'; import { RestService } from 'RestService'; import { Permission, PermissionGroup, RoleConfig, RoleData } from 'RolesModel'; import { SharedService } from 'SharedService'; -import { isNullOrUndefined } from 'util'; /** * Creating component @@ -191,7 +191,9 @@ export class RolesCreateEditComponent implements OnInit { }; this.restService.postResource(apiURLHeader, postData).subscribe(() => { this.notifierService.notify('success', this.translateService.instant('PAGE.ROLES.CREATEDSUCCESSFULLY')); - this.router.navigate(['/roles/details']).catch(); + this.router.navigate(['/roles/details']).catch((): void => { + // Catch Navigation Error + }); }, (error: ERRORDATA) => { this.isLoadingResults = false; this.restService.handleError(error, 'post'); @@ -229,7 +231,9 @@ export class RolesCreateEditComponent implements OnInit { }; this.restService.patchResource(apiURLHeader, postData).subscribe(() => { this.notifierService.notify('success', this.translateService.instant('PAGE.ROLES.UPDATEDSUCCESSFULLY')); - this.router.navigate(['/roles/details']).catch(); + this.router.navigate(['/roles/details']).catch((): void => { + // Catch Navigation Error + }); }, (error: ERRORDATA) => { this.isLoadingResults = false; this.restService.handleError(error, 'patch'); @@ -254,7 +258,6 @@ export class RolesCreateEditComponent implements OnInit { } this.viewMode = 'text'; } - } /** Generate role permission post data @private */ @@ -282,6 +285,7 @@ export class RolesCreateEditComponent implements OnInit { this.roleForm.value.permissions = this.roleForm.value.permissions.replace(/'/g, '"'); const rolePermission: {} = JSON.parse(this.roleForm.value.permissions); for (const key of Object.keys(rolePermission)) { + // eslint-disable-next-line security/detect-object-injection if (typeof rolePermission[key] !== 'boolean') { this.notifierService.notify('error', this.translateService.instant('PAGE.ROLES.ROLEKEYERROR', { roleKey: key })); return false; @@ -294,7 +298,6 @@ export class RolesCreateEditComponent implements OnInit { /** Get role data from NBI based on ID and apply filter @private */ private getRoleData(): void { - // tslint:disable-next-line: no-backbone-get-set-outside-model this.roleRef = this.activatedRoute.snapshot.paramMap.get('id'); if (!isNullOrUndefined(this.roleRef)) { this.restService.getResource(environment.ROLES_URL + '/' + this.roleRef).subscribe((data: RoleData) => { @@ -302,7 +305,9 @@ export class RolesCreateEditComponent implements OnInit { this.filterRoleData(data.permissions); this.isLoadingResults = false; }, (error: ERRORDATA) => { - this.router.navigate(['/roles/details']).catch(); + this.router.navigate(['/roles/details']).catch((): void => { + // Catch Navigation Error + }); this.restService.handleError(error, 'get'); }); } @@ -313,6 +318,7 @@ export class RolesCreateEditComponent implements OnInit { Object.keys(permissions).forEach((permission: string) => { jsonpath.apply(this.rolePermissions, '$..permissions[?(@.operation == "' + permission + '")]', (response: Permission) => { if (response.operation === permission) { + // eslint-disable-next-line security/detect-object-injection response.value = permissions[permission]; } return response; @@ -331,5 +337,4 @@ export class RolesCreateEditComponent implements OnInit { }); }); } - } diff --git a/src/app/roles/roles-details/RolesDetailsComponent.ts b/src/app/roles/roles-details/RolesDetailsComponent.ts index 89affae..9c2e3e3 100644 --- a/src/app/roles/roles-details/RolesDetailsComponent.ts +++ b/src/app/roles/roles-details/RolesDetailsComponent.ts @@ -18,6 +18,7 @@ /** * @file Roles Deatils component. */ +import { isNullOrUndefined } from 'util'; import { Component, Injector, OnInit } from '@angular/core'; import { Router } from '@angular/router'; import { TranslateService } from '@ngx-translate/core'; @@ -30,7 +31,6 @@ import { RolesActionComponent } from 'RolesAction'; import { RoleData, RoleDetails } from 'RolesModel'; import { Subscription } from 'rxjs'; import { SharedService } from 'SharedService'; -import { isNullOrUndefined } from 'util'; /** * Creating component @@ -159,7 +159,9 @@ export class RolesDetailsComponent implements OnInit { }); this.dataSource.load(this.roleData).then((data: boolean) => { this.isLoadingResults = false; - }).catch(); + }).catch((): void => { + // Catch Navigation Error + }); }, (error: ERRORDATA) => { this.restService.handleError(error, 'get'); this.isLoadingResults = false; @@ -188,5 +190,4 @@ export class RolesDetailsComponent implements OnInit { public ngOnDestroy(): void { this.generateDataSub.unsubscribe(); } - } diff --git a/src/app/sdn-controller/SDNControllerComponent.ts b/src/app/sdn-controller/SDNControllerComponent.ts index 661882c..247553a 100644 --- a/src/app/sdn-controller/SDNControllerComponent.ts +++ b/src/app/sdn-controller/SDNControllerComponent.ts @@ -49,7 +49,9 @@ export class SDNControllerComponent { /** Return to list NS Package List */ public redirectToList(getURL: string): void { if (getURL === '/sdn') { - this.router.navigate(['/sdn/details']).catch(); + this.router.navigate(['/sdn/details']).catch((): void => { + // Catch Navigation Error + }); } } } diff --git a/src/app/sdn-controller/SDNControllerModule.ts b/src/app/sdn-controller/SDNControllerModule.ts index 6da4a5c..9b2f523 100644 --- a/src/app/sdn-controller/SDNControllerModule.ts +++ b/src/app/sdn-controller/SDNControllerModule.ts @@ -68,7 +68,6 @@ const routes: Routes = [ PagePerRowModule, LoaderModule, PageReloadModule], declarations: [SDNControllerComponent, SDNControllerDetailsComponent, SDNControllerInfoComponent, NewSDNControllerComponent], providers: [DataService], - entryComponents: [SDNControllerInfoComponent, NewSDNControllerComponent], schemas: [CUSTOM_ELEMENTS_SCHEMA] }) /** Exporting a class @exports SDNControllerModule */ @@ -76,7 +75,7 @@ export class SDNControllerModule { /** * Lifecyle Hooks the trigger before component is instantiate */ - public ngOnInit(): void { - //Empty Class - } + constructor() { + //Empty + } } diff --git a/src/app/sdn-controller/sdn-controller-details/SDNControllerDetailsComponent.ts b/src/app/sdn-controller/sdn-controller-details/SDNControllerDetailsComponent.ts index 589f13e..ef2f350 100644 --- a/src/app/sdn-controller/sdn-controller-details/SDNControllerDetailsComponent.ts +++ b/src/app/sdn-controller/sdn-controller-details/SDNControllerDetailsComponent.ts @@ -206,12 +206,15 @@ export class SDNControllerDetailsComponent implements OnInit, OnDestroy { /** Compose new SDN Controller @public */ public composeSDN(): void { + // eslint-disable-next-line security/detect-non-literal-fs-filename const modalRef: NgbModalRef = this.modalService.open(NewSDNControllerComponent, { backdrop: 'static' }); modalRef.result.then((result: MODALCLOSERESPONSEDATA) => { if (result) { this.sharedService.callData(); } - }).catch(); + }).catch((): void => { + // Catch Navigation Error + }); } /** @@ -237,11 +240,12 @@ export class SDNControllerDetailsComponent implements OnInit, OnDestroy { } this.dataSource.load(this.sdnData).then((data: {}) => { this.isLoadingResults = false; - }).catch(); + }).catch((): void => { + // Catch Navigation Error + }); }, (error: ERRORDATA) => { this.restService.handleError(error, 'get'); this.isLoadingResults = false; }); } - } diff --git a/src/app/user-settings/UserSettingsComponent.ts b/src/app/user-settings/UserSettingsComponent.ts index 19b525f..5212eb5 100644 --- a/src/app/user-settings/UserSettingsComponent.ts +++ b/src/app/user-settings/UserSettingsComponent.ts @@ -83,10 +83,8 @@ export class UserSettingsComponent implements OnInit { }); const setLanguage: string = localStorage.getItem('languageCode'); if (setLanguage !== null && this.validateLanguageList(setLanguage)) { - // tslint:disable-next-line:no-backbone-get-set-outside-model this.usersettingsForm.get('selectedLanguage').setValue(setLanguage); } else { - // tslint:disable-next-line:no-backbone-get-set-outside-model this.usersettingsForm.get('selectedLanguage').setValue('en'); } } diff --git a/src/app/users/UsersComponent.ts b/src/app/users/UsersComponent.ts index 178b979..b14c2e7 100644 --- a/src/app/users/UsersComponent.ts +++ b/src/app/users/UsersComponent.ts @@ -49,7 +49,9 @@ export class UsersComponent { /** Return to list NS Package List */ public redirectToList(getURL: string): void { if (getURL === '/users') { - this.router.navigate(['/users/details']).catch(); + this.router.navigate(['/users/details']).catch((): void => { + // Catch Navigation Error + }); } } } diff --git a/src/app/users/UsersModule.ts b/src/app/users/UsersModule.ts index 8b5f316..2294886 100644 --- a/src/app/users/UsersModule.ts +++ b/src/app/users/UsersModule.ts @@ -63,15 +63,14 @@ const routes: Routes = [ FlexLayoutModule, NgSelectModule, NgbModule, RouterModule.forChild(routes), PagePerRowModule, LoaderModule, PageReloadModule, ChangePasswordModule], declarations: [UsersComponent, UserDetailsComponent, ProjectRoleComponent], - providers: [DataService], - entryComponents: [ProjectRoleComponent] + providers: [DataService] }) /** Exporting a class @exports UsersModule */ export class UsersModule { /** * Lifecyle Hooks the trigger before component is instantiate */ - public ngOnInit(): void { - // Empty Block - } + constructor() { + //Empty + } } diff --git a/src/app/users/add-user/AddEditUserComponent.ts b/src/app/users/add-user/AddEditUserComponent.ts index 0e9456a..076cfba 100644 --- a/src/app/users/add-user/AddEditUserComponent.ts +++ b/src/app/users/add-user/AddEditUserComponent.ts @@ -18,6 +18,7 @@ /** * @file Add Edit Component. */ +import { isNullOrUndefined } from 'util'; import { HttpHeaders } from '@angular/common/http'; import { Component, Injector, Input, OnInit } from '@angular/core'; import { AbstractControl, FormBuilder, FormGroup, Validators } from '@angular/forms'; @@ -29,7 +30,6 @@ import { APIURLHEADER, ERRORDATA, LOGINPARAMS, MODALCLOSERESPONSEDATA, TYPESECTI import { environment } from 'environment'; import { RestService } from 'RestService'; import { SharedService } from 'SharedService'; -import { isNullOrUndefined } from 'util'; /** * Creating component @@ -265,6 +265,7 @@ export class AddEditUserComponent implements OnInit { /** Used to get the AbstractControl of controlName passed @private */ private getFormControl(controlName: string): AbstractControl { + // eslint-disable-next-line security/detect-object-injection return this.userForm.controls[controlName]; } diff --git a/src/app/users/project-role/ProjectRoleComponent.ts b/src/app/users/project-role/ProjectRoleComponent.ts index 600cecd..3a7e612 100644 --- a/src/app/users/project-role/ProjectRoleComponent.ts +++ b/src/app/users/project-role/ProjectRoleComponent.ts @@ -141,7 +141,6 @@ export class ProjectRoleComponent implements OnInit { /** Handle FormArray Controls @public */ public getControls(): AbstractControl[] { - // tslint:disable-next-line:no-backbone-get-set-outside-model return (this.projectRoleForm.get('project_role_mappings') as FormArray).controls; } @@ -185,7 +184,6 @@ export class ProjectRoleComponent implements OnInit { /** Set all roles and project values to the form @public */ public loadMapping(): void { this.userDetails.project_role_mappings.forEach((data: ProjectRoleMappings): void => { - // tslint:disable-next-line:no-backbone-get-set-outside-model this.projectRoleFormArray = this.projectRoleForm.get('project_role_mappings') as FormArray; this.projectRoleFormArray.push(this.projectRoleParamsBuilder); }); @@ -229,7 +227,6 @@ export class ProjectRoleComponent implements OnInit { /** Add extra mapping and set empty project and roles @public */ public addMapping(): void { - // tslint:disable-next-line:no-backbone-get-set-outside-model this.projectRoleFormArray = this.projectRoleForm.get('project_role_mappings') as FormArray; this.projectRoleFormArray.push(this.projectRoleParamsBuilder); } diff --git a/src/app/users/user-details/UserDetailsComponent.ts b/src/app/users/user-details/UserDetailsComponent.ts index aede6e2..ba24454 100644 --- a/src/app/users/user-details/UserDetailsComponent.ts +++ b/src/app/users/user-details/UserDetailsComponent.ts @@ -18,6 +18,7 @@ /** * @file users details Component. */ +import { isNullOrUndefined } from 'util'; import { Component, Injector, OnDestroy, OnInit } from '@angular/core'; import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; import { TranslateService } from '@ngx-translate/core'; @@ -32,7 +33,6 @@ import { Subscription } from 'rxjs'; import { SharedService } from 'SharedService'; import { UserData, UserDetail } from 'UserModel'; import { UsersActionComponent } from 'UsersActionComponent'; -import { isNullOrUndefined } from 'util'; /** * Creating component @@ -146,6 +146,7 @@ export class UserDetailsComponent implements OnInit, OnDestroy { /** on Navigate to Composer Page @public */ public composeUser(): void { + // eslint-disable-next-line security/detect-non-literal-fs-filename const modalRef: NgbModalRef = this.modalService.open(AddEditUserComponent, { backdrop: 'static' }); modalRef.componentInstance.userTitle = this.translateService.instant('PAGE.USERS.NEWUSER'); modalRef.componentInstance.userType = 'add'; @@ -153,7 +154,9 @@ export class UserDetailsComponent implements OnInit, OnDestroy { if (result) { this.sharedService.callData(); } - }).catch(); + }).catch((): void => { + // Catch Navigation Error + }); } /** smart table listing manipulation @private */ @@ -206,7 +209,9 @@ export class UserDetailsComponent implements OnInit, OnDestroy { } this.dataSource.load(this.userData).then((data: {}) => { this.isLoadingResults = false; - }).catch(); + }).catch((): void => { + // Catch Navigation Error + }); }, (error: ERRORDATA) => { this.restService.handleError(error, 'get'); this.isLoadingResults = false; diff --git a/src/app/utilities/change-password/ChangePasswordComponent.ts b/src/app/utilities/change-password/ChangePasswordComponent.ts index a2036ff..4c6aa5a 100644 --- a/src/app/utilities/change-password/ChangePasswordComponent.ts +++ b/src/app/utilities/change-password/ChangePasswordComponent.ts @@ -59,6 +59,7 @@ export class ChangePasswordComponent implements OnInit { /** Lifecyle Hooks the trigger before component is instantiate @public */ public ngOnInit(): void { + // eslint-disable-next-line security/detect-non-literal-fs-filename const modalRef: NgbModalRef = this.modalService.open(AddEditUserComponent, { backdrop: 'static', keyboard: false }); modalRef.componentInstance.userID = localStorage.getItem('user_id'); if (this.editType === 'changePassword') { @@ -72,5 +73,4 @@ export class ChangePasswordComponent implements OnInit { }).catch((err: Error): void => { // catch error }); } - } diff --git a/src/app/utilities/change-password/ChangePasswordModule.ts b/src/app/utilities/change-password/ChangePasswordModule.ts index bd64f9e..6c0524a 100644 --- a/src/app/utilities/change-password/ChangePasswordModule.ts +++ b/src/app/utilities/change-password/ChangePasswordModule.ts @@ -32,8 +32,7 @@ import { LoaderModule } from 'LoaderModule'; @NgModule({ imports: [CommonModule, TranslateModule, FormsModule, ReactiveFormsModule, NgSelectModule, LoaderModule], declarations: [AddEditUserComponent], - exports: [AddEditUserComponent], - entryComponents: [AddEditUserComponent] + exports: [AddEditUserComponent] }) /** Exporting a class @exports ChangePasswordModule */ export class ChangePasswordModule { diff --git a/src/app/utilities/clone-package/ClonePackageComponent.ts b/src/app/utilities/clone-package/ClonePackageComponent.ts index 125a726..02db8d8 100644 --- a/src/app/utilities/clone-package/ClonePackageComponent.ts +++ b/src/app/utilities/clone-package/ClonePackageComponent.ts @@ -163,7 +163,6 @@ export class ClonePackageComponent implements OnInit { url: this.endPoint, httpOptions: { headers: apiHeader } }; - // tslint:disable-next-line: completed-docs this.restService.postResource(apiURLHeader, content).subscribe((result: { id: string }): void => { this.activeModal.close(modalData); this.isLoadingResults = false; diff --git a/src/app/utilities/compose-packages/ComposePackages.ts b/src/app/utilities/compose-packages/ComposePackages.ts index c621215..6f2a031 100644 --- a/src/app/utilities/compose-packages/ComposePackages.ts +++ b/src/app/utilities/compose-packages/ComposePackages.ts @@ -34,7 +34,7 @@ import { RestService } from 'RestService'; import { SharedService } from 'SharedService'; /** This is added globally by the tar.js library */ -// tslint:disable-next-line: no-any +// eslint-disable-next-line @typescript-eslint/no-explicit-any declare const Tar: any; /** @@ -46,6 +46,7 @@ declare const Tar: any; styleUrls: ['./ComposePackages.scss'] }) /** Exporting a class @exports ComposePackages */ +// eslint-disable-next-line @angular-eslint/component-class-suffix export class ComposePackages implements OnInit { /** Invoke service injectors @public */ public injector: Injector; @@ -148,7 +149,7 @@ export class ComposePackages implements OnInit { } const descriptor: string = this.packageYaml(this.params.page); try { - // tslint:disable-next-line: no-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any const tar: any = new Tar(); const out: Uint8Array = tar.append(this.packagesForm.value.name + '/' + this.packagesForm.value.name + '.yaml', descriptor, { type: '0' }); @@ -166,7 +167,6 @@ export class ComposePackages implements OnInit { url: this.endPoint, httpOptions: { headers: this.headers } }; - // tslint:disable-next-line: completed-docs this.restService.postResource(apiURLHeader, packageContent).subscribe((result: { id: string }): void => { this.isLoadingResults = false; this.activeModal.close(); diff --git a/src/app/utilities/confirmation-topology/ConfirmationTopologyComponent.ts b/src/app/utilities/confirmation-topology/ConfirmationTopologyComponent.ts index a1a79b9..de9dac2 100644 --- a/src/app/utilities/confirmation-topology/ConfirmationTopologyComponent.ts +++ b/src/app/utilities/confirmation-topology/ConfirmationTopologyComponent.ts @@ -98,5 +98,4 @@ export class ConfirmationTopologyComponent implements OnInit { }; this.activeModal.close(modalData); } - } diff --git a/src/app/utilities/dragDropUpload/DragDirective.ts b/src/app/utilities/dragDropUpload/DragDirective.ts index 735ac7c..d052b3f 100644 --- a/src/app/utilities/dragDropUpload/DragDirective.ts +++ b/src/app/utilities/dragDropUpload/DragDirective.ts @@ -31,7 +31,6 @@ export interface FileHandle { * Creating Directive * @Directive for handling the files. */ -// tslint:disable-next-line:export-name @Directive({ selector: '[appDrag]' }) @@ -77,6 +76,7 @@ export class DragDirective { const files: FileHandle[] = []; Array.from(evt.dataTransfer.files).forEach((listFiles: File, index: number) => { const file: File = listFiles; + // eslint-disable-next-line @microsoft/sdl/no-angular-bypass-sanitizer const url: SafeUrl = this.sanitizer.bypassSecurityTrustUrl(window.URL.createObjectURL(file)); files.push({ file, url }); }); diff --git a/src/app/utilities/edit-packages/EditPackagesComponent.ts b/src/app/utilities/edit-packages/EditPackagesComponent.ts index e38d3cf..42998b8 100644 --- a/src/app/utilities/edit-packages/EditPackagesComponent.ts +++ b/src/app/utilities/edit-packages/EditPackagesComponent.ts @@ -90,6 +90,7 @@ export class EditPackagesComponent implements OnInit { /** options @public */ public options: {} = { + // eslint-disable-next-line no-invalid-this mode: this.modeDefault, showCursorWhenSelecting: true, autofocus: true, @@ -172,9 +173,7 @@ export class EditPackagesComponent implements OnInit { Accept: 'text/plain', 'Cache-Control': 'no-cache, no-store, must-revalidate, max-age=0' }); - // tslint:disable-next-line: no-backbone-get-set-outside-model this.paramsID = this.activatedRoute.snapshot.paramMap.get('id'); - // tslint:disable-next-line: no-backbone-get-set-outside-model this.pacakgeType = this.activatedRoute.snapshot.paramMap.get('type'); this.generateURLPath(); } @@ -254,9 +253,13 @@ export class EditPackagesComponent implements OnInit { (packageType !== 'netslice') ? 'PAGE.NSPACKAGE.EDITPACKAGES.UPDATEDSUCCESSFULLY' : 'PAGE.NETSLICE.UPDATEDSUCCESSFULLY')); if (showgraph) { if (packageType === 'nsd') { - this.router.navigate(['/packages/ns/compose/' + this.paramsID]).catch(); + this.router.navigate(['/packages/ns/compose/' + this.paramsID]).catch((): void => { + // Catch Navigation Error + }); } else if (packageType === 'vnf') { - this.router.navigate(['/packages/vnf/compose/' + this.paramsID]).catch(); + this.router.navigate(['/packages/vnf/compose/' + this.paramsID]).catch((): void => { + // Catch Navigation Error + }); } } this.getEditFileData(); @@ -301,14 +304,15 @@ export class EditPackagesComponent implements OnInit { this.restService.getResource(this.getUpdateURL + '/' + this.paramsID + '/' + this.getFileContentType, httpOptions) .subscribe((nsData: NSDDetails[]) => { const getJson: string = jsyaml.load(nsData.toString(), { json: true }); - //tslint:disable-next-line:no-string-literal this.defaults['text/x-yaml'] = nsData.toString(); this.defaults['text/json'] = JSON.stringify(getJson, null, '\t'); this.isLoadingResults = false; }, (error: ERRORDATA) => { error.error = typeof error.error === 'string' ? jsyaml.load(error.error) : error.error; if (error.error.status === HttpStatus.NOT_FOUND || error.error.status === HttpStatus.UNAUTHORIZED ) { - this.router.navigateByUrl('404', { skipLocationChange: true }).catch(); + this.router.navigateByUrl('404', { skipLocationChange: true }).catch((): void => { + // Catch Navigation Error + }); } else { this.restService.handleError(error, 'get'); } diff --git a/src/app/utilities/loader/LoaderComponent.ts b/src/app/utilities/loader/LoaderComponent.ts index ee8cab8..4190a7d 100644 --- a/src/app/utilities/loader/LoaderComponent.ts +++ b/src/app/utilities/loader/LoaderComponent.ts @@ -46,5 +46,4 @@ export class LoaderComponent implements OnInit { this.getMessage = ''; } } - } diff --git a/src/app/utilities/loader/LoaderModule.ts b/src/app/utilities/loader/LoaderModule.ts index ba81b6a..e235be0 100644 --- a/src/app/utilities/loader/LoaderModule.ts +++ b/src/app/utilities/loader/LoaderModule.ts @@ -35,7 +35,7 @@ export class LoaderModule { /** * Lifecyle Hooks the trigger before component is instantiate */ - public ngOnInit(): void { - // Empty Block + constructor() { + //Empty } } diff --git a/src/app/utilities/netslice-instances-action/NetsliceInstancesActionComponent.ts b/src/app/utilities/netslice-instances-action/NetsliceInstancesActionComponent.ts index 0e528a8..ab7d51f 100644 --- a/src/app/utilities/netslice-instances-action/NetsliceInstancesActionComponent.ts +++ b/src/app/utilities/netslice-instances-action/NetsliceInstancesActionComponent.ts @@ -69,6 +69,7 @@ export class NetsliceInstancesActionComponent { /** Shows information using modalservice @public */ public infoNetSliceInstance(): void { + // eslint-disable-next-line security/detect-non-literal-fs-filename this.modalService.open(ShowInfoComponent, { backdrop: 'static' }).componentInstance.params = { id: this.instanceID, page: 'net-slice-instance', @@ -78,13 +79,16 @@ export class NetsliceInstancesActionComponent { /** Delete NetSlice Instance packages @public */ public deleteNetSliceInstance(forceAction: boolean): void { + // eslint-disable-next-line security/detect-non-literal-fs-filename const modalRef: NgbModalRef = this.modalService.open(DeleteComponent, { backdrop: 'static' }); modalRef.componentInstance.params = {forceDeleteType: forceAction}; modalRef.result.then((result: MODALCLOSERESPONSEDATA) => { if (result) { this.sharedService.callData(); } - }).catch(); + }).catch((): void => { + // Catch Navigation Error + }); } /** History of operations for an Instanace @public */ public historyOfOperations(): void { diff --git a/src/app/utilities/netslice-packages-action/NetslicePackagesActionComponent.ts b/src/app/utilities/netslice-packages-action/NetslicePackagesActionComponent.ts index 8be5f50..78e6e51 100644 --- a/src/app/utilities/netslice-packages-action/NetslicePackagesActionComponent.ts +++ b/src/app/utilities/netslice-packages-action/NetslicePackagesActionComponent.ts @@ -71,16 +71,20 @@ export class NetslicePackagesActionComponent { /** Delete NetSliceTemplate packages @public */ public deleteNetSliceTemplate(): void { + // eslint-disable-next-line security/detect-non-literal-fs-filename const modalRef: NgbModalRef = this.modalService.open(DeleteComponent, {backdrop: 'static'}); modalRef.result.then((result: MODALCLOSERESPONSEDATA) => { if (result) { this.sharedService.callData(); } - }).catch(); + }).catch((): void => { + // Catch Navigation Error + }); } /** Shows information using modalservice @public */ public infoNetSlice(): void { + // eslint-disable-next-line security/detect-non-literal-fs-filename this.modalService.open(ShowInfoComponent, { backdrop: 'static' }).componentInstance.params = { id: this.instanceID, page: 'net-slice-package', @@ -97,6 +101,7 @@ export class NetslicePackagesActionComponent { /** Instantiate Net Slice using modalservice @public */ public instantiateNetSlice(): void { + // eslint-disable-next-line security/detect-non-literal-fs-filename this.modalService.open(InstantiateNetSliceTemplateComponent, { backdrop: 'static' }); } } diff --git a/src/app/utilities/ns-instances-action/NSInstancesActionComponent.html b/src/app/utilities/ns-instances-action/NSInstancesActionComponent.html index 3ac6a60..517dbde 100644 --- a/src/app/utilities/ns-instances-action/NSInstancesActionComponent.html +++ b/src/app/utilities/ns-instances-action/NSInstancesActionComponent.html @@ -29,7 +29,7 @@ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.i
-