Skip to content

Commit

Permalink
fix:desktop password login and static host (#4639)
Browse files Browse the repository at this point in the history
Signed-off-by: jingyang <3161362058@qq.com>
  • Loading branch information
zjy365 committed Mar 28, 2024
1 parent df38d07 commit 851cd69
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 15 deletions.
3 changes: 2 additions & 1 deletion frontend/desktop/src/components/region/RegionToggle.tsx
Expand Up @@ -36,6 +36,7 @@ export default function RegionToggle() {
target.searchParams.append('token', token);
await router.replace(target);
};

return (
<>
<HStack h="36px" borderRadius={'12px'} position={'relative'}>
Expand Down Expand Up @@ -127,7 +128,7 @@ export default function RegionToggle() {
<Text>{t('Description')}</Text>
</HStack>
<Text color={'#111824'} lineHeight={'20px'}>
{t(region?.description?.description?.zh)}
{region?.description?.description?.[i18n.language as 'zh' | 'en']}
</Text>
</Box>
</Box>
Expand Down
2 changes: 1 addition & 1 deletion frontend/desktop/src/pages/api/auth/password/exist.ts
Expand Up @@ -22,7 +22,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
}
// const userRes = await findUser({realUserUid: payload.realUserUid})
// const passwordProvider = userRes?.oauthProvider.find(val=>val.providerType === ProviderType.PASSWORD)
const isExist = globalPrisma.oauthProvider.findUnique({
const isExist = await globalPrisma.oauthProvider.findUnique({
where: {
providerId_providerType: {
providerType: ProviderType.PASSWORD,
Expand Down
2 changes: 1 addition & 1 deletion frontend/packages/client-sdk/src/utils/kubernetes.ts
Expand Up @@ -35,7 +35,7 @@ function K8sApi(config: string): k8s.KubeConfig {
name: cluster.name,
caData: cluster.caData,
caFile: cluster.caFile,
server: inCluster && hosts ? hosts : 'https://apiserver.cluster.local:6443',
server: inCluster && hosts ? hosts : cluster.server,
skipTLSVerify: cluster.skipTLSVerify
};

Expand Down
Expand Up @@ -393,15 +393,15 @@ const Form = ({
disabled={isEdit}
title={isEdit ? t('Not allowed to change app name') || '' : ''}
autoFocus={true}
maxLength={30}
maxLength={60}
placeholder={
t(
'Starts with a letter and can contain only lowercase letters, digits, and hyphens (-)'
) || ''
}
{...register('appName', {
required: t('Not allowed to change app name') || '',
maxLength: 30,
maxLength: 60,
pattern: {
value: /^[a-z][a-z0-9]+([-.][a-z0-9]+)*$/g,
message: t(
Expand Down
Expand Up @@ -212,7 +212,7 @@ const EditApp = ({ appName, tabType }: { appName?: string; tabType: string }) =>
const submitError = useCallback(() => {
// deep search message
const deepSearch = (obj: any): string => {
if (!obj) return t('Submit Error');
if (!obj || typeof obj !== 'object') return t('Submit Error');
if (!!obj.message) {
return obj.message;
}
Expand Down
Expand Up @@ -33,7 +33,7 @@ export function K8sApi(config: string): k8s.KubeConfig {
name: cluster.name,
caData: cluster.caData,
caFile: cluster.caFile,
server: inCluster && hosts ? hosts : 'https://apiserver.cluster.local:6443',
server: inCluster && hosts ? hosts : cluster.server,
skipTLSVerify: cluster.skipTLSVerify
};

Expand Down
2 changes: 1 addition & 1 deletion frontend/providers/dbprovider/src/pages/db/edit/index.tsx
Expand Up @@ -136,7 +136,7 @@ const EditApp = ({ dbName, tabType }: { dbName?: string; tabType?: 'form' | 'yam
const submitError = useCallback(() => {
// deep search message
const deepSearch = (obj: any): string => {
if (!obj) return t('Submit Error');
if (!obj || typeof obj !== 'object') return t('Submit Error');
if (!!obj.message) {
return obj.message;
}
Expand Down
Expand Up @@ -6,6 +6,7 @@ import {
Circle,
HStack,
IconButton,
Link,
Menu,
MenuButton,
MenuItem,
Expand Down Expand Up @@ -97,9 +98,12 @@ export function HostStatus() {
</HStack>
) : (
<HStack>
<Text>
{t('Current Domain')}: {domain}
</Text>
<Box>
{t('Current Domain')}:
<Link href={`https://${domain}`} isExternal style={{ textDecoration: 'none' }}>
{domain}
</Link>
</Box>
<StatusTag hostStatus={hostStatus} />
<Menu>
<MenuButton
Expand All @@ -120,7 +124,7 @@ export function HostStatus() {
const name = `static-host-${currentBucket?.name}`;
sealosApp.runEvents('openDesktopApp', {
appKey: 'system-applaunchpad',
pathname: '/app/detail',
pathname: '/app/edit',
query: { name },
messageData: { type: 'InternalAppCall', name }
});
Expand Down
Expand Up @@ -19,8 +19,8 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
runCMD: '',
cmdParam: '',
replicas: 1,
cpu: 1000,
memory: 512,
cpu: 200,
memory: 128,
networks: [
{
networkName: `network-${appName}`,
Expand Down
Expand Up @@ -14,7 +14,6 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
const headers = {
Authorization: req.headers.authorization
};
console.log(headers);
const result = await appLanuchPadClient.get('/getAppByAppName', {
headers,
params: {
Expand Down

0 comments on commit 851cd69

Please sign in to comment.