Sharkey/packages/frontend/src/pages/admin/abuses.vue

95 lines
3.1 KiB
Vue
Raw Normal View History

<!--
SPDX-FileCopyrightText: syuilo and other misskey contributors
SPDX-License-Identifier: AGPL-3.0-only
-->
2020-10-19 13:29:04 +03:00
<template>
<MkStickyContainer>
<template #header><XHeader :actions="headerActions" :tabs="headerTabs"/></template>
2023-05-19 14:52:15 +03:00
<MkSpacer :contentMax="900">
2023-05-14 04:21:56 +03:00
<div>
2023-01-06 02:41:14 +02:00
<div class="reports">
<div class="">
<div class="inputs" style="display: flex;">
<MkSelect v-model="state" style="margin: 0; flex: 1;">
2022-07-20 16:24:26 +03:00
<template #label>{{ i18n.ts.state }}</template>
<option value="all">{{ i18n.ts.all }}</option>
<option value="unresolved">{{ i18n.ts.unresolved }}</option>
<option value="resolved">{{ i18n.ts.resolved }}</option>
</MkSelect>
<MkSelect v-model="targetUserOrigin" style="margin: 0; flex: 1;">
2022-07-20 16:24:26 +03:00
<template #label>{{ i18n.ts.reporteeOrigin }}</template>
<option value="combined">{{ i18n.ts.all }}</option>
<option value="local">{{ i18n.ts.local }}</option>
<option value="remote">{{ i18n.ts.remote }}</option>
</MkSelect>
<MkSelect v-model="reporterOrigin" style="margin: 0; flex: 1;">
2022-07-20 16:24:26 +03:00
<template #label>{{ i18n.ts.reporterOrigin }}</template>
<option value="combined">{{ i18n.ts.all }}</option>
<option value="local">{{ i18n.ts.local }}</option>
<option value="remote">{{ i18n.ts.remote }}</option>
</MkSelect>
</div>
<!-- TODO
2020-10-19 13:29:04 +03:00
<div class="inputs" style="display: flex; padding-top: 1.2em;">
2022-07-04 11:35:27 +03:00
<MkInput v-model="searchUsername" style="margin: 0; flex: 1;" type="text" :spellcheck="false">
2022-07-20 16:24:26 +03:00
<span>{{ i18n.ts.username }}</span>
2020-10-19 13:29:04 +03:00
</MkInput>
2022-07-04 11:35:27 +03:00
<MkInput v-model="searchHost" style="margin: 0; flex: 1;" type="text" :spellcheck="false" :disabled="pagination.params().origin === 'local'">
2022-07-20 16:24:26 +03:00
<span>{{ i18n.ts.host }}</span>
2020-10-19 13:29:04 +03:00
</MkInput>
</div>
-->
<MkPagination v-slot="{items}" ref="reports" :pagination="pagination" style="margin-top: var(--margin);">
<XAbuseReport v-for="report in items" :key="report.id" :report="report" @resolved="resolved"/>
</MkPagination>
</div>
</div>
2020-10-19 13:29:04 +03:00
</div>
</MkSpacer>
</MkStickyContainer>
2020-10-19 13:29:04 +03:00
</template>
2022-04-27 09:17:49 +03:00
<script lang="ts" setup>
import { computed, shallowRef, ref } from 'vue';
2021-11-11 19:02:25 +02:00
import XHeader from './_header_.vue';
2023-01-07 08:09:46 +02:00
import MkSelect from '@/components/MkSelect.vue';
import MkPagination from '@/components/MkPagination.vue';
import XAbuseReport from '@/components/MkAbuseReport.vue';
2023-09-19 10:37:43 +03:00
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
2020-10-19 13:29:04 +03:00
const reports = shallowRef<InstanceType<typeof MkPagination>>();
2020-10-19 13:29:04 +03:00
const state = ref('unresolved');
const reporterOrigin = ref('combined');
const targetUserOrigin = ref('combined');
const searchUsername = ref('');
const searchHost = ref('');
2022-04-27 09:17:49 +03:00
const pagination = {
endpoint: 'admin/abuse-user-reports' as const,
limit: 10,
params: computed(() => ({
state: state.value,
reporterOrigin: reporterOrigin.value,
targetUserOrigin: targetUserOrigin.value,
2022-04-27 09:17:49 +03:00
})),
};
2020-10-19 13:29:04 +03:00
2022-04-27 09:17:49 +03:00
function resolved(reportId) {
reports.value.removeItem(reportId);
2022-04-27 09:17:49 +03:00
}
const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata({
title: i18n.ts.abuseReports,
icon: 'ti ti-exclamation-circle',
2020-10-19 13:29:04 +03:00
});
</script>