mirror of
https://github.com/MCSManager/MCSManager.git
synced 2025-01-12 14:54:34 +08:00
Refactor: user types
This commit is contained in:
parent
c066828a13
commit
6f41802c9a
@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, computed } from "vue";
|
||||
import type { UserInstance, MountComponent } from "@/types";
|
||||
import type { MountComponent, NodeStatus } from "@/types";
|
||||
import type { UserInstance } from "@/types/user";
|
||||
import { t } from "@/lang/i18n";
|
||||
import {
|
||||
SearchOutlined,
|
||||
@ -10,11 +11,9 @@ import {
|
||||
FrownOutlined
|
||||
} from "@ant-design/icons-vue";
|
||||
import BetweenMenus from "@/components/BetweenMenus.vue";
|
||||
import { remoteInstances } from "@/services/apis";
|
||||
import { remoteNodeList } from "../services/apis";
|
||||
import type { NodeStatus } from "../types/index";
|
||||
import { remoteInstances, remoteNodeList } from "@/services/apis";
|
||||
import { message } from "ant-design-vue";
|
||||
import { computeNodeName } from "../tools/nodes";
|
||||
import { computeNodeName } from "@/tools/nodes";
|
||||
import { throttle } from "lodash";
|
||||
|
||||
const props = defineProps<MountComponent>();
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { useMountComponent } from "./useMountComponent";
|
||||
import SelectInstances from "@/components/SelectInstances.vue";
|
||||
import type { UserInstance } from "@/types";
|
||||
import type { UserInstance } from "@/types/user";
|
||||
|
||||
export function useSelectInstances() {
|
||||
const { mount } = useMountComponent();
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { useDefineApi } from "@/stores/useDefineApi";
|
||||
import type { InstanceDetail, NodeStatus, Settings, UserInfo, UserInstance } from "@/types";
|
||||
import type { BaseUserInfo } from "@/types/user";
|
||||
import type { InstanceDetail, NodeStatus, Settings } from "@/types";
|
||||
import type { BaseUserInfo, UserInstance } from "@/types/user";
|
||||
import type { IPanelOverviewResponse } from "../../../../common/global";
|
||||
|
||||
export const panelInstall = useDefineApi<
|
||||
@ -125,7 +125,7 @@ export const getUserInfo = useDefineApi<
|
||||
page_size: number;
|
||||
};
|
||||
},
|
||||
{ total: number; pageSize: number; page: number; maxPage: number; data: UserInfo[] }
|
||||
{ total: number; pageSize: number; page: number; maxPage: number; data: BaseUserInfo[] }
|
||||
>({
|
||||
url: "/api/auth/search",
|
||||
method: "GET"
|
||||
|
@ -65,26 +65,6 @@ export interface Settings {
|
||||
redisUrl: string;
|
||||
}
|
||||
|
||||
export interface UserInfo {
|
||||
uuid: string;
|
||||
userName: string;
|
||||
registerTime: string;
|
||||
permission: number;
|
||||
passWordType: number;
|
||||
loginTime: string;
|
||||
isInit: boolean;
|
||||
instances: UserInstance[];
|
||||
apiKey: string;
|
||||
}
|
||||
|
||||
export interface UserInstance {
|
||||
hostIp: string;
|
||||
instanceUuid: string;
|
||||
nickname: string;
|
||||
daemonId: string;
|
||||
status: number;
|
||||
}
|
||||
|
||||
export interface ImageInfo {
|
||||
Containers: number;
|
||||
Created: number;
|
||||
|
@ -1,4 +1,10 @@
|
||||
import type { UserInstance } from "@/types/index";
|
||||
export interface UserInstance {
|
||||
hostIp: string;
|
||||
instanceUuid: string;
|
||||
nickname: string;
|
||||
daemonId: string;
|
||||
status: number;
|
||||
}
|
||||
|
||||
export interface BaseUserInfo {
|
||||
uuid: string;
|
||||
|
@ -4,15 +4,13 @@ import { t } from "@/lang/i18n";
|
||||
import { message } from "ant-design-vue";
|
||||
import { DownOutlined, UserOutlined, SearchOutlined } from "@ant-design/icons-vue";
|
||||
import { throttle } from "lodash";
|
||||
|
||||
import CardPanel from "@/components/CardPanel.vue";
|
||||
import BetweenMenus from "@/components/BetweenMenus.vue";
|
||||
|
||||
import { useScreen } from "../hooks/useScreen";
|
||||
import { arrayFilter } from "../tools/array";
|
||||
import { useAppRouters } from "@/hooks/useAppRouters";
|
||||
import { getUserInfo, deleteUser as deleteUserApi, addUser as addUserApi } from "@/services/apis";
|
||||
import type { LayoutCard, UserInfo } from "@/types/index";
|
||||
import type { LayoutCard } from "@/types/index";
|
||||
import type { BaseUserInfo } from "@/types/user";
|
||||
|
||||
defineProps<{
|
||||
@ -24,7 +22,7 @@ interface dataType {
|
||||
pageSize: number;
|
||||
page: number;
|
||||
maxPage: number;
|
||||
data: UserInfo[];
|
||||
data: BaseUserInfo[];
|
||||
}
|
||||
|
||||
const { execute } = getUserInfo();
|
||||
@ -92,7 +90,9 @@ const data = ref<dataType>();
|
||||
const dataSource = computed(() => data?.value?.data);
|
||||
const selectedUsers = ref<string[]>([]);
|
||||
|
||||
const handleToUserConfig = (user: BaseUserInfo) => {
|
||||
const handleEditUserConfig = (user: BaseUserInfo) => {
|
||||
console.log(user);
|
||||
|
||||
// TXT_CODE_dbc9f7b2
|
||||
};
|
||||
|
||||
@ -144,7 +144,7 @@ const deleteUser = async (userList: string[]) => {
|
||||
}
|
||||
};
|
||||
|
||||
const handleDeleteUser = async (user: UserInfo) => {
|
||||
const handleDeleteUser = async (user: BaseUserInfo) => {
|
||||
await deleteUser([user.uuid]);
|
||||
};
|
||||
|
||||
@ -330,14 +330,14 @@ onMounted(async () => {
|
||||
<a-table
|
||||
:row-selection="{
|
||||
selectedRowKeys: selectedUsers,
|
||||
onChange: (selectedRowKeys: string[], selectedRows: UserInfo[]) => {
|
||||
onChange: (selectedRowKeys: string[], selectedRows: BaseUserInfo[]) => {
|
||||
selectedUsers = selectedRowKeys;
|
||||
}
|
||||
}"
|
||||
:data-source="dataSource"
|
||||
:columns="columns"
|
||||
:preserve-selected-row-keys="true"
|
||||
:row-key="(record: UserInfo) => record.uuid"
|
||||
:row-key="(record: BaseUserInfo) => record.uuid"
|
||||
:pagination="{
|
||||
current: operationForm.currentPage,
|
||||
pageSize: operationForm.pageSize,
|
||||
@ -352,7 +352,7 @@ onMounted(async () => {
|
||||
<a-dropdown>
|
||||
<template #overlay>
|
||||
<a-menu>
|
||||
<a-menu-item key="1" @click="handleToUserConfig(record)">
|
||||
<a-menu-item key="1" @click="handleEditUserConfig(record)">
|
||||
{{ t("TXT_CODE_236f70aa") }}
|
||||
</a-menu-item>
|
||||
<a-menu-item key="2" @click="handleToUserResources(record)">
|
||||
|
@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import CardPanel from "@/components/CardPanel.vue";
|
||||
import type { LayoutCard, UserInstance } from "@/types";
|
||||
import type { LayoutCard } from "@/types";
|
||||
import type { UserInstance } from "@/types/user";
|
||||
import { computed, ref } from "vue";
|
||||
import type { Ref } from "vue";
|
||||
import { t } from "@/lang/i18n";
|
||||
|
Loading…
Reference in New Issue
Block a user