mirror of
https://github.com/HangarMC/Hangar.git
synced 2024-11-21 01:21:54 +08:00
parent
047c5383a2
commit
d06cc4e714
@ -16,7 +16,7 @@ const props = defineProps<{
|
||||
project: HangarProject;
|
||||
}>();
|
||||
const i18n = useI18n();
|
||||
const slug = computed(() => props.project.namespace.owner + "/" + props.project.name);
|
||||
const namespace = computed(() => props.project.namespace.owner + "/" + props.project.name);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@ -68,7 +68,7 @@ const slug = computed(() => props.project.namespace.owner + "/" + props.project.
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="text-left">
|
||||
<Link :to="`/${slug}/stars`">
|
||||
<Link :to="`/${namespace}/stars`">
|
||||
{{ i18n.t("project.info.stars", 0) }}
|
||||
</Link>
|
||||
</th>
|
||||
@ -76,7 +76,7 @@ const slug = computed(() => props.project.namespace.owner + "/" + props.project.
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="text-left">
|
||||
<Link :to="`/${slug}/watchers`">
|
||||
<Link :to="`/${namespace}/watchers`">
|
||||
{{ i18n.t("project.info.watchers", 0) }}
|
||||
</Link>
|
||||
</th>
|
||||
@ -96,13 +96,13 @@ const slug = computed(() => props.project.namespace.owner + "/" + props.project.
|
||||
</template>
|
||||
<template #footer>
|
||||
<DropdownButton v-if="hasPerms(NamedPermission.IS_STAFF)" :name="i18n.t('project.actions.adminActions')" class="mb-2">
|
||||
<DropdownItem :to="`/${slug}/flags`">
|
||||
<DropdownItem :to="`/${namespace}/flags`">
|
||||
{{ i18n.t("project.actions.flagHistory", [project.info.flagCount]) }}
|
||||
</DropdownItem>
|
||||
<DropdownItem :to="`/${slug}/notes`">
|
||||
<DropdownItem :to="`/${namespace}/notes`">
|
||||
{{ i18n.t("project.actions.staffNotes", [project.info.noteCount]) }}
|
||||
</DropdownItem>
|
||||
<DropdownItem :to="`/admin/log?projectFilter=/${slug}`">
|
||||
<DropdownItem :to="`/admin/log?authorName=${project.namespace.owner}&projectSlug=${project.namespace.slug}`">
|
||||
{{ i18n.t("project.actions.userActionLogs") }}
|
||||
</DropdownItem>
|
||||
</DropdownButton>
|
||||
|
@ -7,7 +7,6 @@ import { computed, ref } from "vue";
|
||||
import { LoggedAction } from "hangar-internal";
|
||||
import { debounce } from "lodash-es";
|
||||
import PageTitle from "~/components/design/PageTitle.vue";
|
||||
import { useActionLogs } from "~/composables/useApiHelper";
|
||||
import Card from "~/components/design/Card.vue";
|
||||
import SortableTable from "~/components/SortableTable.vue";
|
||||
import Link from "~/components/design/Link.vue";
|
||||
@ -16,7 +15,6 @@ import DiffModal from "~/components/modals/DiffModal.vue";
|
||||
import Button from "~/components/design/Button.vue";
|
||||
import { useSeo } from "~/composables/useSeo";
|
||||
import { definePageMeta, hasPerms, useApi, useInternalApi, useRouter, watch } from "#imports";
|
||||
import InputText from "~/components/ui/InputText.vue";
|
||||
import InputSelect from "~/components/ui/InputSelect.vue";
|
||||
import { useBackendData } from "~/store/backendData";
|
||||
import { Header } from "~/types/components/SortableTable";
|
||||
@ -29,7 +27,8 @@ definePageMeta({
|
||||
|
||||
const i18n = useI18n();
|
||||
const route = useRoute();
|
||||
const loggedActions = await useActionLogs();
|
||||
const router = useRouter();
|
||||
const loggedActions = ref();
|
||||
|
||||
// TODO add support for sorting
|
||||
const headers: Header[] = [
|
||||
@ -55,6 +54,19 @@ const filter = ref<{
|
||||
projectSlug?: string;
|
||||
}>({});
|
||||
|
||||
if (route.query.authorName) {
|
||||
filter.value.authorName = route.query.authorName as string;
|
||||
}
|
||||
if (route.query.projectSlug) {
|
||||
filter.value.projectSlug = route.query.projectSlug as string;
|
||||
}
|
||||
if (route.query.user) {
|
||||
filter.value.authorName = route.query.user as string;
|
||||
}
|
||||
if (route.query.logAction) {
|
||||
filter.value.authorName = route.query.logAction as string;
|
||||
}
|
||||
|
||||
const requestParams = computed(() => {
|
||||
const limit = 25;
|
||||
return {
|
||||
@ -65,6 +77,8 @@ const requestParams = computed(() => {
|
||||
};
|
||||
});
|
||||
|
||||
await update();
|
||||
|
||||
watch(filter, debounce(update, 500), { deep: true });
|
||||
|
||||
async function updateSort(col: string, sorter: Record<string, number>) {
|
||||
@ -85,7 +99,6 @@ async function updatePage(newPage: number) {
|
||||
await update();
|
||||
}
|
||||
|
||||
const router = useRouter();
|
||||
async function update() {
|
||||
loggedActions.value = await useInternalApi<PaginatedResult<LoggedAction>>("admin/log", "GET", requestParams.value);
|
||||
const { limit, offset, ...paramsWithoutLimit } = requestParams.value;
|
||||
|
Loading…
Reference in New Issue
Block a user