egirlskey/packages/client/src/pages/admin/abuses.vue

91 lines
2.8 KiB
Vue
Raw Normal View History

2020-10-19 10:29:04 +00:00
<template>
<div class="lcixvhis">
2020-10-19 10:29:04 +00:00
<div class="_section reports">
<div class="_content">
<div class="inputs" style="display: flex;">
2021-08-06 13:29:19 +00:00
<MkSelect v-model="state" style="margin: 0; flex: 1;">
2020-12-26 01:47:36 +00:00
<template #label>{{ $ts.state }}</template>
<option value="all">{{ $ts.all }}</option>
<option value="unresolved">{{ $ts.unresolved }}</option>
<option value="resolved">{{ $ts.resolved }}</option>
2020-10-19 10:29:04 +00:00
</MkSelect>
2021-08-06 13:29:19 +00:00
<MkSelect v-model="targetUserOrigin" style="margin: 0; flex: 1;">
2021-11-05 03:32:35 +00:00
<template #label>{{ $ts.reporteeOrigin }}</template>
2020-12-26 01:47:36 +00:00
<option value="combined">{{ $ts.all }}</option>
<option value="local">{{ $ts.local }}</option>
<option value="remote">{{ $ts.remote }}</option>
2020-10-19 10:29:04 +00:00
</MkSelect>
2021-08-06 13:29:19 +00:00
<MkSelect v-model="reporterOrigin" style="margin: 0; flex: 1;">
2020-12-26 01:47:36 +00:00
<template #label>{{ $ts.reporterOrigin }}</template>
<option value="combined">{{ $ts.all }}</option>
<option value="local">{{ $ts.local }}</option>
<option value="remote">{{ $ts.remote }}</option>
2020-10-19 10:29:04 +00:00
</MkSelect>
</div>
<!-- TODO
<div class="inputs" style="display: flex; padding-top: 1.2em;">
2022-04-27 06:17:49 +00:00
<MkInput v-model="searchUsername" style="margin: 0; flex: 1;" type="text" spellcheck="false">
2020-12-26 01:47:36 +00:00
<span>{{ $ts.username }}</span>
2020-10-19 10:29:04 +00:00
</MkInput>
2022-04-27 06:17:49 +00:00
<MkInput v-model="searchHost" style="margin: 0; flex: 1;" type="text" spellcheck="false" :disabled="pagination.params().origin === 'local'">
2020-12-26 01:47:36 +00:00
<span>{{ $ts.host }}</span>
2020-10-19 10:29:04 +00:00
</MkInput>
</div>
-->
2021-12-02 11:09:12 +00:00
<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"/>
2020-10-19 10:29:04 +00:00
</MkPagination>
</div>
</div>
</div>
</template>
2022-04-27 06:17:49 +00:00
<script lang="ts" setup>
import { computed } from 'vue';
2021-11-11 17:02:25 +00:00
import MkInput from '@/components/form/input.vue';
import MkSelect from '@/components/form/select.vue';
import MkPagination from '@/components/ui/pagination.vue';
import XAbuseReport from '@/components/abuse-report.vue';
2021-11-11 17:02:25 +00:00
import * as os from '@/os';
import * as symbols from '@/symbols';
2022-04-27 06:17:49 +00:00
import { i18n } from '@/i18n';
2020-10-19 10:29:04 +00:00
2022-04-27 06:17:49 +00:00
let reports = $ref<InstanceType<typeof MkPagination>>();
2020-10-19 10:29:04 +00:00
2022-04-27 06:17:49 +00:00
let state = $ref('unresolved');
let reporterOrigin = $ref('combined');
let targetUserOrigin = $ref('combined');
let searchUsername = $ref('');
let searchHost = $ref('');
2022-04-27 06:17:49 +00:00
const pagination = {
endpoint: 'admin/abuse-user-reports' as const,
limit: 10,
params: computed(() => ({
state,
reporterOrigin,
targetUserOrigin,
})),
};
2020-10-19 10:29:04 +00:00
2022-04-27 06:17:49 +00:00
function resolved(reportId) {
reports.removeItem(item => item.id === reportId);
}
defineExpose({
[symbols.PAGE_INFO]: {
title: i18n.ts.abuseReports,
icon: 'fas fa-exclamation-circle',
bg: 'var(--bg)',
2020-10-19 10:29:04 +00:00
}
});
</script>
<style lang="scss" scoped>
.lcixvhis {
margin: var(--margin);
}
2020-10-19 10:29:04 +00:00
</style>