Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
c121914yu committed Jul 20, 2023
1 parent 636a859 commit a347862
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 40 deletions.
2 changes: 1 addition & 1 deletion frontend/packages/client-sdk/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// export { request } from "./utils"
export { API_NAME, EVENT_NAME } from './constants';
export type { MasterReplyMessageType, AppSendMessageType } from './types';
export type { MasterReplyMessageType, AppSendMessageType } from './types';
11 changes: 5 additions & 6 deletions frontend/providers/dbprovider/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ const queryClient = new QueryClient({

function App({
Component,
pageProps,
// domain,
// env_storage_className
}: AppProps) {
pageProps
}: // domain,
// env_storage_className
AppProps) {
const router = useRouter();
const { i18n } = useTranslation();
const { setScreenWidth, loading, setLastRoute } = useGlobalStore();
Expand Down Expand Up @@ -106,7 +106,7 @@ function App({

getUserPrice();
getDBVersion();
getEnv();
getEnv();
(async () => {
try {
const lang = await sealosApp.getLanguage();
Expand Down Expand Up @@ -154,5 +154,4 @@ function App({
);
}


export default appWithTranslation(App);
32 changes: 16 additions & 16 deletions frontend/providers/dbprovider/src/pages/api/getEnv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ import { authSession } from '@/services/backend/auth';
import { getK8s } from '@/services/backend/kubernetes';
import { jsonRes } from '@/services/backend/response';
export type Response = {
domain?: string;
env_storage_className?: string;
}
domain?: string;
env_storage_className?: string;
};
export default async function handler(req: NextApiRequest, res: NextApiResponse<ApiResp>) {
try {
jsonRes<Response>(res, {
data: {
domain: process.env.SEALOS_DOMAIN || 'cloud.sealos.io',
env_storage_className: process.env.STORAGE_CLASSNAME
}
});
} catch (err: any) {
jsonRes(res, {
code: 500,
error: err
});
}
try {
jsonRes<Response>(res, {
data: {
domain: process.env.SEALOS_DOMAIN || 'cloud.sealos.io',
env_storage_className: process.env.STORAGE_CLASSNAME
}
});
} catch (err: any) {
jsonRes(res, {
code: 500,
error: err
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export type ComponentRef = {
};

const BackupTable = ({ db }: { db?: DBDetailType }, ref: ForwardedRef<ComponentRef>) => {
if(!db) return <></>
if (!db) return <></>;
const { t } = useTranslation();
const { toast } = useToast();
const { Loading, setIsLoading } = useLoading();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const BackupModal = ({
onClose: () => void;
onSuccess?: () => void;
}) => {
if(!db) return <></>
if (!db) return <></>;
const router = useRouter();
const { t } = useTranslation();
const { toast } = useToast();
Expand Down
29 changes: 14 additions & 15 deletions frontend/providers/dbprovider/src/store/static.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export let INSTALL_ACCOUNT = false;

let retryGetPrice = 3;
let retryVersion = 3;
let retryGetEnv = 3
let retryGetEnv = 3;
export let DBVersionMap: DBVersionMapType = {
[DBTypeEnum.postgresql]: [{ id: 'postgresql-14.8.0', label: 'postgresql-14.8.0' }],
[DBTypeEnum.mongodb]: [{ id: 'mongodb-5.0.14', label: 'mongodb-5.0.14' }],
Expand All @@ -37,19 +37,19 @@ export const getUserPrice = async () => {
}
};
export const getEnv = async () => {
try {
const res = await getAppEnv()
StorageClassName = res.env_storage_className;
Domain = res.domain;
} catch {
retryGetEnv--;
if (retryGetEnv >= 0) {
setTimeout(() => {
getEnv();
}, 1000);
}
}
}
try {
const res = await getAppEnv();
StorageClassName = res.env_storage_className;
Domain = res.domain;
} catch {
retryGetEnv--;
if (retryGetEnv >= 0) {
setTimeout(() => {
getEnv();
}, 1000);
}
}
};
export const getDBVersion = async () => {
try {
const res = await getDBVersionMap();
Expand All @@ -63,4 +63,3 @@ export const getDBVersion = async () => {
}
}
};

0 comments on commit a347862

Please sign in to comment.