Fix: reportError -> reportErrorMsg

This commit is contained in:
unitwk 2024-03-13 14:19:30 +08:00
parent 42c2199914
commit e182397c95
38 changed files with 136 additions and 130 deletions

View File

@ -2,7 +2,7 @@
import { t } from "@/lang/i18n";
import { CopyOutlined } from "@ant-design/icons-vue";
import { Modal, message } from "ant-design-vue";
import { reportError } from "@/tools/validator";
import { reportErrorMsg } from "@/tools/validator";
import type { ButtonType } from "ant-design-vue/es/button";
import type { SizeType } from "ant-design-vue/es/config-provider";
import { h } from "vue";
@ -25,7 +25,7 @@ const copy = async () => {
await navigator.clipboard.writeText(props.value);
message.success(t("TXT_CODE_b858d78a"));
} catch (error) {
reportError(t("TXT_CODE_81b9b599") + error);
reportErrorMsg(t("TXT_CODE_81b9b599") + error);
}
};
</script>

View File

@ -5,7 +5,7 @@ import { useAppToolsStore } from "@/stores/useAppToolsStore";
import { reactive, ref } from "vue";
import { confirm2FA, setUserApiKey, updatePassword } from "@/services/apis/user";
import { message } from "ant-design-vue";
import { reportError } from "@/tools/validator";
import { reportErrorMsg } from "@/tools/validator";
import type { FormInstance } from "ant-design-vue";
import CopyButton from "@/components/CopyButton.vue";
import { bind2FA } from "../services/apis/user";
@ -39,9 +39,9 @@ const handleGenerateApiKey = async (enable: boolean) => {
const handleChangePassword = async () => {
formRef.value?.validateFields().then(async () => {
if (formState.password1 !== formState.password2) return reportError(t("TXT_CODE_d51f5d6"));
if (formState.password1 !== formState.password2) return reportErrorMsg(t("TXT_CODE_d51f5d6"));
if (formState.password1.length < 6 || formState.password1.length > 36)
return reportError(t("TXT_CODE_cc5a3aea"));
return reportErrorMsg(t("TXT_CODE_cc5a3aea"));
try {
await executeUpdatePassword({
data: {
@ -51,7 +51,7 @@ const handleChangePassword = async () => {
updateUserInfo();
return message.success(t("TXT_CODE_d3de39b4"));
} catch (error: any) {
return reportError(error.message);
return reportErrorMsg(error.message);
}
});
};

View File

@ -10,7 +10,7 @@ import Params from "./params.vue";
import { t } from "@/lang/i18n";
import { ROLE } from "@/config/router";
import type { NewCardItem } from "../../config/index";
import { reportError } from "@/tools/validator";
import { reportErrorMsg } from "@/tools/validator";
import { AppstoreOutlined } from "@ant-design/icons-vue";
const { getCardPool } = useCardPool();
@ -33,7 +33,7 @@ const currentPageRole = route.meta.permission as ROLE;
const insertCardToLayout = async (card: NewCardItem) => {
if (card.permission > currentPageRole) {
return reportError(t("TXT_CODE_fb4cb9cb"));
return reportErrorMsg(t("TXT_CODE_fb4cb9cb"));
}
if (card.params) {

View File

@ -7,7 +7,7 @@ import { BuildFilled, DropboxSquareFilled, SwitcherFilled } from "@ant-design/ic
import { QUICKSTART_ACTION_TYPE } from "@/hooks/widgets/quickStartFlow";
import FadeUpAnimation from "@/components/FadeUpAnimation.vue";
import { useStartCmdBuilder } from "@/hooks/useGenerateStartCmd";
import { reportError } from "@/tools/validator";
import { reportErrorMsg } from "@/tools/validator";
import {
TYPE_MINECRAFT_BEDROCK,
TYPE_MINECRAFT_JAVA,
@ -63,7 +63,7 @@ const submit = async () => {
try {
await formRef.value.validate();
} catch (error) {
return reportError(t("TXT_CODE_d6c5a7f8"));
return reportErrorMsg(t("TXT_CODE_d6c5a7f8"));
}
const command = buildCmd();

View File

@ -13,7 +13,7 @@ import {
FrownOutlined
} from "@ant-design/icons-vue";
import type { AntColumnsType, AntTableCell } from "@/types/ant";
import { reportError } from "@/tools/validator";
import { reportErrorMsg } from "@/tools/validator";
import { remoteInstances, remoteNodeList } from "@/services/apis";
import { computeNodeName } from "@/tools/nodes";
import _, { throttle } from "lodash";
@ -68,7 +68,7 @@ const initNodes = async () => {
await getNodes();
nodes?.value?.sort((a, b) => (a.available === b.available ? 0 : a.available ? -1 : 1));
if (!nodes.value?.length) {
return reportError(t("TXT_CODE_e3d96a26"));
return reportErrorMsg(t("TXT_CODE_e3d96a26"));
}
if (localStorage.getItem("pageSelectedRemote")) {
currentRemoteNode.value = JSON.parse(localStorage.pageSelectedRemote);
@ -92,7 +92,7 @@ const initInstancesData = async () => {
}
});
} catch (err) {
return reportError(t("TXT_CODE_e109c091"));
return reportErrorMsg(t("TXT_CODE_e109c091"));
}
};

View File

@ -2,12 +2,13 @@
import { ref, onMounted } from "vue";
import type { UploadProps } from "ant-design-vue";
import { t } from "@/lang/i18n";
import { FolderOpenOutlined, UploadOutlined } from "@ant-design/icons-vue";
import { FolderOpenOutlined } from "@ant-design/icons-vue";
import { message } from "ant-design-vue";
import { uploadFile } from "@/services/apis/layout";
import type { MountComponent } from "../../types/index";
import { reportErrorMsg } from "@/tools/validator";
const { state, execute } = uploadFile();
const { execute } = uploadFile();
const props = defineProps<MountComponent>();
const uploadControl = new AbortController();
@ -52,7 +53,7 @@ const beforeUpload: UploadProps["beforeUpload"] = async (file) => {
submit("");
}
} catch (error) {
reportError(error);
reportErrorMsg(error);
}
return false;
};
@ -85,7 +86,11 @@ onMounted(() => {
>
<a-button type="primary" :loading="percentComplete > 0">
<FolderOpenOutlined v-if="percentComplete === 0" />
{{ percentComplete > 0 ? t("TXT_CODE_b625dbf0") + percentComplete + "%" : t("TXT_CODE_335ba209") }}
{{
percentComplete > 0
? t("TXT_CODE_b625dbf0") + percentComplete + "%"
: t("TXT_CODE_335ba209")
}}
</a-button>
</a-upload>
<a-button class="ml-16" @click="cancel">{{ t("TXT_CODE_a0451c97") }}</a-button>

View File

@ -27,7 +27,7 @@ import type {
FileStatus,
Permission
} from "@/types/fileManager";
import { reportError } from "@/tools/validator";
import { reportErrorMsg } from "@/tools/validator";
import { openLoadingDialog } from "@/components/fc";
export const useFileManager = (instanceId?: string, daemonId?: string) => {
@ -95,7 +95,7 @@ export const useFileManager = (instanceId?: string, daemonId?: string) => {
dialog.value.mode != "unzip" &&
dialog.value.mode != "permission"
) {
return reportError(t("TXT_CODE_4ea93630"));
return reportErrorMsg(t("TXT_CODE_4ea93630"));
}
resolve(dialog.value.value);
dialog.value.show = false;
@ -126,7 +126,7 @@ export const useFileManager = (instanceId?: string, daemonId?: string) => {
operationForm.value.total = res.value?.total || 0;
} catch (error: any) {
if (throwErr) throw error;
return reportError(error.message);
return reportErrorMsg(error.message);
}
};
@ -155,7 +155,7 @@ export const useFileManager = (instanceId?: string, daemonId?: string) => {
await getFileList();
message.success(t("TXT_CODE_d28c05df"));
} catch (error: any) {
return reportError(error.message);
return reportErrorMsg(error.message);
}
};
@ -167,7 +167,7 @@ export const useFileManager = (instanceId?: string, daemonId?: string) => {
};
} else {
if (!selectionData.value || selectionData.value.length === 0)
return reportError(t("TXT_CODE_b152cd75"));
return reportErrorMsg(t("TXT_CODE_b152cd75"));
clipboard.value = {
type,
value: selectionData.value?.map((e) => breadcrumbs[breadcrumbs.length - 1].path + e.name)
@ -179,7 +179,7 @@ export const useFileManager = (instanceId?: string, daemonId?: string) => {
const paste = async () => {
if (!clipboard?.value?.type || !clipboard.value.value)
return reportError(t("TXT_CODE_b152cd75"));
return reportErrorMsg(t("TXT_CODE_b152cd75"));
const execute = clipboard.value.type == "copy" ? copyFileApi().execute : moveFileApi().execute;
try {
await execute({
@ -199,7 +199,7 @@ export const useFileManager = (instanceId?: string, daemonId?: string) => {
clearSelected();
clipboard.value.value = [];
} catch (error: any) {
reportError(error.message);
reportErrorMsg(error.message);
}
};
@ -248,7 +248,7 @@ export const useFileManager = (instanceId?: string, daemonId?: string) => {
await getFileList();
}
} catch (error: any) {
reportError(error.message);
reportErrorMsg(error.message);
}
};
@ -262,7 +262,7 @@ export const useFileManager = (instanceId?: string, daemonId?: string) => {
await useDeleteFileApi([breadcrumbs[breadcrumbs.length - 1].path + file]);
} else {
// more file
if (!selectionData.value) return reportError(t("TXT_CODE_f41ad30a"));
if (!selectionData.value) return reportErrorMsg(t("TXT_CODE_f41ad30a"));
await useDeleteFileApi(
selectionData.value.map((e) => breadcrumbs[breadcrumbs.length - 1].path + e.name)
);
@ -277,7 +277,7 @@ export const useFileManager = (instanceId?: string, daemonId?: string) => {
const zipFile = async () => {
if (!selectionData.value || selectionData.value.length === 0)
return reportError(t("TXT_CODE_b152cd75"));
return reportErrorMsg(t("TXT_CODE_b152cd75"));
const filename = await openDialog(t("TXT_CODE_f8a15a94"), t("TXT_CODE_366bad15"), "", "zip");
const { execute } = compressFileApi();
const loadingDialog = await openLoadingDialog(
@ -302,7 +302,7 @@ export const useFileManager = (instanceId?: string, daemonId?: string) => {
await getFileList();
} catch (error: any) {
message.error(t("TXT_CODE_dba9bf61"));
reportError(error.message);
reportErrorMsg(error.message);
} finally {
loadingDialog.cancel();
}
@ -336,7 +336,7 @@ export const useFileManager = (instanceId?: string, daemonId?: string) => {
await getFileList();
} catch (error: any) {
message.error(t("TXT_CODE_26d7316f"));
reportError(error.message);
reportErrorMsg(error.message);
} finally {
loadingDialog.cancel();
}
@ -378,7 +378,7 @@ export const useFileManager = (instanceId?: string, daemonId?: string) => {
} catch (err: any) {
console.error(err);
percentComplete.value = 0;
return reportError(err.response?.data || err.message);
return reportErrorMsg(err.response?.data || err.message);
}
};
@ -416,7 +416,7 @@ export const useFileManager = (instanceId?: string, daemonId?: string) => {
await getFileList(true);
} catch (error: any) {
breadcrumbs.splice(breadcrumbs.length - 1, 1);
return reportError(error.message);
return reportErrorMsg(error.message);
} finally {
spinning.value = false;
}
@ -440,13 +440,13 @@ export const useFileManager = (instanceId?: string, daemonId?: string) => {
);
} catch (err: any) {
console.error(err);
return reportError(err.message);
return reportErrorMsg(err.message);
}
};
const handleChangeDir = async (dir: string) => {
if (breadcrumbs.findIndex((e) => e.path === dir) === -1)
return reportError(t("TXT_CODE_96281410"));
return reportErrorMsg(t("TXT_CODE_96281410"));
spinning.value = true;
breadcrumbs.splice(breadcrumbs.findIndex((e) => e.path === dir) + 1);
await getFileList();
@ -475,7 +475,7 @@ export const useFileManager = (instanceId?: string, daemonId?: string) => {
}
} catch (err: any) {
console.error(err);
return reportError(err.message);
return reportErrorMsg(err.message);
}
};
@ -530,7 +530,7 @@ export const useFileManager = (instanceId?: string, daemonId?: string) => {
message.success(t("TXT_CODE_b05948d1"));
await getFileList();
} catch (err: any) {
return reportError(err.message);
return reportErrorMsg(err.message);
}
permission.deep = false;
};

View File

@ -1,4 +1,4 @@
import { reportError } from "@/tools/validator";
import { reportErrorMsg } from "@/tools/validator";
import type { IPanelResponseProtocol } from "./../../../common/global.d";
import { useAppStateStore } from "@/stores/useAppStateStore";
import type { AxiosError, AxiosRequestConfig } from "axios";
@ -65,7 +65,7 @@ class ApiService {
this.event.once(reqId, (data: any) => {
if (data instanceof Error) {
if (config.errorAlert === true) {
reportError(data.message);
reportErrorMsg(data.message);
}
reject(data);
} else {

View File

@ -1,5 +1,6 @@
import { useAppConfigStore } from "@/stores/useAppConfigStore";
import axios from "axios";
import { reportErrorMsg } from "@/tools/validator";
const { getTheme } = useAppConfigStore();
class SandboxBridge {
@ -27,7 +28,7 @@ class SandboxBridge {
try {
callback.call(null, ...args);
} catch (error) {
reportError(error);
reportErrorMsg(error);
}
});
}

View File

@ -29,8 +29,8 @@ export function reportValidatorError(error: any) {
message.error(getValidatorErrorMsg(error, t("TXT_CODE_6a365d01")));
}
export function reportError(error: any = {}) {
console.error("Function reportError():", error);
export function reportErrorMsg(error: any = {}) {
console.error("Function reportErrorMsg():", error);
message.error(getValidatorErrorMsg(error, t("TXT_CODE_6a365d01")));
}

View File

@ -3,7 +3,7 @@ import { onMounted, ref, reactive } from "vue";
import CardPanel from "@/components/CardPanel.vue";
import { t } from "@/lang/i18n";
import { panelInstall } from "@/services/apis";
import { reportError } from "@/tools/validator";
import { reportErrorMsg } from "@/tools/validator";
import type { FormInstance } from "ant-design-vue";
import { useAppRouters } from "@/hooks/useAppRouters";
import { useAppStateStore } from "@/stores/useAppStateStore";
@ -43,7 +43,7 @@ const createUser = async () => {
await updateUserInfo();
step.value++;
} catch (err: any) {
reportError(err.message);
reportErrorMsg(err.message);
} finally {
installLoading.value = false;
}

View File

@ -31,7 +31,7 @@ import { useInstanceMoreDetail } from "../hooks/useInstance";
import { throttle } from "lodash";
import { useScreen } from "@/hooks/useScreen";
import { parseTimestamp } from "../tools/time";
import { reportError } from "@/tools/validator";
import { reportErrorMsg } from "@/tools/validator";
import { INSTANCE_STATUS } from "@/types/const";
defineProps<{
@ -66,7 +66,7 @@ const initNodes = async () => {
await getNodes();
nodes?.value?.sort((a, b) => (a.available === b.available ? 0 : a.available ? -1 : 1));
if (nodes.value?.length === 0) {
return reportError(t("TXT_CODE_e3d96a26"));
return reportErrorMsg(t("TXT_CODE_e3d96a26"));
}
if (localStorage.getItem("pageSelectedRemote")) {
currentRemoteNode.value = JSON.parse(localStorage.pageSelectedRemote);
@ -95,7 +95,7 @@ const initInstancesData = async (resetPage?: boolean) => {
}
});
} catch (err) {
return reportError(t("TXT_CODE_e109c091"));
return reportErrorMsg(t("TXT_CODE_e109c091"));
}
};
@ -207,7 +207,7 @@ const instanceOperations = [
];
const batchOperation = async (actName: "start" | "stop" | "kill") => {
if (selectedInstance.value.length === 0) return reportError(t("TXT_CODE_a0a77be5"));
if (selectedInstance.value.length === 0) return reportErrorMsg(t("TXT_CODE_a0a77be5"));
const operationMap = {
start: async () => exec(batchStart().execute, t("TXT_CODE_2b5fd76e")),
stop: async () => exec(batchStop().execute, t("TXT_CODE_4822a21")),
@ -232,7 +232,7 @@ const batchOperation = async (actName: "start" | "stop" | "kill") => {
}
} catch (err: any) {
console.error(err);
reportError(err.message);
reportErrorMsg(err.message);
}
};
@ -240,7 +240,7 @@ const batchOperation = async (actName: "start" | "stop" | "kill") => {
};
const batchDeleteInstance = async (deleteFile: boolean) => {
if (selectedInstance.value.length === 0) return reportError(t("TXT_CODE_a0a77be5"));
if (selectedInstance.value.length === 0) return reportErrorMsg(t("TXT_CODE_a0a77be5"));
const { execute, state } = batchDelete();
const uuids: string[] = [];
for (const i of selectedInstance.value) {
@ -273,7 +273,7 @@ const batchDeleteInstance = async (deleteFile: boolean) => {
}
} catch (err: any) {
console.error(err);
reportError(err.message);
reportErrorMsg(err.message);
}
},
onCancel() {}

View File

@ -12,7 +12,7 @@ import { onMounted, reactive, ref } from "vue";
import { router } from "@/config/router";
import { loginPageInfo, loginUser } from "@/services/apis";
import { sleep } from "@/tools/common";
import { reportError } from "@/tools/validator";
import { reportErrorMsg } from "@/tools/validator";
import { useAppStateStore } from "@/stores/useAppStateStore";
import type { LayoutCard } from "@/types";
import { markdownToHTML } from "@/tools/safe";
@ -56,7 +56,7 @@ const handleLogin = async () => {
await sleep(1500);
await handleNext();
} catch (error: any) {
reportError(error.message ? error.message : error);
reportErrorMsg(error.message ? error.message : error);
}
};
@ -195,15 +195,7 @@ const loginSuccess = () => {
</div>
</template>
<style>
.mcsmanager-link {
.global-markdown-html {
text-align: left !important;
p {
margin: 0px !important;
}
}
}
</style>
<style lang="scss" scoped>

View File

@ -5,7 +5,7 @@ import { t } from "@/lang/i18n";
import { SearchOutlined, ClusterOutlined } from "@ant-design/icons-vue";
import BetweenMenus from "@/components/BetweenMenus.vue";
import { message } from "ant-design-vue";
import { reportError } from "@/tools/validator";
import { reportErrorMsg } from "@/tools/validator";
import NodeItem from "./node/NodeItem.vue";
import { useRemoteNode } from "../hooks/useRemoteNode";
import NodeDetailDialog from "./node/NodeDetailDialog.vue";
@ -32,7 +32,7 @@ const refresh = async () => {
await refreshOverviewInfo();
message.success(t("TXT_CODE_fbde647e"));
} catch (error: any) {
reportError(error.message);
reportErrorMsg(error.message);
} finally {
refreshLoading.value = false;
}

View File

@ -4,7 +4,7 @@ import { getCurrentLang, isCN, t } from "@/lang/i18n";
import type { LayoutCard, Settings } from "@/types";
import { onMounted, ref } from "vue";
import { Modal, message } from "ant-design-vue";
import { reportError } from "@/tools/validator";
import { reportErrorMsg } from "@/tools/validator";
import {
BankOutlined,
BookOutlined,
@ -48,7 +48,7 @@ const submit = async () => {
message.success(t("TXT_CODE_a7907771"));
setTimeout(() => window.location.reload(), 600);
} catch (error: any) {
reportError(error);
reportErrorMsg(error);
}
}
};
@ -144,7 +144,7 @@ const handleSaveBgUrl = async (url?: string) => {
async onOk() {
const cfg = await getSettingsConfig();
if (!cfg?.theme) {
return reportError(t("TXT_CODE_b89780e2"));
return reportErrorMsg(t("TXT_CODE_b89780e2"));
}
cfg.theme.backgroundImage = url ?? formData.value?.bgUrl ?? "";
await setSettingsConfig(cfg);

View File

@ -23,6 +23,7 @@ import type { AntColumnsType, AntTableCell } from "../types/ant";
import type { Key } from "ant-design-vue/es/_util/type";
import { PASSWORD_REGEX } from "../tools/validator";
import { PERMISSION_MAP } from "@/config/const";
import { reportErrorMsg } from "@/tools/validator";
defineProps<{
card: LayoutCard;
@ -148,7 +149,7 @@ const deleteUser = async (userList: string[]) => {
message.success(t("TXT_CODE_28190dbc"));
await fetchData();
} catch (error: any) {
reportError(error.message);
reportErrorMsg(error.message);
}
};
@ -196,7 +197,7 @@ const userDialog = ref({
userDialog.value.status = false;
formData.value = _.cloneDeep(formDataOrigin);
} catch (error: any) {
return reportError(error.message);
return reportErrorMsg(error.message);
} finally {
fetchData();
userDialog.value.confirmBtnLoading = false;

View File

@ -2,7 +2,7 @@
import { ref, computed } from "vue";
import { t } from "@/lang/i18n";
import { useScreen } from "@/hooks/useScreen";
import { reportError } from "@/tools/validator";
import { reportErrorMsg } from "@/tools/validator";
import { buildProgress } from "@/services/apis/envImage";
import Loading from "@/components/Loading.vue";
const props = defineProps<{
@ -43,7 +43,7 @@ const getProgress = async () => {
}
} catch (err: any) {
console.error(err);
return reportError(err.message);
return reportErrorMsg(err.message);
}
};

View File

@ -3,6 +3,7 @@ import { reactive, onMounted } from "vue";
import { t } from "@/lang/i18n";
import { notification } from "ant-design-vue";
import { imageList } from "@/services/apis/envImage";
import { reportErrorMsg } from "@/tools/validator";
const props = defineProps<{
dockerFile: string;
@ -23,7 +24,7 @@ const { execute } = imageList();
const submit = async () => {
try {
if (!options.dockerFile || !options.name || !options.version)
return reportError(t("TXT_CODE_2764f197"));
return reportErrorMsg(t("TXT_CODE_2764f197"));
await execute({
params: {
daemonId: props.daemonId
@ -42,7 +43,7 @@ const submit = async () => {
emit("close");
} catch (err: any) {
console.error(err.message);
return reportError(err.message);
return reportErrorMsg(err.message);
}
};

View File

@ -1,7 +1,7 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { t } from "@/lang/i18n";
import { reportError } from "@/tools/validator";
import { reportErrorMsg } from "@/tools/validator";
import CardPanel from "@/components/CardPanel.vue";
import BetweenMenus from "@/components/BetweenMenus.vue";
import { useScreen } from "@/hooks/useScreen";
@ -93,7 +93,7 @@ const selectType = (type: number) => {
version.value = "latest";
break;
default:
return reportError(t("TXT_CODE_fb1ff943"));
return reportErrorMsg(t("TXT_CODE_fb1ff943"));
}
dockerFileDrawer.value = true;
};

View File

@ -11,6 +11,7 @@ import { imageList, containerList } from "@/services/apis/envImage";
import type { LayoutCard, ImageInfo, ContainerInfo } from "@/types";
import { useAppRouters } from "@/hooks/useAppRouters";
import type { AntColumnsType, AntTableCell } from "@/types/ant";
import { reportErrorMsg } from "@/tools/validator";
const props = defineProps<{
card: LayoutCard;
@ -108,7 +109,7 @@ const delImage = async (item: ImageInfo) => {
});
} catch (err: any) {
console.error(err);
return reportError(err.message);
return reportErrorMsg(err.message);
}
};
@ -169,7 +170,7 @@ const getContainerList = async () => {
if (containers.value) containerDataSource.value = containers.value;
} catch (err: any) {
console.error(err);
return reportError(err.message);
return reportErrorMsg(err.message);
}
};

View File

@ -2,7 +2,7 @@
import { ref, onMounted } from "vue";
import { t } from "@/lang/i18n";
import { message } from "ant-design-vue";
import { reportError } from "@/tools/validator";
import { reportErrorMsg } from "@/tools/validator";
import { DeleteOutlined, FieldTimeOutlined } from "@ant-design/icons-vue";
import CardPanel from "@/components/CardPanel.vue";
import BetweenMenus from "@/components/BetweenMenus.vue";
@ -37,7 +37,7 @@ const getScheduleList = async () => {
});
} catch (err: any) {
console.error(err);
reportError(err.message);
reportErrorMsg(err.message);
}
};
@ -57,7 +57,7 @@ const deleteSchedule = async (name: string) => {
}
} catch (err: any) {
console.error(err);
reportError(err.message);
reportErrorMsg(err.message);
}
};

View File

@ -12,6 +12,7 @@ import Loading from "@/components/Loading.vue";
import configComponent from "@/components/InstanceConfigEditor.vue";
import FileEditor from "./dialogs/FileEditor.vue";
import { useKeyboardEvents } from "@/hooks/useKeyboardEvents";
import { reportErrorMsg } from "@/tools/validator";
const props = defineProps<{
card: LayoutCard;
@ -55,7 +56,7 @@ const render = async () => {
} catch (err: any) {
console.error(err);
isFailure.value = true;
return reportError(err.message);
return reportErrorMsg(err.message);
}
};
@ -89,7 +90,7 @@ const save = async () => {
}
} catch (err: any) {
console.error(err);
return reportError(err.message);
return reportErrorMsg(err.message);
}
};

View File

@ -4,7 +4,7 @@ import { t } from "@/lang/i18n";
import CardPanel from "@/components/CardPanel.vue";
import type { LayoutCard } from "@/types";
import { getConfigFileList } from "@/services/apis/instance";
import { reportError } from "@/tools/validator";
import { reportErrorMsg } from "@/tools/validator";
import { useLayoutCardTools } from "@/hooks/useCardTools";
import { getInstanceConfigByType, type InstanceConfigs } from "@/hooks/useInstance";
import { useAppRouters } from "@/hooks/useAppRouters";
@ -49,7 +49,7 @@ const render = async () => {
files: files
}
});
if (!realFiles.value) return reportError(t("TXT_CODE_83e553fc"));
if (!realFiles.value) return reportErrorMsg(t("TXT_CODE_83e553fc"));
realFiles.value.forEach((v) => {
configFiles.forEach((z) => {
if (z.path === v.file) {
@ -63,7 +63,7 @@ const render = async () => {
InstanceConfigsList.value = configFiles;
} catch (err: any) {
console.error(err);
return reportError(err.message);
return reportErrorMsg(err.message);
}
};

View File

@ -28,7 +28,7 @@ import {
import { CloseOutlined } from "@ant-design/icons-vue";
import { GLOBAL_INSTANCE_NAME } from "../../config/const";
import { INSTANCE_STATUS } from "@/types/const";
import { reportError } from "@/tools/validator";
import { reportErrorMsg } from "@/tools/validator";
import TerminalCore from "@/components/TerminalCore.vue";
const props = defineProps<{
@ -61,7 +61,7 @@ const quickOperations = computed(() =>
}
});
} catch (error) {
reportError(error);
reportErrorMsg(error);
}
},
props: {},
@ -80,7 +80,7 @@ const quickOperations = computed(() =>
}
});
} catch (error) {
reportError(error);
reportErrorMsg(error);
}
},
props: {
@ -106,7 +106,7 @@ const instanceOperations = computed(() =>
}
});
} catch (error) {
reportError(error);
reportErrorMsg(error);
}
},
condition: () => isRunning.value
@ -124,7 +124,7 @@ const instanceOperations = computed(() =>
}
});
} catch (error) {
reportError(error);
reportErrorMsg(error);
}
},
condition: () => !isStopped.value
@ -146,7 +146,7 @@ const instanceOperations = computed(() =>
}
});
} catch (error) {
reportError(error);
reportErrorMsg(error);
}
},
condition: () => isStopped.value && updateCmd.value

