Advanced Cluster Management Enhancements 20/14820/5 v17.0.0
authorSANDHYA.JS <sandhya.j@tataelxsi.co.in>
Tue, 10 Dec 2024 09:51:03 +0000 (15:21 +0530)
committerjssan <sandhya.j@tataelxsi.co.in>
Fri, 13 Dec 2024 09:35:01 +0000 (10:35 +0100)
- Chnaged cluster page design from switch to single page
- Added bootstrap option in creation and registration
- Added horizontal scaling, vertical scaling and upgrade in
  cluster action
- In cluster page, for list combined two apis to show list done
  temporary fix from UI

Change-Id: Ie4d30f5db28025ec92398cc60fc50ab7030f8f9b
Signed-off-by: SANDHYA.JS <sandhya.j@tataelxsi.co.in>
17 files changed:
src/app/k8s/k8s-action/K8sActionComponent.html
src/app/k8s/k8s-action/K8sActionComponent.ts
src/app/k8s/k8s-add-cluster/K8sAddClusterComponent.html
src/app/k8s/k8s-add-cluster/K8sAddClusterComponent.scss
src/app/k8s/k8s-add-cluster/K8sAddClusterComponent.ts
src/app/k8s/k8scluster/K8sClusterComponent.html
src/app/k8s/k8scluster/K8sClusterComponent.scss
src/app/k8s/k8scluster/K8sClusterComponent.ts
src/app/utilities/delete/DeleteComponent.html
src/app/utilities/delete/DeleteComponent.ts
src/app/utilities/show-info/ShowInfoComponent.ts
src/assets/i18n/de.json
src/assets/i18n/en.json
src/assets/i18n/es.json
src/assets/i18n/pt.json
src/models/CommonModel.ts
src/models/K8sModel.ts

index efa3616..5482868 100644 (file)
@@ -16,28 +16,34 @@ limitations under the License.
 Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
 -->
 <div class="btn-group list action" role="group">
-  <button *ngIf="getK8sType === 'repo'" type="button" class="btn btn-primary" (click)="infoK8s(getK8sType)"
+  <button *ngIf="getK8sType === 'repo' || !isCluster && !isKSU && !isProfile" type="button" class="btn btn-primary"
+    (click)="infoK8s(getK8sType)" placement="top" container="body" ngbTooltip="{{'INFO' | translate}}">
+    <i class="fas fa-info icons list" title="info"></i>
+  </button>
+  <button *ngIf="isCluster && !isKSU && !isProfile " type="button" class="btn btn-primary" (click)="infoK8s(getK8sType)"
     placement="top" container="body" ngbTooltip="{{'INFO' | translate}}">
     <i class="fas fa-info icons list" title="info"></i>
   </button>
-  <button *ngIf="(isCluster  || isProfile || isKSU) && getK8sType !== 'repo' && !checkRegister" [disabled]="state != 'CREATED'"
-    type="button" class="btn btn-primary" (click)="deleteK8s()" placement="top" container="body"
-    ngbTooltip="{{'DELETE' | translate}}">
+  <button *ngIf="(isCluster  || isProfile || isKSU)" type="button" class="btn btn-primary" (click)="deleteK8s()"
+    placement="top" container="body" ngbTooltip="{{'DELETE' | translate}}">
     <i class="far fa-trash-alt icons" title="delete"></i>
   </button>
-  <button *ngIf="(!isCluster  || !isProfile || !isKSU) && getK8sType === 'repo'" type="button" class="btn btn-primary"
-    (click)="deleteK8s()" placement="top" container="body" ngbTooltip="{{'DELETE' | translate}}">
+  <button *ngIf="getK8sType === 'repo'" type="button" class="btn btn-primary" (click)="deleteK8s()" placement="top"
+    container="body" ngbTooltip="{{'DELETE' | translate}}">
     <i class="far fa-trash-alt icons" title="delete"></i>
   </button>
-  <button *ngIf="checkRegister && !isCluster && !isProfile && !isKSU && getK8sType !== 'repo'"
-    [disabled]="state != 'CREATED'" type="button" class="btn btn-primary" (click)="deleteK8s()" placement="top"
+  <button *ngIf="!isCluster && !isKSU && !isProfile && getK8sType !== 'repo' " type="button" class="btn btn-primary" (click)="deleteK8s()" placement="top"
     container="body" ngbTooltip="{{'DEREGISTER' | translate}}">
     <i class="fas fa-window-close icons" title="deregister"></i>
   </button>
-  <div *ngIf="isCluster && !isProfile && !isKSU  && getK8sType !== 'repo'" class="btn-group" placement="bottom-right" ngbDropdown
+  <button *ngIf="isProfile" type="button" class="btn btn-primary" placement="top" container="body"
+    (click)="editProfile(getK8sType)" ngbTooltip="{{'PAGE.K8S.EDITPROFILE' | translate}}">
+    <i class="fa fa-edit icons"></i>
+  </button>
+  <div *ngIf="isCluster || !isCluster && !isKSU && !isProfile && getK8sType !== 'repo' " class="btn-group" placement="bottom-right" ngbDropdown
     display="dynamic" container="body">
-    <button type="button" class="btn btn-primary" [disabled]="state != 'CREATED'" ngbDropdownToggle placement="top" container="body"
-      ngbTooltip="{{'Attach Profile' | translate}}">
+    <button type="button" class="btn btn-primary" [disabled]="!isCluster" ngbDropdownToggle placement="top"
+      container="body" ngbTooltip="{{'Attach Profile' | translate}}">
       <i class="fas fa-link"></i>
     </button>
     <div class="dropdown-menu list-action-dropdown" ngbDropdownMenu>
@@ -60,38 +66,46 @@ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.i
       </button>
     </div>
   </div>
-  <div *ngIf="(isProfile || isKSU || isCluster  && getK8sType !== 'repo')" class="btn-group" ngbDropdown display="dynamic" container="body">
-    <button type="button" [disabled]="state != 'CREATED'" class="btn btn-primary dropdown-toggle action-button" ngbDropdownToggle>
+  <div *ngIf="((isCluster || !isCluster)&& !isKSU && !isProfile && getK8sType !== 'repo'  )" class="btn-group" ngbDropdown display="dynamic" container="body">
+    <button type="button" [disabled]="!isCluster" class="btn btn-primary dropdown-toggle action-button"
+      ngbDropdownToggle>
       {{'ACTION' | translate}}
     </button>
     <div class="dropdown-menu list-action-dropdown" ngbDropdownMenu>
-      <button *ngIf="isProfile && !KSU && !isCluster" type="button" class="btn btn-primary dropdown-item"
-        placement="left" container="body" (click)="editProfile(getK8sType)" ngbTooltip="{{'PAGE.K8S.EDITPROFILE' | translate}}">
-        <i class="fa fa-edit icons"></i> {{'PAGE.K8S.EDITPROFILE' | translate}}
+      <button *ngIf="isCluster" type="button" class="btn btn-primary dropdown-item" placement="left"
+        (click)="editCluster('upgrade')" container="body" ngbTooltip="{{'PAGE.K8S.UPGRADECLUSTER' | translate}}">
+        <i class="fa fa-arrow-up"></i> {{'PAGE.K8S.UPGRADECLUSTER' | translate}}
       </button>
-      <button *ngIf="isKSU && !isProfile && !isCluster" type="button" class="btn btn-primary dropdown-item"
-        placement="left" (click)="moveKsu()" container="body" ngbTooltip="{{'PAGE.K8S.MOVE' | translate}}">
-        <i class="fas fa-truck-moving"></i> {{'PAGE.K8S.MOVE' | translate}}
+      <button *ngIf="isCluster" type="button" class="btn btn-primary dropdown-item" placement="left"
+        (click)="editCluster('horizontal')" container="body" ngbTooltip="{{'PAGE.K8S.HORIZONTALSCALING' | translate}}">
+        <i class="fas fa-arrows-alt-h"></i> {{'PAGE.K8S.HORIZONTALSCALING' | translate}}
       </button>
-      <button *ngIf="isKSU && !isProfile && !isCluster" type="button" class="btn btn-primary dropdown-item"
-        placement="left" (click)="cloneKsu()" container="body" ngbTooltip="{{'PAGE.K8S.CLONE' | translate}}">
-        <i class="fa fa-clone icons"></i> {{'PAGE.K8S.CLONE' | translate}}
+      <button *ngIf="isCluster" type="button" class="btn btn-primary dropdown-item" placement="left"
+        (click)="editCluster('vertical')" container="body" ngbTooltip="{{'PAGE.K8S.VERTICALSCALING' | translate}}">
+        <i class="fas fa-arrows-alt-v"></i> {{'PAGE.K8S.VERTICALSCALING' | translate}}
       </button>
