Skip to content

Commit 1a400c9

Browse files
authored
Director sets the namespace according to the selected endpoint (#49)
Signed-off-by: qijianshuai <qjianshuai@vmware.com>
1 parent 0006893 commit 1a400c9

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

frontend/src/app/view/openfl/director-new/director-new.component.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ <h6 *ngIf="!noEndpoint"><b>{{'EndpointNew.currentSelection'|translate}}:</b>&nbs
4545
<clr-dg-column [clrDgField]="'name'">{{'CommonlyUse.name'| translate}}</clr-dg-column>
4646
<clr-dg-column>{{'CommonlyUse.description'| translate}}</clr-dg-column>
4747
<clr-dg-column>{{'CommonlyUse.type'| translate}}</clr-dg-column>
48+
<clr-dg-column>{{'NewCluster.namespace'| translate}}</clr-dg-column>
4849
<clr-dg-column>{{'CommonlyUse.creationTime'| translate}}</clr-dg-column>
4950
<clr-dg-column>{{'EndpointMg.infraName'|translate}}</clr-dg-column>
5051
<clr-dg-column>{{'EndpointMg.endpointURL'|translate}}</clr-dg-column>
@@ -53,6 +54,7 @@ <h6 *ngIf="!noEndpoint"><b>{{'EndpointNew.currentSelection'|translate}}:</b>&nbs
5354
<clr-dg-cell>{{endpoint?.name}}</clr-dg-cell>
5455
<clr-dg-cell>{{endpoint?.description}}</clr-dg-cell>
5556
<clr-dg-cell>{{endpoint?.type}}</clr-dg-cell>
57+
<clr-dg-cell>{{endpoint?.namespace}}</clr-dg-cell>
5658
<clr-dg-cell>{{endpoint?.created_at | date : "medium"}}</clr-dg-cell>
5759
<clr-dg-cell>{{endpoint?.infra_provider_name}}</clr-dg-cell>
5860
<clr-dg-cell>{{endpoint?.kubefate_host}}</clr-dg-cell>
@@ -91,6 +93,8 @@ <h6 *ngIf="!noEndpoint"><b>{{'EndpointNew.currentSelection'|translate}}:</b>&nbs
9193
<clr-input-container class="no-warp">
9294
<label>{{'NewCluster.namespace'|translate}}</label>
9395
<input clrInput Placeholder="Default: fate-exchange" formControlName="namespace"
96+
[disabled]="setNamespaceDisabled"
97+
[class]="{disabled: setNamespaceDisabled}"
9498
(ngModelChange)="selectChange($event)" />
9599
</clr-input-container>
96100
<button clrStepButton="next">{{'CommonlyUse.next'| translate}}</button>

frontend/src/app/view/openfl/director-new/director-new.component.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,8 @@ form {
5656
margin-right: 20px;
5757
}
5858
}
59+
}
60+
.disabled {
61+
color: #666;
62+
cursor: not-allowed;
5963
}

frontend/src/app/view/openfl/director-new/director-new.component.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,16 @@ export class DirectorNewComponent implements OnInit {
317317
return this.codeMirror && !this.hasYAMLTextAreaDOM && this.form.controls['yaml'].get('yaml')?.value
318318
}
319319

320+
// set Namespace Disabled
321+
get setNamespaceDisabled() {
322+
if (this.selectedEndpoint && this.selectedEndpoint.namespace) {
323+
this.form.get('namespace')?.get('namespace')?.setValue(this.selectedEndpoint.namespace)
324+
return true
325+
} else {
326+
return false
327+
}
328+
}
329+
320330
//reset form when selection change
321331
onSelectEndpoint() {
322332
if (this.selectedEndpoint) {

0 commit comments

Comments
 (0)