View File

@ -4,7 +4,8 @@ import { t } from "@/lang/i18n";
import type { InstanceDetail } from "@/types";
import { updateInstanceConfig } from "@/services/apis/instance";
import { message } from "ant-design-vue";
import { reportError } from "@/tools/validator";
import { reportErrorMsg } from "@/tools/validator";
const props = defineProps<{
instanceInfo?: InstanceDetail;
instanceId?: string;
@ -12,7 +13,6 @@ const props = defineProps<{
}>();
const emit = defineEmits(["update"]);
const options = ref<InstanceDetail>();
const open = ref(false);
const openDialog = () => {
open.value = true;
@ -36,7 +36,7 @@ const submit = async () => {
open.value = false;
return message.success(t("TXT_CODE_d3de39b4"));
} catch (err: any) {
return reportError(err.message);
return reportErrorMsg(err.message);
}
};

View File

@ -2,7 +2,7 @@
import { computed, ref } from "vue";
import { t } from "@/lang/i18n";
import { message } from "ant-design-vue";
import { reportError } from "@/tools/validator";
import { reportErrorMsg } from "@/tools/validator";
import Editor from "@/components/Editor.vue";
import { fileContent } from "@/services/apis/fileManager";
import { useKeyboardEvents } from "@/hooks/useKeyboardEvents";
@ -74,7 +74,7 @@ const render = async () => {
openEditor.value = true;
} catch (err: any) {
console.error(err.message);
return reportError(err.message);
return reportErrorMsg(err.message);
}
};
@ -91,7 +91,7 @@ const submitRequest = async () => {
}
});
} catch (err: any) {
return reportError(err.message);
return reportErrorMsg(err.message);
}
};
@ -104,7 +104,7 @@ const submit = async () => {
} catch (err: any) {
console.error(err.message);
reject(err);
return reportError(err.message);
return reportErrorMsg(err.message);
}
};