-      <button *ngIf="isKSU && !isProfile && !isCluster" type="button" class="btn btn-primary dropdown-item"
-        placement="left" (click)="editKsu()" container="body" ngbTooltip="{{'EDIT' | translate}}">
-        <i class="fa fa-edit icons"></i> {{'EDIT' | translate}}
+      <button *ngIf="isCluster" type="button" class="btn btn-primary dropdown-item" placement="left"
+        (click)="getCredentials()" container="body" ngbTooltip="{{'PAGE.K8S.GETCREDENTIALS' | translate}}">
+        <i class="fas fa-download icons"></i> {{'PAGE.K8S.GETCREDENTIALS' | translate}}
       </button>
-      <button *ngIf="!isKSU && !isProfile && isCluster" type="button" class="btn btn-primary dropdown-item"
-        placement="left" (click)="editCluster('upgrade')" container="body" ngbTooltip="{{'PAGE.K8S.UPGRADE' | translate}}">
-        <i class="fa fa-arrow-up"></i> {{'PAGE.K8S.UPGRADE' | translate}}
+    </div>
+  </div>
+  <div *ngIf="isKSU" class="btn-group" ngbDropdown display="dynamic" container="body">
+    <button type="button" class="btn btn-primary dropdown-toggle action-button" ngbDropdownToggle>
+      {{'ACTION' | translate}}
+    </button>
+    <div class="dropdown-menu list-action-dropdown" ngbDropdownMenu>
+      <button *ngIf="isKSU" type="button" class="btn btn-primary dropdown-item" placement="left" (click)="moveKsu()"
+        container="body" ngbTooltip="{{'PAGE.K8S.MOVE' | translate}}">
+        <i class="fas fa-truck-moving"></i> {{'PAGE.K8S.MOVE' | translate}}
       </button>
-      <button *ngIf="!isKSU && !isProfile && isCluster" type="button" class="btn btn-primary dropdown-item"
-        placement="left" (click)="editCluster('scale')" container="body" ngbTooltip="{{'PAGE.K8S.SCALE' | translate}}">
-        <i class="fas fa-compress-alt"></i> {{'PAGE.K8S.SCALE' | translate}}
+      <button *ngIf="isKSU" type="button" class="btn btn-primary dropdown-item" placement="left" (click)="cloneKsu()"
+        container="body" ngbTooltip="{{'PAGE.K8S.CLONE' | translate}}">
+        <i class="fa fa-clone icons"></i> {{'PAGE.K8S.CLONE' | translate}}
       </button>
-      <button *ngIf="!isKSU && !isProfile && isCluster" type="button" class="btn btn-primary dropdown-item"
-        placement="left" (click)="getCredentials()" container="body" ngbTooltip="{{'PAGE.K8S.GETCREDENTIALS' | translate}}">
-        <i class="fas fa-download icons"></i> {{'PAGE.K8S.GETCREDENTIALS' | translate}}
+      <button *ngIf="isKSU" type="button" class="btn btn-primary dropdown-item" placement="left" (click)="editKsu()"
+        container="body" ngbTooltip="{{'EDIT' | translate}}">
+        <i class="fa fa-edit icons"></i> {{'EDIT' | translate}}
       </button>
     </div>
   </div>
