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
affd9160
Commit
affd9160
authored
Sep 02, 2025
by
Ooh-Ao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
config
parent
cd412f68
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
18 deletions
+52
-18
dashboard-management.component.ts
...ge/dashboard-management/dashboard-management.component.ts
+12
-5
dashboard-viewer.component.ts
...tal-manage/dashboard-viewer/dashboard-viewer.component.ts
+12
-1
simple-kpi-widget.component.ts
.../widgets/simple-kpi-widget/simple-kpi-widget.component.ts
+28
-12
ข้อเสนอแนะเพื่อการปรับปรุง.txt
ข้อเสนอแนะเพื่อการปรับปรุง.txt
+0
-0
No files found.
src/app/portal-manage/dashboard-management/dashboard-management.component.ts
View file @
affd9160
...
@@ -624,11 +624,17 @@ export class DashboardManagementComponent implements OnInit {
...
@@ -624,11 +624,17 @@ export class DashboardManagementComponent implements OnInit {
mapWidgetsToPanels
(
widgets
:
WidgetModel
[]):
DashboardPanel
[]
{
mapWidgetsToPanels
(
widgets
:
WidgetModel
[]):
DashboardPanel
[]
{
return
widgets
.
map
(
widget
=>
{
return
widgets
.
map
(
widget
=>
{
// Always pass the entire widget.config as the input to the component
let
widgetConfig
:
any
=
{};
// Ensure widget.config exists, initialize if not.
if
(
typeof
widget
.
config
===
'string'
)
{
const
widgetConfig
=
widget
.
config
||
{};
try
{
widgetConfig
=
JSON
.
parse
(
widget
.
config
);
}
catch
(
e
)
{
console
.
error
(
'Error parsing widget config string:'
,
widget
.
config
,
e
);
widgetConfig
=
{};
// Default to empty object on error
}
}
else
{
widgetConfig
=
widget
.
config
||
{};
}
return
{
return
{
id
:
widget
.
widgetId
,
id
:
widget
.
widgetId
,
...
@@ -852,6 +858,7 @@ export class DashboardManagementComponent implements OnInit {
...
@@ -852,6 +858,7 @@ export class DashboardManagementComponent implements OnInit {
openWidgetConfigDialog
(
panel
:
PanelModel
&
{
componentType
:
Type
<
any
>
,
componentInputs
?:
{
[
key
:
string
]:
any
},
originalWidget
:
WidgetModel
}):
void
{
openWidgetConfigDialog
(
panel
:
PanelModel
&
{
componentType
:
Type
<
any
>
,
componentInputs
?:
{
[
key
:
string
]:
any
},
originalWidget
:
WidgetModel
}):
void
{
const
widget
=
panel
.
originalWidget
;
const
widget
=
panel
.
originalWidget
;
console
.
log
(
'Opening config dialog for widget:'
,
widget
);
this
.
dashboardStateService
.
selectedDataset$
.
subscribe
((
selectedDataset
:
SelectedDataset
|
null
)
=>
{
this
.
dashboardStateService
.
selectedDataset$
.
subscribe
((
selectedDataset
:
SelectedDataset
|
null
)
=>
{
const
availableColumns
=
selectedDataset
?
selectedDataset
.
columns
:
[];
const
availableColumns
=
selectedDataset
?
selectedDataset
.
columns
:
[];
...
...
src/app/portal-manage/dashboard-viewer/dashboard-viewer.component.ts
View file @
affd9160
...
@@ -129,7 +129,18 @@ export class DashboardViewerComponent implements OnInit {
...
@@ -129,7 +129,18 @@ export class DashboardViewerComponent implements OnInit {
mapWidgetsToPanels
(
widgets
:
WidgetModel
[]):
DashboardPanel
[]
{
mapWidgetsToPanels
(
widgets
:
WidgetModel
[]):
DashboardPanel
[]
{
return
widgets
.
map
(
widget
=>
{
return
widgets
.
map
(
widget
=>
{
const
widgetConfig
=
widget
.
config
||
{};
let
widgetConfig
:
any
=
{};
if
(
typeof
widget
.
config
===
'string'
)
{
try
{
widgetConfig
=
JSON
.
parse
(
widget
.
config
);
}
catch
(
e
)
{
console
.
error
(
'Error parsing widget config string:'
,
widget
.
config
,
e
);
widgetConfig
=
{};
// Default to empty object on error
}
}
else
{
widgetConfig
=
widget
.
config
||
{};
}
return
{
return
{
id
:
widget
.
widgetId
,
id
:
widget
.
widgetId
,
header
:
widget
.
thName
,
header
:
widget
.
thName
,
...
...
src/app/portal-manage/widgets/simple-kpi-widget/simple-kpi-widget.component.ts
View file @
affd9160
...
@@ -26,22 +26,38 @@ export class SimpleKpiWidgetComponent extends BaseWidgetComponent {
...
@@ -26,22 +26,38 @@ export class SimpleKpiWidgetComponent extends BaseWidgetComponent {
this
.
unit
=
this
.
config
.
unit
||
''
;
this
.
unit
=
this
.
config
.
unit
||
''
;
this
.
trend
=
this
.
config
.
trend
||
'neutral'
;
this
.
trend
=
this
.
config
.
trend
||
'neutral'
;
this
.
trendValue
=
this
.
config
.
trendValue
||
''
;
this
.
trendValue
=
this
.
config
.
trendValue
||
''
;
this
.
value
=
'
...'
;
// Loading indicator
this
.
value
=
'
-'
;
// Initial state before data loads
}
}
onDataUpdate
(
data
:
any
[]):
void
{
onDataUpdate
(
data
:
any
[]):
void
{
if
(
data
.
length
>
0
)
{
console
.
log
(
'SimpleKpiWidget onDataUpdate config:'
,
this
.
config
);
let
kpiValue
=
0
;
// Handle count aggregation separately as it doesn't need a valueField
if
(
this
.
config
.
aggregation
===
'count'
)
{
if
(
this
.
config
.
aggregation
===
'count'
)
{
kpiValue
=
data
.
length
;
this
.
value
=
(
data
?.
length
||
0
).
toLocaleString
();
}
else
if
(
this
.
config
.
aggregation
===
'sum'
)
{
return
;
kpiValue
=
data
.
reduce
((
sum
,
item
)
=>
sum
+
(
item
[
this
.
config
.
valueField
]
||
0
),
0
);
}
else
{
// Default to first value if no aggregation
kpiValue
=
data
[
0
][
this
.
config
.
valueField
];
}
this
.
value
=
kpiValue
.
toLocaleString
();
}
}
// For other aggregations, valueField is required
if
(
!
this
.
config
.
valueField
)
{
this
.
value
=
'N/A'
;
// Indicate a configuration error
console
.
error
(
'SimpleKpiWidget Error: valueField is not configured for this widget.'
,
this
.
config
);
return
;
}
// If data is empty, result is 0
if
(
!
data
||
data
.
length
===
0
)
{
this
.
value
=
'0'
;
return
;
}
let
kpiValue
=
0
;
if
(
this
.
config
.
aggregation
===
'sum'
)
{
kpiValue
=
data
.
reduce
((
sum
,
item
)
=>
sum
+
(
item
[
this
.
config
.
valueField
]
||
0
),
0
);
}
else
{
// Default to first value if no aggregation is specified
kpiValue
=
data
[
0
][
this
.
config
.
valueField
]
||
0
;
}
this
.
value
=
kpiValue
.
toLocaleString
();
}
}
onReset
():
void
{
onReset
():
void
{
...
...
ข้อเสนอแนะเพื่อการปรับปรุง.txt
View file @
affd9160
This diff is collapsed.
Click to expand it.
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