@@ -78,14 +83,16 @@ function StorePage() {
display="row"
labels={imageLabels.filter((item) => item.checked)}
onChange={handleLabelsChange}
+ onClear={handleLabelsClear}
/>
+ {isLoading &&
}
{isSuccess && (
{appLists?.map((item: TAppInfo) => {
@@ -96,13 +103,18 @@ function StorePage() {
onClick={() => toPage(EPageType.DetailPage, item.name)}
>
-

+
{handleImageName(item?.name).name}
-
+
{item?.description}
@@ -121,10 +133,11 @@ function StorePage() {
-
*/}
+
{item.size ? formattedSize(item.size) : 'empty'}
@@ -132,11 +145,11 @@ function StorePage() {
大小
-
*/}
);
diff --git a/desktop/frontend/src/components/app_window/index.module.scss b/desktop/frontend/src/components/app_window/index.module.scss
index 660b72e14..40cd3288a 100644
--- a/desktop/frontend/src/components/app_window/index.module.scss
+++ b/desktop/frontend/src/components/app_window/index.module.scss
@@ -347,3 +347,10 @@ body[data-theme='dark'] .win11Scroll,
}
}
}
+
+.appMask {
+ position: absolute;
+ width: 100%;
+ height: 100%;
+ z-index: 4;
+}
diff --git a/desktop/frontend/src/components/app_window/index.tsx b/desktop/frontend/src/components/app_window/index.tsx
index 316243bbc..dc7d11349 100644
--- a/desktop/frontend/src/components/app_window/index.tsx
+++ b/desktop/frontend/src/components/app_window/index.tsx
@@ -16,10 +16,13 @@ export default function AppWindow(props: {
}) {
const wnapp = props.app;
- const { closeApp, updateAppInfo, switchApp } = useAppStore((state) => state);
+ const { closeApp, updateAppInfo, switchApp, currentApp, openedApps } = useAppStore(
+ (state) => state
+ );
const dragDom = useRef(null);
const [dragging, setDragging] = useState(false);
const [position, setPosition] = useState({ x: 0, y: 0 });
+ // console.log(position);
return (
{
- switchApp(wnapp, 'clickHeader');
+ switchApp({ ...wnapp, mask: false }, 'clickMask');
}}
style={{
- background: wnapp.style?.bg || '#fff'
+ background: '#fff'
}}
>
@@ -121,8 +124,18 @@ export default function AppWindow(props: {
-
-
{props.children}
+
+
+ {wnapp.mask && (
+
{
+ switchApp({ ...wnapp, mask: false }, 'clickMask');
+ }}
+ >
+ )}
+ {props.children}
+
diff --git a/desktop/frontend/src/components/app_window/tab.module.scss b/desktop/frontend/src/components/app_window/tab.module.scss
index 1b4f202ca..bc37dee2c 100644
--- a/desktop/frontend/src/components/app_window/tab.module.scss
+++ b/desktop/frontend/src/components/app_window/tab.module.scss
@@ -79,6 +79,9 @@
}
&[data-size='minimize'] {
+ left: 20%;
+ height: 80%;
+ width: 60%;
top: calc(100% + 10px);
transform: scale(0.6);
transform-origin: bottom;
diff --git a/desktop/frontend/src/components/iconfont/index.module.scss b/desktop/frontend/src/components/iconfont/index.module.scss
deleted file mode 100644
index 13adafdc8..000000000
--- a/desktop/frontend/src/components/iconfont/index.module.scss
+++ /dev/null
@@ -1,7 +0,0 @@
-.icon {
- width: 16px;
- height: 16px;
- vertical-align: middle;
- fill: currentColor;
- overflow: hidden;
-}
diff --git a/desktop/frontend/src/components/iconfont/index.tsx b/desktop/frontend/src/components/iconfont/index.tsx
index a92cafae3..98786de3f 100644
--- a/desktop/frontend/src/components/iconfont/index.tsx
+++ b/desktop/frontend/src/components/iconfont/index.tsx
@@ -1,19 +1,18 @@
-import clsx from 'clsx';
-import styles from './index.module.scss';
-
type TIconfont = {
iconName: string;
+ color?: string;
};
function Iconfont(props: TIconfont) {
- const { iconName } = props;
+ const { iconName, color } = props;
+ const style = {
+ fill: color
+ };
return (
- <>
-
- >
+
);
}
diff --git a/desktop/frontend/src/components/taskbar/index.tsx b/desktop/frontend/src/components/taskbar/index.tsx
index 6769cdabc..473c3a3b9 100644
--- a/desktop/frontend/src/components/taskbar/index.tsx
+++ b/desktop/frontend/src/components/taskbar/index.tsx
@@ -43,7 +43,7 @@ const Taskbar = () => {
return (
{
- switchApp(item);
+ switchApp({ ...item, mask: false });
}}
key={index}
className={clsx({
diff --git a/desktop/frontend/src/mock/installedApps.ts b/desktop/frontend/src/mock/installedApps.ts
index b27074d2a..3f36202a4 100644
--- a/desktop/frontend/src/mock/installedApps.ts
+++ b/desktop/frontend/src/mock/installedApps.ts
@@ -20,7 +20,9 @@ const installedApps: TApp[] = [
nameColor: 'text-black',
helpDropDown: true,
helpDocs: false
- }
+ },
+ cacheSize: 'maximize',
+ mask: true
},
{
name: 'App Store',
@@ -37,9 +39,11 @@ const installedApps: TApp[] = [
size: 'maximize',
menu: {
nameColor: 'text-black',
- helpDropDown: true,
+ helpDropDown: false,
helpDocs: false
- }
+ },
+ cacheSize: 'maximize',
+ mask: true
},
// {
// name: 'Python Compiler',
@@ -87,7 +91,9 @@ const installedApps: TApp[] = [
nameColor: 'text-black',
helpDropDown: true,
helpDocs: false
- }
+ },
+ cacheSize: 'maximize',
+ mask: true
},
{
name: 'Kubernetes Dashboard',
@@ -106,28 +112,32 @@ const installedApps: TApp[] = [
nameColor: 'text-black',
helpDropDown: true,
helpDocs: false
- }
- },
- {
- name: 'Kuboard',
- icon: '/images/kuboard.svg',
- type: APPTYPE.IFRAME,
- data: {
- url: '',
- desc: 'sealos Cloud Kuboard'
},
- gallery: [
- 'https: //cdn.programiz.com/cdn/farfuture/IwFGGPqycIxTfzLl7mPdcaqUaircnStXfipaHd4EBik/mtime:1605833048/sites/all/themes/programiz/assets/compiler.png',
- 'https: //www.programiz.com/blog/content/images/2020/07/programiz-online-compiler.png'
- ],
- size: 'maximize',
- menu: {
- nameColor: 'text-black',
- helpDropDown: true,
- helpDocs: false
- }
+ cacheSize: 'maximize',
+ mask: true
},
// {
+ // name: 'Kuboard',
+ // icon: '/images/kuboard.svg',
+ // type: APPTYPE.IFRAME,
+ // data: {
+ // url: '',
+ // desc: 'sealos Cloud Kuboard'
+ // },
+ // gallery: [
+ // 'https: //cdn.programiz.com/cdn/farfuture/IwFGGPqycIxTfzLl7mPdcaqUaircnStXfipaHd4EBik/mtime:1605833048/sites/all/themes/programiz/assets/compiler.png',
+ // 'https: //www.programiz.com/blog/content/images/2020/07/programiz-online-compiler.png'
+ // ],
+ // size: 'maximize',
+ // menu: {
+ // nameColor: 'text-black',
+ // helpDropDown: true,
+ // helpDocs: false
+ // },
+ // cacheSize: 'maximize',
+ // mask: true
+ // },
+ // {
// name: 'Prometheus',
// icon: '/images/prometheus.svg',
// type: APPTYPE.IFRAME,
@@ -155,25 +165,27 @@ const installedApps: TApp[] = [
// ],
// size: 'maximize'
// },
- {
- name: 'Redis',
- icon: '/images/redis.svg',
- type: APPTYPE.IFRAME,
- data: {
- url: '',
- desc: 'redis operator'
- },
- gallery: [
- 'https://cdn.programiz.com/cdn/farfuture/IwFGGPqycIxTfzLl7mPdcaqUaircnStXfipaHd4EBik/mtime:1605833048/sites/all/themes/programiz/assets/compiler.png',
- 'https://www.programiz.com/blog/content/images/2020/07/programiz-online-compiler.png'
- ],
- size: 'maximize',
- menu: {
- nameColor: 'text-black',
- helpDropDown: true,
- helpDocs: false
- }
- },
+ // {
+ // name: 'Redis',
+ // icon: '/images/redis.svg',
+ // type: APPTYPE.IFRAME,
+ // data: {
+ // url: '',
+ // desc: 'redis operator'
+ // },
+ // gallery: [
+ // 'https://cdn.programiz.com/cdn/farfuture/IwFGGPqycIxTfzLl7mPdcaqUaircnStXfipaHd4EBik/mtime:1605833048/sites/all/themes/programiz/assets/compiler.png',
+ // 'https://www.programiz.com/blog/content/images/2020/07/programiz-online-compiler.png'
+ // ],
+ // size: 'maximize',
+ // menu: {
+ // nameColor: 'text-black',
+ // helpDropDown: true,
+ // helpDocs: false
+ // },
+ // cacheSize: 'maximize',
+ // mask: true
+ // },
// {
// name: 'Postgres',
// icon: '/images/pgadmin.svg',
@@ -223,28 +235,32 @@ const installedApps: TApp[] = [
menu: {
nameColor: '#0073D7',
helpDropDown: false,
- helpDocs: true
- }
- },
- {
- name: 'AFFiNE',
- icon: '/images/affine.svg',
- type: APPTYPE.IFRAME,
- data: {
- url: '',
- desc: 'AFFiNE operator'
- },
- gallery: [
- 'https: //cdn.programiz.com/cdn/farfuture/IwFGGPqycIxTfzLl7mPdcaqUaircnStXfipaHd4EBik/mtime:1605833048/sites/all/themes/programiz/assets/compiler.png',
- 'https: //www.programiz.com/blog/content/images/2020/07/programiz-online-compiler.png'
- ],
- size: 'maximize',
- menu: {
- nameColor: 'text-black',
- helpDropDown: true,
helpDocs: false
- }
+ },
+ cacheSize: 'maximize',
+ mask: true
},
+ // {
+ // name: 'AFFiNE',
+ // icon: '/images/affine.svg',
+ // type: APPTYPE.IFRAME,
+ // data: {
+ // url: '',
+ // desc: 'AFFiNE operator'
+ // },
+ // gallery: [
+ // 'https: //cdn.programiz.com/cdn/farfuture/IwFGGPqycIxTfzLl7mPdcaqUaircnStXfipaHd4EBik/mtime:1605833048/sites/all/themes/programiz/assets/compiler.png',
+ // 'https: //www.programiz.com/blog/content/images/2020/07/programiz-online-compiler.png'
+ // ],
+ // size: 'maximize',
+ // menu: {
+ // nameColor: 'text-black',
+ // helpDropDown: true,
+ // helpDocs: false
+ // },
+ // cacheSize: 'maximize',
+ // mask: true
+ // },
{
name: 'Postgres',
icon: '/images/pgadmin.svg',
@@ -257,7 +273,9 @@ const installedApps: TApp[] = [
data: {
url: '',
desc: 'postgres operator'
- }
+ },
+ cacheSize: 'maximize',
+ mask: true
}
];
diff --git a/desktop/frontend/src/pages/_document.tsx b/desktop/frontend/src/pages/_document.tsx
index 0ff54359b..aeee874de 100644
--- a/desktop/frontend/src/pages/_document.tsx
+++ b/desktop/frontend/src/pages/_document.tsx
@@ -56,11 +56,7 @@ class MyDocument extends Document {
-
-
+
diff --git a/desktop/frontend/src/pages/api/image_hub/get_detail.ts b/desktop/frontend/src/pages/api/image_hub/get_detail.ts
index 9a23ca4b8..c229a5001 100644
--- a/desktop/frontend/src/pages/api/image_hub/get_detail.ts
+++ b/desktop/frontend/src/pages/api/image_hub/get_detail.ts
@@ -4,7 +4,13 @@ import type { NextApiRequest, NextApiResponse } from 'next';
import { ApplyYaml, GetClusterObject, K8sApi } from 'services/backend/kubernetes';
import { CRDTemplateBuilder } from 'services/backend/wrapper';
import { hashAny } from 'utils/strings';
-import { BadRequestResp, InternalErrorResp, JsonResp, UnprocessableResp } from '../response';
+import {
+ BadRequestResp,
+ InternalErrorResp,
+ JsonResp,
+ UnprocessableResp,
+ CreatedJsonResp
+} from '../response';
type DataPackDesc = {
codes: number;
@@ -41,7 +47,7 @@ export default async function handler(req: NextApiRequest, resp: NextApiResponse
const datapackDesc = dataDesc.body.status as DataPackDesc;
if (datapackDesc.codes === DataPackStatus.Ok) {
let result = Object.values(datapackDesc.datas);
- return JsonResp({ items: result, code: 200 }, resp);
+ return JsonResp(result, resp);
}
return JsonResp(datapackDesc, resp);
}
@@ -58,7 +64,7 @@ export default async function handler(req: NextApiRequest, resp: NextApiResponse
try {
const result = await ApplyYaml(kc, datapackCRD);
- return JsonResp({ ...result, code: 201 }, resp);
+ return CreatedJsonResp(result, resp);
} catch (err) {
return InternalErrorResp(String(err), resp);
}
diff --git a/desktop/frontend/src/pages/api/image_hub/get_list.ts b/desktop/frontend/src/pages/api/image_hub/get_list.ts
index d1a6ab3ee..566ed75dd 100644
--- a/desktop/frontend/src/pages/api/image_hub/get_list.ts
+++ b/desktop/frontend/src/pages/api/image_hub/get_list.ts
@@ -14,7 +14,13 @@ import {
} from 'services/backend/kubernetes';
import { CRDTemplateBuilder } from 'services/backend/wrapper';
import { hashAny } from 'utils/strings';
-import { BadRequestResp, InternalErrorResp, JsonResp, UnprocessableResp } from '../response';
+import {
+ BadRequestResp,
+ InternalErrorResp,
+ JsonResp,
+ UnprocessableResp,
+ CreatedJsonResp
+} from '../response';
type repositoryStatus = {
items: {
@@ -66,9 +72,7 @@ export default async function handler(req: NextApiRequest, resp: NextApiResponse
images_names.push(item.spec.name + ':' + item.status.latestTag.name);
}
}
- // return JsonResp(repositoryDesc.body, resp);
} catch (err) {
- console.log(err, 'list');
if (err instanceof k8s.HttpError) {
return InternalErrorResp(err.body.message, resp);
}
@@ -83,7 +87,7 @@ export default async function handler(req: NextApiRequest, resp: NextApiResponse
const datapackDesc = dataDesc.body.status as DataPackDesc;
if (datapackDesc.codes === DataPackStatus.Ok) {
let result = Object.values(datapackDesc.datas);
- return JsonResp({ items: result, code: 200 }, resp);
+ return JsonResp(result, resp);
}
return JsonResp(datapackDesc, resp);
}
@@ -100,7 +104,7 @@ export default async function handler(req: NextApiRequest, resp: NextApiResponse
try {
const result = await ApplyYaml(kc, datapackCRD);
- return JsonResp({ ...result, code: 201 }, resp);
+ return CreatedJsonResp(result, resp);
} catch (err) {
return InternalErrorResp(String(err), resp);
}
diff --git a/desktop/frontend/src/pages/api/response.ts b/desktop/frontend/src/pages/api/response.ts
index dcbee4db3..ed978e9ef 100644
--- a/desktop/frontend/src/pages/api/response.ts
+++ b/desktop/frontend/src/pages/api/response.ts
@@ -56,6 +56,17 @@ const InternalErrorResp = (str: string, resp?: NextApiResponse) =>
const JsonResp = (data: any, resp?: NextApiResponse) =>
CommonResp({ code: 200, message: 'ok', data: data, statusCode: 200 }, resp);
+const CreatedJsonResp = (data: any, resp?: NextApiResponse) =>
+ CommonResp(
+ {
+ code: 201,
+ message: 'the resource has been created and needs to be requested again',
+ data: data,
+ statusCode: 201
+ },
+ resp
+ );
+
export {
BadRequestResp,
BadAuthResp,
@@ -64,5 +75,6 @@ export {
MethodNotAllowedResp,
InternalErrorResp,
CommonResp,
- JsonResp
+ JsonResp,
+ CreatedJsonResp
};
diff --git a/desktop/frontend/src/services/request.ts b/desktop/frontend/src/services/request.ts
index a98806c64..6d54a3dab 100644
--- a/desktop/frontend/src/services/request.ts
+++ b/desktop/frontend/src/services/request.ts
@@ -101,7 +101,8 @@ request.interceptors.response.use(
// UnWrap
const apiResp = data as ApiResp;
- if (apiResp.code !== 200) {
+ const successfulCode = [200, 201];
+ if (!successfulCode.includes(apiResp.code)) {
return Promise.reject(new Error(apiResp.code + ':' + apiResp.message));
}
diff --git a/desktop/frontend/src/stores/app.ts b/desktop/frontend/src/stores/app.ts
index 3301cea4f..a0ab3022f 100644
--- a/desktop/frontend/src/stores/app.ts
+++ b/desktop/frontend/src/stores/app.ts
@@ -18,6 +18,7 @@ export type TAppFront = {
}
| {};
cacheSize: 'maximize' | 'maxmin' | 'minimize';
+ mask: boolean;
};
const initialFrantState: TAppFront = {
@@ -25,6 +26,7 @@ const initialFrantState: TAppFront = {
zIndex: 1,
size: 'maximize',
cacheSize: 'maximize',
+ mask: true,
style: {}
};
@@ -78,7 +80,7 @@ type TOSState = {
openApp(app: TApp): void;
// switch the app
- switchApp(app: TApp, type?: 'clickHeader'): void;
+ switchApp(app: TApp, type?: 'clickMask'): void;
updateAppInfo(app: TApp): void;
@@ -141,6 +143,7 @@ const useAppStore = create()(
updateAppInfo: (app: TApp) => {
set((state) => {
state.openedApps = state.openedApps.map((_app) => {
+ _app.mask = true;
return _app.name === app.name ? app : _app;
});
@@ -148,9 +151,9 @@ const useAppStore = create()(
return _app.name === app.name ? app : _app;
});
- const temp = state.openedApps.filter((item) => item.size !== 'minimize');
- temp.sort((a, b) => b.zIndex - a.zIndex);
- state.currentApp = temp[0];
+ const activeApps = state.openedApps.filter((item) => item.size !== 'minimize');
+ activeApps.sort((a, b) => b.zIndex - a.zIndex);
+ state.currentApp = activeApps[0];
});
},
@@ -164,6 +167,7 @@ const useAppStore = create()(
_app.zIndex = zIndex;
_app.isShow = true;
_app.size = 'maximize';
+ _app.mask = false;
get().updateAppInfo(_app);
@@ -181,13 +185,16 @@ const useAppStore = create()(
const _app: TApp = JSON.parse(JSON.stringify(app));
_app.zIndex = zIndex;
_app.isShow = true;
- if (type !== 'clickHeader') {
+ if (type !== 'clickMask') {
if (get().currentApp?.name === _app.name) {
_app.size === 'minimize' ? (_app.size = _app.cacheSize) : (_app.size = 'minimize');
} else {
_app.size = _app.cacheSize;
}
}
+
+ get().updateAppInfo(_app);
+
set((state) => {
// repalce app info
state.openedApps = state.openedApps.map((item) => {
diff --git a/desktop/frontend/src/styles/globals.scss b/desktop/frontend/src/styles/globals.scss
index 37cc786f2..a15bcdfe2 100755
--- a/desktop/frontend/src/styles/globals.scss
+++ b/desktop/frontend/src/styles/globals.scss
@@ -3,6 +3,7 @@
@tailwind utilities;
@import './highlight.scss';
+
html {
font-size: 12px;
scrollbar-color: transparent transparent;
@@ -115,3 +116,11 @@ body::-webkit-scrollbar {
--hover-bg: rgba(0, 178, 255, 0.16);
--focus-bg: rgba(0, 183, 255, 0.25);
}
+
+.icon {
+ width: 16px;
+ height: 16px;
+ vertical-align: -0.15em;
+ fill: currentColor;
+ overflow: hidden;
+}