index 4723deb..bbd574f 100644 (file)
@@ -121,21 +121,20 @@ export class K8sActionComponent {
     this.instanceID = this.value.identifier;
     this.getK8sType = this.value.pageType;
     this.state = this.value.state;
-    if (sessionStorage.getItem('clusterType') === 'Registered') {
-      this.checkRegister = true;
-    }
-    if (this.getK8sType === 'infra-config' || this.getK8sType === 'infra-controller' || this.getK8sType === 'app-profile' || this.getK8sType === 'resource-profile') {
-      this.isCluster = false;
-      this.isProfile = true;
-      this.isKSU = false;
-    } else if (sessionStorage.getItem('clusterType') === 'Managed') {
+    if ((this.value.createdbyosm) === 'true') {
       this.isCluster = true;
-      this.isProfile = false;
-      this.isKSU = false;
+    } else if ((this.value.createdbyosm) === 'false') {
+      this.isCluster = false;
     }
     if (this.getK8sType === 'k8-ksu') {
       this.isKSU = true;
-      this.isCluster = false;
+    } else {
+      this.isKSU = false;
+    }
+
+    if (this.getK8sType === 'infra-config' || this.getK8sType === 'infra-controller' || this.getK8sType === 'app-profile' || this.getK8sType === 'resource-profile') {
+    this.isProfile = true;
+    } else {
       this.isProfile = false;
     }
   }
@@ -168,7 +167,10 @@ export class K8sActionComponent {
     this.modalService.open(ShowInfoComponent, { backdrop: 'static' }).componentInstance.params = {
       id: this.instanceID,
       page: pageName,
-      titleName: title
+      titleName: title,
+      createdbyosm: this.value.createdbyosm,
+      bootstrap: this.value.bootstrap,
+      key: this.value.key
     };
   }
   /** Edit profile @public */
index a8d5820..3d623ae 100644 (file)
@@ -17,19 +17,39 @@ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.i
 -->
 <form [formGroup]="k8sclusterForm" (ngSubmit)="k8sAddClusterSubmit();">
   <div class="modal-header">
-    <h4 *ngIf="profileType === 'Register'" class="modal-title" id="modal-basic-title">{{'PAGE.K8S.REGISTERCLUSTER' | translate}}
+    <h4 *ngIf="profileType === 'Register'" class="modal-title" id="modal-basic-title">{{'PAGE.K8S.REGISTERCLUSTER' |
+      translate}}
     </h4>
-    <h4 *ngIf="profileType === 'Manage'" class="modal-title" id="modal-basic-title">{{'PAGE.K8S.CREATECLUSTER' | translate}}
+    <h4 *ngIf="profileType === 'Manage'" class="modal-title" id="modal-basic-title">{{'PAGE.K8S.CREATECLUSTER' |
+      translate}}
     </h4>
-    <h4 *ngIf="profileType === 'upgrade'" class="modal-title" id="modal-basic-title">{{'PAGE.K8S.UPGRADECLUSTER' | translate}}
+    <h4 *ngIf="profileType === 'upgrade'" class="modal-title" id="modal-basic-title">{{'PAGE.K8S.UPGRADECLUSTER' |
+      translate}}
+    </h4>
+    <h4 *ngIf="profileType === 'vertical'" class="modal-title" id="modal-basic-title">{{'PAGE.K8S.VERTICALSCALING' |
+      translate}}
+    </h4>
+    <h4 *ngIf="profileType === 'horizontal'" class="modal-title" id="modal-basic-title">{{'PAGE.K8S.HORIZONTALSCALING' |
+      translate}}
     </h4>
-    <h4 *ngIf="profileType === 'scale'" class="modal-title" id="modal-basic-title">{{'PAGE.K8S.SCALECLUSTER' | translate}}</h4>
     <button class="button-xs" type="button" class="close" aria-label="Close" (click)="activeModal.close()">
       <i class="fas fa-times-circle text-danger"></i>
     </button>
   </div>
   <div class="modal-body modal-body-custom-height">
     <div class="form-group row mb-3" *ngIf="profileType === 'Manage' || profileType === 'Register'">
+      <div class="col-sm-12">
+        <label class="form-check-label">
+          <input class="quotacheck form-check-input" (click)=getValue($event) type="checkbox"
+            formControlName="bootstrap" id="quotacheck">
+          <label class="form-check-label" for="quotaCheck">&nbsp;<b>{{ 'PAGE.K8S.BOOTSTRAP' | translate }}</b> </label>
+          <i class="fas fa-info-circle tooltip-icon">
+            &nbsp;<span class="tooltip-text">{{ 'PAGE.K8S.BOOTSTRAPINFO' | translate }}</span>
+          </i>
+        </label>
+      </div>
+    </div>
+    <div class="form-group row mb-3" *ngIf="profileType === 'Manage' || profileType === 'Register' || !isChecked">
       <label class="col-sm-12 col-form-label mandatory-label"
         [ngClass]="{'text-danger': k8sclusterForm.invalid === true && submitted === true}">{{'MANDATORYCHECK' |
         translate}}</label>
@@ -39,8 +59,7 @@ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.i
           formControlName="name" id="name" [ngClass]="{ 'is-invalid': submitted && f.name.errors }" required>
       </div>
     </div>
-    <div class="form-group row mb-3"
-      *ngIf="profileType === 'Manage' || profileType === 'Register'|| profileType === 'upgrade'">
+    <div class="form-group row mb-3" *ngIf="profileType === 'Manage'|| !isChecked">
       <label class="col-sm-4 col-form-label" for="k8s_version">{{'PAGE.K8S.K8SVERSION' | translate}}*</label>
       <div class="col-sm-8">
         <input autocomplete="off" class="form-control" placeholder="{{'PAGE.K8S.K8SVERSION' | translate}}" type="text"
@@ -48,7 +67,7 @@ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.i
           required>
       </div>
     </div>
-    <div class="form-group row mb-3" *ngIf="profileType === 'Manage' || profileType === 'Register'">
+    <div class="form-group row mb-3" *ngIf="profileType === 'Manage' || profileType === 'Register' || !isChecked">
       <label class="col-sm-4 col-form-label" for="vim_account">{{'PAGE.K8S.VIMACCOUNT' | translate}}*</label>
       <div class="col-sm-8">
         <ng-select (change)="getDetailsvim($event)"
@@ -58,7 +77,7 @@ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.i
         </ng-select>
       </div>
     </div>
-    <div class="form-group row mb-3" *ngIf="profileType === 'Register'">
+    <div class="form-group row mb-3" *ngIf="!isChecked && profileType === 'Register'">
       <label class="col-sm-4 col-form-label" for="deployment_methods">{{'PAGE.K8S.DEPLOYMENTMETHODS' |
         translate}}*</label>
       <div class="col-sm-8">
@@ -69,27 +88,27 @@ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.i
         </ng-select>
       </div>
     </div>
-    <div class="form-group row mb-3" *ngIf="profileType === 'Manage' || profileType === 'Register'">
-      <label class="col-sm-4 col-form-label" for="description">{{'PAGE.K8S.DESCRIPTION' | translate}}*</label>
+    <div class="form-group row mb-3" *ngIf="profileType === 'Manage' || profileType === 'Register' || !isChecked">
+      <label class="col-sm-4 col-form-label" for="description">{{'PAGE.K8S.DESCRIPTION' | translate}}</label>
       <div class="col-sm-8">
         <textarea class="form-control" placeholder="{{'PAGE.K8S.DESCRIPTION' | translate}}" type="text"
-          formControlName="description" id="description" [ngClass]="{ 'is-invalid': submitted && f.description.errors }"
-          required></textarea>
+          formControlName="description" id="description"
+          [ngClass]="{ 'is-invalid': submitted && f.description.errors }"></textarea>
       </div>
     </div>
-    <div class="form-group row mb-3" *ngIf="profileType === 'Register'">
+    <div class="form-group row mb-3" *ngIf="!isChecked && profileType === 'Register'">
       <label class="col-sm-4 col-form-label" for="nets">{{'PAGE.K8S.NETS' | translate}}*</label>
       <div class="col-sm-8">
         <textarea rows="5" cols="50" class="form-control" placeholder="{{'PAGE.K8S.NETSPLACEHOLDER' | translate}}"
           formControlName="nets" id="nets" [ngClass]="{ 'is-invalid': submitted && f.nets.errors }" required></textarea>
         <div class="fileupload-text mt-1 mb-1">{{'FILEUPLOADLABEL' | translate}}</div>
         <div class="custom-file">
-          <input type="file" #fileInputNets class="fileupload custom-file-input" (change)="netsFile($event.target.files)"
-            id="customFileNets">
+          <input type="file" #fileInputNets class="fileupload custom-file-input"
+            (change)="netsFile($event.target.files)" id="customFileNets">
         </div>
       </div>
     </div>
-    <div class="form-group row mb-3" *ngIf="profileType === 'Register'">
+    <div class="form-group row mb-3" *ngIf="profileType === 'Register'|| (profileType === 'Register' && !isChecked)">
       <label class="col-sm-4 col-form-label" for="credentials">{{'PAGE.K8S.CREDENTIALS' | translate}}*</label>
       <div class="col-sm-8">
         <textarea rows="5" cols="50" class="form-control" placeholder="{{'YAMLCONFIG' | translate}}"
@@ -113,12 +132,12 @@ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.i
     <div class="form-group row mb-3" *ngIf="profileType === 'Manage'">
       <label class="col-sm-4 col-form-label" for="k8s_version">{{'PAGE.K8S.RESOURCEGROUP' | translate}}</label>
       <div class="col-sm-8">
-        <input autocomplete="off" class="form-control" placeholder="{{'PAGE.K8S.RESOURCEGROUP' | translate}}" type="text"
-          formControlName="resource_group" id="k8s_version"
+        <input autocomplete="off" class="form-control" placeholder="{{'PAGE.K8S.RESOURCEGROUP' | translate}}"
+          type="text" formControlName="resource_group" id="k8s_version"
           [ngClass]="{ 'is-invalid': submitted && f.resource_group.errors }">
       </div>
     </div>
-    <div class="form-group row mb-3" *ngIf="profileType === 'Manage' || profileType === 'scale'">
+    <div class="form-group row mb-3" *ngIf="profileType === 'Manage'">
       <label class="col-sm-4 col-form-label" for="node_count">{{'PAGE.K8S.NODECOUNT' | translate}}*</label>
       <div class="col-sm-8">
         <input autocomplete="off" class="form-control" placeholder="{{'PAGE.K8S.NODECOUNT' | translate}}" type="text"
@@ -134,12 +153,34 @@ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.i
           required>
       </div>
     </div>
+    <div class="form-group row mb-3" *ngIf="profileType === 'horizontal'">
+      <label class="col-sm-4 col-form-label" for="node_count">{{'PAGE.K8S.NODECOUNT' | translate}}</label>
+      <div class="col-sm-8">
+        <input autocomplete="off" class="form-control" placeholder="{{'PAGE.K8S.NODECOUNT' | translate}}" type="text"
+          formControlName="nodeCount" id="node_count" [ngClass]="{ 'is-invalid': submitted && f.nodeCount.errors }">
+      </div>
+    </div>
+    <div class="form-group row mb-3" *ngIf="profileType === 'vertical'">
+      <label class="col-sm-4 col-form-label" for="k8s_version">{{'PAGE.K8S.NODESIZE' | translate}}</label>
+      <div class="col-sm-8">
+        <input autocomplete="off" class="form-control" placeholder="{{'PAGE.K8S.NODESIZE' | translate}}" type="text"
+          formControlName="nodeSize" id="k8s_version" [ngClass]="{ 'is-invalid': submitted && f.nodeSize.errors }">
+      </div>
+    </div>
+    <div class="form-group row mb-3" *ngIf="profileType === 'upgrade'">
+      <label class="col-sm-4 col-form-label" for="k8s_version">{{'PAGE.K8S.K8SVERSION' | translate}}</label>
+      <div class="col-sm-8">
+        <input autocomplete="off" class="form-control" placeholder="{{'PAGE.K8S.K8SVERSION' | translate}}" type="text"
+          formControlName="k8sVersion" id="k8s_version" [ngClass]="{ 'is-invalid': submitted && f.k8sVersion.errors }">
+      </div>
+    </div>
   </div>
   <div class="modal-footer">
     <button type="button" class="btn btn-danger" (click)="activeModal.close()">{{'CANCEL' | translate}}</button>
-    <button *ngIf="profileType === 'Manage' || profileType === 'Register'" type="submit"
-      class="btn btn-primary">{{'CREATE' | translate}}</button>
-    <button *ngIf="profileType === 'upgrade' || profileType === 'scale'" type="submit" class="btn btn-primary">{{'APPLY'
+    <button *ngIf="profileType === 'Manage'" type="submit" class="btn btn-primary">{{'CREATE' | translate}}</button>
+    <button *ngIf="profileType === 'Register'" type="submit" class="btn btn-primary">{{'REGISTER' | translate}}</button>
+    <button *ngIf="profileType === 'upgrade' || profileType === 'vertical' || profileType === 'horizontal'"
+      type="submit" class="btn btn-primary">{{'APPLY'
       | translate}}</button>
   </div>
 </form>
index 021d205..8885be8 100644 (file)
  limitations under the License.
 
  Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
-*/
\ No newline at end of file
+*/
+@import "../../../assets/scss/variable.scss";
+@import "../../../assets/scss/mixins/mixin";
+.quotacheck {
+   box-shadow: none;
+   border-radius: 2px;
+   border-color: $gray-600;
+}
+.form-check {
+   padding-left: 30px;
+}
+.quotaCheck-label {
+   position: absolute;
+   left: 26px;
+}
+.tooltip-icon {
+   position: relative;
+   margin-left: 5px;
+   cursor: pointer;
+ }
+ .tooltip-icon .tooltip-text {
+   visibility: hidden;
+   width: 200px;
+   background-color: #fff;
+   color: #555;
+   text-align: center;
+   padding: 5px 10px;
+   border-radius: 4px;
+   @include border(all, 1, solid, $gray-300);
+   z-index: 1;
+   bottom: 125%;
+   left: 50%;
+   transform: translateX(-50%);
+   opacity: 0;
+   transition: opacity 0.3s;
+ }
+ .tooltip-icon:hover .tooltip-text {
+   visibility: visible;
+   opacity: 1;
+ }
\ No newline at end of file
index bb5dcfa..cf03f0f 100644 (file)
@@ -29,7 +29,7 @@ import { environment } from 'environment';
 import * as jsyaml from 'js-yaml';
 import { K8SPayload } from 'K8sModel';
 import { RestService } from 'RestService';
-import { SharedService } from 'SharedService';
+import { isNullOrUndefined, SharedService } from 'SharedService';
 import { VimAccountDetails } from 'VimAccountModel';
 /**
  * Creating Component
@@ -81,6 +81,9 @@ export class K8sAddClusterComponent implements OnInit {
   /** contains payload */
   public payload: K8SPayload;
 
+  /** Check the checkbox status */
+  public isChecked: boolean = true;
+
   /** Check the loading results @public */
   public isLoadingResults: boolean = false;
 
@@ -154,14 +157,18 @@ export class K8sAddClusterComponent implements OnInit {
       name: ['', [Validators.required]],
       k8s_version: ['', [Validators.required]],
       vim_account: [null, [Validators.required]],
-      description: ['', [Validators.required]],
+      description: [''],
       nets: ['', [Validators.required]],
       deployment_methods: ['', [Validators.required]],
       credentials: ['', [Validators.required]],
       region_name: [''],
       resource_group: [''],
       node_count: ['', [Validators.required]],
-      node_size: ['', [Validators.required]]
+      node_size: ['', [Validators.required]],
+      bootstrap: [true],
+      k8sVersion: ['', [Validators.required]],
+      nodeCount: ['', [Validators.required]],
+      nodeSize: ['', [Validators.required]]
     });
   }
 
@@ -180,6 +187,11 @@ export class K8sAddClusterComponent implements OnInit {
     });
   }
 
