mirror of https://github.com/halo-dev/halo-admin
refactor: remove the ability to edit user using yaml (#799)
#### What type of PR is this? /kind improvement #### What this PR does / why we need it: 移除使用 yaml 编辑用户信息的功能。 #### Which issue(s) this PR fixes: Fixes https://github.com/halo-dev/halo/issues/3046 #### Special notes for your reviewer: None #### Does this PR introduce a user-facing change? ```release-note 移除 Console 端使用 yaml 编辑用户信息的功能 ```pull/800/head^2
parent
023831cdd4
commit
a48c33d9ba
|
@ -76,8 +76,7 @@
|
||||||
"vue": "^3.2.45",
|
"vue": "^3.2.45",
|
||||||
"vue-grid-layout": "3.0.0-beta1",
|
"vue-grid-layout": "3.0.0-beta1",
|
||||||
"vue-router": "^4.1.6",
|
"vue-router": "^4.1.6",
|
||||||
"vuedraggable": "^4.1.0",
|
"vuedraggable": "^4.1.0"
|
||||||
"yaml": "^2.1.3"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@changesets/cli": "^2.25.2",
|
"@changesets/cli": "^2.25.2",
|
||||||
|
|
|
@ -98,7 +98,6 @@ importers:
|
||||||
vue-router: ^4.1.6
|
vue-router: ^4.1.6
|
||||||
vue-tsc: ^1.0.9
|
vue-tsc: ^1.0.9
|
||||||
vuedraggable: ^4.1.0
|
vuedraggable: ^4.1.0
|
||||||
yaml: ^2.1.3
|
|
||||||
dependencies:
|
dependencies:
|
||||||
'@emoji-mart/data': 1.0.8
|
'@emoji-mart/data': 1.0.8
|
||||||
'@formkit/core': 1.0.0-beta.12-e579559
|
'@formkit/core': 1.0.0-beta.12-e579559
|
||||||
|
@ -144,7 +143,6 @@ importers:
|
||||||
vue-grid-layout: 3.0.0-beta1
|
vue-grid-layout: 3.0.0-beta1
|
||||||
vue-router: 4.1.6_vue@3.2.45
|
vue-router: 4.1.6_vue@3.2.45
|
||||||
vuedraggable: 4.1.0_vue@3.2.45
|
vuedraggable: 4.1.0_vue@3.2.45
|
||||||
yaml: 2.1.3
|
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@changesets/cli': 2.25.2
|
'@changesets/cli': 2.25.2
|
||||||
'@iconify-json/mdi': 1.1.36
|
'@iconify-json/mdi': 1.1.36
|
||||||
|
@ -9923,6 +9921,7 @@ packages:
|
||||||
/yaml/2.1.3:
|
/yaml/2.1.3:
|
||||||
resolution: {integrity: sha512-AacA8nRULjKMX2DvWvOAdBZMOfQlypSFkjcOcu9FalllIDJ1kvlREzcdIZmidQUqqeMv7jorHjq2HlLv/+c2lg==}
|
resolution: {integrity: sha512-AacA8nRULjKMX2DvWvOAdBZMOfQlypSFkjcOcu9FalllIDJ1kvlREzcdIZmidQUqqeMv7jorHjq2HlLv/+c2lg==}
|
||||||
engines: {node: '>= 14'}
|
engines: {node: '>= 14'}
|
||||||
|
dev: true
|
||||||
|
|
||||||
/yargs-parser/18.1.3:
|
/yargs-parser/18.1.3:
|
||||||
resolution: {integrity: sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==}
|
resolution: {integrity: sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==}
|
||||||
|
|
|
@ -5,19 +5,10 @@ import { apiClient } from "@/utils/api-client";
|
||||||
import type { User } from "@halo-dev/api-client";
|
import type { User } from "@halo-dev/api-client";
|
||||||
|
|
||||||
// components
|
// components
|
||||||
import {
|
import { Toast, VButton, VModal, VSpace } from "@halo-dev/components";
|
||||||
IconCodeBoxLine,
|
|
||||||
IconEye,
|
|
||||||
Toast,
|
|
||||||
VButton,
|
|
||||||
VCodemirror,
|
|
||||||
VModal,
|
|
||||||
VSpace,
|
|
||||||
} from "@halo-dev/components";
|
|
||||||
import SubmitButton from "@/components/button/SubmitButton.vue";
|
import SubmitButton from "@/components/button/SubmitButton.vue";
|
||||||
|
|
||||||
// libs
|
// libs
|
||||||
import YAML from "yaml";
|
|
||||||
import cloneDeep from "lodash.clonedeep";
|
import cloneDeep from "lodash.clonedeep";
|
||||||
import { reset } from "@formkit/core";
|
import { reset } from "@formkit/core";
|
||||||
|
|
||||||
|
@ -60,8 +51,6 @@ const initialFormState: User = {
|
||||||
|
|
||||||
const formState = ref<User>(cloneDeep(initialFormState));
|
const formState = ref<User>(cloneDeep(initialFormState));
|
||||||
const saving = ref(false);
|
const saving = ref(false);
|
||||||
const rawMode = ref(false);
|
|
||||||
const raw = ref("");
|
|
||||||
|
|
||||||
const isUpdateMode = computed(() => {
|
const isUpdateMode = computed(() => {
|
||||||
return !!formState.value.metadata.creationTimestamp;
|
return !!formState.value.metadata.creationTimestamp;
|
||||||
|
@ -71,10 +60,6 @@ const creationModalTitle = computed(() => {
|
||||||
return isUpdateMode.value ? "编辑用户" : "新增用户";
|
return isUpdateMode.value ? "编辑用户" : "新增用户";
|
||||||
});
|
});
|
||||||
|
|
||||||
const modalWidth = computed(() => {
|
|
||||||
return rawMode.value ? 800 : 700;
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.visible,
|
() => props.visible,
|
||||||
(visible) => {
|
(visible) => {
|
||||||
|
@ -132,34 +117,14 @@ const handleCreateUser = async () => {
|
||||||
saving.value = false;
|
saving.value = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleRawModeChange = () => {
|
|
||||||
rawMode.value = !rawMode.value;
|
|
||||||
|
|
||||||
if (rawMode.value) {
|
|
||||||
raw.value = YAML.stringify(formState.value);
|
|
||||||
} else {
|
|
||||||
formState.value = YAML.parse(raw.value);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VModal
|
<VModal
|
||||||
:title="creationModalTitle"
|
:title="creationModalTitle"
|
||||||
:visible="visible"
|
:visible="visible"
|
||||||
:width="modalWidth"
|
:width="700"
|
||||||
@update:visible="onVisibleChange"
|
@update:visible="onVisibleChange"
|
||||||
>
|
>
|
||||||
<template #actions>
|
|
||||||
<span @click="handleRawModeChange">
|
|
||||||
<IconCodeBoxLine v-if="!rawMode" v-tooltip="`查看编码`" />
|
|
||||||
<IconEye v-else v-tooltip="`查看表单`" />
|
|
||||||
</span>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<VCodemirror v-show="rawMode" v-model="raw" height="50vh" language="yaml" />
|
|
||||||
|
|
||||||
<div v-show="!rawMode">
|
|
||||||
<FormKit
|
<FormKit
|
||||||
id="user-form"
|
id="user-form"
|
||||||
name="user-form"
|
name="user-form"
|
||||||
|
@ -213,7 +178,6 @@ const handleRawModeChange = () => {
|
||||||
validation="length:0,2048"
|
validation="length:0,2048"
|
||||||
></FormKit>
|
></FormKit>
|
||||||
</FormKit>
|
</FormKit>
|
||||||
</div>
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<VSpace>
|
<VSpace>
|
||||||
<SubmitButton
|
<SubmitButton
|
||||||
|
|
Loading…
Reference in New Issue