diff --git a/components/crud-web-apps/common/backend/kubeflow/kubeflow/crud_backend/api/utils.py b/components/crud-web-apps/common/backend/kubeflow/kubeflow/crud_backend/api/utils.py index 6c3f47fed78..874990bc97c 100644 --- a/components/crud-web-apps/common/backend/kubeflow/kubeflow/crud_backend/api/utils.py +++ b/components/crud-web-apps/common/backend/kubeflow/kubeflow/crud_backend/api/utils.py @@ -1,3 +1,5 @@ +import json + from flask import jsonify from kubernetes import client diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/existing/existing-volume.component.html b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/existing/existing-volume.component.html deleted file mode 100644 index 8ec98b96a26..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/existing/existing-volume.component.html +++ /dev/null @@ -1,44 +0,0 @@ - - Type - - - Kubernetes Volume - - - - Custom (Advanced) - - - - - - - - - - - - Check the - K8s docs - for the supported volumes and their specs - - - - {{ errorParsingYaml }} - diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/existing/existing-volume.component.scss b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/existing/existing-volume.component.scss deleted file mode 100644 index 6ced43b6500..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/existing/existing-volume.component.scss +++ /dev/null @@ -1,13 +0,0 @@ -:host { - display: block; -} - -.editor { - margin-top: 0.5rem; - margin-bottom: 1rem; -} - -.mat-error { - margin-bottom: 1rem; - white-space: pre-wrap; -} diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/existing/existing-volume.component.spec.ts b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/existing/existing-volume.component.spec.ts deleted file mode 100644 index 0afb04dab65..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/existing/existing-volume.component.spec.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { MatInputModule } from '@angular/material/input'; -import { MatSelectModule } from '@angular/material/select'; -import { EditorModule } from 'kubeflow'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; -import { ExistingVolumeComponent } from './existing-volume.component'; -import { ExistingPvcModule } from './pvc/pvc.module'; - -describe('ExistingVolumeComponent', () => { - let component: ExistingVolumeComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ExistingVolumeComponent], - imports: [ - CommonModule, - MatFormFieldModule, - ReactiveFormsModule, - MatInputModule, - MatSelectModule, - ExistingPvcModule, - NoopAnimationsModule, - EditorModule, - ], - }).compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(ExistingVolumeComponent); - component = fixture.componentInstance; - component.volGroup = new FormGroup({ - existingSource: new FormControl(), - }); - - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/existing/existing-volume.component.ts b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/existing/existing-volume.component.ts deleted file mode 100644 index 06ab6b09f02..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/existing/existing-volume.component.ts +++ /dev/null @@ -1,85 +0,0 @@ -import { Component, Input, OnInit } from '@angular/core'; -import { AbstractControl, FormControl, FormGroup } from '@angular/forms'; -import { EXISTING_SOURCE, EXISTING_VOLUME_TYPE } from 'src/app/types'; -import { - createExistingSourceFormGroup, - createSourceFormGroup, -} from 'src/app/shared/utils/volumes'; -import { dump } from 'js-yaml'; -import { V1Volume } from '@kubernetes/client-node'; -import { parseYAML } from 'src/app/shared/utils/yaml'; - -@Component({ - selector: 'app-existing-volume', - templateUrl: './existing-volume.component.html', - styleUrls: ['./existing-volume.component.scss'], -}) -export class ExistingVolumeComponent implements OnInit { - @Input() volGroup: FormGroup; - - EXISTING_VOLUME_TYPE = EXISTING_VOLUME_TYPE; - - errorParsingYaml = ''; - private yamlInternal = ''; - get yaml(): string { - return this.yamlInternal; - } - set yaml(text: string) { - // Try to parse the YAML contents into a JS dict and store it in the - // FormControl for the existingSource - this.yamlInternal = text; - - const [parsed, error] = parseYAML(text); - this.errorParsingYaml = error; - - if (error) { - return; - } - - this.volGroup.get('existingSource').setValue(parsed); - } - - get type(): EXISTING_VOLUME_TYPE { - if (!this.volGroup) { - return EXISTING_VOLUME_TYPE.CUSTOM; - } - - if (this.volGroup.get('existingSource') instanceof FormControl) { - return EXISTING_VOLUME_TYPE.CUSTOM; - } - - if (this.volGroup.get('existingSource') instanceof FormGroup) { - return EXISTING_VOLUME_TYPE.PVC; - } - } - - constructor() {} - - ngOnInit(): void { - const existingSource: V1Volume = this.volGroup.get('existingSource').value; - this.yaml = dump(existingSource); - } - - typeChanged(type: EXISTING_VOLUME_TYPE) { - // In case of custom we change from a form group to a simple form control - // The user will be inputing a YAML, which we will be converting to JS dict - if (type === EXISTING_VOLUME_TYPE.CUSTOM) { - const currSrc = this.volGroup.get('existingSource').value; - this.yamlInternal = dump(currSrc); - this.volGroup.setControl('existingSource', new FormControl(currSrc)); - return; - } - - // Use a FormGroup for PVC, since there will be a form with subfields - this.volGroup.setControl('existingSource', createExistingSourceFormGroup()); - - const sourceGroup = this.volGroup.get('existingSource') as FormGroup; - const source = EXISTING_SOURCE.PERSISTENT_VOLUME_CLAIM; - - sourceGroup.addControl(source, createSourceFormGroup(source)); - } - - getPvcFormGroup(): AbstractControl { - return this.volGroup.get('existingSource.persistentVolumeClaim'); - } -} diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/existing/existing-volume.module.ts b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/existing/existing-volume.module.ts deleted file mode 100644 index 3e00ccd5a2b..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/existing/existing-volume.module.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { ExistingVolumeComponent } from './existing-volume.component'; -import { ReactiveFormsModule } from '@angular/forms'; - -import { MatFormFieldModule } from '@angular/material/form-field'; -import { MatInputModule } from '@angular/material/input'; -import { MatSelectModule } from '@angular/material/select'; - -import { ExistingPvcModule } from './pvc/pvc.module'; -import { EditorModule } from 'kubeflow'; - -@NgModule({ - declarations: [ExistingVolumeComponent], - imports: [ - CommonModule, - MatFormFieldModule, - ReactiveFormsModule, - MatInputModule, - MatSelectModule, - ExistingPvcModule, - EditorModule, - ], - exports: [ExistingVolumeComponent], -}) -export class ExistingVolumeModule {} diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/existing/pvc/pvc.component.html b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/existing/pvc/pvc.component.html deleted file mode 100644 index ccfc1a73850..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/existing/pvc/pvc.component.html +++ /dev/null @@ -1,16 +0,0 @@ -Readonly - - - Name - - -
-
{{ pvc.name }}
- -
{{ pvc.size }}
-
{{ pvc.mode }}
-
-
-
-
-
diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/existing/pvc/pvc.component.scss b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/existing/pvc/pvc.component.scss deleted file mode 100644 index 5e208d15218..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/existing/pvc/pvc.component.scss +++ /dev/null @@ -1,16 +0,0 @@ -:host { - display: block; -} - -.name { - width: 60%; - margin-right: 1rem; -} - -.size { - width: 15%; -} - -.mode { - width: 25%; -} diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/existing/pvc/pvc.component.spec.ts b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/existing/pvc/pvc.component.spec.ts deleted file mode 100644 index 5a35365cd3d..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/existing/pvc/pvc.component.spec.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { MatCheckboxModule } from '@angular/material/checkbox'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { MatInputModule } from '@angular/material/input'; -import { MatSelectModule } from '@angular/material/select'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; -import { NamespaceService } from 'kubeflow'; -import { of } from 'rxjs'; -import { JWABackendService } from 'src/app/services/backend.service'; -import { ExistingPvcComponent } from './pvc.component'; - -const JWABackendServiceStub: Partial = { - getVolumes: () => of(), -}; - -const NamespaceServiceStub: Partial = { - getSelectedNamespace: () => of(), -}; - -describe('ExistingPvcComponent', () => { - let component: ExistingPvcComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ExistingPvcComponent], - imports: [ - CommonModule, - MatFormFieldModule, - MatInputModule, - MatSelectModule, - MatCheckboxModule, - NoopAnimationsModule, - ReactiveFormsModule, - ], - providers: [ - { provide: JWABackendService, useValue: JWABackendServiceStub }, - { provide: NamespaceService, useValue: NamespaceServiceStub }, - ], - }).compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(ExistingPvcComponent); - component = fixture.componentInstance; - component.pvcGroup = new FormGroup({ - readOnly: new FormControl(), - claimName: new FormControl(), - }); - - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/existing/pvc/pvc.component.ts b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/existing/pvc/pvc.component.ts deleted file mode 100644 index fc29671febb..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/existing/pvc/pvc.component.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { Component, Input, OnInit } from '@angular/core'; -import { FormGroup } from '@angular/forms'; -import { NamespaceService } from 'kubeflow'; -import { JWABackendService } from 'src/app/services/backend.service'; -import { PvcResponseObject } from 'src/app/types'; - -@Component({ - selector: 'app-existing-pvc', - templateUrl: './pvc.component.html', - styleUrls: ['./pvc.component.scss'], -}) -export class ExistingPvcComponent implements OnInit { - @Input() pvcGroup: FormGroup; - - pvcs: PvcResponseObject[] = []; - - constructor( - private backend: JWABackendService, - private ns: NamespaceService, - ) {} - - ngOnInit(): void { - this.ns.getSelectedNamespace().subscribe(ns => { - this.backend.getVolumes(ns).subscribe(pvcs => { - this.pvcs = pvcs; - }); - }); - } -} diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/existing/pvc/pvc.module.ts b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/existing/pvc/pvc.module.ts deleted file mode 100644 index 17d1e2233ac..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/existing/pvc/pvc.module.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { ExistingPvcComponent } from './pvc.component'; -import { ReactiveFormsModule } from '@angular/forms'; - -import { MatFormFieldModule } from '@angular/material/form-field'; -import { MatCheckboxModule } from '@angular/material/checkbox'; -import { MatInputModule } from '@angular/material/input'; -import { MatSelectModule } from '@angular/material/select'; - -@NgModule({ - declarations: [ExistingPvcComponent], - imports: [ - CommonModule, - ReactiveFormsModule, - MatFormFieldModule, - MatInputModule, - MatSelectModule, - MatCheckboxModule, - ], - exports: [ExistingPvcComponent], -}) -export class ExistingPvcModule {} diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/mount/mount.component.html b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/mount/mount.component.html deleted file mode 100644 index 313bf4885a4..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/mount/mount.component.html +++ /dev/null @@ -1,9 +0,0 @@ - - Mount path - - diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/mount/mount.component.scss b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/mount/mount.component.scss deleted file mode 100644 index b38e9de4778..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/mount/mount.component.scss +++ /dev/null @@ -1,5 +0,0 @@ -.form-title { - font-weight: 500; - margin-bottom: 0.6rem; - color: rgba(0, 0, 0, 0.64); -} diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/mount/mount.component.spec.ts b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/mount/mount.component.spec.ts deleted file mode 100644 index 15feea4bf9c..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/mount/mount.component.spec.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { MatCheckboxModule } from '@angular/material/checkbox'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { MatInputModule } from '@angular/material/input'; -import { MatSelectModule } from '@angular/material/select'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; -import { VolumeMountComponent } from './mount.component'; - -describe('VolumeMountComponent', () => { - let component: VolumeMountComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [VolumeMountComponent], - imports: [ - CommonModule, - MatFormFieldModule, - MatInputModule, - NoopAnimationsModule, - MatSelectModule, - MatCheckboxModule, - ReactiveFormsModule, - ], - }).compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(VolumeMountComponent); - component = fixture.componentInstance; - component.volGroup = new FormGroup({ - mount: new FormControl(), - newPvc: new FormControl({ - metadata: {}, - }), - }); - - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/mount/mount.component.ts b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/mount/mount.component.ts deleted file mode 100644 index 9b4efbbb64f..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/mount/mount.component.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { Component, Input, OnDestroy } from '@angular/core'; -import { AbstractControl, FormArray, FormGroup } from '@angular/forms'; -import { Subscription } from 'rxjs'; - -@Component({ - selector: 'app-volume-mount', - templateUrl: './mount.component.html', - styleUrls: ['./mount.component.scss'], -}) -export class VolumeMountComponent implements OnDestroy { - private prvVolGroup: FormGroup; - @Input() - get volGroup(): FormGroup { - return this.prvVolGroup; - } - - set volGroup(volGroup: FormGroup) { - this.prvVolGroup = volGroup; - this.valueChangeSubscription.unsubscribe(); - this.updateMountOnNameChange(volGroup); - } - - private valueChangeSubscription: Subscription = new Subscription(); - - constructor() {} - - ngOnDestroy() { - this.valueChangeSubscription.unsubscribe(); - } - - updateMountOnNameChange(volGroup: FormGroup) { - // If volGroup's parent is a FormArray it means that this component is used - // in Data volumes else we disable this feature. - if (!(volGroup.parent instanceof FormArray)) { - return; - } - - if (volGroup.contains('newPvc')) { - this.updateMountPath(volGroup, this.getNewVolumeNameCtrl(volGroup)); - } - - if (volGroup.contains('existingSource')) { - this.updateMountPath( - volGroup, - volGroup.get('existingSource.persistentVolumeClaim.claimName'), - ); - } - } - - updateMountPath(volGroup: FormGroup, nameCtrl: AbstractControl) { - const mountPathCtrl = volGroup.get('mount'); - this.valueChangeSubscription = nameCtrl.valueChanges.subscribe(v => { - const mount = v; - if (mountPathCtrl.dirty) { - this.valueChangeSubscription.unsubscribe(); - return; - } - volGroup.get('mount').setValue(`/home/jovyan/${mount}`); - }); - } - - getNewVolumeNameCtrl(volGroup: FormGroup): AbstractControl { - const metadata = volGroup.get('newPvc.metadata') as FormGroup; - if (metadata.contains('name')) { - return metadata.get('name'); - } - - if (metadata.contains('generateName')) { - return metadata.get('generateName'); - } - } -} diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/mount/mount.module.ts b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/mount/mount.module.ts deleted file mode 100644 index d1e01ff6b7b..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/mount/mount.module.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { VolumeMountComponent } from './mount.component'; -import { ReactiveFormsModule } from '@angular/forms'; - -import { MatFormFieldModule } from '@angular/material/form-field'; -import { MatInputModule } from '@angular/material/input'; - -@NgModule({ - declarations: [VolumeMountComponent], - imports: [ - CommonModule, - ReactiveFormsModule, - MatFormFieldModule, - MatInputModule, - ], - exports: [VolumeMountComponent], -}) -export class VolumeMountModule {} diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/access-modes/access-modes.component.html b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/access-modes/access-modes.component.html deleted file mode 100644 index 83241c95b4e..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/access-modes/access-modes.component.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - ReadWriteOnce - - - ReadOnlyMany - - - ReadWriteMany - - diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/access-modes/access-modes.component.scss b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/access-modes/access-modes.component.scss deleted file mode 100644 index 5bbd6d1388a..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/access-modes/access-modes.component.scss +++ /dev/null @@ -1,23 +0,0 @@ -:host { - display: inline-block; -} - -.form-title { - font-weight: 500; - margin-bottom: 0.4rem; - color: rgba(0, 0, 0, 0.64); - display: block; -} - -.mat-radio-group { - display: flex; - flex-direction: column; - - .mat-radio-button { - margin-bottom: 0.5rem; - } - - .mat-radio-button:last-child { - margin-bottom: 1rem; - } -} diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/access-modes/access-modes.component.spec.ts b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/access-modes/access-modes.component.spec.ts deleted file mode 100644 index 8ab909f1025..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/access-modes/access-modes.component.spec.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { FormControl, ReactiveFormsModule } from '@angular/forms'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { MatRadioModule } from '@angular/material/radio'; -import { MatTooltipModule } from '@angular/material/tooltip'; -import { VolumeAccessModesComponent } from './access-modes.component'; - -describe('VolumeAccessModesComponent', () => { - let component: VolumeAccessModesComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [VolumeAccessModesComponent], - imports: [ - CommonModule, - ReactiveFormsModule, - MatFormFieldModule, - MatRadioModule, - MatTooltipModule, - ], - }).compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(VolumeAccessModesComponent); - component = fixture.componentInstance; - component.modesCtrl = new FormControl('test'); - - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/access-modes/access-modes.component.ts b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/access-modes/access-modes.component.ts deleted file mode 100644 index 5aa25cb5454..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/access-modes/access-modes.component.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { Component, Input, OnInit } from '@angular/core'; -import { FormControl, Validators } from '@angular/forms'; - -@Component({ - selector: 'app-volume-access-modes', - templateUrl: './access-modes.component.html', - styleUrls: ['./access-modes.component.scss'], -}) -export class VolumeAccessModesComponent implements OnInit { - // Control used in the FormGroup and is always an array - private modesCtrlPrv: FormControl; - - @Input() - get modesCtrl(): FormControl { - return this.modesCtrlPrv; - } - set modesCtrl(ctrl) { - this.modesCtrlPrv = ctrl; - - // Update the initial value of temp control. - // We expect the input Group to always have one value - const modes = ctrl.value; - this.mode.setValue(modes[0]); - } - - // used in the form, takes the first value of the array - mode = new FormControl('', Validators.required); - - constructor() {} - - ngOnInit(): void { - this.mode.valueChanges.subscribe(mode => { - this.modesCtrl.setValue([mode]); - }); - } -} diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/access-modes/access-modes.module.ts b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/access-modes/access-modes.module.ts deleted file mode 100644 index 747dbc22b2d..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/access-modes/access-modes.module.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { VolumeAccessModesComponent } from './access-modes.component'; -import { ReactiveFormsModule } from '@angular/forms'; - -import { MatFormFieldModule } from '@angular/material/form-field'; -import { MatRadioModule } from '@angular/material/radio'; -import { MatTooltipModule } from '@angular/material/tooltip'; - -@NgModule({ - declarations: [VolumeAccessModesComponent], - imports: [ - CommonModule, - ReactiveFormsModule, - MatFormFieldModule, - MatRadioModule, - MatTooltipModule, - ], - exports: [VolumeAccessModesComponent], -}) -export class VolumeAccessModesModule {} diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/name/name.component.html b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/name/name.component.html deleted file mode 100644 index 04c898fc7f4..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/name/name.component.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - Name - - - - - Name (suffix) - - info - diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/name/name.component.scss b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/name/name.component.scss deleted file mode 100644 index e6af5d787cd..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/name/name.component.scss +++ /dev/null @@ -1,7 +0,0 @@ -:host { - display: block; -} - -.info-icon { - color: rgba(0, 0, 0, 0.48); -} diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/name/name.component.spec.ts b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/name/name.component.spec.ts deleted file mode 100644 index 51c9257163f..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/name/name.component.spec.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { MatCheckboxModule } from '@angular/material/checkbox'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { MatInputModule } from '@angular/material/input'; -import { VolumeNameComponent } from './name.component'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('VolumeNameComponent', () => { - let component: VolumeNameComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [VolumeNameComponent], - imports: [ - CommonModule, - ReactiveFormsModule, - MatFormFieldModule, - MatCheckboxModule, - MatInputModule, - NoopAnimationsModule, - ], - }).compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(VolumeNameComponent); - component = fixture.componentInstance; - component.metadataGroup = new FormGroup({ - name: new FormControl(''), - }); - - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/name/name.component.ts b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/name/name.component.ts deleted file mode 100644 index cb694be87dc..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/name/name.component.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { Component, Input, OnDestroy } from '@angular/core'; -import { AbstractControl, FormGroup } from '@angular/forms'; -import { Subscription } from 'rxjs'; - -const NB_NAME_SUBST = '{notebook-name}'; - -@Component({ - selector: 'app-volume-name', - templateUrl: './name.component.html', - styleUrls: ['./name.component.scss'], -}) -export class VolumeNameComponent implements OnDestroy { - private templatedName = ''; - private subs = new Subscription(); - private group: FormGroup; - private externalNamePrv = ''; - - @Input() - get metadataGroup(): FormGroup { - return this.group; - } - set metadataGroup(meta: FormGroup) { - this.group = meta; - this.subs.unsubscribe(); - - // substitute {notebook-name} - const nameCtrl = this.getNameCtrl(this.metadataGroup); - - // update the templated path, with the new initial value - this.templatedName = nameCtrl.value; - - // set the form's value based on the templated name - setTimeout(() => { - nameCtrl.setValue( - this.templatedName.replace(NB_NAME_SUBST, this.externalName), - ); - }); - } - - @Input() - get externalName(): string { - return this.externalNamePrv; - } - set externalName(name) { - this.externalNamePrv = name; - if (!name) { - return; - } - - const nameCtrl = this.getNameCtrl(this.metadataGroup); - if (nameCtrl.dirty) { - return; - } - - // to avoid ExpressionChangedAfterItHasBeenCheckedError - setTimeout(() => { - nameCtrl.setValue(this.templatedName.replace(NB_NAME_SUBST, name)); - }); - } - - constructor() {} - - ngOnDestroy(): void { - this.subs.unsubscribe(); - } - - private getNameCtrl(metadata: FormGroup): AbstractControl { - if (metadata.contains('name')) { - return metadata.get('name'); - } - - if (metadata.contains('generateName')) { - return metadata.get('generateName'); - } - } -} diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/name/name.module.ts b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/name/name.module.ts deleted file mode 100644 index 07124dc7ab6..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/name/name.module.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { VolumeNameComponent } from './name.component'; -import { ReactiveFormsModule } from '@angular/forms'; - -import { MatFormFieldModule } from '@angular/material/form-field'; -import { MatInputModule } from '@angular/material/input'; -import { MatCheckboxModule } from '@angular/material/checkbox'; -import { FormModule } from 'kubeflow'; - -@NgModule({ - declarations: [VolumeNameComponent], - imports: [ - CommonModule, - ReactiveFormsModule, - MatFormFieldModule, - MatCheckboxModule, - MatInputModule, - FormModule, - ], - exports: [VolumeNameComponent], -}) -export class VolumeNameModule {} diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/new.component.html b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/new.component.html deleted file mode 100644 index 0a22eb336d4..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/new.component.html +++ /dev/null @@ -1,62 +0,0 @@ - - Type - - Empty volume - - - Custom (Advanced) - - - - - - - - Check the - K8s docs - for the supported volumes and their specs - - - - {{ errorParsingYaml }} - - - - - - - - - - - - - diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/new.component.scss b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/new.component.scss deleted file mode 100644 index 6ced43b6500..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/new.component.scss +++ /dev/null @@ -1,13 +0,0 @@ -:host { - display: block; -} - -.editor { - margin-top: 0.5rem; - margin-bottom: 1rem; -} - -.mat-error { - margin-bottom: 1rem; - white-space: pre-wrap; -} diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/new.component.spec.ts b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/new.component.spec.ts deleted file mode 100644 index 2d0a5f8d9e2..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/new.component.spec.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { MatInputModule } from '@angular/material/input'; -import { MatSelectModule } from '@angular/material/select'; -import { EditorModule } from 'kubeflow'; -import { NewVolumeComponent } from './new.component'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; - -describe('NewVolumeComponent', () => { - let component: NewVolumeComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [NewVolumeComponent], - imports: [ - CommonModule, - MatInputModule, - MatSelectModule, - ReactiveFormsModule, - MatFormFieldModule, - NoopAnimationsModule, - EditorModule, - ], - }).compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(NewVolumeComponent); - component = fixture.componentInstance; - component.volGroup = new FormGroup({ - newPvc: new FormControl(), - }); - - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/new.component.ts b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/new.component.ts deleted file mode 100644 index 2c2872b1a91..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/new.component.ts +++ /dev/null @@ -1,79 +0,0 @@ -import { Component, Input, OnInit } from '@angular/core'; -import { FormControl, FormGroup, Validators } from '@angular/forms'; -import { dump } from 'js-yaml'; -import { parseYAML } from 'src/app/shared/utils/yaml'; -import { NEW_VOLUME_TYPE } from 'src/app/types'; -import { createNewPvcFormGroup } from 'src/app/shared/utils/volumes'; -import { environment } from '@app/environment'; - -@Component({ - selector: 'app-new-volume', - templateUrl: './new.component.html', - styleUrls: ['./new.component.scss'], -}) -export class NewVolumeComponent implements OnInit { - env = environment; - - get volumeType(): NEW_VOLUME_TYPE { - if (!this.volGroup) { - return NEW_VOLUME_TYPE.EMPTY; - } - - const pvcGroup = this.volGroup.get('newPvc'); - - // if we have a form-control then we expect the user to be typing yaml text - if (pvcGroup instanceof FormControl) { - return NEW_VOLUME_TYPE.CUSTOM; - } - - return NEW_VOLUME_TYPE.EMPTY; - } - - @Input() volGroup: FormGroup; - @Input() externalName: string; - - yamlPrv = ''; - errorParsingYaml = ''; - - NEW_VOLUME_TYPE = NEW_VOLUME_TYPE; - - get yaml(): string { - return this.yamlPrv; - } - set yaml(text) { - // Try to parse the YAML contents into a JS dict and store it in the - // FormControl for the newPvc - this.yamlPrv = text; - - const [parsed, error] = parseYAML(text); - this.errorParsingYaml = error; - - if (error) { - return; - } - - this.volGroup.get('newPvc').setValue(parsed); - } - - constructor() {} - - ngOnInit(): void {} - - typeChanged(type: NEW_VOLUME_TYPE) { - if (type === NEW_VOLUME_TYPE.CUSTOM) { - // Remove the FormGroup and make newPvc a FormControl, since it's value - // will be updated from the parsed YAML that the user will write - const currPvc = this.volGroup.get('newPvc').value; - this.volGroup.setControl('newPvc', new FormControl({})); - this.yaml = dump(currPvc); - return; - } - - // Have an initial empty PVC definition in case of empty type - this.volGroup.setControl('newPvc', createNewPvcFormGroup()); - - if (type === NEW_VOLUME_TYPE.EMPTY) { - return; - } - } -} diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/new.module.ts b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/new.module.ts deleted file mode 100644 index 237bd42b6f7..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/new.module.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { NewVolumeComponent } from './new.component'; -import { VolumeNameModule } from './name/name.module'; -import { StorageClassModule } from './storage-class/storage-class.module'; -import { VolumeAccessModesModule } from './access-modes/access-modes.module'; -import { VolumeSizeModule } from './size/size.module'; -import { MatInputModule } from '@angular/material/input'; -import { MatSelectModule } from '@angular/material/select'; -import { ReactiveFormsModule } from '@angular/forms'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { EditorModule } from 'kubeflow'; - -@NgModule({ - declarations: [NewVolumeComponent], - imports: [ - CommonModule, - VolumeNameModule, - StorageClassModule, - VolumeAccessModesModule, - VolumeSizeModule, - MatInputModule, - MatSelectModule, - ReactiveFormsModule, - MatFormFieldModule, - EditorModule, - ], - exports: [NewVolumeComponent], -}) -export class NewVolumeModule {} diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/size/size.component.html b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/size/size.component.html deleted file mode 100644 index 1b2abc4581e..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/size/size.component.html +++ /dev/null @@ -1,11 +0,0 @@ - - Size in Gi - - diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/size/size.component.scss b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/size/size.component.scss deleted file mode 100644 index 5d4e87f30f6..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/size/size.component.scss +++ /dev/null @@ -1,3 +0,0 @@ -:host { - display: block; -} diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/size/size.component.spec.ts b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/size/size.component.spec.ts deleted file mode 100644 index 41deb323b85..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/size/size.component.spec.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { FormControl, ReactiveFormsModule } from '@angular/forms'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { MatInputModule } from '@angular/material/input'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; -import { VolumeSizeComponent } from './size.component'; - -describe('VolumeSizeComponent', () => { - let component: VolumeSizeComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [VolumeSizeComponent], - imports: [ - CommonModule, - MatFormFieldModule, - MatInputModule, - NoopAnimationsModule, - ReactiveFormsModule, - ], - }).compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(VolumeSizeComponent); - component = fixture.componentInstance; - component.sizeCtrl = new FormControl(''); - - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/size/size.component.ts b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/size/size.component.ts deleted file mode 100644 index 9bc08ec49f8..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/size/size.component.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { Component, Input, OnInit } from '@angular/core'; -import { FormControl, Validators } from '@angular/forms'; -import { Subscription } from 'rxjs'; - -@Component({ - selector: 'app-volume-size', - templateUrl: './size.component.html', - styleUrls: ['./size.component.scss'], -}) -export class VolumeSizeComponent implements OnInit { - private ctrl: FormControl; - public sizeNum = new FormControl(1, Validators.required); - - @Input() - get sizeCtrl(): FormControl { - return this.ctrl; - } - set sizeCtrl(ctrl) { - const size = ctrl.value; - this.ctrl = ctrl; - this.sizeNum.setValue(this.parseK8sGiSizeToInt(size)); - } - - constructor() {} - - ngOnInit(): void { - // This is used for the form, and does not contain Gi - this.sizeNum.setValue(this.parseK8sGiSizeToInt(this.sizeCtrl.value)); - - // This is the FormGroup's control value, and we want Gi here - this.sizeCtrl.setValue(`${this.sizeNum.value}Gi`); - - this.sizeNum.valueChanges.subscribe(size => { - if (size === null) { - this.sizeCtrl.setValue(''); - } else { - this.sizeCtrl.setValue(`${size}Gi`, { emitEvent: false }); - } - }); - } - - private parseK8sGiSizeToInt(sizeK8s: string): number { - if (sizeK8s.includes('Gi')) { - return parseInt(sizeK8s.replace('Gi', ''), 10); - } - - if (sizeK8s.includes('Mi')) { - return parseInt(sizeK8s.replace('Mi', ''), 10) / 1000; - } - - return parseInt(sizeK8s, 10); - } -} diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/size/size.module.ts b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/size/size.module.ts deleted file mode 100644 index 675b1a51ca5..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/size/size.module.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { VolumeSizeComponent } from './size.component'; -import { ReactiveFormsModule } from '@angular/forms'; - -import { MatFormFieldModule } from '@angular/material/form-field'; -import { MatInputModule } from '@angular/material/input'; - -@NgModule({ - declarations: [VolumeSizeComponent], - imports: [ - CommonModule, - ReactiveFormsModule, - MatFormFieldModule, - MatInputModule, - ], - exports: [VolumeSizeComponent], -}) -export class VolumeSizeModule {} diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/storage-class/storage-class.component.html b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/storage-class/storage-class.component.html deleted file mode 100644 index 0291d97fa7a..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/storage-class/storage-class.component.html +++ /dev/null @@ -1,20 +0,0 @@ -
Storage class
- - - Use default class - - - - Class - - Empty storage class - - {{ sc }} - - - diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/storage-class/storage-class.component.scss b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/storage-class/storage-class.component.scss deleted file mode 100644 index 513c01aad03..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/storage-class/storage-class.component.scss +++ /dev/null @@ -1,9 +0,0 @@ -:host { - display: block; -} - -.form-title { - font-weight: 500; - margin-bottom: 0.4rem; - color: rgba(0, 0, 0, 0.64); -} diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/storage-class/storage-class.component.spec.ts b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/storage-class/storage-class.component.spec.ts deleted file mode 100644 index 146dd009d83..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/storage-class/storage-class.component.spec.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { FormControl, ReactiveFormsModule } from '@angular/forms'; -import { MatCheckboxModule } from '@angular/material/checkbox'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { MatInputModule } from '@angular/material/input'; -import { MatSelectModule } from '@angular/material/select'; -import { of } from 'rxjs'; -import { JWABackendService } from 'src/app/services/backend.service'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; -import { StorageClassComponent } from './storage-class.component'; - -const JWABackendServiceStub: Partial = { - getStorageClasses: () => of([]), - getDefaultStorageClass: () => of(), -}; - -describe('StorageClassComponent', () => { - let component: StorageClassComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [StorageClassComponent], - imports: [ - CommonModule, - ReactiveFormsModule, - MatFormFieldModule, - MatCheckboxModule, - MatInputModule, - MatSelectModule, - NoopAnimationsModule, - ], - providers: [ - { provide: JWABackendService, useValue: JWABackendServiceStub }, - ], - }).compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(StorageClassComponent); - component = fixture.componentInstance; - component.scControl = new FormControl(); - - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/storage-class/storage-class.component.ts b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/storage-class/storage-class.component.ts deleted file mode 100644 index 31d4c31561e..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/storage-class/storage-class.component.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { Component, Input, OnInit } from '@angular/core'; -import { FormControl } from '@angular/forms'; -import { JWABackendService } from 'src/app/services/backend.service'; - -@Component({ - selector: 'app-storage-class', - templateUrl: './storage-class.component.html', - styleUrls: ['./storage-class.component.scss'], -}) -export class StorageClassComponent implements OnInit { - storageClasses: string[] = []; - defaultStoraceClass: string; - - @Input() - scControl: FormControl; - - constructor(private backend: JWABackendService) {} - - ngOnInit(): void { - // get list of storage classes - this.backend.getStorageClasses().subscribe(classes => { - this.storageClasses = classes; - }); - - // get the default storage class - this.backend.getDefaultStorageClass().subscribe(sc => { - this.defaultStoraceClass = sc; - - if (!this.scControl || !this.scControl.disabled) { - return; - } - - // if control is disabled then the user wants to use the default SC - this.scControl.setValue(sc); - }); - } - - useDefaultSC(useDefault: boolean) { - if (useDefault) { - this.scControl.disable(); - return; - } - - this.scControl.enable(); - } -} diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/storage-class/storage-class.module.ts b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/storage-class/storage-class.module.ts deleted file mode 100644 index 58ae0e8a746..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/new/storage-class/storage-class.module.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { StorageClassComponent } from './storage-class.component'; -import { ReactiveFormsModule } from '@angular/forms'; - -import { MatFormFieldModule } from '@angular/material/form-field'; -import { MatCheckboxModule } from '@angular/material/checkbox'; -import { MatInputModule } from '@angular/material/input'; -import { MatSelectModule } from '@angular/material/select'; - -@NgModule({ - declarations: [StorageClassComponent], - imports: [ - CommonModule, - ReactiveFormsModule, - MatFormFieldModule, - MatCheckboxModule, - MatInputModule, - MatSelectModule, - ], - exports: [StorageClassComponent], -}) -export class StorageClassModule {} diff --git a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/volume.module.ts b/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/volume.module.ts deleted file mode 100644 index f5f02547c5b..00000000000 --- a/components/crud-web-apps/jupyter/frontend/src/app/pages/form/form-new/volume/volume.module.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { MatIconModule } from '@angular/material/icon'; -import { MatTooltipModule } from '@angular/material/tooltip'; -import { ExistingVolumeModule } from './existing/existing-volume.module'; -import { VolumeMountModule } from './mount/mount.module'; -import { NewVolumeModule } from './new/new.module'; -import { MatButtonModule } from '@angular/material/button'; - -@NgModule({ - declarations: [], - imports: [ - CommonModule, - MatIconModule, - MatButtonModule, - MatTooltipModule, - ExistingVolumeModule, - VolumeMountModule, - NewVolumeModule, - ], - exports: [ExistingVolumeModule, VolumeMountModule, NewVolumeModule], -}) -export class VolumeModule {} diff --git a/components/notebook-controller/config/manager/params.env b/components/notebook-controller/config/manager/params.env index 05c769cc4e9..b2885d9f466 100644 --- a/components/notebook-controller/config/manager/params.env +++ b/components/notebook-controller/config/manager/params.env @@ -4,4 +4,4 @@ CLUSTER_DOMAIN=cluster.local ENABLE_CULLING=false CULL_IDLE_TIME=1440 IDLENESS_CHECK_PERIOD=1 -ISTIO_HOSTS='*' \ No newline at end of file +ISTIO_HOSTS='*' diff --git a/components/notebook-controller/controllers/notebook_controller.go b/components/notebook-controller/controllers/notebook_controller.go index 273cd0c51ef..7b2a794fd4c 100644 --- a/components/notebook-controller/controllers/notebook_controller.go +++ b/components/notebook-controller/controllers/notebook_controller.go @@ -498,11 +498,11 @@ func generateVirtualService(instance *v1beta1.Notebook) (*unstructured.Unstructu vsvc.SetName(virtualServiceName(name, namespace)) vsvc.SetNamespace(namespace) - istioHosts := os.Getenv("ISTIO_HOSTS") + istioHosts := strings.Split(os.Getenv("ISTIO_HOSTS"), ",") if len(istioHosts) == 0 { - istioHosts = "*" + istioHosts = []string{"*"} } - if err := unstructured.SetNestedStringSlice(vsvc.Object, []string{istioHosts}, "spec", "hosts"); err != nil { + if err := unstructured.SetNestedStringSlice(vsvc.Object, istioHosts, "spec", "hosts"); err != nil { return nil, fmt.Errorf("set .spec.hosts error: %v", err) } diff --git a/components/tensorboard-controller/controllers/tensorboard_controller.go b/components/tensorboard-controller/controllers/tensorboard_controller.go index 9db4f181ef7..c127b4f2f3c 100644 --- a/components/tensorboard-controller/controllers/tensorboard_controller.go +++ b/components/tensorboard-controller/controllers/tensorboard_controller.go @@ -339,12 +339,12 @@ func generateVirtualService(tb *tensorboardv1alpha1.Tensorboard) (*unstructured. vsvc.SetName(tb.Name) vsvc.SetNamespace(tb.Namespace) - if err := unstructured.SetNestedStringSlice(vsvc.Object, []string{istioHost}, "spec", "hosts"); err != nil { - return nil, fmt.Errorf("Set .spec.hosts error: %v", err) + if err := unstructured.SetNestedStringSlice(vsvc.Object, strings.Split(istioHost, ","), "spec", "hosts"); err != nil { + return nil, fmt.Errorf("set .spec.hosts error: %v", err) } if err := unstructured.SetNestedStringSlice(vsvc.Object, []string{istioGateway}, "spec", "gateways"); err != nil { - return nil, fmt.Errorf("Set .spec.gateways error: %v", err) + return nil, fmt.Errorf("set .spec.gateways error: %v", err) } http := []interface{}{ @@ -373,7 +373,7 @@ func generateVirtualService(tb *tensorboardv1alpha1.Tensorboard) (*unstructured. }, } if err := unstructured.SetNestedSlice(vsvc.Object, http, "spec", "http"); err != nil { - return nil, fmt.Errorf("Set .spec.http error: %v", err) + return nil, fmt.Errorf("set .spec.http error: %v", err) } return vsvc, nil