+  /** Call the event when checkbox is checked @public */
+  public getValue(event: Event): void {
+    this.isChecked = (event.target as HTMLInputElement).checked;
+  }
+
 
   /** Contain selected vimAccount details @public */
   public getDetailsvim(event: VimAccountDetails): void {
@@ -192,45 +204,64 @@ export class K8sAddClusterComponent implements OnInit {
       this.getFormControl('nets').disable();
       this.getFormControl('credentials').disable();
       this.getFormControl('deployment_methods').disable();
+      this.getFormControl('k8sVersion').disable();
+      this.getFormControl('nodeSize').disable();
+      this.getFormControl('nodeCount').disable();
       this.manageCluster();
-    } else if (this.profileType === 'Register') {
+    } else if (this.profileType === 'Register' && this.isChecked === true) {
       this.clusterUrl = environment.K8SCREATECLUSTER_URL + '/register';
       this.getFormControl('region_name').disable();
       this.getFormControl('resource_group').disable();
-      this.getFormControl('node_count').disable();
+      this.getFormControl('k8s_version').disable();
       this.getFormControl('node_size').disable();
+      this.getFormControl('node_count').disable();
+      this.getFormControl('nets').disable();
+      this.getFormControl('deployment_methods').disable();
+      this.getFormControl('k8sVersion').disable();
+      this.getFormControl('nodeSize').disable();
+      this.getFormControl('nodeCount').disable();
       this.registerCluster();
-    } else if (this.profileType === 'upgrade') {
-      this.clusterUrl = environment.K8SCREATECLUSTER_URL + '/' + this.profileID + '/' + 'upgrade';
+    } if (this.isChecked === false && this.profileType === 'Register') {
+      this.clusterUrl = environment.K8SCLUSTER_URL;
+      this.getFormControl('bootstrap').disable();
       this.getFormControl('region_name').disable();
       this.getFormControl('resource_group').disable();
       this.getFormControl('node_count').disable();
       this.getFormControl('node_size').disable();
-      this.getFormControl('nets').disable();
-      this.getFormControl('credentials').disable();
-      this.getFormControl('deployment_methods').disable();
-      this.getFormControl('name').disable();
-      this.getFormControl('vim_account').disable();
-      this.getFormControl('description').disable();
-      this.updateCluster();
-    } else if (this.profileType === 'scale') {
-      this.clusterUrl = environment.K8SCREATECLUSTER_URL + '/' + this.profileID + '/' + 'scale';
+      this.getFormControl('k8sVersion').disable();
+      this.getFormControl('nodeSize').disable();
+      this.getFormControl('nodeCount').disable();
+      this.oldregisterCluster();
+    } else if (this.profileType === 'upgrade' || this.profileType === 'horizontal' || this.profileType === 'vertical') {
+      this.clusterUrl = environment.K8SCREATECLUSTER_URL + '/' + this.profileID + '/' + 'update';
       this.getFormControl('region_name').disable();
       this.getFormControl('resource_group').disable();
-      this.getFormControl('k8s_version').disable();
-      this.getFormControl('node_size').disable();
       this.getFormControl('nets').disable();
       this.getFormControl('credentials').disable();
       this.getFormControl('deployment_methods').disable();
       this.getFormControl('name').disable();
       this.getFormControl('vim_account').disable();
       this.getFormControl('description').disable();
+      this.getFormControl('bootstrap').disable();
+      this.getFormControl('node_count').disable();
+      this.getFormControl('node_size').disable();
+      this.getFormControl('k8s_version').disable();
+      if (this.profileType === 'upgrade') {
+        this.getFormControl('nodeCount').disable();
+        this.getFormControl('nodeSize').disable();
+      } else if (this.profileType === 'vertical') {
+        this.getFormControl('nodeCount').disable();
+        this.getFormControl('k8sVersion').disable();
+      } else if (this.profileType === 'horizontal') {
+        this.getFormControl('nodeSize').disable();
+        this.getFormControl('k8sVersion').disable();
+      }
       this.updateCluster();
     }
   }
 
