Commit cc462cc0 by Ooh-Ao

save

parent eb235a94
...@@ -605,6 +605,7 @@ export class DashboardManagementComponent implements OnInit { ...@@ -605,6 +605,7 @@ export class DashboardManagementComponent implements OnInit {
const newDashboard = new DashboardModel({ const newDashboard = new DashboardModel({
dashboardId: `dash-${Date.now()}`, dashboardId: `dash-${Date.now()}`,
thName: newDashboardName, thName: newDashboardName,
application: sessionStorage.getItem('module') || '',
widgets: [] widgets: []
}); });
this.dashboardDataService.saveDashboard(newDashboard).subscribe(addedDashboard => { this.dashboardDataService.saveDashboard(newDashboard).subscribe(addedDashboard => {
...@@ -715,7 +716,7 @@ export class DashboardManagementComponent implements OnInit { ...@@ -715,7 +716,7 @@ export class DashboardManagementComponent implements OnInit {
deleteDashboard(): void { deleteDashboard(): void {
if (this.selectedDashboardId && confirm('Are you sure you want to delete this dashboard?')) { if (this.selectedDashboardId && confirm('Are you sure you want to delete this dashboard?')) {
this.dashboardDataService.deleteDashboard(this.selectedDashboardId).subscribe(result => { this.dashboardDataService.deleteDashboard(this.dashboardData!).subscribe(result => {
console.log(result) console.log(result)
}); });
...@@ -741,6 +742,8 @@ export class DashboardManagementComponent implements OnInit { ...@@ -741,6 +742,8 @@ export class DashboardManagementComponent implements OnInit {
console.log('Dataset selected:', dataset); // Added for debugging/clarity console.log('Dataset selected:', dataset); // Added for debugging/clarity
if (this.dashboardData) { if (this.dashboardData) {
this.dashboardData.datasetId = dataset.itemId; this.dashboardData.datasetId = dataset.itemId;
this.dashboardData.templateId = dataset.templateId;
this.dashboardData.fileName = dataset.fileName;
this.dashboardStateService.selectDataset(dataset); this.dashboardStateService.selectDataset(dataset);
// this.getDatasetByTemplate(dataset); // this.getDatasetByTemplate(dataset);
} }
......
...@@ -79,6 +79,8 @@ export interface IDashboard { ...@@ -79,6 +79,8 @@ export interface IDashboard {
application: string; application: string;
description: string; description: string;
datasetId?: string; datasetId?: string;
templateId: string
fileName: string
widgets: IWidget[]; widgets: IWidget[];
} }
...@@ -89,6 +91,8 @@ export class DashboardModel implements IDashboard { ...@@ -89,6 +91,8 @@ export class DashboardModel implements IDashboard {
application: string; application: string;
description: string; description: string;
datasetId?: string; datasetId?: string;
templateId: string
fileName: string
widgets: IWidget[]; widgets: IWidget[];
constructor(data: Partial<IDashboard>) { constructor(data: Partial<IDashboard>) {
...@@ -98,6 +102,8 @@ export class DashboardModel implements IDashboard { ...@@ -98,6 +102,8 @@ export class DashboardModel implements IDashboard {
this.application = data.application ?? ''; this.application = data.application ?? '';
this.description = data.description ?? ''; this.description = data.description ?? '';
this.datasetId = data.datasetId; this.datasetId = data.datasetId;
this.templateId = data.templateId ?? '';
this.fileName = data.fileName ?? '';
this.widgets = data.widgets ? data.widgets.map(w => new WidgetModel(w)) : []; this.widgets = data.widgets ? data.widgets.map(w => new WidgetModel(w)) : [];
} }
} }
...@@ -37,7 +37,7 @@ export class DashboardDataService { ...@@ -37,7 +37,7 @@ export class DashboardDataService {
headers: new HttpHeaders({ headers: new HttpHeaders({
"Content-Type": "application/json", "Content-Type": "application/json",
}), }),
body: {} body: dashboard
}; };
return this.http.delete<any>(this.apiBaseUrl, options); return this.http.delete<any>(this.apiBaseUrl, options);
} }
......
...@@ -23,13 +23,13 @@ export class TokenService { ...@@ -23,13 +23,13 @@ export class TokenService {
throw new Error('Method not implemented.'); throw new Error('Method not implemented.');
} }
apptoken: any = { apptoken: any = {
"myhr-plus" : "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJBdXRoIiwidWlkIjoiOGFhNDUzMzAtMzE0Yy0xMWU3LWJhZjMtMmQ3ZDA5ODc3NzQ0Iiwicm9sZXMiOlsiYWRtaW4iXSwiaXNzIjoiQ29tcHV0ZXIgU2NpZW5jZSBDb3Jwb3JhdGlvbiBMaW1pdGVkIiwidXNlcm5hbWUiOiJhZG1pbiJ9.Um39_CTM01n1g4XpFyuAa3VPxOozNPnJ0mu7kxU6KUs", "myhr-plus": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJBdXRoIiwidWl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hbWUiOiJhZG1pbiJ9.Um39_CTM01n1g4XpFyuAa3VPxOozNPnJ0mu7kxU6KUs", "myskill-x": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJBdXRoIiwidWlkIjoiOGFhNDUzMzAtMzE0Yy0xMWU3LWJhZjMtMmQ3ZDA5ODc3NzQ0Iiwicm9sZXMiOlsiYWRtaW4iXSwiaXNzIjoiQ29tcHV0ZXIgU2NpZW5jZSBDb3Jwb3JhdGlvbiBMaW1pdGVkIiwidXNlcm5hbWUiOiJhZG1pbiJ9.Um39_CTM01n1g4XpFyuAa3VPxOozNPnJ0mu7kxU6KUs",
} }
constructor(private router: Router) { } constructor(private router: Router) { }
...@@ -114,6 +114,7 @@ export class TokenService { ...@@ -114,6 +114,7 @@ export class TokenService {
public saveAppToken(module: string): void { public saveAppToken(module: string): void {
let tokenkey = this.apptoken[module] let tokenkey = this.apptoken[module]
window.sessionStorage.setItem("module", module);
// window.localStorage.removeItem(APP_TOKEN_KEY); // window.localStorage.removeItem(APP_TOKEN_KEY);
// window.localStorage.setItem(APP_TOKEN_KEY, tokenkey); // window.localStorage.setItem(APP_TOKEN_KEY, tokenkey);
window.sessionStorage.removeItem(APP_TOKEN_KEY); window.sessionStorage.removeItem(APP_TOKEN_KEY);
...@@ -125,4 +126,9 @@ export class TokenService { ...@@ -125,4 +126,9 @@ export class TokenService {
return window.sessionStorage.getItem(APP_TOKEN_KEY); return window.sessionStorage.getItem(APP_TOKEN_KEY);
} }
public getModule(): string | null {
// return window.localStorage.getItem("module");
return window.sessionStorage.getItem("module");
}
} }
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