View File

@ -8,7 +8,7 @@ import type { Rule } from "ant-design-vue/es/form";
import { updateAnyInstanceConfig } from "@/services/apis/instance";
import { imageList, getNetworkModeList } from "@/services/apis/envImage";
import { message } from "ant-design-vue";
import { reportError } from "@/tools/validator";
import { reportErrorMsg } from "@/tools/validator";
import { TERMINAL_CODE } from "@/types/const";
import { INSTANCE_TYPE_TRANSLATION } from "@/hooks/useInstance";
import { useAppRouters } from "@/hooks/useAppRouters";
@ -120,7 +120,7 @@ const loadImages = async () => {
}
}
} catch (err: any) {
return reportError(err.message);
return reportErrorMsg(err.message);
}
};
@ -148,7 +148,7 @@ const loadNetworkModes = async () => {
});
if (modes.value) networkModes.value = modes.value;
} catch (err: any) {
return reportError(err.message);
return reportErrorMsg(err.message);
}
};
@ -196,7 +196,7 @@ const submit = async () => {
return message.success(t("TXT_CODE_d3de39b4"));
} catch (error: any) {
console.error(error);
return reportError(error.message ?? t("TXT_CODE_9911ac11"));
return reportErrorMsg(error.message ?? t("TXT_CODE_9911ac11"));
}
};

View File

@ -6,6 +6,7 @@ import { ScheduleAction, ScheduleType, ScheduleCreateType } from "@/types/const"
import type { NewScheduleTask } from "@/types";
import { scheduleCreate } from "@/services/apis/instance";
import { useScreen } from "@/hooks/useScreen";
import { reportErrorMsg } from "@/tools/validator";
import type { Dayjs } from "dayjs";
import _ from "lodash";
@ -106,7 +107,7 @@ const createRequest = async () => {
}
} catch (err: any) {
console.error(err);
reportError(err.message);
reportErrorMsg(err.message);
}
};
@ -116,7 +117,7 @@ const submit = async () => {
if (newTask.type === ScheduleCreateType.CYCLE) await createTaskTypeCycle();
if (newTask.type === ScheduleCreateType.SPECIFY) await createTaskTypeSpecify();
} catch (err: any) {
return reportError(err.message);
return reportErrorMsg(err.message);
}
};

View File

@ -4,7 +4,8 @@ import { t } from "@/lang/i18n";
import type { InstanceDetail } from "@/types";
import { updateInstanceConfig } from "@/services/apis/instance";
import { message } from "ant-design-vue";
import { reportError } from "@/tools/validator";
import { reportErrorMsg } from "@/tools/validator";
const props = defineProps<{
instanceInfo?: InstanceDetail;
instanceId?: string;
@ -36,7 +37,7 @@ const submit = async () => {
open.value = false;
return message.success(t("TXT_CODE_d3de39b4"));
} catch (err: any) {
return reportError(err.message);
return reportErrorMsg(err.message);
}
};

