diff --git a/frontend/desktop/src/components/desktop_content/iframe_window.tsx b/frontend/desktop/src/components/desktop_content/iframe_window.tsx
index 5ccdb95c74c..3bad2beead2 100644
--- a/frontend/desktop/src/components/desktop_content/iframe_window.tsx
+++ b/frontend/desktop/src/components/desktop_content/iframe_window.tsx
@@ -12,7 +12,7 @@ export default function Iframe_window({ pid }: { pid: number }) {
);
diff --git a/frontend/desktop/src/hooks/useDriver.tsx b/frontend/desktop/src/hooks/useDriver.tsx
index c54851b3a91..837e493e387 100644
--- a/frontend/desktop/src/hooks/useDriver.tsx
+++ b/frontend/desktop/src/hooks/useDriver.tsx
@@ -73,9 +73,7 @@ export default function useDriver({ openDesktopApp }: { openDesktopApp: any }) {
const isGuidedDesktop = !!data.metadata.annotations?.[GUIDE_DESKTOP_INDEX_KEY];
!isGuidedDesktop ? setShowGuide(true) : '';
}
- } catch (error) {
- console.log(error);
- }
+ } catch (error) {}
};
handleUserGuide();
// eslint-disable-next-line react-hooks/exhaustive-deps
diff --git a/frontend/desktop/src/pages/api/price/bonus.ts b/frontend/desktop/src/pages/api/price/bonus.ts
index b018bc1ef82..cd41a137d82 100644
--- a/frontend/desktop/src/pages/api/price/bonus.ts
+++ b/frontend/desktop/src/pages/api/price/bonus.ts
@@ -21,8 +21,8 @@ export default async function handler(req: NextApiRequest, resp: NextApiResponse
activities: result.body.data.activities
}
});
- } catch (error) {
- console.log(error);
+ } catch (error: any) {
+ console.log(error?.body);
jsonRes(resp, { code: 500, message: 'get price error' });
}
}
diff --git a/frontend/desktop/src/services/backend/db/wechatCode.ts b/frontend/desktop/src/services/backend/db/wechatCode.ts
index dffd9f3e70c..b54850db55a 100644
--- a/frontend/desktop/src/services/backend/db/wechatCode.ts
+++ b/frontend/desktop/src/services/backend/db/wechatCode.ts
@@ -61,7 +61,6 @@ export async function getWeChatAccessToken() {
function isAccessTokenValid(expiresIn: number) {
const currentTime = Date.now();
- console.log(expiresIn, currentTime);
return expiresIn > currentTime;
}
diff --git a/frontend/providers/cronjob/public/locales/en/common.json b/frontend/providers/cronjob/public/locales/en/common.json
index 04dbc178ff0..369fcb53574 100644
--- a/frontend/providers/cronjob/public/locales/en/common.json
+++ b/frontend/providers/cronjob/public/locales/en/common.json
@@ -190,5 +190,8 @@
"Basic Information": "Basic Information",
"Succeeded": "Succeeded",
"Failures": "Failures",
- "Log": "Log"
-}
\ No newline at end of file
+ "Log": "Log",
+ "Basic": "Basic",
+ "Username for the image registry": "Username for the image registry'",
+ "The password cannot be empty": "The password cannot be empty"
+}
diff --git a/frontend/providers/cronjob/public/locales/zh/common.json b/frontend/providers/cronjob/public/locales/zh/common.json
index 48982564d62..3ac5ea2c3ed 100644
--- a/frontend/providers/cronjob/public/locales/zh/common.json
+++ b/frontend/providers/cronjob/public/locales/zh/common.json
@@ -237,5 +237,7 @@
"Basic Information": "基础信息",
"Succeeded": "成功数",
"Failures": "失败数",
- "Log": "日志"
-}
\ No newline at end of file
+ "Log": "日志",
+ "Username for the image registry": "用户名",
+ "The password cannot be empty": "密码不能为空"
+}
diff --git a/frontend/providers/cronjob/src/constants/keys.ts b/frontend/providers/cronjob/src/constants/keys.ts
index caef2924bd5..c3c247c3705 100644
--- a/frontend/providers/cronjob/src/constants/keys.ts
+++ b/frontend/providers/cronjob/src/constants/keys.ts
@@ -17,3 +17,4 @@ export const componentLabel = 'app.kubernetes.io/component';
// cronjob
export const cronJobTypeKey = 'cronjob-type';
export const cronJobKey = 'cloud.sealos.io/cronjob';
+export const defaultDomain = 'cloud.sealos.io';
diff --git a/frontend/providers/cronjob/src/pages/_app.tsx b/frontend/providers/cronjob/src/pages/_app.tsx
index c1ed20500ce..fbb145d45a1 100644
--- a/frontend/providers/cronjob/src/pages/_app.tsx
+++ b/frontend/providers/cronjob/src/pages/_app.tsx
@@ -46,15 +46,11 @@ function App({ Component, pageProps }: AppProps) {
content: '该应用不允许单独使用,点击确认前往 Sealos Desktop 使用。'
});
- useEffect(() => {
- initSystemEnv();
- }, [initSystemEnv]);
-
useEffect(() => {
NProgress.start();
const response = createSealosApp();
-
(async () => {
+ const SystemEnv = await initSystemEnv();
try {
const res = await sealosApp.getSession();
localStorage.setItem('session', JSON.stringify(res));
@@ -72,7 +68,7 @@ function App({ Component, pageProps }: AppProps) {
NProgress.done();
return response;
- }, [SystemEnv.domain, openConfirm]);
+ }, [openConfirm]);
// add resize event
useEffect(() => {
diff --git a/frontend/providers/cronjob/src/pages/api/platform/getEnv.ts b/frontend/providers/cronjob/src/pages/api/platform/getEnv.ts
index 116a7950957..e0e34fb7748 100644
--- a/frontend/providers/cronjob/src/pages/api/platform/getEnv.ts
+++ b/frontend/providers/cronjob/src/pages/api/platform/getEnv.ts
@@ -1,3 +1,4 @@
+import { defaultDomain } from '@/constants/keys';
import { jsonRes } from '@/services/backend/response';
import { ApiResp } from '@/services/kubernet';
import type { NextApiRequest, NextApiResponse } from 'next';
@@ -9,7 +10,7 @@ export type EnvResponse = {
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
jsonRes(res, {
data: {
- domain: process.env.SEALOS_DOMAIN || 'cloud.sealos.io'
+ domain: process.env.SEALOS_DOMAIN || defaultDomain
}
});
}
diff --git a/frontend/providers/cronjob/src/store/env.ts b/frontend/providers/cronjob/src/store/env.ts
index 750b008c4f7..c8936b2fe4b 100644
--- a/frontend/providers/cronjob/src/store/env.ts
+++ b/frontend/providers/cronjob/src/store/env.ts
@@ -1,11 +1,12 @@
import { getPlatformEnv } from '@/api/platform';
+import { defaultDomain } from '@/constants/keys';
import { EnvResponse } from '@/pages/api/platform/getEnv';
import { create } from 'zustand';
import { immer } from 'zustand/middleware/immer';
type EnvState = {
SystemEnv: EnvResponse;
- initSystemEnv: () => void;
+ initSystemEnv: () => Promise;
};
const useEnvStore = create()(
@@ -16,12 +17,14 @@ const useEnvStore = create()(
initSystemEnv: async () => {
try {
const data = await getPlatformEnv();
-
set((state) => {
state.SystemEnv = data;
});
+ return data;
} catch (error) {
- console.log(error, 'get system env');
+ return {
+ domain: defaultDomain
+ };
}
}
}))
diff --git a/frontend/providers/cronjob/src/utils/adapt.ts b/frontend/providers/cronjob/src/utils/adapt.ts
index d8fb6766049..786b0c717f4 100644
--- a/frontend/providers/cronjob/src/utils/adapt.ts
+++ b/frontend/providers/cronjob/src/utils/adapt.ts
@@ -139,7 +139,7 @@ export const adaptAppListItem = (app: V1Deployment): AppListItemType => {
memory: memoryFormatToMi(
app.spec?.template?.spec?.containers?.[0]?.resources?.limits?.memory || '0'
),
- replicas: app.spec?.replicas || 1
+ replicas: app.spec?.replicas || 0
};
};
diff --git a/frontend/providers/cronjob/src/utils/user.ts b/frontend/providers/cronjob/src/utils/user.ts
index 9a1a74aae12..547b147f06c 100644
--- a/frontend/providers/cronjob/src/utils/user.ts
+++ b/frontend/providers/cronjob/src/utils/user.ts
@@ -41,5 +41,5 @@ export const getUserNamespace = () => {
export const getUserServiceAccount = () => {
const kubeConfig = getUserKubeConfig();
const json = yaml.load(kubeConfig) as KC;
- return json?.contexts[0]?.context?.user || json?.users[0]?.name;
+ return json?.contexts[0]?.context?.namespace?.replace('ns-', '') || json?.users[0]?.name;
};
diff --git a/frontend/providers/template/src/hooks/useConfirm.tsx b/frontend/providers/template/src/hooks/useConfirm.tsx
index 3e2bb7e05de..07b99ccc6ce 100644
--- a/frontend/providers/template/src/hooks/useConfirm.tsx
+++ b/frontend/providers/template/src/hooks/useConfirm.tsx
@@ -1,4 +1,4 @@
-import { useCallback, useRef } from 'react';
+import React, { ReactNode, useCallback, useRef } from 'react';
import {
AlertDialog,
AlertDialogBody,
@@ -11,7 +11,15 @@ import {
} from '@chakra-ui/react';
import { useTranslation } from 'next-i18next';
-export const useConfirm = ({ title = 'Prompt', content }: { title?: string; content: string }) => {
+export const useConfirm = ({
+ title = 'Prompt',
+ content,
+ otherContent
+}: {
+ title?: string;
+ content: string;
+ otherContent?: ReactNode;
+}) => {
const { t } = useTranslation();
const { isOpen, onOpen, onClose } = useDisclosure();
const cancelRef = useRef(null);
@@ -38,7 +46,10 @@ export const useConfirm = ({ title = 'Prompt', content }: { title?: string; cont
{t(title)}
- {t(content)}
+
+ {otherContent}
+ {t(content)}
+