-  /** Register cluster @public */
-  public registerCluster(): void {
+  /** Old Register cluster flow @public */
+  public oldregisterCluster(): void {
     this.submitted = true;
     this.sharedService.cleanForm(this.k8sclusterForm);
     if (this.k8sclusterForm.invalid) {
@@ -275,6 +306,49 @@ export class K8sAddClusterComponent implements OnInit {
 
     this.k8sclusterForm.value.vim_account = this.vimAccountId;
 
+    if (this.k8sclusterForm.value.description === '') {
+      delete this.k8sclusterForm.value.description;
+    }
+
+    const apiURLHeader: APIURLHEADER = {
+      url: this.clusterUrl,
+      httpOptions: { headers: this.headers }
+    };
+
+    this.isLoadingResults = true;
+    this.restService.postResource(apiURLHeader, this.k8sclusterForm.value).subscribe((result: {}) => {
+      this.activeModal.close(modalData);
+      this.isLoadingResults = false;
+      this.notifierService.notify('success', this.k8sclusterForm.value.name +
+        this.translateService.instant('PAGE.K8S.REGISTEREDSUCCESSFULLY'));
+    }, (error: ERRORDATA) => {
+      this.restService.handleError(error, 'post');
+      this.isLoadingResults = false;
+    });
+  }
+
+  /** New Register cluster flow @public */
+  public registerCluster(): void {
+    this.submitted = true;
+    this.sharedService.cleanForm(this.k8sclusterForm);
+    if (this.k8sclusterForm.invalid) {
+      return;
+    }
+    const modalData: MODALCLOSERESPONSEDATA = {
+      message: 'Done'
+    };
+    const validJSONCredentails: boolean = this.sharedService.checkJson(this.k8sclusterForm.value.credentials);
+    if (validJSONCredentails) {
+      this.k8sclusterForm.value.credentials = jsyaml.load(this.k8sclusterForm.value.credentials.toString(), { json: true });
+    } else {
+      this.notifierService.notify('error', this.translateService.instant('INVALIDCONFIG'));
+      return;
+    }
+
+    if (this.k8sclusterForm.value.description === '') {
+      delete this.k8sclusterForm.value.description;
+    }
+
     const apiURLHeader: APIURLHEADER = {
       url: this.clusterUrl,
       httpOptions: { headers: this.headers }
@@ -317,16 +391,20 @@ export class K8sAddClusterComponent implements OnInit {
       k8s_version: this.k8sclusterForm.value.k8s_version,
       node_size: this.k8sclusterForm.value.node_size,
       node_count: Number(this.k8sclusterForm.value.node_count),
-      description: this.k8sclusterForm.value.description
+      description: this.k8sclusterForm.value.description,
+      bootstrap: Boolean(this.k8sclusterForm.value.bootstrap)
     };
     if (this.k8sclusterForm.value.region_name === '') {
       delete payload.region_name;
     } else if (this.k8sclusterForm.value.resource_group === '') {
       delete payload.resource_group;
+    } else if (this.k8sclusterForm.value.description === '') {
+      delete payload.description;
     }
-    if (this.k8sclusterForm.value.region_name === '' && this.k8sclusterForm.value.resource_group === '') {
+    if (this.k8sclusterForm.value.region_name === '' && this.k8sclusterForm.value.resource_group === '' && this.k8sclusterForm.value.description === '') {
       delete payload.region_name;
       delete payload.resource_group;
+      delete payload.description;
     }
     this.restService.postResource(apiURLHeader, payload).subscribe((result: {}) => {
       this.activeModal.close(modalData);
@@ -353,17 +431,20 @@ export class K8sAddClusterComponent implements OnInit {
       url: this.clusterUrl,
       httpOptions: { headers: this.headers }
     };
-
-    this.isLoadingResults = true;
     if (this.profileType === 'upgrade') {
       this.payload = {
-        k8s_version: this.k8sclusterForm.value.k8s_version
+        k8s_version: this.k8sclusterForm.value.k8sVersion
+      };
+    } else if (this.profileType === 'vertical') {
+      this.payload = {
+        node_size: (this.k8sclusterForm.value.nodeSize)
       };
-    } else if (this.profileType === 'scale') {
+    } else if (this.profileType === 'horizontal') {
       this.payload = {
-        node_count: this.k8sclusterForm.value.node_count
+        node_count: Number(this.k8sclusterForm.value.nodeCount)
       };
     }
+    this.isLoadingResults = true;
     this.restService.postResource(apiURLHeader, this.payload).subscribe((result: {}) => {
       this.activeModal.close(modalData);
       this.isLoadingResults = false;
index 0bb251e..3c01f4f 100644 (file)
@@ -16,29 +16,15 @@ limitations under the License.
 Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
 -->
 <div class="d-flex flex-row justify-content-between">
-  <div class="d-flex align-items-center header-style">
-    <div class="switches-container justify-content-start">
-      <input type="radio" id="switchRegister" name="switchPlan" (change)="onChangeEvent($event.target.value)"
-        value="Registered" checked="checked" />
-      <input type="radio" id="switchManage" name="switchPlan" (change)="onChangeEvent($event.target.value)"
-        value="Managed" />
-      <label for="switchRegister">{{'PAGE.K8S.REGISTERED' | translate}}</label>
-      <label for="switchManage">{{'PAGE.K8S.MANAGED' | translate}}</label>
-      <div class="switch-wrapper">
-        <div class="switch">
-          <div>{{'PAGE.K8S.REGISTERED' | translate}}</div>
-          <div>{{'PAGE.K8S.MANAGED' | translate}}</div>
-        </div>
-      </div>
-    </div>
+  <div class="d-flex align-items-center header-style"> {{'PAGE.K8S.MENUK8SCLUSTER' | translate}}
   </div>
   <span class="button justify-content-end">
-    <button *ngIf="isCluster === 'Registered'" class="btn btn-primary me-2" type="button" placement="top"
-      container="body" ngbTooltip="{{'PAGE.K8S.REGISTERCLUSTER' | translate}}" (click)="addK8sCluster()">
+    <button class="btn btn-primary me-2" type="button" placement="top" container="body"
+      ngbTooltip="{{'PAGE.K8S.REGISTERCLUSTER' | translate}}" (click)="addK8sCluster('Register')">
       <i class="fas fa-plus-circle" aria-hidden="true"></i>&nbsp; {{'PAGE.K8S.REGISTERCLUSTER' | translate}}
     </button>
-    <button *ngIf="isCluster === 'Managed'" class="btn btn-primary me-2" type="button" placement="top" container="body"
-      ngbTooltip="{{'Create Cluster' | translate}}" (click)="addK8sCluster()">
+    <button class="btn btn-primary me-2" type="button" placement="top" container="body"
+      ngbTooltip="{{'PAGE.K8S.CREATECLUSTER' | translate}}" (click)="addK8sCluster('Manage')">
       <i class="fas fa-plus-circle" aria-hidden="true"></i>&nbsp; {{'PAGE.K8S.CREATECLUSTER' | translate}}
     </button>
   </span>
@@ -46,11 +32,14 @@ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.i
 <div class="mt-2 mb-2 list-utilites-actions">
   <div class="col-auto me-auto">
     <nav class="custom-items-config">
+      <span><i class="fas fa-cloud-upload-alt text-info"></i>{{clusterModeFirstStep}}</span>
+      <span><i class="fas fa-clipboard-check text-info"></i>{{clusterModeSecondStep}}</span>
       <span><i class="fas fa-clock text-success"></i>{{operationalStateFirstStep}}</span>
       <span><i class="fas fa-spinner text-warning"></i>{{operationalStateSecondStep}}</span>
       <span><i class="fas fa-spinner text-danger"></i>{{operationalStateThirdStep}}</span>
       <span><i class="fas fa-times-circle text-danger"></i>{{operationalStateFourthStep}}</span>
       <span><i class="fas fa-times-circle text-warning"></i>{{operationalStateFifthStep}}</span>
+      <span><i class="fas fa-ban text-danger"></i>{{operationalStateSixthStep}}</span>
     </nav>
   </div>
   <page-per-row class="me-2" (pagePerRow)="onChange($event)"></page-per-row>
index d194553..8c2b739 100644 (file)
 
  Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
 */
-.switches-container {
-   border-bottom: 1px solid #5f5f5f;
-   background-color: #054c8c;
-   border-radius: 2px;
-   width: 230px;
-   position: relative;
-   display: block;
-   padding: 0;
-   line-height: 2em;
-   border-radius: 3rem;
-   margin-left: auto;
-   margin-right: auto;
-   height: 36px;
-}
-
-.switches-container input {
-   visibility: hidden;
-   position: absolute;
-   top: 0;
-}
-
-.switches-container label {
-   width: 50%;
-   padding: 0;
-   margin: 0;
-   text-align: center;
-   cursor: pointer;
-   color: white;
-   font-size: 0.875rem;
-   font-weight: 400;
-}
-
-.switch-wrapper {
-   position: absolute;
-   top: 0;
-   bottom: 0;
-   width: 50%;
-   padding: 0.15rem;
-   z-index: 3;
-   transition: transform 0.5s cubic-bezier(0.77, 0, 0.175, 1);
-}
-
-.switch {
-   border-radius: 3rem;
-   background: white;
-   height: 100%;
-   width: 110px;
-   margin-top: 1px;
-   margin-right: 1px;
-}
-
-.switch div {
-   width: 100%;
-   text-align: center;
-   opacity: 0;
-   display: block;
-   color: #054c8c;
-   font-size: 0.875rem;
-   font-weight: 400;
-   transition: opacity 0.2s cubic-bezier(0.77, 0, 0.175, 1) 0.125s;
-   will-change: opacity;
-   position: absolute;
-   top: 0;
-   left: 0;
-}
-
-/* slide the switch box from right to left */
-.switches-container input:nth-of-type(1):checked ~ .switch-wrapper {
-   transform: translateX(0%);
-}
-
-/* slide the switch box from left to right */
-.switches-container input:nth-of-type(2):checked ~ .switch-wrapper {
-   transform: translateX(100%);
-}
-
-/* toggle the switch box labels - first checkbox:checked - show first switch div */
-.switches-container input:nth-of-type(1):checked ~ .switch-wrapper .switch div:nth-of-type(1) {
-   opacity: 1;
-}
-
-/* toggle the switch box labels - second checkbox:checked - show second switch div */
-.switches-container input:nth-of-type(2):checked ~ .switch-wrapper .switch div:nth-of-type(2) {
-   opacity: 1;
-}
index ee98ed5..95c8e88 100644 (file)
@@ -29,8 +29,9 @@ import { K8sAddClusterComponent } from 'K8sAddClusterComponent';
 import { K8SCLUSTERDATA, K8SCLUSTERDATADISPLAY, K8SCREATEDATADISPLAY } from 'K8sModel';
 import { LocalDataSource } from 'ng2-smart-table';
 import { RestService } from 'RestService';
-import { Subscription } from 'rxjs';
-import { SharedService } from 'SharedService';
+import { forkJoin, Observable, Subscription } from 'rxjs';
+import { map } from 'rxjs/operators';
+import { isNullOrUndefined, SharedService } from 'SharedService';
 /**
  * Creating Component
  * @Component takes K8sClusterComponent.html as template url
@@ -81,6 +82,15 @@ export class K8sClusterComponent implements OnInit, OnDestroy {
   /** operational State failed creation data @public */
   public operationalStateFifthStep: string = CONFIGCONSTANT.k8OperationalStateFifthStep;
 
+  /** operational State failed creation data @public */
+  public operationalStateSixthStep: string = CONFIGCONSTANT.k8OperationalStateSixthStep;
+
+  /** Cluster Mode Managed data @public */
+  public clusterModeFirstStep: string = CONFIGCONSTANT.clusterModeFirstStep;
+
+  /** Cluster Mode Regsitered data @public */
+  public clusterModeSecondStep: string = CONFIGCONSTANT.clusterModeSecondStep;
+
   /** cluster Type @public */
   public isCluster: string = 'Registered';
 
@@ -128,6 +138,32 @@ export class K8sClusterComponent implements OnInit, OnDestroy {
       name: { title: this.translateService.instant('NAME'), width: '20%', sortDirection: 'asc' },
       identifier: { title: this.translateService.instant('IDENTIFIER'), width: '20%' },
       version: { title: this.translateService.instant('K8VERSION'), width: '10%' },
+      clusterMode: {
+        title: this.translateService.instant('Cluster Mode'), width: '15%', type: 'html',
+        filter: {
+          type: 'list',
+          config: {
+            selectText: 'Select',
+            list: [
+              { value: this.clusterModeFirstStep, title: this.clusterModeFirstStep },
+              { value: this.clusterModeSecondStep, title: this.clusterModeSecondStep }
+            ]
+          }
+        },
+        valuePrepareFunction: (cell: K8SCLUSTERDATADISPLAY, row: K8SCLUSTERDATADISPLAY): string => {
+          if (row.clusterMode === this.clusterModeFirstStep) {
+            return `<span class="icon-label" title="${row.clusterMode}">
+                         <i class="fas fa-cloud-upload-alt text-info"></i>
+                         </span>`;
+          } else if (row.clusterMode === this.clusterModeSecondStep) {
+            return `<span class="icon-label" title="${row.clusterMode}">
+                         <i class="fas fa-clipboard-check text-info"></i>
+                         </span>`;
+          } else {
+            return `<span>${row.clusterMode}</span>`;
+          }
+        }
+      },
       state: {
         title: this.translateService.instant('STATE'), width: '15%', type: 'html',
         filter: {
@@ -138,8 +174,9 @@ export class K8sClusterComponent implements OnInit, OnDestroy {
               { value: this.operationalStateFirstStep, title: this.operationalStateFirstStep },
               { value: this.operationalStateSecondStep, title: this.operationalStateSecondStep },
               { value: this.operationalStateThirdStep, title: this.operationalStateThirdStep },
-              { value: this.operationalStateThirdStep, title: this.operationalStateFourthStep },
-              { value: this.operationalStateThirdStep, title: this.operationalStateFifthStep }
+              { value: this.operationalStateFourthStep, title: this.operationalStateFourthStep },
+              { value: this.operationalStateFifthStep, title: this.operationalStateFifthStep },
+              { value: this.operationalStateSixthStep, title: this.operationalStateFifthStep }
             ]
           }
         },
@@ -164,13 +201,16 @@ export class K8sClusterComponent implements OnInit, OnDestroy {
             return `<span class="icon-label" title="${row.state}">
                          <i class="fas fa-times-circle text-warning"></i>
                          </span>`;
+          } else if (row.state === this.operationalStateSixthStep) {
+            return `<span class="icon-label" title="${row.state}">
+                         <i class="fas fa-ban text-danger"></i>
+                         </span>`;
           } else {
             return `<span>${row.state}</span>`;
           }
         }
       },
       created: { title: this.translateService.instant('CREATED'), width: '15%' },
-      modified: { title: this.translateService.instant('MODIFIED'), width: '15%' },
       Actions: {
         name: 'Action', width: '5%', filter: false, sort: false, title: this.translateService.instant('ACTIONS'), type: 'custom',
         valuePrepareFunction: (cell: K8SCLUSTERDATADISPLAY, row: K8SCLUSTERDATADISPLAY): K8SCLUSTERDATADISPLAY => row,
@@ -202,11 +242,11 @@ export class K8sClusterComponent implements OnInit, OnDestroy {
   }
 
   /** Compose new K8s Cluster Accounts @public */
-  public addK8sCluster(): void {
+  public addK8sCluster(type?: string): void {
     // eslint-disable-next-line security/detect-non-literal-fs-filename
     const modalRef: NgbModalRef = this.modalService.open(K8sAddClusterComponent, { backdrop: 'static' });
 
-    if (this.isCluster === 'Registered') {
+    if (type === 'Register') {
       modalRef.componentInstance.profileType = 'Register';
     } else {
       modalRef.componentInstance.profileType = 'Manage';
@@ -231,56 +271,83 @@ export class K8sClusterComponent implements OnInit, OnDestroy {
   public generateK8sclusterData(k8sClusterdata: K8SCLUSTERDATA): K8SCLUSTERDATADISPLAY {
     return {
       name: k8sClusterdata.name,
-      state: k8sClusterdata.state,
+      state: !isNullOrUndefined(k8sClusterdata.state) ? k8sClusterdata.state : 'N/A',
       identifier: k8sClusterdata._id,
-      operationalState: k8sClusterdata._admin.operationalState,
+      operationalState: !isNullOrUndefined(k8sClusterdata._admin.operationalState) ? k8sClusterdata._admin.operationalState : 'N/A',
       version: k8sClusterdata.k8s_version,
       created: this.sharedService.convertEpochTime(Number(k8sClusterdata._admin.created)),
       modified: this.sharedService.convertEpochTime(Number(k8sClusterdata._admin.modified)),
-      pageType: 'cluster'
+      pageType: 'cluster',
+      createdbyosm: !isNullOrUndefined(k8sClusterdata.created) ? (k8sClusterdata.created) : 'false',
+      bootstrap: !isNullOrUndefined(k8sClusterdata.bootstrap) ? (k8sClusterdata.bootstrap) : false,
+      key: (k8sClusterdata.key === 'registered') ? true : false,
+      clusterMode: (k8sClusterdata.created === 'true') ? 'MANAGED' : 'REGISTERED'
     };
   }
 
-  /** Change event @public */
-  public onChangeEvent(value: string): void {
-    if (value === 'Managed') {
-      this.isCluster = 'Managed';
-    } else {
-      this.isCluster = 'Registered';
-    }
-    sessionStorage.setItem('clusterType', value);
-    this.generateColumns();
-    this.generateSettings();
-    this.generateData();
-  }
-
   /** Fetching the data from server to Load in the smarttable @protected */
   protected generateData(): void {
     this.isLoadingResults = true;
-    if (this.isCluster === 'Registered') {
-      this.clusterUrl = environment.K8SCREATECLUSTER_URL + '?created=false';
-    } else {
-      this.clusterUrl = environment.K8SCREATECLUSTER_URL + '?created=true';
-    }
-    this.restService.getResource(this.clusterUrl).subscribe((k8sClusterDatas: K8SCLUSTERDATA[]) => {
-      this.k8sClusterData = [];
-      k8sClusterDatas.forEach((k8sClusterdata: K8SCLUSTERDATA) => {
-        const k8sClusterDataObj: K8SCLUSTERDATADISPLAY = this.generateK8sclusterData(k8sClusterdata);
-        this.k8sClusterData.push(k8sClusterDataObj);
+    const tempURL: Observable<K8SCLUSTERDATA[]>[] = [];
+    const apiUrl1: string = environment.K8SCLUSTER_URL;
+    const apiUrl2: string = environment.K8SCREATECLUSTER_URL;
+    const response1$: Observable<K8SCLUSTERDATA[]> = this.restService.getResource(apiUrl1).pipe(
+      map((data: unknown) =>
+        data as K8SCLUSTERDATA[]
+      )
+    );
+    const response2$: Observable<K8SCLUSTERDATA[]> = this.restService.getResource(apiUrl2).pipe(
+      map((data: unknown) =>
+        data as K8SCLUSTERDATA[]
+      )
+    );
+    tempURL.push(response1$, response2$);
+    forkJoin(tempURL).subscribe(
+      ([response1, response2]) => {
+        if (!isNullOrUndefined(response1) && !isNullOrUndefined(response2)) {
+          const combinedResponse: K8SCLUSTERDATA[] = [...response1, ...response2];
+          const uniqueResponse = this.removeDuplicates(combinedResponse);
+          this.k8sClusterData = [];
+          uniqueResponse.forEach((clusterData: K8SCLUSTERDATA) => {
+            const k8sClusterDataObj: K8SCLUSTERDATADISPLAY = this.generateK8sclusterData(clusterData);
+            this.k8sClusterData.push(k8sClusterDataObj);
+          });
+          if (this.k8sClusterData.length > 0) {
+            this.checkDataClass = 'dataTables_present';
+          } else {
+            this.checkDataClass = 'dataTables_empty';
+          }
+          this.dataSource.load(this.k8sClusterData).then((data: boolean) => {
+            this.isLoadingResults = false;
+          }).catch(() => {
+            this.isLoadingResults = false;
+          });
+        }
+      }, (error: ERRORDATA) => {
+        this.restService.handleError(error, 'get');
+        this.isLoadingResults = false;
       });
-      if (this.k8sClusterData.length > 0) {
-        this.checkDataClass = 'dataTables_present';
+  }
+
+  /** Removes duplicates based on 'name' and merges them if necessary */
+  private removeDuplicates(response: K8SCLUSTERDATA[]): K8SCLUSTERDATA[] {
+    const seenIds = new Set();
+    const uniqueResponse: K8SCLUSTERDATA[] = [];
+    response.forEach((obj) => {
+      if (!seenIds.has(obj.name)) {
+        uniqueResponse.push(obj);
+        seenIds.add(obj.name);
       } else {
-        this.checkDataClass = 'dataTables_empty';
+        const existingObj = uniqueResponse.find((o) => o.name === obj.name);
+        Object.keys(obj).forEach((key) => {
+          // eslint-disable-next-line security/detect-object-injection
+          if (existingObj[key] !== obj[key]) {
+            // eslint-disable-next-line security/detect-object-injection
+            existingObj[key] = obj[key];
+          }
+        });
       }
-      this.dataSource.load(this.k8sClusterData).then((data: boolean) => {
-        this.isLoadingResults = false;
-      }).catch(() => {
-        this.isLoadingResults = false;
-      });
-    }, (error: ERRORDATA) => {
-      this.restService.handleError(error, 'get');
-      this.isLoadingResults = false;
     });
+    return uniqueResponse;
   }
 }
index 81cece0..c7a6c62 100644 (file)
@@ -16,7 +16,7 @@ limitations under the License.
 Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
 -->
 <div class="modal-header">
-  <h4 *ngIf="isRegisterPage; else Delete" class="modal-title" id="modal-basic-title">
+  <h4 *ngIf="createdbyosm === 'false'; else Delete" class="modal-title" id="modal-basic-title">
     {{'DEREGISTER' | translate}}
   </h4>
   <ng-template #Delete>
index c709672..9a8a0d8 100644 (file)
@@ -66,7 +66,7 @@ export class DeleteComponent {
 
   /** Number of instances @public */
   // eslint-disable-next-line @typescript-eslint/no-magic-numbers
-  public noOfInstances: Number = 25;
+  public noOfInstances: number = 10;
 
   /** Give the message for the loading @public */
   public notifyMessage: string = 'DELETELOADERMESSAGE';
@@ -74,6 +74,9 @@ export class DeleteComponent {
   /** Give the message for the loading @public */
   public message: string = 'PLEASEWAIT';
 
+  /** Check whether cluster is credated or registered @public */
+  public createdbyosm: string;
+
   /** DataService to pass the data from one component to another @private */
   private dataService: DataService;
 
@@ -83,6 +86,12 @@ export class DeleteComponent {
   /** Instance of the modal service @private */
   private id: string;
 
+  /** contsians bootstrap value @private */
+  private bootstrap: boolean;
+
+  /** Check whether cluster is registered or not @private */
+  private key: boolean;
+
   /** Variables holds url to be delete @private */
   private deleteURL: string;
 
@@ -123,6 +132,9 @@ export class DeleteComponent {
       if (sessionStorage.getItem('clusterType') === 'Registered') {
         this.isRegisterPage = true;
       }
+      this.createdbyosm = data.createdbyosm;
+      this.bootstrap = data.bootstrap;
+      this.key = data.key;
       if (!isNullOrUndefined(this.params)) {
         if (this.params.page === 'instantiateNS') {
           this.isPage = true;
@@ -230,9 +242,6 @@ export class DeleteComponent {
       this.deleteURL = environment.KSU_URL;
     } else if (data.page === 'k8-cluster') {
       this.page = data.page;
-      if (sessionStorage.getItem('clusterType') === 'Managed' || sessionStorage.getItem('clusterType') === 'Registered') {
-        this.deleteURL = environment.K8SCREATECLUSTER_URL;
-      }
     }
   }
   /** Generate Data function @public */
@@ -245,8 +254,23 @@ export class DeleteComponent {
     if (this.forceDelete) {
       deletingURl = this.deleteURL + '/' + this.id + '?FORCE=true';
       this.notifyMessage = 'DELETEDSUCCESSFULLY';
-    } else if (this.page === 'k8-cluster' && sessionStorage.getItem('clusterType') === 'Registered') {
-      deletingURl = this.deleteURL + '/' + this.id + '/deregister';
+    } else if (this.page === 'k8-cluster') {
+      if (this.createdbyosm === 'true') {
+        this.deleteURL = environment.K8SCREATECLUSTER_URL;
+        deletingURl = this.deleteURL + '/' + this.id;
+      } else {
+        if (this.bootstrap === false && this.key === true) {
+          this.deleteURL = environment.K8SCLUSTER_URL;
+          deletingURl = this.deleteURL + '/' + this.id;
+        } else if (this.bootstrap === false && this.key === false) {
+          this.deleteURL = environment.K8SCREATECLUSTER_URL;
+          deletingURl = this.deleteURL + '/' + this.id + '/deregister';
+        }
+        else if (this.bootstrap === true) {
+          this.deleteURL = environment.K8SCREATECLUSTER_URL;
+          deletingURl = this.deleteURL + '/' + this.id + '/deregister';
+        }
+      }
     } else {
       deletingURl = this.deleteURL + '/' + this.id;
     }
index 015d50c..6c21ac5 100644 (file)
@@ -98,6 +98,9 @@ export class ShowInfoComponent implements OnInit {
   /** Reading the page Name @public */
   public titleName: string;
 
+  /** Contains url @public */
+  public url: string;
+
   /** Check the loading results @public */
   public isLoadingResults: Boolean = false;
 
@@ -193,15 +196,25 @@ export class ShowInfoComponent implements OnInit {
           this.isLoadingResults = false;
         });
     } else if (this.params.page === 'k8s-cluster') {
-      this.restService.getResource(environment.K8SCLUSTER_URL + '/' +
-        this.params.id).subscribe((k8sclusterOpn: {}[]) => {
-          this.defaults['text/json'] = JSON.stringify(k8sclusterOpn, null, '\t');
-        }, (error: ERRORDATA) => {
-          this.isLoadingResults = false;
-          this.restService.handleError(error, 'get');
-        }, () => {
-          this.isLoadingResults = false;
-        });
+      if (this.params.createdbyosm === 'true') {
+        this.url = environment.K8SCREATECLUSTER_URL + '/' + this.params.id;
+      } else {
+        if (this.params.bootstrap === true) {
+          this.url = environment.K8SCREATECLUSTER_URL + '/' + this.params.id;
+        } else if (this.params.bootstrap === false && this.params.key === false) {
+          this.url = environment.K8SCREATECLUSTER_URL + '/' + this.params.id;
+        } else if (this.params.bootstrap === false && this.params.key === true) {
+          this.url = environment.K8SCLUSTER_URL + '/' + this.params.id;
+        }
+      }
+      this.restService.getResource(this.url).subscribe((k8sclusterOpn: {}[]) => {
+        this.defaults['text/json'] = JSON.stringify(k8sclusterOpn, null, '\t');
+      }, (error: ERRORDATA) => {
+        this.isLoadingResults = false;
+        this.restService.handleError(error, 'get');
+      }, () => {
+        this.isLoadingResults = false;
+      });
     } else if (this.params.page === 'k8s-repo') {
       this.restService.getResource(environment.K8REPOS_URL + '/' +
         this.params.id).subscribe((k8srepoOpn: {}[]) => {
index bc80975..b3dbfe4 100644 (file)
     "SELECTVDU": "Wählen VDU",
     "DATE": "Datum",
     "DEREGISTER": "Abmelden",
+    "REGISTER": "Registrieren",
     "PAGE": {
         "DASHBOARD": {
             "DASHBOARD": "Instrumententafel",
             "REGISTEREDSUCCESSFULLY": "K8s Erfolgreich registriert",
             "OKA": "OKA",
             "PATH": "SW-Katalogpfad",
-            "GETCREDENTIALS": "Anmeldeinformationen abrufen"
+            "GETCREDENTIALS": "Anmeldeinformationen abrufen",
+            "HORIZONTALSCALING": "Horizontale Skalierung",
+            "VERTICALSCALING": "Vertikale Skalierung",
+            "BOOTSTRAP": "Bootstrap",
+            "BOOTSTRAPINFO": "Bereite dich auf GitOps vor"
         },
         "OSMREPO": {
             "MENUOSMREPO": "OSM-Repositorys",
index e9ceb32..ada5d6e 100644 (file)
     "SELECTVDU": "Select VDU",
     "DATE": "Date",
     "DEREGISTER": "Deregister",
+    "REGISTER": "Register",
     "PAGE": {
         "DASHBOARD": {
             "DASHBOARD": "Dashboard",
             "REGISTEREDSUCCESSFULLY": "K8s Registered Successfully",
             "OKA": "OKA",
             "PATH": "SW Catalog Path",
-            "GETCREDENTIALS": "Get Credentials"
+            "GETCREDENTIALS": "Get Credentials",
+            "HORIZONTALSCALING": "Horizontal Scaling",
+            "VERTICALSCALING": "Vertical Scaling",
+            "BOOTSTRAP": "Bootstrap",
+            "BOOTSTRAPINFO": "Prepare for GitOps"
         },
         "OSMREPO": {
             "MENUOSMREPO": "OSM Repositories",
index fe5e576..8082d6e 100644 (file)
     "SELECTVDU": "Seleccionar VDU",
     "DATE": "Fecha",
     "DEREGISTER": "Darse de baja",
+    "REGISTER": "Registrar",
     "PAGE": {
         "DASHBOARD": {
             "DASHBOARD": "Tablero",
             "REGISTEREDSUCCESSFULLY": "K8s Registrado con éxito",
             "OKA": "OKA",
             "PATH": "Ruta del catálogo SW",
-            "GETCREDENTIALS": "Obtener credenciales"
+            "GETCREDENTIALS": "Obtener credenciales",
+            "HORIZONTALSCALING": "Escalado Horizontal",
+            "VERTICALSCALING": "Escalado Vertical",
+            "BOOTSTRAP": "Bootstrap",
+            "BOOTSTRAPINFO": "Prepárate para GitOps"
         },
         "OSMREPO": {
             "MENUOSMREPO": "Repositorios OSM",
index cc68a22..8c099b1 100644 (file)
     "SELECTVDU": "Selecione VDU",
     "DATE": "Data",
     "DEREGISTER": "Cancelar registro",
+    "REGISTER": "Registrar",
     "PAGE": {
         "DASHBOARD": {
             "DASHBOARD": "painel de controle",
             "REGISTEREDSUCCESSFULLY": "K8s registado com sucesso",
             "OKA": "OKA",
             "PATH": "Caminho do Catálogo SW",
-            "GETCREDENTIALS": "Obter credenciais"
+            "GETCREDENTIALS": "Obter credenciais",
+            "HORIZONTALSCALING": "Escalonamento Horizontal",
+            "VERTICALSCALING": "Escalonamento Vertical",
+            "BOOTSTRAP": "Bootstrap",
+            "BOOTSTRAPINFO": "Prepare-se para GitOps"
         },
         "OSMREPO": {
             "MENUOSMREPO": "Repositórios OSM",
index 0b85878..cb69103 100644 (file)
@@ -75,6 +75,9 @@ export enum CONFIGCONSTANT {
     k8OperationalStateThirdStep = 'IN_DELETION',
     k8OperationalStateFourthStep = 'FAILED_DELETION',
     k8OperationalStateFifthStep = 'FAILED_CREATION',
+    k8OperationalStateSixthStep = 'N/A',
+    clusterModeFirstStep = 'MANAGED',
+    clusterModeSecondStep = 'REGISTERED',
     done = 'done',
     close = 'close',
     userActive = 'active',
@@ -131,6 +134,9 @@ export interface URLPARAMS {
     actions?: object;
     executedActions?: EXECUTEDACTIONS[];
     identifierList: [];
+    createdbyosm?: string;
+    bootstrap?: boolean;
+    key?: boolean;
 }
 /** Handle the Delete params */
 export interface DELETEPARAMS {
@@ -142,6 +148,9 @@ export interface DELETEPARAMS {
     page?: string;
     id?: string;
     productName?: string;
+    createdbyosm?: string;
+    bootstrap?: boolean;
+    key?: boolean;
 }
 
 /** Interface for the Delete Details */
index 307cb34..58a96b1 100644 (file)
@@ -32,6 +32,10 @@ export interface K8SCLUSTERDATA {
     _admin: Admin;
     _id: string;
     state?: string;
+    resourceState?: string;
+    created?: string;
+    bootstrap?: boolean;
+    key?: string;
 }
 /** Interface for K8SCLUSTERDATA */
 export interface K8SREPODATA {
@@ -110,14 +114,18 @@ interface JujuBundle {
 export interface K8SCLUSTERDATADISPLAY {
     name: string;
     identifier: string;
-    operationalState: string;
+    operationalState?: string;
     version: number;
-    created: string;
-    modified: string;
+    created?: string;
+    modified?: string;
     pageType: string;
     description?: string;
     default?: boolean;
     state?: string;
+    createdbyosm?: string;
+    bootstrap?: boolean;
+    key?: boolean;
+    clusterMode?: string;
 }
 /** Interface for the K8SCLUSTERDATA Return to Display */
 export interface K8SREPODATADISPLAY {
@@ -131,6 +139,9 @@ export interface K8SREPODATADISPLAY {
     description?: string;
     default?: boolean;
     state?: string;
+    createdbyosm?: boolean;
+    bootstrap?: boolean;
+    key?: boolean;
 }
 
 /** Interface for the Create cluster */
@@ -171,6 +182,9 @@ export interface INFRACONFIGPAYLOAD {
     modified?: string;
     ksus?: KSU[];
     state?: string;
+    createdbyosm?: boolean;
+    bootstrap?: boolean;
+    key?: boolean;
 }
 
 /** Interface for the KSU */
@@ -208,6 +222,7 @@ export interface K8SPayload {
     region_name?: string;
     resource_group?: string;
     'node_size'?: string;
+    bootstrap?: boolean
 }
 
 /** Interface for Profile Mappings */