Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cherry-pick: UI fix for handling missing params #1657

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@
<mat-form-field appearance="outline" class="fit-content">
<mat-label>Source Type</mat-label>
<mat-select formControlName="type">
<mat-option value="configmap">ConfigMap</mat-option>
<mat-option
[disabled]="!templates.length"
[matTooltip]="!templates.length ? 'No Trial templates found' : ''"
value="configmap"
>
ConfigMap
</mat-option>
<mat-option value="yaml">YAML</mat-option>
</mat-select>
</mat-form-field>
Expand Down Expand Up @@ -90,7 +96,7 @@
<mat-divider class="margin-bottom margin-top"></mat-divider>

<app-trial-parameter
*ngFor="let ctrl of trialParameters.controls"
*ngFor="let ctrl of trialParameters?.controls"
[formGroup]="ctrl"
></app-trial-parameter>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class FormTrialTemplateComponent implements OnInit, OnDestroy {
public templates: ConfigMapResponse[] = [];
public configmaps: ConfigMapBody[] = [];
public paths: string[] = [];
public trialParameters: FormArray;
public trialParameters = new FormArray([]);
private selectedConfigMap: ConfigMapBody;
private subs = new Subscription();
private yamlPrv = '';
Expand Down Expand Up @@ -53,6 +53,12 @@ export class FormTrialTemplateComponent implements OnInit, OnDestroy {
this.backend.getTrialTemplates('').subscribe(templates => {
this.templates = templates.Data;
this.formGroup.get('cmNamespace').setValue('kubeflow');

// Use the ConfigMap option if the TrialTemplates were successfully
// fetched
if (this.templates && this.templates.length) {
this.formGroup.get('type').setValue('configmap');
}
}),
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export class ExperimentFormService {

createTrialTemplateForm(): FormGroup {
return this.builder.group({
type: 'configmap',
type: 'yaml',
podLabels: this.builder.array([]),
containerName: 'training-container',
successCond: 'status.conditions.#(type=="Complete")#|#(status=="True")#',
Expand Down