From a48c33d9bab40f4324a0acdf9886177bc4596ee7 Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Mon, 26 Dec 2022 18:36:32 +0800 Subject: [PATCH] refactor: remove the ability to edit user using yaml (#799) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### 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 编辑用户信息的功能 ``` --- package.json | 3 +- pnpm-lock.yaml | 3 +- .../users/components/UserEditingModal.vue | 144 +++++++----------- 3 files changed, 56 insertions(+), 94 deletions(-) diff --git a/package.json b/package.json index e3459d07..629ede92 100644 --- a/package.json +++ b/package.json @@ -76,8 +76,7 @@ "vue": "^3.2.45", "vue-grid-layout": "3.0.0-beta1", "vue-router": "^4.1.6", - "vuedraggable": "^4.1.0", - "yaml": "^2.1.3" + "vuedraggable": "^4.1.0" }, "devDependencies": { "@changesets/cli": "^2.25.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e29242df..ebee7f8b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -98,7 +98,6 @@ importers: vue-router: ^4.1.6 vue-tsc: ^1.0.9 vuedraggable: ^4.1.0 - yaml: ^2.1.3 dependencies: '@emoji-mart/data': 1.0.8 '@formkit/core': 1.0.0-beta.12-e579559 @@ -144,7 +143,6 @@ importers: vue-grid-layout: 3.0.0-beta1 vue-router: 4.1.6_vue@3.2.45 vuedraggable: 4.1.0_vue@3.2.45 - yaml: 2.1.3 devDependencies: '@changesets/cli': 2.25.2 '@iconify-json/mdi': 1.1.36 @@ -9923,6 +9921,7 @@ packages: /yaml/2.1.3: resolution: {integrity: sha512-AacA8nRULjKMX2DvWvOAdBZMOfQlypSFkjcOcu9FalllIDJ1kvlREzcdIZmidQUqqeMv7jorHjq2HlLv/+c2lg==} engines: {node: '>= 14'} + dev: true /yargs-parser/18.1.3: resolution: {integrity: sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==} diff --git a/src/modules/system/users/components/UserEditingModal.vue b/src/modules/system/users/components/UserEditingModal.vue index 746aa1f4..8298a5e1 100644 --- a/src/modules/system/users/components/UserEditingModal.vue +++ b/src/modules/system/users/components/UserEditingModal.vue @@ -5,19 +5,10 @@ import { apiClient } from "@/utils/api-client"; import type { User } from "@halo-dev/api-client"; // components -import { - IconCodeBoxLine, - IconEye, - Toast, - VButton, - VCodemirror, - VModal, - VSpace, -} from "@halo-dev/components"; +import { Toast, VButton, VModal, VSpace } from "@halo-dev/components"; import SubmitButton from "@/components/button/SubmitButton.vue"; // libs -import YAML from "yaml"; import cloneDeep from "lodash.clonedeep"; import { reset } from "@formkit/core"; @@ -60,8 +51,6 @@ const initialFormState: User = { const formState = ref(cloneDeep(initialFormState)); const saving = ref(false); -const rawMode = ref(false); -const raw = ref(""); const isUpdateMode = computed(() => { return !!formState.value.metadata.creationTimestamp; @@ -71,10 +60,6 @@ const creationModalTitle = computed(() => { return isUpdateMode.value ? "编辑用户" : "新增用户"; }); -const modalWidth = computed(() => { - return rawMode.value ? 800 : 700; -}); - watch( () => props.visible, (visible) => { @@ -132,88 +117,67 @@ const handleCreateUser = async () => { 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); - } -};