Skip to content

Commit

Permalink
Director sets the namespace according to the selected endpoint (#49)
Browse files Browse the repository at this point in the history
Signed-off-by: qijianshuai <[email protected]>
  • Loading branch information
qijianshuai authored May 4, 2023
1 parent 0006893 commit 1a400c9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ <h6 *ngIf="!noEndpoint"><b>{{'EndpointNew.currentSelection'|translate}}:</b>&nbs
<clr-dg-column [clrDgField]="'name'">{{'CommonlyUse.name'| translate}}</clr-dg-column>
<clr-dg-column>{{'CommonlyUse.description'| translate}}</clr-dg-column>
<clr-dg-column>{{'CommonlyUse.type'| translate}}</clr-dg-column>
<clr-dg-column>{{'NewCluster.namespace'| translate}}</clr-dg-column>
<clr-dg-column>{{'CommonlyUse.creationTime'| translate}}</clr-dg-column>
<clr-dg-column>{{'EndpointMg.infraName'|translate}}</clr-dg-column>
<clr-dg-column>{{'EndpointMg.endpointURL'|translate}}</clr-dg-column>
Expand All @@ -53,6 +54,7 @@ <h6 *ngIf="!noEndpoint"><b>{{'EndpointNew.currentSelection'|translate}}:</b>&nbs
<clr-dg-cell>{{endpoint?.name}}</clr-dg-cell>
<clr-dg-cell>{{endpoint?.description}}</clr-dg-cell>
<clr-dg-cell>{{endpoint?.type}}</clr-dg-cell>
<clr-dg-cell>{{endpoint?.namespace}}</clr-dg-cell>
<clr-dg-cell>{{endpoint?.created_at | date : "medium"}}</clr-dg-cell>
<clr-dg-cell>{{endpoint?.infra_provider_name}}</clr-dg-cell>
<clr-dg-cell>{{endpoint?.kubefate_host}}</clr-dg-cell>
Expand Down Expand Up @@ -91,6 +93,8 @@ <h6 *ngIf="!noEndpoint"><b>{{'EndpointNew.currentSelection'|translate}}:</b>&nbs
<clr-input-container class="no-warp">
<label>{{'NewCluster.namespace'|translate}}</label>
<input clrInput Placeholder="Default: fate-exchange" formControlName="namespace"
[disabled]="setNamespaceDisabled"
[class]="{disabled: setNamespaceDisabled}"
(ngModelChange)="selectChange($event)" />
</clr-input-container>
<button clrStepButton="next">{{'CommonlyUse.next'| translate}}</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,8 @@ form {
margin-right: 20px;
}
}
}
.disabled {
color: #666;
cursor: not-allowed;
}
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,16 @@ export class DirectorNewComponent implements OnInit {
return this.codeMirror && !this.hasYAMLTextAreaDOM && this.form.controls['yaml'].get('yaml')?.value
}

// set Namespace Disabled
get setNamespaceDisabled() {
if (this.selectedEndpoint && this.selectedEndpoint.namespace) {
this.form.get('namespace')?.get('namespace')?.setValue(this.selectedEndpoint.namespace)
return true
} else {
return false
}
}

//reset form when selection change
onSelectEndpoint() {
if (this.selectedEndpoint) {
Expand Down

0 comments on commit 1a400c9

Please sign in to comment.