Commit 06fcd6a9 by Ooh-Ao

layout

parent dd585d89
...@@ -60,8 +60,7 @@ ...@@ -60,8 +60,7 @@
"src/.htaccess" "src/.htaccess"
], ],
"styles": [ "styles": [
"src/styles.scss", "src/styles.scss"
"node_modules/@fortawesome/fontawesome-free/css/all.min.css"
], ],
"scripts": [ "scripts": [
"node_modules/preline/dist/preline.js" "node_modules/preline/dist/preline.js"
......
...@@ -88,12 +88,12 @@ ...@@ -88,12 +88,12 @@
(datasetSelected)="onDatasetSelected($event)" (datasetSelected)="onDatasetSelected($event)"
></app-dataset-picker> ></app-dataset-picker>
<div *ngIf="dashboardData" class="relative flex items-center"> <div *ngIf="dashboardData" class="relative flex items-center">
<input <!-- <input
type="text" type="text"
[(ngModel)]="dashboardData.thName" [(ngModel)]="dashboardData.thName"
(blur)="saveDashboardName()" (blur)="saveDashboardName()"
class="p-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 bg-white text-gray-800 font-semibold" class="p-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 bg-white text-gray-800 font-semibold"
/> /> -->
<button <button
(click)="saveDashboardName()" (click)="saveDashboardName()"
class="ml-2 text-emerald-500 hover:text-emerald-700 focus:outline-none" class="ml-2 text-emerald-500 hover:text-emerald-700 focus:outline-none"
...@@ -107,12 +107,12 @@ ...@@ -107,12 +107,12 @@
> >
<i class="bi bi-plus-circle-fill"></i> New Dashboard <i class="bi bi-plus-circle-fill"></i> New Dashboard
</button> </button>
<button <!-- <button
(click)="addDataDrivenWidget()" (click)="addDataDrivenWidget()"
class="ti-btn ti-btn-info-full flex items-center gap-2" class="ti-btn ti-btn-info-full flex items-center gap-2"
> >
<i class="bi bi-plus-circle-fill"></i> Add Data-Driven Widget (Test) <i class="bi bi-plus-circle-fill"></i> Add Data-Driven Widget (Test)
</button> </button> -->
<button <button
*ngIf="selectedDashboardId" *ngIf="selectedDashboardId"
(click)="deleteDashboard()" (click)="deleteDashboard()"
...@@ -137,11 +137,12 @@ ...@@ -137,11 +137,12 @@
</div> </div>
<div class="dashboard-content"> <div class="dashboard-content">
<ejs-dashboardlayout <ejs-dashboardlayout
[columns]="6" [columns]="6"
#editLayout #editLayout
[cellSpacing]="cellSpacing" [cellSpacing]="cellSpacing"
[allowResizing]="true"
(change)="onPanelChange($event)"
> >
<e-panels> <e-panels>
<e-panel <e-panel
......
...@@ -771,4 +771,22 @@ export class DashboardManagementComponent implements OnInit { ...@@ -771,4 +771,22 @@ export class DashboardManagementComponent implements OnInit {
}); });
}); });
} }
onPanelChange(args: any): void {
if (this.dashboardData && args.changedPanels) {
args.changedPanels.forEach((changedPanel: PanelModel) => {
const widgetIndex = this.dashboardData!.widgets.findIndex(w => w.id === changedPanel.id);
if (widgetIndex > -1) {
const updatedWidget = { ...this.dashboardData!.widgets[widgetIndex] };
updatedWidget.cols = changedPanel.sizeX!;
updatedWidget.rows = changedPanel.sizeY!;
updatedWidget.x = changedPanel.col!;
updatedWidget.y = changedPanel.row!;
this.dashboardData!.widgets[widgetIndex] = updatedWidget;
}
});
// Save the updated dashboard after all panels have been processed
this.dashboardDataService.saveDashboard(this.dashboardData!).subscribe();
}
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment