tweak logs

This commit is contained in:
samunohito 2024-02-07 08:11:55 +09:00
parent e892fbf000
commit b0b474d2a3
1 changed files with 25 additions and 8 deletions

View File

@ -1,12 +1,22 @@
<template> <template>
<div> <div>
<div v-if="logs.length > 0" style="overflow-y: scroll;"> <div v-if="logs.length > 0" style="display:flex; flex-direction: column; overflow-y: scroll; gap: 16px;">
<MkGrid <MkSwitch v-model="showingSuccessLogs">
:gridSetting="{ rowNumberVisible: false, rowSelectable: false }" <template #label>成功ログを表示する</template>
:data="logs" </MkSwitch>
:columnSettings="columnSettings" <div>
@event="onGridEvent" <div v-if="filteredLogs.length > 0">
/> <MkGrid
:gridSetting="{ rowNumberVisible: false, rowSelectable: false }"
:data="filteredLogs"
:columnSettings="columnSettings"
@event="onGridEvent"
/>
</div>
<div v-else>
失敗ログはありません
</div>
</div>
</div> </div>
<div v-else> <div v-else>
ログはありません ログはありません
@ -16,7 +26,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { toRefs } from 'vue'; import { computed, ref, toRefs } from 'vue';
import { ColumnSetting } from '@/components/grid/column.js'; import { ColumnSetting } from '@/components/grid/column.js';
import { RequestLogItem } from '@/pages/admin/custom-emojis-grid.impl.js'; import { RequestLogItem } from '@/pages/admin/custom-emojis-grid.impl.js';
import { import {
@ -28,6 +38,7 @@ import {
} from '@/components/grid/grid-event.js'; } from '@/components/grid/grid-event.js';
import { optInGridUtils } from '@/components/grid/optin-utils.js'; import { optInGridUtils } from '@/components/grid/optin-utils.js';
import MkGrid from '@/components/grid/MkGrid.vue'; import MkGrid from '@/components/grid/MkGrid.vue';
import MkSwitch from '@/components/MkSwitch.vue';
const columnSettings: ColumnSetting[] = [ const columnSettings: ColumnSetting[] = [
{ bindTo: 'failed', title: 'failed', type: 'boolean', editable: false, width: 50 }, { bindTo: 'failed', title: 'failed', type: 'boolean', editable: false, width: 50 },
@ -41,6 +52,12 @@ const props = defineProps<{
}>(); }>();
const { logs } = toRefs(props); const { logs } = toRefs(props);
const showingSuccessLogs = ref<boolean>(false);
const filteredLogs = computed(() => {
const forceShowing = showingSuccessLogs.value;
return logs.value.filter((log) => forceShowing || log.failed);
});
function onGridEvent(event: GridEvent, currentState: GridCurrentState) { function onGridEvent(event: GridEvent, currentState: GridCurrentState) {
switch (event.type) { switch (event.type) {