@orsetra/shared-ui 1.1.19 → 1.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/addon.ts +85 -0
- package/api/application.ts +478 -0
- package/api/cluster.ts +29 -0
- package/api/component.ts +9 -0
- package/api/configs.ts +79 -0
- package/api/definitions.ts +29 -0
- package/api/env.ts +29 -0
- package/api/index.ts +16 -0
- package/api/kubernetes.ts +9 -0
- package/api/observation.ts +241 -0
- package/api/pipeline.ts +172 -0
- package/api/project.ts +86 -0
- package/api/repository.ts +77 -0
- package/api/roles.ts +15 -0
- package/api/system.ts +41 -0
- package/api/target.ts +20 -0
- package/api/user.ts +48 -0
- package/components/ui/index.ts +1 -1
- package/context/index.tsx +39 -0
- package/i18n.tsx +39 -0
- package/index.ts +7 -1
- package/locals/En/en.json +1 -0
- package/locals/Zh/zh.json +657 -0
- package/package.json +7 -1
- package/types/application.ts +6 -0
- package/types/data.ts +9 -0
- package/types/index.ts +5 -0
- package/types/layout.ts +7 -0
- package/types/menus.ts +32 -0
- package/types/permission.ts +4 -0
- package/utils/_test/permission.test.ts +26 -0
- package/utils/cache.ts +9 -0
- package/utils/common.ts +314 -0
- package/utils/errors.ts +31 -0
- package/utils/i18n.tsx +28 -0
- package/utils/icon.tsx +42 -0
- package/utils/locale.tsx +190 -0
- package/utils/locals/En/en.json +1 -0
- package/utils/locals/Zh/zh.json +657 -0
- package/utils/permission.ts +136 -0
- package/utils/resetLogin.ts +35 -0
- package/utils/storage.ts +21 -0
- package/utils/utils.ts +216 -0
package/api/user.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { NameAlias } from './env';
|
|
2
|
+
|
|
3
|
+
export type User = {
|
|
4
|
+
name: string;
|
|
5
|
+
alias?: string;
|
|
6
|
+
email?: string;
|
|
7
|
+
createTime?: string;
|
|
8
|
+
lastLoginTime?: string;
|
|
9
|
+
enable?: boolean;
|
|
10
|
+
password?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
roles?: NameAlias[];
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export interface LoginUserInfo {
|
|
16
|
+
name: string;
|
|
17
|
+
alias?: string;
|
|
18
|
+
email?: string;
|
|
19
|
+
createTime?: string;
|
|
20
|
+
lastLoginTime?: string;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
projects: UserProject[];
|
|
23
|
+
platformPermissions?: PermissionBase[];
|
|
24
|
+
projectPermissions?: Record<string, PermissionBase[]>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface UserProject {
|
|
28
|
+
name: string;
|
|
29
|
+
alias?: string;
|
|
30
|
+
owner: string;
|
|
31
|
+
joinTime: string;
|
|
32
|
+
roles?: NameAlias[];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface PermissionBase {
|
|
36
|
+
name: string;
|
|
37
|
+
alias?: string;
|
|
38
|
+
resources?: string[];
|
|
39
|
+
actions: string[];
|
|
40
|
+
effect: string;
|
|
41
|
+
createTime: string;
|
|
42
|
+
updateTime: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface CloudShellPrepare {
|
|
46
|
+
status: string;
|
|
47
|
+
message?: string;
|
|
48
|
+
}
|
package/components/ui/index.ts
CHANGED
|
@@ -34,7 +34,7 @@ export { Collapsible, CollapsibleTrigger, CollapsibleContent } from './collapsib
|
|
|
34
34
|
export { Command, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandShortcut, CommandSeparator } from './command'
|
|
35
35
|
export { ContextMenu, ContextMenuTrigger, ContextMenuContent, ContextMenuItem, ContextMenuCheckboxItem, ContextMenuRadioItem, ContextMenuLabel, ContextMenuSeparator, ContextMenuShortcut, ContextMenuGroup, ContextMenuPortal, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuRadioGroup } from './context-menu'
|
|
36
36
|
export { Dialog, DialogTrigger, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription } from './dialog'
|
|
37
|
-
export { ProjectSelectorModal, type Project, type ProjectSelectorModalProps } from './project-selector-modal'
|
|
37
|
+
export { ProjectSelectorModal, type Project as ProjectSelectorItem, type ProjectSelectorModalProps } from './project-selector-modal'
|
|
38
38
|
export { Drawer, DrawerTrigger, DrawerContent, DrawerHeader, DrawerFooter, DrawerTitle, DrawerDescription } from './drawer'
|
|
39
39
|
export { Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField } from './form'
|
|
40
40
|
export { HoverCard, HoverCardTrigger, HoverCardContent } from './hover-card'
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
import type { WorkflowMode , WorkflowStep } from '../api';
|
|
6
|
+
|
|
7
|
+
export interface UISchemaContextState {
|
|
8
|
+
appName?: string;
|
|
9
|
+
appNamespace?: string;
|
|
10
|
+
projectName?: string;
|
|
11
|
+
envName?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const UISchemaContext = React.createContext<UISchemaContextState>({});
|
|
15
|
+
|
|
16
|
+
export type WorkflowData = {
|
|
17
|
+
alias?: string;
|
|
18
|
+
name: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
createTime?: string;
|
|
21
|
+
steps: WorkflowStep[];
|
|
22
|
+
mode: WorkflowMode;
|
|
23
|
+
subMode: WorkflowMode;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
type workflowContext = {
|
|
27
|
+
appName?: string;
|
|
28
|
+
projectName?: string;
|
|
29
|
+
workflow?: WorkflowData;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const WorkflowContext = React.createContext<workflowContext>({});
|
|
33
|
+
|
|
34
|
+
type workflowEditContext = {
|
|
35
|
+
steps?: WorkflowStep[];
|
|
36
|
+
stepName?: string;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const WorkflowEditContext = React.createContext<workflowEditContext>({});
|
package/i18n.tsx
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import i18n from 'i18next';
|
|
4
|
+
import { initReactI18next } from 'react-i18next';
|
|
5
|
+
|
|
6
|
+
import En from './locals/En/en.json';
|
|
7
|
+
import Zh from './locals/Zh/zh.json';
|
|
8
|
+
import { getLanguage } from './utils/common';
|
|
9
|
+
|
|
10
|
+
const resources = {
|
|
11
|
+
en: {
|
|
12
|
+
translation: En,
|
|
13
|
+
},
|
|
14
|
+
zh: {
|
|
15
|
+
translation: Zh,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
// Initialize i18n with default language, will be updated on client side
|
|
20
|
+
i18n
|
|
21
|
+
.use(initReactI18next) // passes i18n down to react-i18next
|
|
22
|
+
.init({
|
|
23
|
+
resources,
|
|
24
|
+
lng: 'en', // Default to 'en' for SSR
|
|
25
|
+
keySeparator: false, // we do not use keys in form messages.welcome
|
|
26
|
+
interpolation: {
|
|
27
|
+
escapeValue: false, // react already safes from xss
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// Update language on client side
|
|
32
|
+
if (typeof window !== 'undefined') {
|
|
33
|
+
const currentLanguage = getLanguage();
|
|
34
|
+
if (currentLanguage !== i18n.language) {
|
|
35
|
+
i18n.changeLanguage(currentLanguage);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export default i18n;
|
package/index.ts
CHANGED
|
@@ -18,10 +18,16 @@ export * from './components/layout'
|
|
|
18
18
|
export * from './hooks'
|
|
19
19
|
|
|
20
20
|
// Context
|
|
21
|
-
export * from './context'
|
|
21
|
+
export * from './context/index'
|
|
22
22
|
|
|
23
23
|
// Internationalization
|
|
24
24
|
export { default as i18n } from './i18n'
|
|
25
25
|
|
|
26
26
|
// Utilities (additional exports)
|
|
27
27
|
export { locale } from './utils/locale'
|
|
28
|
+
export * from './utils/common'
|
|
29
|
+
export * from './utils/storage'
|
|
30
|
+
export * from './utils/permission'
|
|
31
|
+
export * from './utils/resetLogin'
|
|
32
|
+
export * from './utils/cache'
|
|
33
|
+
export * from './utils/errors'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|