forked from kubeflow/notebooks
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Pod Defaults in Tensorboard Web App (kubeflow/kubeflow#6924)
* support Pod Defaults in Tensorboard Web App * flint files
- Loading branch information
Showing
16 changed files
with
265 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...boards/frontend/src/app/pages/form/form-configurations/form-configurations.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<lib-form-section title="Configurations" i18n-title> | ||
<mat-form-field class="wide" appearance="outline"> | ||
<mat-label i18n> Configurations </mat-label> | ||
<mat-select [formControl]="parentForm.get('configurations')" multiple> | ||
<mat-option *ngFor="let config of podDefaults" [value]="config.label"> | ||
{{ config.desc }} | ||
</mat-option> | ||
</mat-select> | ||
</mat-form-field> | ||
</lib-form-section> |
Empty file.
59 changes: 59 additions & 0 deletions
59
...rds/frontend/src/app/pages/form/form-configurations/form-configurations.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { CommonModule } from '@angular/common'; | ||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; | ||
import { FormControl, FormGroup } from '@angular/forms'; | ||
import { MatFormFieldModule } from '@angular/material/form-field'; | ||
import { MatInputModule } from '@angular/material/input'; | ||
import { MatSelectModule } from '@angular/material/select'; | ||
import { NamespaceService } from 'kubeflow'; | ||
import { of } from 'rxjs'; | ||
import { TWABackendService } from 'src/app/services/backend.service'; | ||
import { FormModule as KfFormModule } from 'kubeflow'; | ||
import { FormConfigurationsComponent } from './form-configurations.component'; | ||
import { NoopAnimationsModule } from '@angular/platform-browser/animations'; | ||
|
||
const TWABackendServiceStub: Partial<TWABackendService> = { | ||
getPodDefaults: () => of(), | ||
}; | ||
|
||
const NamespaceServiceStub: Partial<NamespaceService> = { | ||
getSelectedNamespace: () => of(), | ||
}; | ||
|
||
describe('FormConfigurationsComponent', () => { | ||
let component: FormConfigurationsComponent; | ||
let fixture: ComponentFixture<FormConfigurationsComponent>; | ||
|
||
beforeEach( | ||
waitForAsync(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [FormConfigurationsComponent], | ||
imports: [ | ||
CommonModule, | ||
KfFormModule, | ||
MatFormFieldModule, | ||
MatInputModule, | ||
MatSelectModule, | ||
NoopAnimationsModule, | ||
], | ||
providers: [ | ||
{ provide: TWABackendService, useValue: TWABackendServiceStub }, | ||
{ provide: NamespaceService, useValue: NamespaceServiceStub }, | ||
], | ||
}).compileComponents(); | ||
}), | ||
); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(FormConfigurationsComponent); | ||
component = fixture.componentInstance; | ||
component.parentForm = new FormGroup({ | ||
configurations: new FormControl(), | ||
}); | ||
|
||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
36 changes: 36 additions & 0 deletions
36
...orboards/frontend/src/app/pages/form/form-configurations/form-configurations.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { Component, OnInit, OnDestroy, Input } from '@angular/core'; | ||
import { FormGroup } from '@angular/forms'; | ||
import { PodDefault } from 'src/app/types'; | ||
import { Subscription } from 'rxjs'; | ||
import { NamespaceService } from 'kubeflow'; | ||
import { TWABackendService } from 'src/app/services/backend.service'; | ||
|
||
@Component({ | ||
selector: 'app-form-configurations', | ||
templateUrl: './form-configurations.component.html', | ||
styleUrls: ['./form-configurations.component.scss'], | ||
}) | ||
export class FormConfigurationsComponent implements OnInit, OnDestroy { | ||
podDefaults: PodDefault[]; | ||
subscriptions = new Subscription(); | ||
|
||
@Input() parentForm: FormGroup; | ||
|
||
constructor(public ns: NamespaceService, public backend: TWABackendService) {} | ||
|
||
ngOnInit() { | ||
// Keep track of the selected namespace | ||
const nsSub = this.ns.getSelectedNamespace().subscribe(namespace => { | ||
// Get the PodDefaults of the new Namespace | ||
this.backend.getPodDefaults(namespace).subscribe(pds => { | ||
this.podDefaults = pds; | ||
}); | ||
}); | ||
|
||
this.subscriptions.add(nsSub); | ||
} | ||
|
||
ngOnDestroy() { | ||
this.subscriptions.unsubscribe(); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...ensorboards/frontend/src/app/pages/form/form-configurations/form-configurations.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { FormModule as KfFormModule } from 'kubeflow'; | ||
import { FormConfigurationsComponent } from './form-configurations.component'; | ||
import { MatFormFieldModule } from '@angular/material/form-field'; | ||
import { ReactiveFormsModule } from '@angular/forms'; | ||
import { MatInputModule } from '@angular/material/input'; | ||
import { MatSelectModule } from '@angular/material/select'; | ||
|
||
@NgModule({ | ||
declarations: [FormConfigurationsComponent], | ||
imports: [ | ||
CommonModule, | ||
KfFormModule, | ||
MatFormFieldModule, | ||
ReactiveFormsModule, | ||
MatInputModule, | ||
MatSelectModule, | ||
], | ||
exports: [FormConfigurationsComponent], | ||
}) | ||
export class FormConfigurationsModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.