Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
portal-apps-manage
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
angular
portal-apps-manage
Commits
1d851225
Commit
1d851225
authored
Sep 02, 2025
by
Ooh-Ao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
viewchile
parent
244ac3e1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
3 deletions
+20
-3
dashboard-management.component.ts
...ge/dashboard-management/dashboard-management.component.ts
+20
-3
No files found.
src/app/portal-manage/dashboard-management/dashboard-management.component.ts
View file @
1d851225
...
...
@@ -5,7 +5,7 @@ import { NgComponentOutlet } from '@angular/common';
import
{
FormsModule
}
from
'@angular/forms'
;
import
{
Observable
,
of
,
forkJoin
,
throwError
}
from
'rxjs'
;
import
{
map
,
switchMap
,
tap
,
catchError
,
take
}
from
'rxjs/operators'
;
import
{
DashboardLayoutModule
,
PanelModel
}
from
'@syncfusion/ej2-angular-layouts'
;
// Import Syncfusion modules
import
{
DashboardLayout
Component
,
DashboardLayout
Module
,
PanelModel
}
from
'@syncfusion/ej2-angular-layouts'
;
// Import Syncfusion modules
import
{
MatDialog
,
MatDialogModule
}
from
'@angular/material/dialog'
;
// Import MatDialog
import
{
NotificationService
}
from
'../../shared/services/notification.service'
;
...
...
@@ -101,7 +101,7 @@ export interface DashboardPanel extends PanelModel {
styleUrls
:
[
'./dashboard-management.component.scss'
],
})
export
class
DashboardManagementComponent
implements
OnInit
{
@
ViewChild
(
'editLayout'
)
public
layout
!
:
DashboardLayoutComponent
;
public
panels
:
DashboardPanel
[]
=
[];
public
cellSpacing
:
number
[]
=
[
10
,
10
];
public
mediaQuery
:
string
=
'max-width: 700px'
;
...
...
@@ -284,7 +284,23 @@ export class DashboardManagementComponent implements OnInit {
}
saveLayout
():
void
{
if
(
!
this
.
dashboardData
)
return
;
if
(
!
this
.
dashboardData
||
!
this
.
layout
)
return
;
// Get the current layout state directly from the Syncfusion component
const
currentPanels
=
this
.
layout
.
serialize
();
// Update the widgets array with the latest positions and sizes
currentPanels
.
forEach
((
panel
:
PanelModel
)
=>
{
const
widgetIndex
=
this
.
dashboardData
!
.
widgets
.
findIndex
(
w
=>
w
.
widgetId
===
panel
.
id
);
if
(
widgetIndex
>
-
1
)
{
this
.
dashboardData
!
.
widgets
[
widgetIndex
].
x
=
panel
.
col
!
;
this
.
dashboardData
!
.
widgets
[
widgetIndex
].
y
=
panel
.
row
!
;
this
.
dashboardData
!
.
widgets
[
widgetIndex
].
cols
=
panel
.
sizeX
!
;
this
.
dashboardData
!
.
widgets
[
widgetIndex
].
rows
=
panel
.
sizeY
!
;
}
});
// Now, prepare the data for saving (deep copy and stringify)
const
dashboardToSave
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
dashboardData
));
if
(
dashboardToSave
.
widgets
)
{
dashboardToSave
.
widgets
.
forEach
((
widget
:
WidgetModel
)
=>
{
...
...
@@ -296,6 +312,7 @@ export class DashboardManagementComponent implements OnInit {
});
});
}
this
.
dashboardDataService
.
saveDashboard
(
dashboardToSave
).
pipe
(
catchError
(
error
=>
{
this
.
notificationService
.
error
(
'Error'
,
'Failed to save dashboard layout.'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment