data lake
This commit is contained in:
@@ -142,7 +142,6 @@
|
|||||||
|
|
||||||
<!-- who column -->
|
<!-- who column -->
|
||||||
<clr-dg-cell>
|
<clr-dg-cell>
|
||||||
<div style="display: flex; align-items: center; gap: 1px; flex-wrap: nowrap;">
|
|
||||||
<clr-signpost>
|
<clr-signpost>
|
||||||
<span style="cursor: pointer;" clrSignpostTrigger><clr-icon shape="help" class="success"
|
<span style="cursor: pointer;" clrSignpostTrigger><clr-icon shape="help" class="success"
|
||||||
style="color: rgb(0, 130, 236);"></clr-icon></span>
|
style="color: rgb(0, 130, 236);"></clr-icon></span>
|
||||||
@@ -157,20 +156,27 @@
|
|||||||
</clr-signpost>
|
</clr-signpost>
|
||||||
|
|
||||||
<!-- New JSON Update button -->
|
<!-- New JSON Update button -->
|
||||||
<button class="btn btn-icon btn-sm" (click)="updateJson(user.id)" title="Update JSON">
|
<button class="btn btn-icon" (click)="updateJson(user.id)" title="Update JSON">
|
||||||
<clr-icon shape="refresh"></clr-icon>
|
<clr-icon shape="refresh"></clr-icon>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<!-- Calculated Field button -->
|
<!-- Calculated Field button -->
|
||||||
<button class="btn btn-icon btn-sm" (click)="fetchAvailableKeys(user, false)" title="Create Calculated Field">
|
<button class="btn btn-icon" (click)="fetchAvailableKeys(user)" title="Create Calculated Field">
|
||||||
<clr-icon shape="calculator"></clr-icon>
|
<clr-icon shape="calculator"></clr-icon>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<!-- Group By button -->
|
<!-- Group By button -->
|
||||||
<button class="btn btn-icon btn-sm" (click)="openGroupByModal(user)" title="Group By Configuration">
|
<button class="btn btn-icon" (click)="openGroupByModal(user)" title="Group By Configuration">
|
||||||
<clr-icon shape="group"></clr-icon>
|
<clr-icon shape="group"></clr-icon>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
|
||||||
|
<!-- Blending Keys button (only shown for blending type with non-empty blending_lakeids) -->
|
||||||
|
<button class="btn btn-icon"
|
||||||
|
(click)="fetchBlendingKeys(user)"
|
||||||
|
title="Configure Blending Query"
|
||||||
|
*ngIf="canShowBlendingAction(user)">
|
||||||
|
<clr-icon shape="code"></clr-icon>
|
||||||
|
</button>
|
||||||
</clr-dg-cell>
|
</clr-dg-cell>
|
||||||
|
|
||||||
<!-- who colmn -->
|
<!-- who colmn -->
|
||||||
@@ -964,4 +970,36 @@
|
|||||||
</div>
|
</div>
|
||||||
</clr-modal>
|
</clr-modal>
|
||||||
|
|
||||||
|
<!-- Blending Keys Panel -->
|
||||||
|
<div class="blending-keys-panel" *ngIf="showBlendingKeys">
|
||||||
|
<div class="panel-header">
|
||||||
|
<h3>Blending Configuration</h3>
|
||||||
|
<button class="btn btn-icon" (click)="closeBlendingKeys()" title="Close">
|
||||||
|
<clr-icon shape="close"></clr-icon>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="panel-content">
|
||||||
|
<!-- Display keys for each blending lake -->
|
||||||
|
<div class="keys-container" *ngFor="let keyData of blendingKeysData">
|
||||||
|
<h4>Data Lake {{ keyData.lakeId }} - Table: {{ keyData.tableName }}</h4>
|
||||||
|
<div class="headers-container">
|
||||||
|
<span class="header-tag" *ngFor="let header of keyData.headers">{{ header }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- SQL Query Editor -->
|
||||||
|
<div class="sql-editor-container">
|
||||||
|
<h4>SQL Query Builder</h4>
|
||||||
|
<textarea class="clr-textarea sql-textarea"
|
||||||
|
[(ngModel)]="sqlQueryText"
|
||||||
|
placeholder="Enter your SQL query here using the available headers..."
|
||||||
|
rows="6"></textarea>
|
||||||
|
<div class="editor-actions">
|
||||||
|
<button class="btn btn-primary" (click)="updateSqlQuery()">Update SQL Query</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- htmlpopup -->
|
<!-- htmlpopup -->
|
||||||
@@ -422,3 +422,80 @@
|
|||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
cursor: pointer;
|
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;
|
||||||
|
}
|
||||||
|
|||||||
@@ -109,6 +109,12 @@ export class Data_lakeComponent implements OnInit {
|
|||||||
selectedBlendingLakeIds: string[] = [];
|
selectedBlendingLakeIds: string[] = [];
|
||||||
editSelectedBlendingLakeIds: string[] = [];
|
editSelectedBlendingLakeIds: string[] = [];
|
||||||
|
|
||||||
|
// New properties for blending functionality
|
||||||
|
showBlendingKeys = false;
|
||||||
|
blendingKeysData: any[] = [];
|
||||||
|
sqlQueryText = '';
|
||||||
|
selectedBlendingItem: any = null;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private extensionService: ExtensionService,
|
private extensionService: ExtensionService,
|
||||||
private userInfoService: UserInfoService,
|
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)
|
// Method to handle checkbox change for blending lakes (ADD form)
|
||||||
onBlendingLakeCheckboxChange(event: any, lakeId: number) {
|
onBlendingLakeCheckboxChange(event: any, lakeId: number) {
|
||||||
const lakeIdStr = lakeId.toString();
|
const lakeIdStr = lakeId.toString();
|
||||||
|
|||||||
@@ -42,6 +42,12 @@ export class Data_lakeservice{
|
|||||||
return this.apiRequest.get(apiUrl);
|
return this.apiRequest.get(apiUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Method to fetch blending keys for a specific lake ID
|
||||||
|
fetchBlendingKeys(lakeId: number): Observable<any> {
|
||||||
|
const _http = `${this.baseURL}/keys/${lakeId}`;
|
||||||
|
return this.apiRequest.get(_http);
|
||||||
|
}
|
||||||
|
|
||||||
// Method to update calculated fields for a data lake item
|
// Method to update calculated fields for a data lake item
|
||||||
updateCalculatedFields(id: number, calculatedFieldJson: string, isCalculatedField: boolean): Observable<any> {
|
updateCalculatedFields(id: number, calculatedFieldJson: string, isCalculatedField: boolean): Observable<any> {
|
||||||
const _http = this.baseURL + "/" + id;
|
const _http = this.baseURL + "/" + id;
|
||||||
|
|||||||
Reference in New Issue
Block a user