sevago-sso-fe 1.0.46 → 1.0.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/constant/apps.data.d.ts +22 -0
- package/dist/common/utils/other/app.utils.d.ts +9 -0
- package/dist/common/utils/other/index.d.ts +1 -0
- package/dist/components/app-grid/app-grid.component.d.ts +1 -0
- package/dist/components/elements/icon/index.d.ts +0 -1
- package/dist/components/elements/radio/index.d.ts +0 -1
- package/dist/components/elements/tooltip/index.d.ts +0 -1
- package/dist/components/sidebar/system-monitor-sidebar.part.d.ts +2 -0
- package/dist/index.cjs.js +140 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +140 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/pages/dashboard/screen/system-monitor/system-monitor.screen.d.ts +2 -0
- package/package.json +1 -1
|
@@ -42,3 +42,25 @@ export declare const APP_GROUP_COLOR: {
|
|
|
42
42
|
Khác: string;
|
|
43
43
|
};
|
|
44
44
|
export declare const APP_OBJ: Record<string, AppInfo>;
|
|
45
|
+
export declare const APPS_ENV: {
|
|
46
|
+
FORMULA_PRICE: {
|
|
47
|
+
development: string;
|
|
48
|
+
staging: string;
|
|
49
|
+
production: string;
|
|
50
|
+
};
|
|
51
|
+
E_CATALOGUE: {
|
|
52
|
+
development: string;
|
|
53
|
+
staging: string;
|
|
54
|
+
production: string;
|
|
55
|
+
};
|
|
56
|
+
LANDING_PAGE: {
|
|
57
|
+
development: string;
|
|
58
|
+
staging: string;
|
|
59
|
+
production: string;
|
|
60
|
+
};
|
|
61
|
+
SSO: {
|
|
62
|
+
development: string;
|
|
63
|
+
staging: string;
|
|
64
|
+
production: string;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AppInfo } from '../../constant/apps.data';
|
|
2
|
+
export declare enum Environment {
|
|
3
|
+
DEVELOPMENT = "development",
|
|
4
|
+
STAGING = "staging",
|
|
5
|
+
PRODUCTION = "production"
|
|
6
|
+
}
|
|
7
|
+
export declare const getCurrentEnvironment: () => Environment;
|
|
8
|
+
export declare const getAppUrl: (app: AppInfo, env: Environment) => string | null;
|
|
9
|
+
export declare const getSsoUrl: (env: Environment) => string;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { Environment } from '../../common/utils/other/app.utils';
|
|
1
2
|
export interface SystemMonitorSidebarPartProps {
|
|
2
3
|
position?: "left" | "right";
|
|
3
4
|
blacklist?: string[];
|
|
5
|
+
env: Environment;
|
|
4
6
|
}
|
|
5
7
|
export declare const SystemMonitorSidebarPart: React.FC<SystemMonitorSidebarPartProps>;
|
package/dist/index.cjs.js
CHANGED
|
@@ -8145,6 +8145,26 @@ var AppGroup = /* @__PURE__ */ ((AppGroup2) => {
|
|
|
8145
8145
|
AppGroup2["CLIENT"] = "Web";
|
|
8146
8146
|
return AppGroup2;
|
|
8147
8147
|
})(AppGroup || {});
|
|
8148
|
+
var App = /* @__PURE__ */ ((App2) => {
|
|
8149
|
+
App2["E_HIRING"] = "Tuyển dụng";
|
|
8150
|
+
App2["HR"] = "Nhân sự";
|
|
8151
|
+
App2["PAYROLL"] = "Tính lương";
|
|
8152
|
+
App2["ORG"] = "Sơ đồ tổ chức";
|
|
8153
|
+
App2["CHECKIN"] = "Chấm công";
|
|
8154
|
+
App2["PROJECT"] = "Dự án";
|
|
8155
|
+
App2["REQUEST"] = "Đề xuất";
|
|
8156
|
+
App2["PROCESS"] = "Quy trình";
|
|
8157
|
+
App2["TRACKING"] = "Tiến trình";
|
|
8158
|
+
App2["CHAT"] = "Chat";
|
|
8159
|
+
App2["TRAINING"] = "Đào tạo";
|
|
8160
|
+
App2["FORM"] = "Biểu mẫu";
|
|
8161
|
+
App2["INSIDE"] = "Thông tin & CSNV";
|
|
8162
|
+
App2["BOOKING"] = "Tài nguyên";
|
|
8163
|
+
App2["FORMULA_PRICE"] = "Tính giá";
|
|
8164
|
+
App2["E_CATALOGUE"] = "E-Catalogue";
|
|
8165
|
+
App2["LANDING_PAGE"] = "Landing page";
|
|
8166
|
+
return App2;
|
|
8167
|
+
})(App || {});
|
|
8148
8168
|
const APP_GROUP_COLOR = {
|
|
8149
8169
|
[
|
|
8150
8170
|
"Workflow Engine"
|
|
@@ -8406,6 +8426,76 @@ const APP_OBJ = {
|
|
|
8406
8426
|
]
|
|
8407
8427
|
}
|
|
8408
8428
|
};
|
|
8429
|
+
const generateOfficeAppUrl = (path, baseUrl) => ({
|
|
8430
|
+
development: `${baseUrl.development}/${path}`,
|
|
8431
|
+
staging: `${baseUrl.staging}/${path}`,
|
|
8432
|
+
production: `${baseUrl.production}/${path}`
|
|
8433
|
+
});
|
|
8434
|
+
const OFFICE_BASE_URL = {
|
|
8435
|
+
development: "https://dev.admin.office.sevago.local",
|
|
8436
|
+
staging: "https://sta.admin.office.sevago.local",
|
|
8437
|
+
production: "https://admin.office.sevago.local"
|
|
8438
|
+
};
|
|
8439
|
+
const getAppEnvKey$1 = (appKey) => {
|
|
8440
|
+
const enumKey = Object.keys(App).find(
|
|
8441
|
+
(key) => App[key] === appKey
|
|
8442
|
+
);
|
|
8443
|
+
return enumKey || null;
|
|
8444
|
+
};
|
|
8445
|
+
const generateOfficeAppsEnv = () => {
|
|
8446
|
+
const officeApps = {};
|
|
8447
|
+
const officeAppKeys = [
|
|
8448
|
+
"Tuyển dụng",
|
|
8449
|
+
"Nhân sự",
|
|
8450
|
+
"Tính lương",
|
|
8451
|
+
"Sơ đồ tổ chức",
|
|
8452
|
+
"Chấm công",
|
|
8453
|
+
"Chat",
|
|
8454
|
+
"Đào tạo",
|
|
8455
|
+
"Biểu mẫu",
|
|
8456
|
+
"Thông tin & CSNV",
|
|
8457
|
+
"Tài nguyên",
|
|
8458
|
+
"Tiến trình",
|
|
8459
|
+
"Đề xuất",
|
|
8460
|
+
"Dự án",
|
|
8461
|
+
"Quy trình"
|
|
8462
|
+
/* PROCESS */
|
|
8463
|
+
];
|
|
8464
|
+
officeAppKeys.forEach((appKey) => {
|
|
8465
|
+
const appInfo = APP_OBJ[appKey];
|
|
8466
|
+
const envKey = getAppEnvKey$1(appKey);
|
|
8467
|
+
if (appInfo && envKey) {
|
|
8468
|
+
officeApps[envKey] = generateOfficeAppUrl(appInfo.path, OFFICE_BASE_URL);
|
|
8469
|
+
}
|
|
8470
|
+
});
|
|
8471
|
+
return officeApps;
|
|
8472
|
+
};
|
|
8473
|
+
const APPS_ENV = {
|
|
8474
|
+
// url khi ấn đẩy về home sso
|
|
8475
|
+
SSO: {
|
|
8476
|
+
development: "https://dev.account.sevago.local",
|
|
8477
|
+
staging: "https://sta.account.sevago.local",
|
|
8478
|
+
production: "https://account.sevago.com.vn"
|
|
8479
|
+
},
|
|
8480
|
+
// Các url dành cho office - tự động generate từ APP_OBJ
|
|
8481
|
+
...generateOfficeAppsEnv(),
|
|
8482
|
+
// Các url ở các app khác
|
|
8483
|
+
FORMULA_PRICE: {
|
|
8484
|
+
development: "https://dev.formula-price.sevago.local",
|
|
8485
|
+
staging: "https://sta.formula-price.sevago.local",
|
|
8486
|
+
production: "https://formula-price.sevago.local"
|
|
8487
|
+
},
|
|
8488
|
+
E_CATALOGUE: {
|
|
8489
|
+
development: "https://dev.admin.e-catalogue.sevago.local",
|
|
8490
|
+
staging: "https://sta.admin.e-catalogue.sevago.local",
|
|
8491
|
+
production: "https://admin.e-catalogue.sevago.local"
|
|
8492
|
+
},
|
|
8493
|
+
LANDING_PAGE: {
|
|
8494
|
+
development: "https://dev.admin.landing-page.sevago.local",
|
|
8495
|
+
staging: "https://sta.admin.landing-page.sevago.local",
|
|
8496
|
+
production: "https://admin.landing-page.sevago.com.vn"
|
|
8497
|
+
}
|
|
8498
|
+
};
|
|
8409
8499
|
const findCurrentAccessByPath = (pathname) => {
|
|
8410
8500
|
for (const module2 of Object.values(APP_OBJ)) {
|
|
8411
8501
|
if (module2.path && pathname.includes(module2.path)) {
|
|
@@ -9100,6 +9190,36 @@ const truncateText = (text, maxLength = 27) => {
|
|
|
9100
9190
|
}
|
|
9101
9191
|
return `${text.substring(0, maxLength)}...`;
|
|
9102
9192
|
};
|
|
9193
|
+
var Environment = /* @__PURE__ */ ((Environment2) => {
|
|
9194
|
+
Environment2["DEVELOPMENT"] = "development";
|
|
9195
|
+
Environment2["STAGING"] = "staging";
|
|
9196
|
+
Environment2["PRODUCTION"] = "production";
|
|
9197
|
+
return Environment2;
|
|
9198
|
+
})(Environment || {});
|
|
9199
|
+
const getAppEnvKey = (appKey) => {
|
|
9200
|
+
const enumKey = Object.keys(App).find(
|
|
9201
|
+
(key) => App[key] === appKey
|
|
9202
|
+
);
|
|
9203
|
+
return enumKey || null;
|
|
9204
|
+
};
|
|
9205
|
+
const getCurrentEnvironment = () => {
|
|
9206
|
+
const { hostname } = window.location;
|
|
9207
|
+
if (hostname.includes("dev.")) return "development";
|
|
9208
|
+
if (hostname.includes("sta.")) return "staging";
|
|
9209
|
+
return "production";
|
|
9210
|
+
};
|
|
9211
|
+
const getAppUrl = (app, env) => {
|
|
9212
|
+
const environment = env || getCurrentEnvironment();
|
|
9213
|
+
const appKey = Object.keys(APP_OBJ).find(
|
|
9214
|
+
(key) => APP_OBJ[key].path === app.path
|
|
9215
|
+
);
|
|
9216
|
+
if (!appKey) return null;
|
|
9217
|
+
const envKey = getAppEnvKey(appKey);
|
|
9218
|
+
if (!envKey || !(envKey in APPS_ENV)) return null;
|
|
9219
|
+
const envConfig = APPS_ENV[envKey];
|
|
9220
|
+
return envConfig[environment] || null;
|
|
9221
|
+
};
|
|
9222
|
+
const getSsoUrl = (env) => APPS_ENV.SSO[env || getCurrentEnvironment()];
|
|
9103
9223
|
const timeUtils = timeUtilsMethods;
|
|
9104
9224
|
const useApps = (tab = AppGroup.ALL) => {
|
|
9105
9225
|
const listApp = React.useMemo(() => {
|
|
@@ -24206,7 +24326,8 @@ const AppGrid = ({
|
|
|
24206
24326
|
titleVariant = "subtitle1",
|
|
24207
24327
|
titleColor,
|
|
24208
24328
|
selectedAppId,
|
|
24209
|
-
showPagination = true
|
|
24329
|
+
showPagination = true,
|
|
24330
|
+
getAppUrl: getAppUrl2
|
|
24210
24331
|
}) => {
|
|
24211
24332
|
const theme = useTheme();
|
|
24212
24333
|
const pageSize = Math.max(1, columns * Math.max(1, rows));
|
|
@@ -24219,7 +24340,7 @@ const AppGrid = ({
|
|
|
24219
24340
|
const start = page * pageSize;
|
|
24220
24341
|
const end = start + pageSize;
|
|
24221
24342
|
const visibleApps = totalPages > 1 ? apps.slice(start, end) : apps;
|
|
24222
|
-
const findLink = (app) => app.path;
|
|
24343
|
+
const findLink = (app) => getAppUrl2 ? getAppUrl2(app) : app.path;
|
|
24223
24344
|
return /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { position: "relative" }, children: [
|
|
24224
24345
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
24225
24346
|
material.Box,
|
|
@@ -24820,14 +24941,22 @@ const TypographyContentCaption = ({
|
|
|
24820
24941
|
)
|
|
24821
24942
|
] });
|
|
24822
24943
|
};
|
|
24823
|
-
const SystemMonitorSidebarPart = ({ position, blacklist }) => {
|
|
24944
|
+
const SystemMonitorSidebarPart = ({ position, blacklist, env }) => {
|
|
24824
24945
|
const { isSidebarOpen, openSidebar, closeSidebar } = useSidebarState();
|
|
24946
|
+
const handleIconClick = () => {
|
|
24947
|
+
const ssoUrl = getSsoUrl(env);
|
|
24948
|
+
if (ssoUrl) {
|
|
24949
|
+
window.location.href = ssoUrl;
|
|
24950
|
+
} else {
|
|
24951
|
+
openSidebar();
|
|
24952
|
+
}
|
|
24953
|
+
};
|
|
24825
24954
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
24826
24955
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
24827
24956
|
ImageElement,
|
|
24828
24957
|
{
|
|
24829
24958
|
url: IconAppsSidebar,
|
|
24830
|
-
onClick:
|
|
24959
|
+
onClick: handleIconClick,
|
|
24831
24960
|
sizeType: ImageSizeType.SQUARE,
|
|
24832
24961
|
sx: { width: MAP_SIZE.medium.width, height: MAP_SIZE.medium.height }
|
|
24833
24962
|
}
|
|
@@ -24854,7 +24983,8 @@ const TypographyFilter = material.styled(material.Typography)(({ theme }) => ({
|
|
|
24854
24983
|
padding: `0px ${PADDING_GAP_LAYOUT}`
|
|
24855
24984
|
}));
|
|
24856
24985
|
const SystemMonitorScreen = ({
|
|
24857
|
-
blacklist
|
|
24986
|
+
blacklist,
|
|
24987
|
+
env
|
|
24858
24988
|
}) => {
|
|
24859
24989
|
const theme = useTheme();
|
|
24860
24990
|
const dispatch = useAppDispatch();
|
|
@@ -24951,6 +25081,7 @@ const SystemMonitorScreen = ({
|
|
|
24951
25081
|
iconRadius: 7,
|
|
24952
25082
|
gap: PADDING_GAP_TAB,
|
|
24953
25083
|
selectedAppId: currentApp?.path,
|
|
25084
|
+
getAppUrl: (app) => getAppUrl(app, env) || app.path,
|
|
24954
25085
|
onClickItem: async (app) => {
|
|
24955
25086
|
await dispatch(
|
|
24956
25087
|
ACTION_ACCOUNT.updateCurrentAccess(app.path)
|
|
@@ -25027,6 +25158,7 @@ exports.DASHBOARD_SCREEN = DASHBOARD_SCREEN;
|
|
|
25027
25158
|
exports.DashboardPage = DashboardPage;
|
|
25028
25159
|
exports.DefaultLayout = DefaultLayout;
|
|
25029
25160
|
exports.EmptyComponent = EmptyComponent;
|
|
25161
|
+
exports.Environment = Environment;
|
|
25030
25162
|
exports.ErrorPage = ErrorPage;
|
|
25031
25163
|
exports.ForgotPasswordType = ForgotPasswordType;
|
|
25032
25164
|
exports.Gender = Gender;
|
|
@@ -25124,6 +25256,8 @@ exports.deleteUser = deleteUser;
|
|
|
25124
25256
|
exports.extractNumberAtStartString = extractNumberAtStartString;
|
|
25125
25257
|
exports.findCurrentAccessByPath = findCurrentAccessByPath;
|
|
25126
25258
|
exports.forgotPassword = forgotPassword;
|
|
25259
|
+
exports.getAppUrl = getAppUrl;
|
|
25260
|
+
exports.getCurrentEnvironment = getCurrentEnvironment;
|
|
25127
25261
|
exports.getDate = getDate;
|
|
25128
25262
|
exports.getDateTime = getDateTime;
|
|
25129
25263
|
exports.getDayOffsetPx = getDayOffsetPx;
|
|
@@ -25134,6 +25268,7 @@ exports.getListNotificationSetting = getListNotificationSetting;
|
|
|
25134
25268
|
exports.getListUser = getListUser;
|
|
25135
25269
|
exports.getListUserRelations = getListUserRelations;
|
|
25136
25270
|
exports.getMonthRangeForYear = getMonthRangeForYear;
|
|
25271
|
+
exports.getSsoUrl = getSsoUrl;
|
|
25137
25272
|
exports.getTimeAgo = getTimeAgo;
|
|
25138
25273
|
exports.getTimeDate = getTimeDate;
|
|
25139
25274
|
exports.getUser = getUser;
|