From 874d5dfed2ffea52edded08a0ab5f905718092bf Mon Sep 17 00:00:00 2001 From: Gaurav Kumar Date: Wed, 5 Nov 2025 18:35:43 +0530 Subject: [PATCH] data lake --- .../Data_lake/Data_lake.component.html | 92 +++++++++++++------ .../Data_lake/Data_lake.component.scss | 77 ++++++++++++++++ .../Data_lake/Data_lake.component.ts | 75 +++++++++++++++ .../Data_lake/Data_lake.service.ts | 6 ++ 4 files changed, 223 insertions(+), 27 deletions(-) diff --git a/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardnew/Data_lake/Data_lake.component.html b/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardnew/Data_lake/Data_lake.component.html index 3a3d46f..5bfc217 100644 --- a/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardnew/Data_lake/Data_lake.component.html +++ b/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardnew/Data_lake/Data_lake.component.html @@ -142,35 +142,41 @@ -
- - - -
Who Column
-
Account ID: {{user.accountId}}
-
Created At: {{user.createdAt| date}}
-
Created By: {{user.createdBy}}
-
Updated At: {{user.updatedAt | date}}
-
Updated By: {{user.updatedBy}}
-
-
+ + + +
Who Column
+
Account ID: {{user.accountId}}
+
Created At: {{user.createdAt| date}}
+
Created By: {{user.createdBy}}
+
Updated At: {{user.updatedAt | date}}
+
Updated By: {{user.updatedBy}}
+
+
- - + + - - - - - -
+ + + + + + + +
@@ -964,4 +970,36 @@ + +
+
+

Blending Configuration

+ +
+ +
+ +
+

Data Lake {{ keyData.lakeId }} - Table: {{ keyData.tableName }}

+
+ {{ header }} +
+
+ + +
+

SQL Query Builder

+ +
+ +
+
+
+
+ \ No newline at end of file diff --git a/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardnew/Data_lake/Data_lake.component.scss b/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardnew/Data_lake/Data_lake.component.scss index dac22f3..e220708 100644 --- a/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardnew/Data_lake/Data_lake.component.scss +++ b/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardnew/Data_lake/Data_lake.component.scss @@ -422,3 +422,80 @@ margin-bottom: 0; cursor: pointer; } + +/* Blending Keys Panel Styles */ +.blending-keys-panel { + position: fixed; + bottom: 0; + left: 0; + right: 0; + background-color: white; + border-top: 1px solid #ccc; + box-shadow: 0 -2px 4px rgba(0,0,0,0.1); + z-index: 1000; + max-height: 50vh; + overflow-y: auto; +} + +.panel-header { + display: flex; + justify-content: space-between; + align-items: center; + padding: 15px; + border-bottom: 1px solid #eee; + background-color: #f5f5f5; +} + +.panel-header h3 { + margin: 0; + color: #333; +} + +.panel-content { + padding: 15px; +} + +.keys-container { + margin-bottom: 20px; + padding: 10px; + border: 1px solid #eee; + border-radius: 4px; + background-color: #fafafa; +} + +.keys-container h4 { + margin-top: 0; + color: #555; +} + +.headers-container { + display: flex; + flex-wrap: wrap; + gap: 8px; + margin-top: 10px; +} + +.header-tag { + display: inline-block; + background-color: #e3f2fd; + border: 1px solid #bbdefb; + border-radius: 12px; + padding: 4px 10px; + font-size: 12px; + font-family: monospace; +} + +.sql-editor-container { + margin-top: 20px; +} + +.sql-textarea { + width: 100%; + font-family: 'Courier New', monospace; + font-size: 14px; +} + +.editor-actions { + margin-top: 10px; + text-align: right; +} diff --git a/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardnew/Data_lake/Data_lake.component.ts b/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardnew/Data_lake/Data_lake.component.ts index 525a440..d5b0a6e 100644 --- a/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardnew/Data_lake/Data_lake.component.ts +++ b/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardnew/Data_lake/Data_lake.component.ts @@ -109,6 +109,12 @@ export class Data_lakeComponent implements OnInit { selectedBlendingLakeIds: string[] = []; editSelectedBlendingLakeIds: string[] = []; + // New properties for blending functionality + showBlendingKeys = false; + blendingKeysData: any[] = []; + sqlQueryText = ''; + selectedBlendingItem: any = null; + constructor( private extensionService: ExtensionService, private userInfoService: UserInfoService, @@ -1307,6 +1313,75 @@ export class Data_lakeComponent implements OnInit { } } + // Method to check if blending action should be available + canShowBlendingAction(item: any): boolean { + return item.datalake_type === 'blending' && + item.blending_lakeids && + item.blending_lakeids.trim() !== ''; + } + + // Method to fetch blending keys + fetchBlendingKeys(item: any) { + this.selectedBlendingItem = item; + this.blendingKeysData = []; + this.showBlendingKeys = true; + + // Parse blending_lakeids string to array + const lakeIds = item.blending_lakeids.split(',').map(id => id.trim()).filter(id => id !== ''); + + // Fetch keys for each lake ID + lakeIds.forEach(lakeId => { + this.mainService.fetchBlendingKeys(Number(lakeId)).subscribe( + (data: any) => { + this.blendingKeysData.push({ + lakeId: lakeId, + tableName: data.tableName, + headers: data.headers + }); + }, + (error) => { + console.error('Error fetching keys for lake ID:', lakeId, error); + this.toastr.error(`Failed to fetch keys for Data Lake ${lakeId}`); + } + ); + }); + } + + // Method to update SQL query + updateSqlQuery() { + if (!this.selectedBlendingItem) { + this.toastr.error('No blending item selected'); + return; + } + + // Update the SQL query JSON field + this.selectedBlendingItem.sqlquery_json = this.sqlQueryText; + + // Call update service + this.mainService.update(this.selectedBlendingItem.id, this.selectedBlendingItem).subscribe( + (response) => { + this.toastr.success('SQL query updated successfully'); + // Update the local data + const index = this.product.findIndex(p => p.id === this.selectedBlendingItem.id); + if (index !== -1) { + this.product[index] = {...this.selectedBlendingItem}; + } + }, + (error) => { + console.error('Error updating SQL query:', error); + this.toastr.error('Failed to update SQL query'); + } + ); + } + + // Method to close blending keys panel + closeBlendingKeys() { + this.showBlendingKeys = false; + this.blendingKeysData = []; + this.sqlQueryText = ''; + this.selectedBlendingItem = null; + } + // Method to handle checkbox change for blending lakes (ADD form) onBlendingLakeCheckboxChange(event: any, lakeId: number) { const lakeIdStr = lakeId.toString(); diff --git a/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardnew/Data_lake/Data_lake.service.ts b/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardnew/Data_lake/Data_lake.service.ts index 5312cf8..b5aaea4 100644 --- a/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardnew/Data_lake/Data_lake.service.ts +++ b/frontend/angular-clarity-master/src/app/modules/main/builder/dashboardnew/Data_lake/Data_lake.service.ts @@ -42,6 +42,12 @@ export class Data_lakeservice{ return this.apiRequest.get(apiUrl); } + // Method to fetch blending keys for a specific lake ID + fetchBlendingKeys(lakeId: number): Observable { + const _http = `${this.baseURL}/keys/${lakeId}`; + return this.apiRequest.get(_http); + } + // Method to update calculated fields for a data lake item updateCalculatedFields(id: number, calculatedFieldJson: string, isCalculatedField: boolean): Observable { const _http = this.baseURL + "/" + id;