View File

@ -4,7 +4,7 @@ import { t } from "@/lang/i18n";
import type { InstanceDetail } from "@/types";
import { updateInstanceConfig } from "@/services/apis/instance";
import { message, type FormInstance } from "ant-design-vue";
import { reportError } from "@/tools/validator";
import { reportErrorMsg } from "@/tools/validator";
const formRef = ref<FormInstance>();
@ -52,7 +52,7 @@ const submit = async () => {
open.value = false;
return message.success(t("TXT_CODE_d3de39b4"));
} catch (err: any) {
return reportError(err.message);
return reportErrorMsg(err.message);
}
};

View File

@ -2,9 +2,9 @@
import { ref } from "vue";
import { t } from "@/lang/i18n";
import { message } from "ant-design-vue";
import { reportError } from "@/tools/validator";
const emit = defineEmits(["selectCode"]);
import { reportErrorMsg } from "@/tools/validator";
const emit = defineEmits(["selectCode"]);
const open = ref(false);
const openDialog = () => {
open.value = true;
@ -19,7 +19,7 @@ const submit = async () => {
open.value = false;
return message.success(t("TXT_CODE_f07610ed"));
} catch (err: any) {
return reportError(err.message);
return reportErrorMsg(err.message);
}
};

View File

@ -5,8 +5,9 @@ import { useScreen } from "@/hooks/useScreen";
import type { InstanceDetail } from "@/types";
import { updateInstanceConfig } from "@/services/apis/instance";
import { message } from "ant-design-vue";
import { reportError } from "@/tools/validator";
import { reportErrorMsg } from "@/tools/validator";
import { TERMINAL_CODE } from "@/types/const";
const props = defineProps<{
instanceInfo?: InstanceDetail;
instanceId?: string;
@ -44,7 +45,7 @@ const submit = async () => {
open.value = false;
return message.success(t("TXT_CODE_d3de39b4"));
} catch (err: any) {
return reportError(err.message);
return reportErrorMsg(err.message);
}
};

