Advanced Cluster Enhancements
- Added edit cluster, profile type in OKA
- State to Git State in all pages
- Changed mandatory fields of edit profile
- Changed api in cluster page
Change-Id: I8a3239f83eb58a3997e4550fc030694c0a2a6c72
Signed-off-by: SANDHYA.JS <sandhya.j@tataelxsi.co.in>
diff --git a/src/app/k8s/k8scluster/K8sClusterComponent.ts b/src/app/k8s/k8scluster/K8sClusterComponent.ts
index 95c8e88..c79493e 100644
--- a/src/app/k8s/k8scluster/K8sClusterComponent.ts
+++ b/src/app/k8s/k8scluster/K8sClusterComponent.ts
@@ -165,7 +165,7 @@
}
},
state: {
- title: this.translateService.instant('STATE'), width: '15%', type: 'html',
+ title: this.translateService.instant('GITSTATE'), width: '15%', type: 'html',
filter: {
type: 'list',
config: {
@@ -288,66 +288,27 @@
/** Fetching the data from server to Load in the smarttable @protected */
protected generateData(): void {
this.isLoadingResults = true;
- 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;
- });
+ this.restService.getResource(environment.K8SCREATECLUSTER_URL).subscribe((k8sClusterDatas: K8SCLUSTERDATA[]) => {
+ if (!isNullOrUndefined(k8sClusterDatas)) {
+ this.k8sClusterData = [];
+ k8sClusterDatas.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';
}
- }, (error: ERRORDATA) => {
- this.restService.handleError(error, 'get');
- this.isLoadingResults = false;
- });
- }
-
- /** 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 {
- 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;
}
}