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
09a9899a
Commit
09a9899a
authored
Sep 23, 2025
by
sawit
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
set localStorage companyId
parent
e63279f3
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
106 additions
and
10 deletions
+106
-10
dataset.service.ts
...l-manage/dashboard-management/services/dataset.service.ts
+6
-3
m-menuitems-widget.service.ts
...shboard-management/services/m-menuitems-widget.service.ts
+1
-1
dataset-widget-linker.component.ts
...ment/widget-management/dataset-widget-linker.component.ts
+1
-1
custom-cube.service.ts
src/app/portal-manage/services/custom-cube.service.ts
+13
-5
token.service.ts
src/app/shared/services/token.service.ts
+85
-0
No files found.
src/app/portal-manage/dashboard-management/services/dataset.service.ts
View file @
09a9899a
...
...
@@ -3,6 +3,7 @@ import { Injectable } from '@angular/core';
import
{
Observable
,
of
}
from
'rxjs'
;
import
{
DatasetModel
}
from
'../models/widgets.model'
;
import
{
HttpClient
}
from
'@angular/common/http'
;
import
{
TokenService
}
from
'../../../shared/services/token.service'
;
@
Injectable
({
providedIn
:
'root'
...
...
@@ -22,14 +23,16 @@ export class DatasetService {
// ];
constructor
(
private
http
:
HttpClient
)
{
}
constructor
(
private
http
:
HttpClient
,
private
tokenService
:
TokenService
)
{
}
getDatasets
():
Observable
<
DatasetModel
[]
>
{
return
this
.
http
.
get
<
DatasetModel
[]
>
(
'https://portal.myhr.co.th/api/template-file/menuitem/mini/lists?companyid=DEMO'
);
const
companyId
=
this
.
tokenService
.
getSelectCompany
().
companyId
||
"MYSKILX_UAT"
;
return
this
.
http
.
get
<
DatasetModel
[]
>
(
`https://portal.myhr.co.th/api/template-file/menuitem/mini/lists?companyid=
${
companyId
}
`
);
}
getDatasetByTemplate
(
templateId
:
string
,
fileName
:
string
):
Observable
<
any
>
{
// return this.http.get<DatasetModel>(`https://portal.myhr.co.th/api/template-file/dataset/${id}`);
return
this
.
http
.
get
<
any
>
(
`https://portal.myhr.co.th/api/template-file/dataset/
${
templateId
}
/
${
fileName
}
?companyid=DEMO`
)
const
companyId
=
this
.
tokenService
.
getSelectCompany
().
companyId
||
"MYSKILX_UAT"
;
return
this
.
http
.
get
<
any
>
(
`https://portal.myhr.co.th/api/template-file/dataset/
${
templateId
}
/
${
fileName
}
?companyid=
${
companyId
}
`
)
}
}
src/app/portal-manage/dashboard-management/services/m-menuitems-widget.service.ts
View file @
09a9899a
...
...
@@ -23,7 +23,7 @@ export class MMenuitemsWidgetService {
* @returns An Observable of MenuItemsWidget[] that are linked to the given datasetId.
*/
getWidgetsForDataset
(
datasetId
:
string
):
Observable
<
MenuItemsWidget
[]
>
{
const
companyId
=
this
.
tokenService
.
getSelectCompany
().
companyId
||
"
DEMO
"
;
// Get companyId from TokenService
const
companyId
=
this
.
tokenService
.
getSelectCompany
().
companyId
||
"
MYSKILX_UAT
"
;
// Get companyId from TokenService
// Assuming the backend /search endpoint supports filtering by datasetId and companyId
return
this
.
http
.
get
<
any
[]
>
(
`
${
this
.
baseUrl
}
/lists/search`
,
{
params
:
{
companyId
:
companyId
,
itemId
:
datasetId
}
}).
pipe
(
map
(
items
=>
items
.
map
(
item
=>
new
MenuItemsWidget
(
item
))),
...
...
src/app/portal-manage/dashboard-management/widget-management/dataset-widget-linker.component.ts
View file @
09a9899a
...
...
@@ -270,7 +270,7 @@ export class DatasetWidgetLinkerComponent implements OnInit {
dialogRef
.
afterClosed
().
subscribe
(
resultConfig
=>
{
if
(
resultConfig
)
{
const
newLinkedWidget
:
MenuItemsWidget
=
{
companyId
:
'
DEMO
'
,
itemId
:
this
.
selectedDatasetId
!
,
widget
:
widget
,
companyId
:
'
MYSKILX_UAT
'
,
itemId
:
this
.
selectedDatasetId
!
,
widget
:
widget
,
config
:
JSON
.
stringify
(
resultConfig
),
data
:
''
,
perspective
:
''
};
this
.
mMenuitemsWidgetService
.
saveLinkedWidget
(
newLinkedWidget
).
subscribe
(()
=>
{
...
...
src/app/portal-manage/services/custom-cube.service.ts
View file @
09a9899a
...
...
@@ -4,23 +4,28 @@ import { TranslateService } from '@ngx-translate/core';
import
{
Observable
}
from
'rxjs'
;
import
{
environment
}
from
'../../../environments/environment'
;
import
{
AlertModel
}
from
'../models/alert.model'
;
import
{
TokenService
}
from
'../../shared/services/token.service'
;
@
Injectable
({
providedIn
:
'root'
})
export
class
CustomCubeService
{
constructor
(
private
http
:
HttpClient
,
private
translateService
:
TranslateService
private
translateService
:
TranslateService
,
private
tokenService
:
TokenService
)
{
}
getExcelColumn
(
body
:
{
templateId
:
string
,
fileName
:
string
,
})
{
return
this
.
http
.
post
(
environment
.
url
+
"customcube/get-excel-column?companyid=eb2f4f30-edaf-11ee-a69a-c7680edc0e47"
,
body
)
const
companyId
=
this
.
tokenService
.
getSelectCompany
()?.
companyId
;
return
this
.
http
.
post
(
environment
.
url
+
`customcube/get-excel-column?companyid=
${
companyId
}
`
,
body
)
}
getExcelData
(
body
:
any
)
{
return
this
.
http
.
post
(
environment
.
url
+
"customcube/get-excel-data?companyid=eb2f4f30-edaf-11ee-a69a-c7680edc0e47"
,
body
)
const
companyId
=
this
.
tokenService
.
getSelectCompany
()?.
companyId
;
return
this
.
http
.
post
(
environment
.
url
+
`customcube/get-excel-data?companyid=
${
companyId
}
`
,
body
)
}
saveExcelPerspective
(
body
:
{
templateId
:
string
,
...
...
@@ -28,12 +33,14 @@ export class CustomCubeService {
dataGridStr
:
string
,
pivotStr
:
string
,
}):
Observable
<
AlertModel
>
{
return
this
.
http
.
post
<
AlertModel
>
(
environment
.
url
+
"customcube/save-excel-perspective?companyid=eb2f4f30-edaf-11ee-a69a-c7680edc0e47"
,
body
)
const
companyId
=
this
.
tokenService
.
getSelectCompany
()?.
companyId
;
return
this
.
http
.
post
<
AlertModel
>
(
environment
.
url
+
`customcube/save-excel-perspective?companyid=
${
companyId
}
`
,
body
)
}
getExcelPerspective
(
body
:
{
templateId
:
string
,
fileName
:
string
,
})
{
return
this
.
http
.
post
(
environment
.
url
+
"customcube/get-excel-perspective?companyid=eb2f4f30-edaf-11ee-a69a-c7680edc0e47"
,
body
)
const
companyId
=
this
.
tokenService
.
getSelectCompany
()?.
companyId
;
return
this
.
http
.
post
(
environment
.
url
+
`customcube/get-excel-perspective?companyid=
${
companyId
}
`
,
body
)
}
}
\ No newline at end of file
src/app/shared/services/token.service.ts
View file @
09a9899a
...
...
@@ -31,6 +31,87 @@ export class TokenService {
"myjob"
:
"eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJBdXRoIiwidWlkIjoiOGFhNDUzMzAtMzE0Yy0xMWU3LWJhZjMtMmQ3ZDA5ODc3NzQ0Iiwicm9sZXMiOlsiYWRtaW4iXSwiaXNzIjoiQ29tcHV0ZXIgU2NpZW5jZSBDb3Jwb3JhdGlvbiBMaW1pdGVkIiwidXNlcm5hbWUiOiJhZG1pbiJ9.Um39_CTM01n1g4XpFyuAa3VPxOozNPnJ0mu7kxU6KUs"
,
"myskill-x"
:
"eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJBdXRoIiwidWlkIjoiOGFhNDUzMzAtMzE0Yy0xMWU3LWJhZjMtMmQ3ZDA5ODc3NzQ0Iiwicm9sZXMiOlsiYWRtaW4iXSwiaXNzIjoiQ29tcHV0ZXIgU2NpZW5jZSBDb3Jwb3JhdGlvbiBMaW1pdGVkIiwidXNlcm5hbWUiOiJhZG1pbiJ9.Um39_CTM01n1g4XpFyuAa3VPxOozNPnJ0mu7kxU6KUs"
,
}
dbApp
:
any
=
{
"myhr-plus"
:
{
"companyId"
:
"DEMO"
,
"companyName"
:
"DEMO"
,
"serverName"
:
"192.168.30.150"
,
"databaseName"
:
"DEMOCUS"
,
"portNumber"
:
"5432"
,
"userName"
:
"myhradmin"
,
"password"
:
"systemadmin"
,
"status"
:
"online"
,
"dbType"
:
"PGSQL"
},
"myhr-lite"
:
{
"companyId"
:
""
,
"companyName"
:
""
,
"serverName"
:
""
,
"databaseName"
:
""
,
"portNumber"
:
""
,
"userName"
:
""
,
"password"
:
""
,
"status"
:
""
,
"dbType"
:
""
},
"zeeme"
:
{
"companyId"
:
""
,
"companyName"
:
""
,
"serverName"
:
""
,
"databaseName"
:
""
,
"portNumber"
:
""
,
"userName"
:
""
,
"password"
:
""
,
"status"
:
""
,
"dbType"
:
""
},
"myface"
:
{
"companyId"
:
""
,
"companyName"
:
""
,
"serverName"
:
""
,
"databaseName"
:
""
,
"portNumber"
:
""
,
"userName"
:
""
,
"password"
:
""
,
"status"
:
""
,
"dbType"
:
""
},
"mylearn"
:
{
"companyId"
:
""
,
"companyName"
:
""
,
"serverName"
:
""
,
"databaseName"
:
""
,
"portNumber"
:
""
,
"userName"
:
""
,
"password"
:
""
,
"status"
:
""
,
"dbType"
:
""
},
"myjob"
:
{
"companyId"
:
"DEMO"
,
"companyName"
:
"DEMO"
,
"databaseName"
:
"DEMOCUS"
,
"dbType"
:
"PGSQL"
,
"password"
:
"systemadmin"
,
"portNumber"
:
"5432"
,
"serverName"
:
"192.168.30.150"
,
"status"
:
"online"
,
"userName"
:
"myhradmin"
},
"myskill-x"
:
{
"companyId"
:
"MYSKILX_UAT"
,
"companyName"
:
"MYSKILX_UAT"
,
"databaseName"
:
"MYSKILL_X_UAT"
,
"dbType"
:
"PGSQL"
,
"password"
:
"systemadmin"
,
"portNumber"
:
"5432"
,
"serverName"
:
"10.204.50.30"
,
"status"
:
"online"
,
"userName"
:
"myhradmin"
},
}
constructor
(
private
router
:
Router
)
{
}
signOut
():
void
{
...
...
@@ -123,6 +204,10 @@ export class TokenService {
// window.localStorage.setItem(APP_TOKEN_KEY, tokenkey);
window
.
sessionStorage
.
removeItem
(
APP_TOKEN_KEY
);
window
.
sessionStorage
.
setItem
(
APP_TOKEN_KEY
,
tokenkey
);
let
db
=
this
.
dbApp
[
module
]
window
.
localStorage
.
removeItem
(
COMPANY
);
window
.
localStorage
.
setItem
(
COMPANY
,
JSON
.
stringify
(
new
CompanyModel
(
db
)));
}
public
getAppToken
():
string
|
null
{
...
...
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