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:
@@ -67,7 +67,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed } from 'vue';
|
||||
import { computed, ref } from 'vue';
|
||||
import MkButton from '@/components/MkButton.vue';
|
||||
import MkSwitch from '@/components/MkSwitch.vue';
|
||||
import MkObjectView from '@/components/MkObjectView.vue';
|
||||
@@ -82,19 +82,19 @@ import { i18n } from '@/i18n.js';
|
||||
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
||||
import { iAmAdmin, iAmModerator } from '@/account.js';
|
||||
|
||||
let tab = $ref('overview');
|
||||
let file: any = $ref(null);
|
||||
let info: any = $ref(null);
|
||||
let isSensitive: boolean = $ref(false);
|
||||
const tab = ref('overview');
|
||||
const file = ref<any>(null);
|
||||
const info = ref<any>(null);
|
||||
const isSensitive = ref<boolean>(false);
|
||||
|
||||
const props = defineProps<{
|
||||
fileId: string,
|
||||
}>();
|
||||
|
||||
async function fetch() {
|
||||
file = await os.api('drive/files/show', { fileId: props.fileId });
|
||||
info = await os.api('admin/drive/show-file', { fileId: props.fileId });
|
||||
isSensitive = file.isSensitive;
|
||||
file.value = await os.api('drive/files/show', { fileId: props.fileId });
|
||||
info.value = await os.api('admin/drive/show-file', { fileId: props.fileId });
|
||||
isSensitive.value = file.value.isSensitive;
|
||||
}
|
||||
|
||||
fetch();
|
||||
@@ -102,29 +102,29 @@ fetch();
|
||||
async function del() {
|
||||
const { canceled } = await os.confirm({
|
||||
type: 'warning',
|
||||
text: i18n.t('removeAreYouSure', { x: file.name }),
|
||||
text: i18n.t('removeAreYouSure', { x: file.value.name }),
|
||||
});
|
||||
if (canceled) return;
|
||||
|
||||
os.apiWithDialog('drive/files/delete', {
|
||||
fileId: file.id,
|
||||
fileId: file.value.id,
|
||||
});
|
||||
}
|
||||
|
||||
async function toggleIsSensitive(v) {
|
||||
await os.api('drive/files/update', { fileId: props.fileId, isSensitive: v });
|
||||
isSensitive = v;
|
||||
isSensitive.value = v;
|
||||
}
|
||||
|
||||
const headerActions = $computed(() => [{
|
||||
const headerActions = computed(() => [{
|
||||
text: i18n.ts.openInNewTab,
|
||||
icon: 'ti ti-external-link',
|
||||
handler: () => {
|
||||
window.open(file.url, '_blank');
|
||||
window.open(file.value.url, '_blank');
|
||||
},
|
||||
}]);
|
||||
|
||||
const headerTabs = $computed(() => [{
|
||||
const headerTabs = computed(() => [{
|
||||
key: 'overview',
|
||||
title: i18n.ts.overview,
|
||||
icon: 'ti ti-info-circle',
|
||||
@@ -139,7 +139,7 @@ const headerTabs = $computed(() => [{
|
||||
}]);
|
||||
|
||||
definePageMetadata(computed(() => ({
|
||||
title: file ? i18n.ts.file + ': ' + file.name : i18n.ts.file,
|
||||
title: file.value ? i18n.ts.file + ': ' + file.value.name : i18n.ts.file,
|
||||
icon: 'ti ti-file',
|
||||
})));
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user