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
Ryan Wang 2022-12-26 18:36:32 +08:00 committed by GitHub
parent 023831cdd4
commit a48c33d9ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 56 additions and 94 deletions

View File

@ -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",

View File

@ -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==}

View File

@ -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<User>(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,34 +117,14 @@ 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);
}
};
</script>
<template>
<VModal
:title="creationModalTitle"
:visible="visible"
:width="modalWidth"
:width="700"
@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
id="user-form"
name="user-form"
@ -213,7 +178,6 @@ const handleRawModeChange = () => {
validation="length:0,2048"
></FormKit>
</FormKit>
</div>
<template #footer>
<VSpace>
<SubmitButton