Skip to content

Commit

Permalink
Merge branch 'labring:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
lingdie committed Oct 20, 2023
2 parents 10985ef + 00726c6 commit c851c15
Show file tree
Hide file tree
Showing 29 changed files with 118 additions and 81 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/controllers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,14 @@ jobs:
- name: Build ${{ matrix.module.name }} amd64
working-directory: controllers/${{ matrix.module.path }}
run: |
GOARCH=amd64 make build
GOARCH=amd64 TARGETARCH=amd64 make build
mv bin/manager bin/controller-${{ matrix.module.name }}-amd64
chmod +x bin/controller-${{ matrix.module.name }}-amd64
- name: Build ${{ matrix.module.name }} arm64
working-directory: controllers/${{ matrix.module.path }}
run: |
GOARCH=arm64 make build
GOARCH=arm64 TARGETARCH=arm64 make build
mv bin/manager bin/controller-${{ matrix.module.name }}-arm64
chmod +x bin/controller-${{ matrix.module.name }}-arm64
Expand Down
3 changes: 2 additions & 1 deletion controllers/db/adminer/controllers/adminer_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,8 @@ func isExpired(adminer *adminerv1.Adminer) bool {

func buildLabelsMap(adminer *adminerv1.Adminer) map[string]string {
labelsMap := map[string]string{
"AdminerID": adminer.Name,
"cloud.sealos.io/app-adminer": adminer.Name,
"app": adminer.Name,
}
return labelsMap
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/desktop/next-i18next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

module.exports = {
i18n: {
defaultLocale: 'en',
defaultLocale: 'zh',
locales: ['en', 'zh'],
localeDetection: false
}
Expand Down
2 changes: 2 additions & 0 deletions frontend/desktop/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ export default function Home({
export async function getServerSideProps({ req, res, locales }: any) {
const lang: string = req?.headers?.['accept-language'] || 'zh';
const local = lang.indexOf('zh') !== -1 ? 'zh' : 'en';
res.setHeader('Set-Cookie', `NEXT_LOCALE=${local}; Max-Age=2592000; Secure; SameSite=None`);

const sealos_cloud_domain = process.env.SEALOS_CLOUD_DOMAIN || 'cloud.sealos.io';

return {
Expand Down
2 changes: 1 addition & 1 deletion frontend/desktop/src/pages/license/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default function LicensePage() {
}

export async function getServerSideProps({ req, res, locales }: any) {
const local = req?.cookies?.NEXT_LOCALE || 'en';
const local = req?.cookies?.NEXT_LOCALE || 'zh';

return {
props: {
Expand Down
1 change: 1 addition & 0 deletions frontend/desktop/src/pages/signin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export default function SigninPage() {
export async function getServerSideProps({ req, res, locales }: any) {
const lang: string = req?.headers?.['accept-language'] || 'zh';
const local = lang.indexOf('zh') !== -1 ? 'zh' : 'en';
res.setHeader('Set-Cookie', `NEXT_LOCALE=${local}; Max-Age=2592000; Secure; SameSite=None`);

const props = {
...(await serverSideTranslations(local, undefined, null, locales || []))
Expand Down
2 changes: 1 addition & 1 deletion frontend/packages/client-sdk/src/master.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class MasterSDK {
messageId: data.messageId,
success: true,
data: {
lng: getCookie('NEXT_LOCALE') || 'en'
lng: getCookie('NEXT_LOCALE') || 'zh'
}
});
} else {
Expand Down
4 changes: 2 additions & 2 deletions frontend/providers/applaunchpad/next-i18next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

module.exports = {
i18n: {
defaultLocale: 'en',
defaultLocale: 'zh',
locales: ['en', 'zh'],
localeDetection: false
}
};
}
4 changes: 2 additions & 2 deletions frontend/providers/applaunchpad/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const App = ({ Component, pageProps }: AppProps) => {
}, [setScreenWidth]);

useEffect(() => {
const changeI18n = async (data: any) => {
const changeI18n = async (data: { currentLanguage: string }) => {
const lastLang = getLangStore();
const newLang = data.currentLanguage;
if (lastLang !== newLang) {
Expand Down Expand Up @@ -132,7 +132,7 @@ const App = ({ Component, pageProps }: AppProps) => {
}, [router.pathname]);

useEffect(() => {
const lang = getLangStore() || 'en';
const lang = getLangStore() || 'zh';
i18n?.changeLanguage?.(lang);
}, [refresh, router.pathname]);

Expand Down
2 changes: 1 addition & 1 deletion frontend/providers/applaunchpad/src/utils/cookieUtils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Cookies from 'js-cookie';

export const LANG_KEY = 'NEXT_LOCALE_LANG';
export const LANG_KEY = 'NEXT_LOCALE';

export const setLangStore = (value: string) => {
return Cookies.set(LANG_KEY, value, { expires: 30, sameSite: 'None', secure: true });
Expand Down
2 changes: 1 addition & 1 deletion frontend/providers/applaunchpad/src/utils/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { LANG_KEY } from './cookieUtils';

export const serviceSideProps = (content: any) => {
return serverSideTranslations(
content.req.cookies[LANG_KEY] || 'en',
content.req.cookies[LANG_KEY] || 'zh',
undefined,
null,
content.locales
Expand Down
6 changes: 3 additions & 3 deletions frontend/providers/costcenter/next-i18next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

module.exports = {
i18n: {
defaultLocale: 'en',
locales: ['en', 'zh', 'zh-Hans'],
defaultLocale: 'zh',
locales: ['en', 'zh'],
localeDetection: false
}
};
}
2 changes: 1 addition & 1 deletion frontend/providers/costcenter/src/stores/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const useSessionStore = create<SessionState>()(
persist(
immer((set, get) => ({
session: {} as SessionV1,
locale: 'en',
locale: 'zh',
setSession: (ss: SessionV1) => set({ session: ss }),
setSessionProp: (key: keyof SessionV1, value: any) => {
set((state) => {
Expand Down
4 changes: 2 additions & 2 deletions frontend/providers/cronjob/next-i18next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

module.exports = {
i18n: {
defaultLocale: 'en',
defaultLocale: 'zh',
locales: ['en', 'zh'],
localeDetection: false
}
};
}
2 changes: 1 addition & 1 deletion frontend/providers/cronjob/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function App({ Component, pageProps }: AppProps) {
}, [router.pathname]);

useEffect(() => {
const lang = getLangStore() || 'en';
const lang = getLangStore() || 'zh';
i18n?.changeLanguage?.(lang);
}, [refresh, router.asPath]);

Expand Down
2 changes: 1 addition & 1 deletion frontend/providers/cronjob/src/utils/cookieUtils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Cookies from 'js-cookie';

export const LANG_KEY = 'NEXT_LOCALE_LANG';
export const LANG_KEY = 'NEXT_LOCALE';

export const setLangStore = (value: string) => {
return Cookies.set(LANG_KEY, value, { expires: 30, sameSite: 'None', secure: true });
Expand Down
2 changes: 1 addition & 1 deletion frontend/providers/cronjob/src/utils/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { LANG_KEY } from './cookieUtils';

export const serviceSideProps = (content: any) => {
return serverSideTranslations(
content.req.cookies[LANG_KEY] || 'en',
content.req.cookies[LANG_KEY] || 'zh',
undefined,
null,
content.locales
Expand Down
6 changes: 3 additions & 3 deletions frontend/providers/dbprovider/next-i18next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

module.exports = {
i18n: {
defaultLocale: 'en',
locales: ['en', 'zh', 'zh-Hans'],
defaultLocale: 'zh',
locales: ['en', 'zh'],
localeDetection: false
}
};
}
2 changes: 1 addition & 1 deletion frontend/providers/dbprovider/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ function App({ Component, pageProps }: AppProps) {
}, [router.pathname]);

useEffect(() => {
const lang = getLangStore() || 'en';
const lang = getLangStore() || 'zh';
i18n?.changeLanguage?.(lang);
}, [refresh, router.asPath]);

Expand Down
2 changes: 1 addition & 1 deletion frontend/providers/dbprovider/src/utils/cookieUtils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Cookies from 'js-cookie';

export const LANG_KEY = 'NEXT_LOCALE_LANG';
export const LANG_KEY = 'NEXT_LOCALE';

export const setLangStore = (value: string) => {
return Cookies.set(LANG_KEY, value, { expires: 30, sameSite: 'None', secure: true });
Expand Down
2 changes: 1 addition & 1 deletion frontend/providers/dbprovider/src/utils/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { LANG_KEY } from './cookieUtils';

export const serviceSideProps = (content: any) => {
return serverSideTranslations(
content.req.cookies[LANG_KEY] || 'en',
content.req.cookies[LANG_KEY] || 'zh',
undefined,
null,
content.locales
Expand Down
4 changes: 2 additions & 2 deletions frontend/providers/license/next-i18next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

module.exports = {
i18n: {
defaultLocale: 'en',
defaultLocale: 'zh',
locales: ['en', 'zh'],
localeDetection: false
}
};
}
2 changes: 1 addition & 1 deletion frontend/providers/license/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function App({ Component, pageProps }: AppProps) {
}, [router.pathname]);

useEffect(() => {
const lang = getLangStore() || 'en';
const lang = getLangStore() || 'zh';
i18n?.changeLanguage?.(lang);
}, [refresh, router.asPath]);

Expand Down
2 changes: 1 addition & 1 deletion frontend/providers/license/src/utils/cookieUtils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Cookies from 'js-cookie';

export const LANG_KEY = 'NEXT_LOCALE_LANG';
export const LANG_KEY = 'NEXT_LOCALE';

export const setLangStore = (value: string) => {
return Cookies.set(LANG_KEY, value, { expires: 30, sameSite: 'None', secure: true });
Expand Down
6 changes: 3 additions & 3 deletions frontend/providers/template/next-i18next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

module.exports = {
i18n: {
defaultLocale: 'en',
locales: ['en', 'zh', 'zh-Hans'],
defaultLocale: 'zh',
locales: ['en', 'zh'],
localeDetection: false
}
};
}
2 changes: 1 addition & 1 deletion frontend/providers/template/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const App = ({ Component, pageProps, domain }: AppProps & { domain: string }) =>
}, [router.pathname]);

useEffect(() => {
const lang = getLangStore() || 'en';
const lang = getLangStore() || 'zh';
i18n?.changeLanguage?.(lang);
}, [refresh, router.pathname]);

Expand Down
2 changes: 1 addition & 1 deletion frontend/providers/template/src/utils/cookieUtils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Cookies from 'js-cookie';

export const LANG_KEY = 'NEXT_LOCALE_LANG';
export const LANG_KEY = 'NEXT_LOCALE';

export const setLangStore = (value: string) => {
return Cookies.set(LANG_KEY, value, { expires: 30, sameSite: 'None', secure: true });
Expand Down
2 changes: 1 addition & 1 deletion frontend/providers/template/src/utils/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { LANG_KEY } from './cookieUtils';

export const serviceSideProps = (content: any) => {
return serverSideTranslations(
content.req.cookies[LANG_KEY] || 'en',
content.req.cookies[LANG_KEY] || 'zh',
undefined,
null,
content.locales
Expand Down
Loading

0 comments on commit c851c15

Please sign in to comment.