refactor(frontend): 非推奨となったReactivity Transformを使わないように (#12539)
* refactor(frontend): 非推奨となったReactivity Transformを使わないように * refactor: 不要な括弧を除去 * fix: 不要なアノテーションを除去 * fix: Refの配列をrefしている部分の対応 * refactor: 不要な括弧を除去 * fix: lint * refactor: Ref、ShallowRef、ComputedRefの変数の宣言をletからconstに置換 * fix: type error * chore: drop reactivity transform from eslint configuration * refactor: remove unnecessary import * fix: 対応漏れ
This commit is contained in:
@@ -45,7 +45,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { watch } from 'vue';
|
||||
import { watch, computed, ref } from 'vue';
|
||||
import JSON5 from 'json5';
|
||||
import * as os from '@/os.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
@@ -61,26 +61,26 @@ const props = defineProps<{
|
||||
domain: string;
|
||||
}>();
|
||||
|
||||
const scope = $computed(() => props.path.split('/').slice(0, -1));
|
||||
const key = $computed(() => props.path.split('/').at(-1));
|
||||
const scope = computed(() => props.path.split('/').slice(0, -1));
|
||||
const key = computed(() => props.path.split('/').at(-1));
|
||||
|
||||
let value = $ref(null);
|
||||
let valueForEditor = $ref(null);
|
||||
const value = ref(null);
|
||||
const valueForEditor = ref(null);
|
||||
|
||||
function fetchValue() {
|
||||
os.api('i/registry/get-detail', {
|
||||
scope,
|
||||
key,
|
||||
scope: scope.value,
|
||||
key: key.value,
|
||||
domain: props.domain === '@' ? null : props.domain,
|
||||
}).then(res => {
|
||||
value = res;
|
||||
valueForEditor = JSON5.stringify(res.value, null, '\t');
|
||||
value.value = res;
|
||||
valueForEditor.value = JSON5.stringify(res.value, null, '\t');
|
||||
});
|
||||
}
|
||||
|
||||
async function save() {
|
||||
try {
|
||||
JSON5.parse(valueForEditor);
|
||||
JSON5.parse(valueForEditor.value);
|
||||
} catch (err) {
|
||||
os.alert({
|
||||
type: 'error',
|
||||
@@ -94,9 +94,9 @@ async function save() {
|
||||
}).then(({ canceled }) => {
|
||||
if (canceled) return;
|
||||
os.apiWithDialog('i/registry/set', {
|
||||
scope,
|
||||
key,
|
||||
value: JSON5.parse(valueForEditor),
|
||||
scope: scope.value,
|
||||
key: key.value,
|
||||
value: JSON5.parse(valueForEditor.value),
|
||||
domain: props.domain === '@' ? null : props.domain,
|
||||
});
|
||||
});
|
||||
@@ -109,8 +109,8 @@ function del() {
|
||||
}).then(({ canceled }) => {
|
||||
if (canceled) return;
|
||||
os.apiWithDialog('i/registry/remove', {
|
||||
scope,
|
||||
key,
|
||||
scope: scope.value,
|
||||
key: key.value,
|
||||
domain: props.domain === '@' ? null : props.domain,
|
||||
});
|
||||
});
|
||||
@@ -118,9 +118,9 @@ function del() {
|
||||
|
||||
watch(() => props.path, fetchValue, { immediate: true });
|
||||
|
||||
const headerActions = $computed(() => []);
|
||||
const headerActions = computed(() => []);
|
||||
|
||||
const headerTabs = $computed(() => []);
|
||||
const headerTabs = computed(() => []);
|
||||
|
||||
definePageMetadata({
|
||||
title: i18n.ts.registry,
|
||||
|
Reference in New Issue
Block a user