From 35f307abfb7910c763563c85e1077efa0d643838 Mon Sep 17 00:00:00 2001 From: Kimonas Sotirchos Date: Thu, 8 Apr 2021 13:51:02 +0300 Subject: [PATCH] Add CI format checks for the Jupyter web app (kubeflow/kubeflow#5811) * jwa(front): Add npm rule for checking the format Signed-off-by: Kimonas Sotirchos * ci: Add common tasks for format checks Signed-off-by: Kimonas Sotirchos * ci(jwa): Add format check tasks Signed-off-by: Kimonas Sotirchos * jwa(back): Fix formatting Signed-off-by: Kimonas Sotirchos * jwa(front): Fix formatting Run `npm run format:write` on frontend Signed-off-by: Kimonas Sotirchos * jwa(front): Include prettier in package.json Signed-off-by: Kimonas Sotirchos * jwa(docker): Don't copy node_modules in Dockerfile Signed-off-by: Kimonas Sotirchos * web-apps: Add global dockerignore file Signed-off-by: Kimonas Sotirchos * jwa: Remove unused dockerignore file Signed-off-by: Kimonas Sotirchos * jwa(make): Don't include dockerignore and cleanup Signed-off-by: Kimonas Sotirchos --- notebooks/crud-web-apps/.dockerignore | 2 + notebooks/crud-web-apps/jupyter/Dockerfile | 13 ++- .../jupyter/Dockerfile.dockerignore | 11 --- notebooks/crud-web-apps/jupyter/Makefile | 55 +---------- .../jupyter/backend/apps/common/form.py | 18 ++-- .../backend/apps/common/routes/__init__.py | 2 +- .../backend/apps/default/routes/__init__.py | 2 +- .../backend/apps/default/routes/post.py | 3 +- .../jupyter/backend/apps/rok/routes/post.py | 3 +- .../jupyter/backend/entrypoint.py | 2 +- .../jupyter/frontend/package-lock.json | 6 ++ .../jupyter/frontend/package.json | 5 +- .../frontend/scripts/check-format-error.js | 6 ++ .../frontend/src/app/app-routing.module.ts | 2 +- .../frontend/src/app/app.component.spec.ts | 12 +-- .../jupyter/frontend/src/app/app.component.ts | 2 +- .../form-advanced-options.component.spec.ts | 10 +- ...orm-affinity-tolerations.component.spec.ts | 5 +- .../form-affinity-tolerations.component.ts | 8 +- .../form-configurations.component.spec.ts | 5 +- .../form-cpu-ram.component.spec.ts | 5 +- .../form-data-volumes.component.spec.ts | 10 +- .../form-default/form-default.component.html | 4 +- .../form-default.component.spec.ts | 5 +- .../form-default/form-default.component.ts | 10 +- .../form-gpus/form-gpus.component.spec.ts | 5 +- .../form-image/form-image.component.html | 98 +++++++++++-------- .../form-image/form-image.component.scss | 8 +- .../form-image/form-image.component.spec.ts | 10 +- .../form-image/form-image.component.ts | 32 ++++-- .../form-name/form-name.component.spec.ts | 10 +- .../form-workspace-volume.component.spec.ts | 10 +- .../volume/volume.component.spec.ts | 10 +- .../form/form-rok/form-rok.component.html | 4 +- .../form/form-rok/form-rok.component.spec.ts | 5 +- .../pages/form/form-rok/form-rok.component.ts | 3 +- .../rok-form-configurations.component.spec.ts | 5 +- .../rok-form-configurations.component.ts | 3 +- .../rok-form-data-volumes.component.spec.ts | 5 +- .../rok-form-data-volumes.component.ts | 4 +- ...ok-form-workspace-volume.component.spec.ts | 5 +- ...rok-jupyter-lab-selector.component.spec.ts | 5 +- .../rok-volume/rok-volume.component.spec.ts | 5 +- .../src/app/pages/form/form-rok/utils.ts | 10 +- .../src/app/pages/form/form.component.spec.ts | 5 +- .../app/pages/index/index-default/config.ts | 2 +- .../index-default.component.spec.ts | 5 +- .../server-type/server-type.component.html | 22 ++++- .../server-type/server-type.component.spec.ts | 5 +- .../server-type/server-type.component.ts | 22 +++-- .../index-rok/index-rok.component.spec.ts | 5 +- .../app/pages/index/index.component.spec.ts | 5 +- .../src/app/pages/index/index.module.ts | 10 +- .../jupyter/frontend/src/main.ts | 3 +- .../jupyter/frontend/src/polyfills.ts | 3 +- .../jupyter/frontend/src/test.ts | 10 +- 56 files changed, 270 insertions(+), 270 deletions(-) create mode 100644 notebooks/crud-web-apps/.dockerignore delete mode 100644 notebooks/crud-web-apps/jupyter/Dockerfile.dockerignore create mode 100644 notebooks/crud-web-apps/jupyter/frontend/scripts/check-format-error.js diff --git a/notebooks/crud-web-apps/.dockerignore b/notebooks/crud-web-apps/.dockerignore new file mode 100644 index 00000000..7e929bb0 --- /dev/null +++ b/notebooks/crud-web-apps/.dockerignore @@ -0,0 +1,2 @@ +**/node_modules/* +**/__pycache__/* diff --git a/notebooks/crud-web-apps/jupyter/Dockerfile b/notebooks/crud-web-apps/jupyter/Dockerfile index e3affa65..db95f25c 100644 --- a/notebooks/crud-web-apps/jupyter/Dockerfile +++ b/notebooks/crud-web-apps/jupyter/Dockerfile @@ -11,8 +11,9 @@ FROM node:12-buster-slim as frontend-kubeflow-lib WORKDIR /src +ENV NG_CLI_ANALYTICS "ci" COPY ./common/frontend/kubeflow-common-lib/package*.json ./ -RUN npm install +RUN npm ci COPY ./common/frontend/kubeflow-common-lib/ . RUN npm run build @@ -21,11 +22,15 @@ RUN npm run build FROM node:12-buster-slim as frontend WORKDIR /src + COPY ./jupyter/frontend/package*.json ./ -RUN npm install -COPY --from=frontend-kubeflow-lib /src/dist/kubeflow/ ./node_modules/kubeflow/ +COPY ./jupyter/frontend/tsconfig*.json ./ +COPY ./jupyter/frontend/angular.json ./ +COPY ./jupyter/frontend/src ./src -COPY ./jupyter/frontend/ . +ENV NG_CLI_ANALYTICS "ci" +RUN npm ci +COPY --from=frontend-kubeflow-lib /src/dist/kubeflow/ ./node_modules/kubeflow/ RUN npm run build -- --output-path=./dist/default --configuration=production RUN npm run build -- --output-path=./dist/rok --configuration=rok-prod diff --git a/notebooks/crud-web-apps/jupyter/Dockerfile.dockerignore b/notebooks/crud-web-apps/jupyter/Dockerfile.dockerignore deleted file mode 100644 index ae4bb9e8..00000000 --- a/notebooks/crud-web-apps/jupyter/Dockerfile.dockerignore +++ /dev/null @@ -1,11 +0,0 @@ -# See: https://github.com/moby/moby/issues/12886#issuecomment-480575928 -# Ignore everything and node_modules -** -# -# Don't ignore the necessary files for the app -!common/ -!jupyter/ - -# Ignore node_modules and pycache inside accepted dirs -**/node_modules/* -**/__pycache__/* diff --git a/notebooks/crud-web-apps/jupyter/Makefile b/notebooks/crud-web-apps/jupyter/Makefile index 09ccbbcc..c3b32744 100644 --- a/notebooks/crud-web-apps/jupyter/Makefile +++ b/notebooks/crud-web-apps/jupyter/Makefile @@ -1,58 +1,9 @@ -# Copyright 2017 The Kubernetes Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# Project used with GCB -PROJECT ?= kubeflow-dev -# Registry where the image should be published -REGISTRY_PROJECT ?= kubeflow-dev -OUTPUT ?= output.yaml - -# We want the git tag to be the last commit to this directory so we don't -# bump the image on unrelated changes. -GIT_TAG ?= $(shell git log -n 1 --pretty=format:"%h" ./) - -IMG ?= gcr.io/${REGISTRY_PROJECT}/jupyter-web-app - +GIT_TAG ?= $(shell git describe --tags --always) +IMG ?= public.ecr.aws/j1r0q0g6/notebooks/jupyter-web-app DOCKERFILE ?= jupyter/Dockerfile -info: - echo image: \"gcr.io/$(REGISTRY_PROJECT)/jupyter-web-app:$(GIT_TAG)\" > $(OUTPUT) - -# TODO(kimwnasptd): we will need to update the gcb scripts to be able to use a -# different context. The web app should be build from the context: -# components/crud-web-apps in order to have access to both the web app's code -# as well as the common code. -build-gcb: info - gcloud --project=$(PROJECT) \ - builds submit \ - --machine-type=n1-highcpu-32 \ - --substitutions=_GIT_VERSION=$(GIT_TAG),_REGISTRY=$(REGISTRY_PROJECT) \ - --config=cloudbuild.yaml . - -build-gcb-win: info - cmd /c gcloud --project=$(PROJECT) \ - builds submit \ - --machine-type=n1-highcpu-32 \ - --substitutions=_GIT_VERSION=$(GIT_TAG),_REGISTRY=$(REGISTRY_PROJECT) \ - --config=cloudbuild.yaml . - docker-build: - cp Dockerfile.dockerignore ../.dockerignore - -cd ../ && docker build -t ${IMG}:${GIT_TAG} -f ${DOCKERFILE} . - rm ../.dockerignore - + cd ../ && docker build -t ${IMG}:${GIT_TAG} -f ${DOCKERFILE} . docker-push: docker push $(IMG):$(GIT_TAG) diff --git a/notebooks/crud-web-apps/jupyter/backend/apps/common/form.py b/notebooks/crud-web-apps/jupyter/backend/apps/common/form.py index 941011a7..36cfd0fb 100644 --- a/notebooks/crud-web-apps/jupyter/backend/apps/common/form.py +++ b/notebooks/crud-web-apps/jupyter/backend/apps/common/form.py @@ -8,6 +8,10 @@ log = logging.getLogger(__name__) +SERVER_TYPE_ANNOTATION = "notebooks.kubeflow.org/server-type" +HEADERS_ANNOTATION = "notebooks.kubeflow.org/http-headers-request-set" +URI_REWRITE_ANNOTATION = "notebooks.kubeflow.org/http-rewrite-uri" + def get_form_value(body, defaults, body_field, defaults_field=None): """ @@ -139,20 +143,20 @@ def set_server_type(notebook, body, defaults): valid_server_types = ["jupyter", "vs-code", "rstudio"] notebook_annotations = notebook["metadata"]["annotations"] server_type = get_form_value(body, defaults, "serverType") - if server_type == "" : + if server_type == "": server_type == "jupyter" if server_type not in valid_server_types: - raise BadRequest("'%s' is not a valid server type" % server_type) + raise BadRequest("'%s' is not a valid server type" % server_type) nb_name = get_form_value(body, defaults, "name") nb_ns = get_form_value(body, defaults, "namespace") - rstudio_header = ('{"X-RStudio-Root-Path":"/notebook/%s/%s/"}' % (nb_ns, nb_name)) - - notebook_annotations["notebooks.kubeflow.org/server-type"] = server_type + rstudio_header = '{"X-RStudio-Root-Path":"/notebook/%s/%s/"}' % (nb_ns, + nb_name) + notebook_annotations[SERVER_TYPE_ANNOTATION] = server_type if server_type == "vs-code" or server_type == "rstudio": - notebook_annotations["notebooks.kubeflow.org/http-rewrite-uri"] = "/" + notebook_annotations[URI_REWRITE_ANNOTATION] = "/" if server_type == "rstudio": - notebook_annotations["notebooks.kubeflow.org/http-headers-request-set"] = rstudio_header + notebook_annotations[HEADERS_ANNOTATION] = rstudio_header def set_notebook_cpu(notebook, body, defaults): diff --git a/notebooks/crud-web-apps/jupyter/backend/apps/common/routes/__init__.py b/notebooks/crud-web-apps/jupyter/backend/apps/common/routes/__init__.py index b0f7a50b..5857c0ba 100644 --- a/notebooks/crud-web-apps/jupyter/backend/apps/common/routes/__init__.py +++ b/notebooks/crud-web-apps/jupyter/backend/apps/common/routes/__init__.py @@ -2,4 +2,4 @@ bp = Blueprint("base_routes", __name__) -from . import get, delete, patch # noqa: F401 +from . import delete, get, patch # noqa: F401, E402 diff --git a/notebooks/crud-web-apps/jupyter/backend/apps/default/routes/__init__.py b/notebooks/crud-web-apps/jupyter/backend/apps/default/routes/__init__.py index f4ea431b..0ad20901 100644 --- a/notebooks/crud-web-apps/jupyter/backend/apps/default/routes/__init__.py +++ b/notebooks/crud-web-apps/jupyter/backend/apps/default/routes/__init__.py @@ -2,4 +2,4 @@ bp = Blueprint("default_routes", __name__) -from . import post # noqa: F401 +from . import post # noqa: F401, E402 diff --git a/notebooks/crud-web-apps/jupyter/backend/apps/default/routes/post.py b/notebooks/crud-web-apps/jupyter/backend/apps/default/routes/post.py index a22fa5cd..0827c342 100644 --- a/notebooks/crud-web-apps/jupyter/backend/apps/default/routes/post.py +++ b/notebooks/crud-web-apps/jupyter/backend/apps/default/routes/post.py @@ -1,7 +1,6 @@ from flask import request -from kubeflow.kubeflow.crud_backend import (api, decorators, helpers, - logging) +from kubeflow.kubeflow.crud_backend import api, decorators, helpers, logging from ...common import form, utils from . import bp diff --git a/notebooks/crud-web-apps/jupyter/backend/apps/rok/routes/post.py b/notebooks/crud-web-apps/jupyter/backend/apps/rok/routes/post.py index acd0e0ac..d36650b1 100644 --- a/notebooks/crud-web-apps/jupyter/backend/apps/rok/routes/post.py +++ b/notebooks/crud-web-apps/jupyter/backend/apps/rok/routes/post.py @@ -1,7 +1,6 @@ from flask import request -from kubeflow.kubeflow.crud_backend import (api, decorators, helpers, - logging) +from kubeflow.kubeflow.crud_backend import api, decorators, helpers, logging from ...common import form, utils from ..utils import common as rok_common diff --git a/notebooks/crud-web-apps/jupyter/backend/entrypoint.py b/notebooks/crud-web-apps/jupyter/backend/entrypoint.py index 88b14dda..a26fde42 100755 --- a/notebooks/crud-web-apps/jupyter/backend/entrypoint.py +++ b/notebooks/crud-web-apps/jupyter/backend/entrypoint.py @@ -18,7 +18,7 @@ def get_config(mode): cfg_class = config_classes.get(mode) if not cfg_class: raise RuntimeError("Backend mode '%s' is not implemented. Choose one" - " of %s" % (mode, list(config_classes.keys()))) + " of %s" % (mode, list(config_classes.keys()))) return cfg_class() diff --git a/notebooks/crud-web-apps/jupyter/frontend/package-lock.json b/notebooks/crud-web-apps/jupyter/frontend/package-lock.json index 3df97888..78474c8b 100644 --- a/notebooks/crud-web-apps/jupyter/frontend/package-lock.json +++ b/notebooks/crud-web-apps/jupyter/frontend/package-lock.json @@ -8624,6 +8624,12 @@ "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", "dev": true }, + "prettier": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz", + "integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==", + "dev": true + }, "private": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", diff --git a/notebooks/crud-web-apps/jupyter/frontend/package.json b/notebooks/crud-web-apps/jupyter/frontend/package.json index 833c44fb..cec967ee 100644 --- a/notebooks/crud-web-apps/jupyter/frontend/package.json +++ b/notebooks/crud-web-apps/jupyter/frontend/package.json @@ -8,6 +8,8 @@ "build:watch": "npm run copyLibAssets && ng build --watch --deploy-url static/ --outputPath ../backend/apps/default/static/ --outputHashing all", "build:watch:rok": "npm run copyLibAssets && ng build --watch --deploy-url static/ --outputPath ../backend/apps/rok/static/ --outputHashing all --configuration=rok", "copyLibAssets": "cp ./node_modules/kubeflow/assets/* ./src/assets/", + "format:check": "prettier --check 'src/**/*.{js,ts,html,scss,css}' || node scripts/check-format-error.js", + "format:write": "prettier --write 'src/**/*.{js,ts,html,scss,css}'", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" @@ -45,9 +47,9 @@ "@angular/cli": "~8.3.20", "@angular/compiler-cli": "~8.2.14", "@angular/language-service": "~8.2.14", - "@types/node": "^12.11.1", "@types/jasmine": "~3.5.0", "@types/jasminewd2": "~2.0.3", + "@types/node": "^12.11.1", "codelyzer": "^5.1.2", "jasmine-core": "~3.5.0", "jasmine-spec-reporter": "~4.2.1", @@ -56,6 +58,7 @@ "karma-coverage-istanbul-reporter": "~2.1.0", "karma-jasmine": "~2.0.1", "karma-jasmine-html-reporter": "^1.4.2", + "prettier": "^2.2.1", "protractor": "~5.4.3", "ts-node": "~8.3.0", "tslint": "~5.18.0", diff --git a/notebooks/crud-web-apps/jupyter/frontend/scripts/check-format-error.js b/notebooks/crud-web-apps/jupyter/frontend/scripts/check-format-error.js new file mode 100644 index 00000000..476196e2 --- /dev/null +++ b/notebooks/crud-web-apps/jupyter/frontend/scripts/check-format-error.js @@ -0,0 +1,6 @@ +console.error(); +console.error('-----------------------------------------------'); +console.error('Please run `npm run format:write` to format your code.'); +console.error('-----------------------------------------------'); +console.error(); +process.exit(1); diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/app-routing.module.ts b/notebooks/crud-web-apps/jupyter/frontend/src/app/app-routing.module.ts index e71cbc9e..46762f6d 100644 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/app-routing.module.ts +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/app-routing.module.ts @@ -6,7 +6,7 @@ import { FormComponent } from './pages/form/form.component'; const routes: Routes = [ { path: '', component: IndexComponent }, - { path: 'new', component: FormComponent}, + { path: 'new', component: FormComponent }, ]; @NgModule({ diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/app.component.spec.ts b/notebooks/crud-web-apps/jupyter/frontend/src/app/app.component.spec.ts index 7ac67f8f..e4e519a4 100644 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/app.component.spec.ts +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/app.component.spec.ts @@ -5,12 +5,8 @@ import { AppComponent } from './app.component'; describe('AppComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - imports: [ - RouterTestingModule - ], - declarations: [ - AppComponent - ], + imports: [RouterTestingModule], + declarations: [AppComponent], }).compileComponents(); })); @@ -30,6 +26,8 @@ describe('AppComponent', () => { const fixture = TestBed.createComponent(AppComponent); fixture.detectChanges(); const compiled = fixture.nativeElement; - expect(compiled.querySelector('.content span').textContent).toContain('frontend app is running!'); + expect(compiled.querySelector('.content span').textContent).toContain( + 'frontend app is running!', + ); }); }); diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/app.component.ts b/notebooks/crud-web-apps/jupyter/frontend/src/app/app.component.ts index 0c5a793f..23b53ae6 100644 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/app.component.ts +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/app.component.ts @@ -3,7 +3,7 @@ import { Component } from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html', - styleUrls: ['./app.component.scss'] + styleUrls: ['./app.component.scss'], }) export class AppComponent { title = 'frontend'; diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-advanced-options/form-advanced-options.component.spec.ts b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-advanced-options/form-advanced-options.component.spec.ts index f1f79fac..8fd2b342 100755 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-advanced-options/form-advanced-options.component.spec.ts +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-advanced-options/form-advanced-options.component.spec.ts @@ -1,14 +1,14 @@ -import { async, ComponentFixture, TestBed } from "@angular/core/testing"; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { FormAdvancedOptionsComponent } from "./form-advanced-options.component"; +import { FormAdvancedOptionsComponent } from './form-advanced-options.component'; -describe("FormAdvancedOptionsComponent", () => { +describe('FormAdvancedOptionsComponent', () => { let component: FormAdvancedOptionsComponent; let fixture: ComponentFixture; beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [FormAdvancedOptionsComponent] + declarations: [FormAdvancedOptionsComponent], }).compileComponents(); })); @@ -18,7 +18,7 @@ describe("FormAdvancedOptionsComponent", () => { fixture.detectChanges(); }); - it("should create", () => { + it('should create', () => { expect(component).toBeTruthy(); }); }); diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-affinity-tolerations/form-affinity-tolerations.component.spec.ts b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-affinity-tolerations/form-affinity-tolerations.component.spec.ts index 28684958..080684b2 100644 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-affinity-tolerations/form-affinity-tolerations.component.spec.ts +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-affinity-tolerations/form-affinity-tolerations.component.spec.ts @@ -8,9 +8,8 @@ describe('FormAffinityTolerationsComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ FormAffinityTolerationsComponent ] - }) - .compileComponents(); + declarations: [FormAffinityTolerationsComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-affinity-tolerations/form-affinity-tolerations.component.ts b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-affinity-tolerations/form-affinity-tolerations.component.ts index d581a8b6..420d2662 100644 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-affinity-tolerations/form-affinity-tolerations.component.ts +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-affinity-tolerations/form-affinity-tolerations.component.ts @@ -5,16 +5,14 @@ import { TolerationGroup, AffinityConfig } from 'src/app/types'; @Component({ selector: 'app-form-affinity-tolerations', templateUrl: './form-affinity-tolerations.component.html', - styleUrls: ['./form-affinity-tolerations.component.scss'] + styleUrls: ['./form-affinity-tolerations.component.scss'], }) export class FormAffinityTolerationsComponent implements OnInit { @Input() parentForm: FormGroup; @Input() tolerationGroups: TolerationGroup[]; @Input() affinityConfigs: AffinityConfig[]; - constructor() { } - - ngOnInit() { - } + constructor() {} + ngOnInit() {} } diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-configurations/form-configurations.component.spec.ts b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-configurations/form-configurations.component.spec.ts index d64ee721..8d71de1d 100644 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-configurations/form-configurations.component.spec.ts +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-configurations/form-configurations.component.spec.ts @@ -8,9 +8,8 @@ describe('FormConfigurationsComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ FormConfigurationsComponent ] - }) - .compileComponents(); + declarations: [FormConfigurationsComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-cpu-ram/form-cpu-ram.component.spec.ts b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-cpu-ram/form-cpu-ram.component.spec.ts index 02bedd5f..ff68e805 100644 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-cpu-ram/form-cpu-ram.component.spec.ts +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-cpu-ram/form-cpu-ram.component.spec.ts @@ -8,9 +8,8 @@ describe('FormCpuRamComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ FormCpuRamComponent ] - }) - .compileComponents(); + declarations: [FormCpuRamComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-data-volumes/form-data-volumes.component.spec.ts b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-data-volumes/form-data-volumes.component.spec.ts index e747f902..ac5ef35b 100755 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-data-volumes/form-data-volumes.component.spec.ts +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-data-volumes/form-data-volumes.component.spec.ts @@ -1,14 +1,14 @@ -import { async, ComponentFixture, TestBed } from "@angular/core/testing"; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { FormDataVolumesComponent } from "./form-data-volumes.component"; +import { FormDataVolumesComponent } from './form-data-volumes.component'; -describe("FormDataVolumesComponent", () => { +describe('FormDataVolumesComponent', () => { let component: FormDataVolumesComponent; let fixture: ComponentFixture; beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [FormDataVolumesComponent] + declarations: [FormDataVolumesComponent], }).compileComponents(); })); @@ -18,7 +18,7 @@ describe("FormDataVolumesComponent", () => { fixture.detectChanges(); }); - it("should create", () => { + it('should create', () => { expect(component).toBeTruthy(); }); }); diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-default.component.html b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-default.component.html index cf383be1..e6a9f307 100644 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-default.component.html +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-default.component.html @@ -63,8 +63,6 @@ LAUNCH - + diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-default.component.spec.ts b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-default.component.spec.ts index 8921be9c..821d2715 100644 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-default.component.spec.ts +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-default.component.spec.ts @@ -8,9 +8,8 @@ describe('FormDefaultComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ FormDefaultComponent ] - }) - .compileComponents(); + declarations: [FormDefaultComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-default.component.ts b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-default.component.ts index 0fddd350..97f30136 100644 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-default.component.ts +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-default.component.ts @@ -107,10 +107,12 @@ export class FormDefaultComponent implements OnInit, OnDestroy { // Use the custom image instead if (notebook.customImageCheck) { notebook.image = notebook.customImage; - } else if (notebook.serverType === 'vs-code') { // Set notebook image from imageVSCode - notebook.image = notebook.imageVSCode; - } else if (notebook.serverType === 'rstudio') { // Set notebook image from imageRStudio - notebook.image = notebook.imageRStudio; + } else if (notebook.serverType === 'vs-code') { + // Set notebook image from imageVSCode + notebook.image = notebook.imageVSCode; + } else if (notebook.serverType === 'rstudio') { + // Set notebook image from imageRStudio + notebook.image = notebook.imageRStudio; } // Remove unnecessary images from the request sent to the backend diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-gpus/form-gpus.component.spec.ts b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-gpus/form-gpus.component.spec.ts index e1236fa0..98b4afa6 100644 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-gpus/form-gpus.component.spec.ts +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-gpus/form-gpus.component.spec.ts @@ -8,9 +8,8 @@ describe('FormGpusComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ FormGpusComponent ] - }) - .compileComponents(); + declarations: [FormGpusComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-image/form-image.component.html b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-image/form-image.component.html index 089310dc..f23fb7a2 100755 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-image/form-image.component.html +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-image/form-image.component.html @@ -4,23 +4,34 @@ ML packages" icon="fa:fab:docker" > -
Custom Image - - + + - + @@ -29,7 +40,10 @@ Image @@ -45,40 +59,46 @@ - - Image - - - {{ img }} - - - Please provide and Image to use - + + Image + + + {{ img }} + + + Please provide and Image to use + - - -Image - - - {{ img }} - - -Please provide and Image to use - + + + Image + + + {{ img }} + + + Please provide and Image to use + { +describe('FormImageComponent', () => { let component: FormImageComponent; let fixture: ComponentFixture; beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [FormImageComponent] + declarations: [FormImageComponent], }).compileComponents(); })); @@ -18,7 +18,7 @@ describe("FormImageComponent", () => { fixture.detectChanges(); }); - it("should create", () => { + it('should create', () => { expect(component).toBeTruthy(); }); }); diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-image/form-image.component.ts b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-image/form-image.component.ts index 60389feb..9c143e6f 100755 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-image/form-image.component.ts +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-image/form-image.component.ts @@ -20,9 +20,18 @@ export class FormImageComponent implements OnInit, OnDestroy { subs = new Subscription(); constructor(iconRegistry: MatIconRegistry, sanitizer: DomSanitizer) { - iconRegistry.addSvgIcon('jupyterlab', sanitizer.bypassSecurityTrustResourceUrl(environment.jupyterlabLogo)); - iconRegistry.addSvgIcon('vs-code', sanitizer.bypassSecurityTrustResourceUrl(environment.vscodeLogo)); - iconRegistry.addSvgIcon('rstudio', sanitizer.bypassSecurityTrustResourceUrl(environment.rstudioLogo)); + iconRegistry.addSvgIcon( + 'jupyterlab', + sanitizer.bypassSecurityTrustResourceUrl(environment.jupyterlabLogo), + ); + iconRegistry.addSvgIcon( + 'vs-code', + sanitizer.bypassSecurityTrustResourceUrl(environment.vscodeLogo), + ); + iconRegistry.addSvgIcon( + 'rstudio', + sanitizer.bypassSecurityTrustResourceUrl(environment.rstudioLogo), + ); } ngOnInit() { @@ -36,27 +45,30 @@ export class FormImageComponent implements OnInit, OnDestroy { this.parentForm.get('imageRStudio').setValidators([]); } this.parentForm.get('serverType').valueChanges.subscribe(selection => { - if (selection === "jupyter") { + if (selection === 'jupyter') { this.parentForm.get('customImage').setValidators([]); this.parentForm.get('image').setValidators(Validators.required); this.parentForm.get('imageVSCode').setValidators([]); this.parentForm.get('imageRStudio').setValidators([]); - } else if (selection === "vs-code") { + } else if (selection === 'vs-code') { this.parentForm.get('customImage').setValidators([]); this.parentForm.get('image').setValidators([]); - this.parentForm.get('imageVSCode').setValidators(Validators.required); + this.parentForm + .get('imageVSCode') + .setValidators(Validators.required); this.parentForm.get('imageRStudio').setValidators([]); - } else if (selection === "rstudio") { + } else if (selection === 'rstudio') { this.parentForm.get('customImage').setValidators([]); this.parentForm.get('image').setValidators([]); this.parentForm.get('imageVSCode').setValidators([]); - this.parentForm.get('imageRStudio').setValidators(Validators.required); + this.parentForm + .get('imageRStudio') + .setValidators(Validators.required); } this.parentForm.get('image').updateValueAndValidity(); this.parentForm.get('imageVSCode').updateValueAndValidity(); this.parentForm.get('imageRStudio').updateValueAndValidity(); - - }) + }); this.parentForm.get('customImage').updateValueAndValidity(); this.parentForm.get('serverType').updateValueAndValidity(); }), diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-name/form-name.component.spec.ts b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-name/form-name.component.spec.ts index 1fab9719..2d7381ea 100755 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-name/form-name.component.spec.ts +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-name/form-name.component.spec.ts @@ -1,14 +1,14 @@ -import { async, ComponentFixture, TestBed } from "@angular/core/testing"; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { FormNameComponent } from "./form-name.component"; +import { FormNameComponent } from './form-name.component'; -describe("FormNameComponent", () => { +describe('FormNameComponent', () => { let component: FormNameComponent; let fixture: ComponentFixture; beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [FormNameComponent] + declarations: [FormNameComponent], }).compileComponents(); })); @@ -18,7 +18,7 @@ describe("FormNameComponent", () => { fixture.detectChanges(); }); - it("should create", () => { + it('should create', () => { expect(component).toBeTruthy(); }); }); diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-workspace-volume/form-workspace-volume.component.spec.ts b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-workspace-volume/form-workspace-volume.component.spec.ts index d191a93d..97bc731b 100755 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-workspace-volume/form-workspace-volume.component.spec.ts +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/form-workspace-volume/form-workspace-volume.component.spec.ts @@ -1,14 +1,14 @@ -import { async, ComponentFixture, TestBed } from "@angular/core/testing"; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { FormWorkspaceVolumeComponent } from "./form-workspace-volume.component"; +import { FormWorkspaceVolumeComponent } from './form-workspace-volume.component'; -describe("FormWorkspaceVolumeComponent", () => { +describe('FormWorkspaceVolumeComponent', () => { let component: FormWorkspaceVolumeComponent; let fixture: ComponentFixture; beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [FormWorkspaceVolumeComponent] + declarations: [FormWorkspaceVolumeComponent], }).compileComponents(); })); @@ -18,7 +18,7 @@ describe("FormWorkspaceVolumeComponent", () => { fixture.detectChanges(); }); - it("should create", () => { + it('should create', () => { expect(component).toBeTruthy(); }); }); diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/volume/volume.component.spec.ts b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/volume/volume.component.spec.ts index fee62035..f9971718 100755 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/volume/volume.component.spec.ts +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-default/volume/volume.component.spec.ts @@ -1,14 +1,14 @@ -import { async, ComponentFixture, TestBed } from "@angular/core/testing"; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { VolumeComponent } from "./volume.component"; +import { VolumeComponent } from './volume.component'; -describe("VolumeComponent", () => { +describe('VolumeComponent', () => { let component: VolumeComponent; let fixture: ComponentFixture; beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [VolumeComponent] + declarations: [VolumeComponent], }).compileComponents(); })); @@ -18,7 +18,7 @@ describe("VolumeComponent", () => { fixture.detectChanges(); }); - it("should create", () => { + it('should create', () => { expect(component).toBeTruthy(); }); }); diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/form-rok.component.html b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/form-rok.component.html index d53ddfe6..b7a44242 100644 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/form-rok.component.html +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/form-rok.component.html @@ -65,8 +65,6 @@ LAUNCH - +
diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/form-rok.component.spec.ts b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/form-rok.component.spec.ts index d3a03679..9cd55f3f 100644 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/form-rok.component.spec.ts +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/form-rok.component.spec.ts @@ -8,9 +8,8 @@ describe('FormRokComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ FormRokComponent ] - }) - .compileComponents(); + declarations: [FormRokComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/form-rok.component.ts b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/form-rok.component.ts index e1295410..9c5f6c11 100644 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/form-rok.component.ts +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/form-rok.component.ts @@ -24,7 +24,8 @@ import { FormDefaultComponent } from '../form-default/form-default.component'; '../form-default/form-default.component.scss', ], }) -export class FormRokComponent extends FormDefaultComponent +export class FormRokComponent + extends FormDefaultComponent implements OnInit, OnDestroy { env = environment; diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/rok-form-configurations/rok-form-configurations.component.spec.ts b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/rok-form-configurations/rok-form-configurations.component.spec.ts index 0d6c98aa..5e3097b8 100644 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/rok-form-configurations/rok-form-configurations.component.spec.ts +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/rok-form-configurations/rok-form-configurations.component.spec.ts @@ -8,9 +8,8 @@ describe('RokFormConfigurationsComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ RokFormConfigurationsComponent ] - }) - .compileComponents(); + declarations: [RokFormConfigurationsComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/rok-form-configurations/rok-form-configurations.component.ts b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/rok-form-configurations/rok-form-configurations.component.ts index b1b423ee..577c08b3 100644 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/rok-form-configurations/rok-form-configurations.component.ts +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/rok-form-configurations/rok-form-configurations.component.ts @@ -6,5 +6,6 @@ import { FormConfigurationsComponent } from '../../form-default/form-configurati templateUrl: './rok-form-configurations.component.html', styleUrls: ['./rok-form-configurations.component.scss'], }) -export class RokFormConfigurationsComponent extends FormConfigurationsComponent +export class RokFormConfigurationsComponent + extends FormConfigurationsComponent implements OnInit, OnDestroy {} diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/rok-form-data-volumes/rok-form-data-volumes.component.spec.ts b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/rok-form-data-volumes/rok-form-data-volumes.component.spec.ts index 9041ff56..b15ca1cf 100644 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/rok-form-data-volumes/rok-form-data-volumes.component.spec.ts +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/rok-form-data-volumes/rok-form-data-volumes.component.spec.ts @@ -8,9 +8,8 @@ describe('RokFormDataVolumesComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ RokFormDataVolumesComponent ] - }) - .compileComponents(); + declarations: [RokFormDataVolumesComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/rok-form-data-volumes/rok-form-data-volumes.component.ts b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/rok-form-data-volumes/rok-form-data-volumes.component.ts index e59f7827..88e997de 100644 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/rok-form-data-volumes/rok-form-data-volumes.component.ts +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/rok-form-data-volumes/rok-form-data-volumes.component.ts @@ -6,9 +6,7 @@ import { addRokDataVolume } from '../utils'; @Component({ selector: 'app-rok-form-data-volumes', templateUrl: './rok-form-data-volumes.component.html', - styleUrls: [ - './rok-form-data-volumes.component.scss', - ], + styleUrls: ['./rok-form-data-volumes.component.scss'], }) export class RokFormDataVolumesComponent implements OnInit { @Input() parentForm: FormGroup; diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/rok-form-workspace-volume/rok-form-workspace-volume.component.spec.ts b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/rok-form-workspace-volume/rok-form-workspace-volume.component.spec.ts index e9205b6d..bc58e419 100644 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/rok-form-workspace-volume/rok-form-workspace-volume.component.spec.ts +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/rok-form-workspace-volume/rok-form-workspace-volume.component.spec.ts @@ -8,9 +8,8 @@ describe('RokFormWorkspaceVolumeComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ RokFormWorkspaceVolumeComponent ] - }) - .compileComponents(); + declarations: [RokFormWorkspaceVolumeComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/rok-jupyter-lab-selector/rok-jupyter-lab-selector.component.spec.ts b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/rok-jupyter-lab-selector/rok-jupyter-lab-selector.component.spec.ts index 63c26f71..e4da50e7 100644 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/rok-jupyter-lab-selector/rok-jupyter-lab-selector.component.spec.ts +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/rok-jupyter-lab-selector/rok-jupyter-lab-selector.component.spec.ts @@ -8,9 +8,8 @@ describe('RokJupyterLabSelectorComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ RokJupyterLabSelectorComponent ] - }) - .compileComponents(); + declarations: [RokJupyterLabSelectorComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/rok-volume/rok-volume.component.spec.ts b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/rok-volume/rok-volume.component.spec.ts index eaf48ad9..c653e6f7 100644 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/rok-volume/rok-volume.component.spec.ts +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/rok-volume/rok-volume.component.spec.ts @@ -8,9 +8,8 @@ describe('RokVolumeComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ RokVolumeComponent ] - }) - .compileComponents(); + declarations: [RokVolumeComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/utils.ts b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/utils.ts index 4bfc7191..c6d894a8 100644 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/utils.ts +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form-rok/utils.ts @@ -167,10 +167,7 @@ export function setLabValues(lab: JupyterLab, formCtrl: AbstractControl) { .get('extraFields') .get('rokUrl') .setValue(lab.workspace.extraFields.rokUrl); - formCtrl - .get('workspace') - .get('type') - .setValue('Existing'); + formCtrl.get('workspace').get('type').setValue('Existing'); // Clear the existing Data Volumes array const dataVols = formCtrl.get('datavols') as FormArray; @@ -191,10 +188,7 @@ export function setLabValues(lab: JupyterLab, formCtrl: AbstractControl) { .get('rokUrl') .setValue(lab.datavols[i].extraFields.rokUrl); - volsArr - .at(i) - .get('type') - .setValue('Existing'); + volsArr.at(i).get('type').setValue('Existing'); } } diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form.component.spec.ts b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form.component.spec.ts index 0ace80a5..4f5bef5e 100644 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form.component.spec.ts +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/form/form.component.spec.ts @@ -8,9 +8,8 @@ describe('FormComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ FormComponent ] - }) - .compileComponents(); + declarations: [FormComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/index/index-default/config.ts b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/index/index-default/config.ts index 417daacc..7856ee11 100644 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/index/index-default/config.ts +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/index/index-default/config.ts @@ -65,7 +65,7 @@ export const defaultConfig = { matHeaderCellDef: 'Type', matColumnDef: 'type', value: new ComponentValue({ - component: ServerTypeComponent + component: ServerTypeComponent, }), }, { diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/index/index-default/index-default.component.spec.ts b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/index/index-default/index-default.component.spec.ts index 6f61d907..7b06612a 100644 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/index/index-default/index-default.component.spec.ts +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/index/index-default/index-default.component.spec.ts @@ -8,9 +8,8 @@ describe('IndexDefaultComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ IndexDefaultComponent ] - }) - .compileComponents(); + declarations: [IndexDefaultComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/index/index-default/server-type/server-type.component.html b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/index/index-default/server-type/server-type.component.html index 4067a1ad..43994022 100644 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/index/index-default/server-type/server-type.component.html +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/index/index-default/server-type/server-type.component.html @@ -1,3 +1,19 @@ - - - + + + diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/index/index-default/server-type/server-type.component.spec.ts b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/index/index-default/server-type/server-type.component.spec.ts index f6e0ff4f..0bfd2707 100644 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/index/index-default/server-type/server-type.component.spec.ts +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/index/index-default/server-type/server-type.component.spec.ts @@ -8,9 +8,8 @@ describe('ServerTypeComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ ServerTypeComponent ] - }) - .compileComponents(); + declarations: [ServerTypeComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/index/index-default/server-type/server-type.component.ts b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/index/index-default/server-type/server-type.component.ts index 4bb5927b..c907e8f9 100644 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/index/index-default/server-type/server-type.component.ts +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/index/index-default/server-type/server-type.component.ts @@ -8,21 +8,27 @@ import { MatIconRegistry } from '@angular/material/icon'; @Component({ selector: 'app-server-type', templateUrl: './server-type.component.html', - styleUrls: ['./server-type.component.scss'] + styleUrls: ['./server-type.component.scss'], }) export class ServerTypeComponent implements TableColumnComponent { - constructor(iconRegistry: MatIconRegistry, sanitizer: DomSanitizer) { - iconRegistry.addSvgIcon('jupyterlab-icon', sanitizer.bypassSecurityTrustResourceUrl(environment.jupyterIcon)); - iconRegistry.addSvgIcon('vs-code-icon', sanitizer.bypassSecurityTrustResourceUrl(environment.vscodeIcon)); - iconRegistry.addSvgIcon('rstudio-icon', sanitizer.bypassSecurityTrustResourceUrl(environment.rstudioIcon)); + iconRegistry.addSvgIcon( + 'jupyterlab-icon', + sanitizer.bypassSecurityTrustResourceUrl(environment.jupyterIcon), + ); + iconRegistry.addSvgIcon( + 'vs-code-icon', + sanitizer.bypassSecurityTrustResourceUrl(environment.vscodeIcon), + ); + iconRegistry.addSvgIcon( + 'rstudio-icon', + sanitizer.bypassSecurityTrustResourceUrl(environment.rstudioIcon), + ); } notebookServerType: string; set element(notebook: NotebookProcessedObject) { - this.notebookServerType = notebook.serverType + this.notebookServerType = notebook.serverType; } - } - diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/index/index-rok/index-rok.component.spec.ts b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/index/index-rok/index-rok.component.spec.ts index 39ac8c82..036c6775 100644 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/index/index-rok/index-rok.component.spec.ts +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/index/index-rok/index-rok.component.spec.ts @@ -8,9 +8,8 @@ describe('IndexRokComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ IndexRokComponent ] - }) - .compileComponents(); + declarations: [IndexRokComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/index/index.component.spec.ts b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/index/index.component.spec.ts index 03122420..f09ec8b2 100644 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/index/index.component.spec.ts +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/index/index.component.spec.ts @@ -8,9 +8,8 @@ describe('IndexComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ IndexComponent ] - }) - .compileComponents(); + declarations: [IndexComponent], + }).compileComponents(); })); beforeEach(() => { diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/index/index.module.ts b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/index/index.module.ts index 503a506d..f183b5de 100644 --- a/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/index/index.module.ts +++ b/notebooks/crud-web-apps/jupyter/frontend/src/app/pages/index/index.module.ts @@ -5,11 +5,17 @@ import { IndexRokModule } from './index-rok/index-rok.module'; import { IndexDefaultModule } from './index-default/index-default.module'; import { IndexComponent } from './index.component'; import { ServerTypeComponent } from './index-default/server-type/server-type.component'; -import {MatTooltipModule} from '@angular/material/tooltip'; +import { MatTooltipModule } from '@angular/material/tooltip'; @NgModule({ declarations: [IndexComponent, ServerTypeComponent], - imports: [CommonModule, IndexRokModule, IndexDefaultModule, MatIconModule, MatTooltipModule], + imports: [ + CommonModule, + IndexRokModule, + IndexDefaultModule, + MatIconModule, + MatTooltipModule, + ], entryComponents: [ServerTypeComponent], }) export class IndexModule {} diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/main.ts b/notebooks/crud-web-apps/jupyter/frontend/src/main.ts index c7b673cf..fa4e0aef 100644 --- a/notebooks/crud-web-apps/jupyter/frontend/src/main.ts +++ b/notebooks/crud-web-apps/jupyter/frontend/src/main.ts @@ -8,5 +8,6 @@ if (environment.production) { enableProdMode(); } -platformBrowserDynamic().bootstrapModule(AppModule) +platformBrowserDynamic() + .bootstrapModule(AppModule) .catch(err => console.error(err)); diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/polyfills.ts b/notebooks/crud-web-apps/jupyter/frontend/src/polyfills.ts index 03711e5d..e49856ec 100644 --- a/notebooks/crud-web-apps/jupyter/frontend/src/polyfills.ts +++ b/notebooks/crud-web-apps/jupyter/frontend/src/polyfills.ts @@ -55,8 +55,7 @@ /*************************************************************************************************** * Zone JS is required by default for Angular itself. */ -import 'zone.js/dist/zone'; // Included with Angular CLI. - +import 'zone.js/dist/zone'; // Included with Angular CLI. /*************************************************************************************************** * APPLICATION IMPORTS diff --git a/notebooks/crud-web-apps/jupyter/frontend/src/test.ts b/notebooks/crud-web-apps/jupyter/frontend/src/test.ts index 50193eb0..a9838d82 100644 --- a/notebooks/crud-web-apps/jupyter/frontend/src/test.ts +++ b/notebooks/crud-web-apps/jupyter/frontend/src/test.ts @@ -4,11 +4,15 @@ import 'zone.js/dist/zone-testing'; import { getTestBed } from '@angular/core/testing'; import { BrowserDynamicTestingModule, - platformBrowserDynamicTesting + platformBrowserDynamicTesting, } from '@angular/platform-browser-dynamic/testing'; declare const require: { - context(path: string, deep?: boolean, filter?: RegExp): { + context( + path: string, + deep?: boolean, + filter?: RegExp, + ): { keys(): string[]; (id: string): T; }; @@ -17,7 +21,7 @@ declare const require: { // First, initialize the Angular testing environment. getTestBed().initTestEnvironment( BrowserDynamicTestingModule, - platformBrowserDynamicTesting() + platformBrowserDynamicTesting(), ); // Then we find all the tests. const context = require.context('./', true, /\.spec\.ts$/);