View File

@ -4,6 +4,7 @@ import { t } from "@/lang/i18n";
import { useRemoteNode } from "@/hooks/useRemoteNode";
import { message, type FormInstance } from "ant-design-vue";
import { type RemoteNodeDetail } from "@/hooks/useRemoteNode";
import { reportErrorMsg } from "@/tools/validator";
const { addNode, deleteNode, updateNode } = useRemoteNode();
@ -80,7 +81,7 @@ const dialog = reactive({
message.success(t("TXT_CODE_e74d658c"));
dialog.close();
} catch (error: any) {
reportError(error.message ?? t("TXT_CODE_5245bd11"));
reportErrorMsg(error.message ?? t("TXT_CODE_5245bd11"));
}
},
hidden: () => {

View File

@ -16,7 +16,7 @@ import IconBtn from "@/components/IconBtn.vue";
import NodeSimpleChart from "@/components/NodeSimpleChart.vue";
import { connectNode } from "@/services/apis";
import { message } from "ant-design-vue";
import { reportError } from "@/tools/validator";
import { reportErrorMsg } from "@/tools/validator";
import { useAppRouters } from "@/hooks/useAppRouters";
import { useLayoutCardTools } from "@/hooks/useCardTools";
import type { LayoutCard } from "@/types";
@ -60,7 +60,7 @@ const tryConnectNode = async (uuid: string, showMsg = true) => {
});
if (showMsg) message.success(t("TXT_CODE_7f0c746d"));
} catch (error) {
reportError(t("TXT_CODE_6a365d01"));
reportErrorMsg(t("TXT_CODE_6a365d01"));
}
};
@ -217,7 +217,7 @@ const nodeOperations = computed(() =>
class="mt-24"
:cpu-data="item.cpuChartData ?? []"
:mem-data="item.memChartData ?? []"
></NodeSimpleChart>
/>
</template>
</CardPanel>
</div>

View File

@ -3,7 +3,7 @@ import { ref } from "vue";
import type { Ref } from "vue";
import ActionButton from "@/components/ActionButton.vue";
import { message } from "ant-design-vue";
import { reportError } from "@/tools/validator";
import { reportErrorMsg } from "@/tools/validator";
import { DeleteOutlined } from "@ant-design/icons-vue";
import { $t as t } from "@/lang/i18n";
@ -43,7 +43,7 @@ const addLink = ref({
},
finish: () => {
if (addLink.value.title == "" || addLink.value.link == "")
return reportError(t("TXT_CODE_633415e2"));
return reportErrorMsg(t("TXT_CODE_633415e2"));
cardData.value.push({
title: addLink.value.title,
link: addLink.value.link

View File

@ -22,7 +22,7 @@ import {
} from "@/services/apis/instance";
import { parseForwardAddress } from "@/tools/protocol";
import { useCmdAssistantDialog } from "@/components/fc";
import { reportError } from "@/tools/validator";
import { reportErrorMsg } from "@/tools/validator";
// eslint-disable-next-line no-unused-vars
enum UNZIP {
@ -116,7 +116,7 @@ const beforeUpload: UploadProps["beforeUpload"] = async (file) => {
if (isImportMode) {
const extName = file.name.split(".").pop()?.toLowerCase() || "";
if (!["zip", "jar"].includes(extName)) return reportError(t("TXT_CODE_808e5ad9"));
if (!["zip", "jar"].includes(extName)) return reportErrorMsg(t("TXT_CODE_808e5ad9"));
selectUnzipCodeDialog.value?.openDialog();
} else {
finalConfirm();
@ -142,7 +142,7 @@ const finalConfirm = async () => {
await formRef.value?.validateFields();
needUpload ? await selectedFile() : await createInstance();
} catch {
return reportError(t("TXT_CODE_47e21c80"));
return reportErrorMsg(t("TXT_CODE_47e21c80"));
}
},
onCancel() {}
@ -186,7 +186,7 @@ const selectedFile = async () => {
return message.success(t("TXT_CODE_d28c05df"));
} catch (err: any) {
console.error(err);
return reportError(err.message);
return reportErrorMsg(err.message);
}
};
@ -208,7 +208,7 @@ const createInstance = async () => {
if (newInstanceInfo.value) emit("nextStep", newInstanceInfo.value.instanceUuid);
return message.success(t("TXT_CODE_d28c05df"));
} catch (err: any) {
return reportError(err.message);
return reportErrorMsg(err.message);
}
};
</script>

View File

@ -4,7 +4,7 @@ import { getCurrentLang, t } from "@/lang/i18n";
import type { LayoutCard } from "@/types/index";
import { DownloadOutlined } from "@ant-design/icons-vue";
import { quickInstallListAddr, createAsyncTask, queryAsyncTask } from "@/services/apis/instance";
import { reportError } from "@/tools/validator";
import { reportErrorMsg } from "@/tools/validator";
import Loading from "@/components/Loading.vue";
import type { QuickStartTemplate } from "@/types";
import { useAppToolsStore } from "@/stores/useAppToolsStore";
@ -49,7 +49,7 @@ const init = async () => {
}
} catch (err: any) {
console.error(err.message);
return reportError(err.message);
return reportErrorMsg(err.message);
}
};
@ -85,7 +85,7 @@ const handleSelectTemplate = async (item: QuickStartTemplate) => {
} catch (err: any) {
console.error(err);
if (err.message === "Dialog closed by user") return;
return reportError(err.message);
return reportErrorMsg(err.message);
}
};
@ -132,7 +132,7 @@ const queryStatus = async () => {
}
} catch (err: any) {
console.error(err);
return reportError(err.message);
return reportErrorMsg(err.message);
}
};

View File

@ -12,7 +12,7 @@ import { useLayoutCardTools } from "@/hooks/useCardTools";
import { updateUserInstance } from "@/services/apis";
import { useSelectInstances } from "@/components/fc";
import { message } from "ant-design-vue";
import { reportError } from "@/tools/validator";
import { reportErrorMsg } from "@/tools/validator";
import { INSTANCE_STATUS } from "@/types/const";
import type { AntColumnsType, AntTableCell } from "@/types/ant";
import dayjs from "dayjs";
@ -42,7 +42,7 @@ const handleDelete = async (deletedInstance: UserInstance) => {
}
await saveData();
} catch (error) {
reportError(error);
reportErrorMsg(error);
}
};
@ -52,7 +52,7 @@ const assignApp = async () => {
if (selectedInstances) dataSource.value = selectedInstances;
await saveData();
} catch (err: any) {
reportError(err);
reportErrorMsg(err);
}
};
@ -71,7 +71,7 @@ const saveData = async () => {
// ignore
});
} catch (err: any) {
reportError(err.message);
reportErrorMsg(err.message);
}
};