2020-06-11 19:13:21 +02:00
|
|
|
<template>
|
2020-06-25 11:36:35 +02:00
|
|
|
<div>
|
|
|
|
<nav class="breadcrumb" aria-label="breadcrumbs">
|
|
|
|
<ul>
|
|
|
|
<li>
|
2020-11-30 10:24:11 +01:00
|
|
|
<router-link :to="{ name: RouteName.MODERATION }">{{
|
|
|
|
$t("Moderation")
|
|
|
|
}}</router-link>
|
2020-06-25 11:36:35 +02:00
|
|
|
</li>
|
|
|
|
<li class="is-active">
|
2020-11-30 10:24:11 +01:00
|
|
|
<router-link :to="{ name: RouteName.PROFILES }">{{
|
|
|
|
$t("Profiles")
|
|
|
|
}}</router-link>
|
2020-06-25 11:36:35 +02:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</nav>
|
|
|
|
<div v-if="persons">
|
|
|
|
<b-switch v-model="local">{{ $t("Local") }}</b-switch>
|
|
|
|
<b-switch v-model="suspended">{{ $t("Suspended") }}</b-switch>
|
|
|
|
<b-table
|
|
|
|
:data="persons.elements"
|
|
|
|
:loading="$apollo.queries.persons.loading"
|
|
|
|
paginated
|
|
|
|
backend-pagination
|
|
|
|
backend-filtering
|
|
|
|
:total="persons.total"
|
|
|
|
:per-page="PROFILES_PER_PAGE"
|
|
|
|
@page-change="onPageChange"
|
|
|
|
@filters-change="onFiltersChange"
|
|
|
|
>
|
2020-11-30 10:24:11 +01:00
|
|
|
<b-table-column
|
|
|
|
field="preferredUsername"
|
|
|
|
:label="$t('Username')"
|
|
|
|
searchable
|
|
|
|
>
|
2020-08-18 15:50:50 +02:00
|
|
|
<template slot="searchable" slot-scope="props">
|
|
|
|
<b-input
|
|
|
|
v-model="props.filters.preferredUsername"
|
|
|
|
placeholder="Search..."
|
|
|
|
icon="magnify"
|
|
|
|
size="is-small"
|
|
|
|
/>
|
|
|
|
</template>
|
|
|
|
<template v-slot:default="props">
|
2020-06-25 11:36:35 +02:00
|
|
|
<router-link
|
|
|
|
class="profile"
|
2020-11-30 10:24:11 +01:00
|
|
|
:to="{
|
|
|
|
name: RouteName.ADMIN_PROFILE,
|
|
|
|
params: { id: props.row.id },
|
|
|
|
}"
|
2020-06-25 11:36:35 +02:00
|
|
|
>
|
|
|
|
<article class="media">
|
|
|
|
<figure class="media-left" v-if="props.row.avatar">
|
|
|
|
<p class="image is-48x48">
|
|
|
|
<img :src="props.row.avatar.url" />
|
|
|
|
</p>
|
|
|
|
</figure>
|
|
|
|
<div class="media-content">
|
|
|
|
<div class="content">
|
|
|
|
<strong v-if="props.row.name">{{ props.row.name }}</strong
|
|
|
|
><br v-if="props.row.name" />
|
|
|
|
<small>@{{ props.row.preferredUsername }}</small>
|
|
|
|
</div>
|
2020-06-11 19:13:21 +02:00
|
|
|
</div>
|
2020-06-25 11:36:35 +02:00
|
|
|
</article>
|
|
|
|
</router-link>
|
2020-08-18 15:50:50 +02:00
|
|
|
</template>
|
|
|
|
</b-table-column>
|
2020-06-11 19:13:21 +02:00
|
|
|
|
2020-08-18 15:50:50 +02:00
|
|
|
<b-table-column field="domain" :label="$t('Domain')" searchable>
|
|
|
|
<template slot="searchable" slot-scope="props">
|
|
|
|
<b-input
|
|
|
|
v-model="props.filters.domain"
|
|
|
|
placeholder="Search..."
|
|
|
|
icon="magnify"
|
|
|
|
size="is-small"
|
|
|
|
/>
|
|
|
|
</template>
|
|
|
|
<template v-slot:default="props">
|
2020-06-25 11:36:35 +02:00
|
|
|
{{ props.row.domain }}
|
2020-08-18 15:50:50 +02:00
|
|
|
</template>
|
|
|
|
</b-table-column>
|
2020-06-25 11:36:35 +02:00
|
|
|
<template slot="empty">
|
|
|
|
<section class="section">
|
|
|
|
<div class="content has-text-grey has-text-centered">
|
|
|
|
<p>{{ $t("No profile matches the filters") }}</p>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
</template>
|
|
|
|
</b-table>
|
|
|
|
</div>
|
2020-06-11 19:13:21 +02:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
|
|
import { Component, Vue, Watch } from "vue-property-decorator";
|
|
|
|
import { LIST_PROFILES } from "../../graphql/actor";
|
|
|
|
import RouteName from "../../router/name";
|
|
|
|
|
|
|
|
const PROFILES_PER_PAGE = 10;
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
apollo: {
|
|
|
|
persons: {
|
|
|
|
query: LIST_PROFILES,
|
2020-08-27 11:53:24 +02:00
|
|
|
fetchPolicy: "cache-and-network",
|
2020-06-11 19:13:21 +02:00
|
|
|
variables() {
|
|
|
|
return {
|
|
|
|
preferredUsername: this.preferredUsername,
|
|
|
|
name: this.name,
|
|
|
|
domain: this.domain,
|
|
|
|
local: this.local,
|
|
|
|
suspended: this.suspended,
|
|
|
|
page: 1,
|
|
|
|
limit: PROFILES_PER_PAGE,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
export default class Profiles extends Vue {
|
|
|
|
page = 1;
|
2020-07-09 17:24:28 +02:00
|
|
|
|
2020-06-11 19:13:21 +02:00
|
|
|
preferredUsername = "";
|
2020-07-09 17:24:28 +02:00
|
|
|
|
2020-06-11 19:13:21 +02:00
|
|
|
name = "";
|
2020-07-09 17:24:28 +02:00
|
|
|
|
2020-06-11 19:13:21 +02:00
|
|
|
domain = "";
|
2020-07-09 17:24:28 +02:00
|
|
|
|
2020-06-11 19:13:21 +02:00
|
|
|
local = true;
|
2020-07-09 17:24:28 +02:00
|
|
|
|
2020-06-11 19:13:21 +02:00
|
|
|
suspended = false;
|
|
|
|
|
|
|
|
PROFILES_PER_PAGE = PROFILES_PER_PAGE;
|
2020-07-09 17:24:28 +02:00
|
|
|
|
2020-06-11 19:13:21 +02:00
|
|
|
RouteName = RouteName;
|
|
|
|
|
2020-11-27 19:27:44 +01:00
|
|
|
async onPageChange(page: number): Promise<void> {
|
2020-06-11 19:13:21 +02:00
|
|
|
this.page = page;
|
|
|
|
await this.$apollo.queries.persons.fetchMore({
|
|
|
|
variables: {
|
|
|
|
preferredUsername: this.preferredUsername,
|
|
|
|
name: this.name,
|
|
|
|
domain: this.domain,
|
|
|
|
local: this.local,
|
|
|
|
suspended: this.suspended,
|
|
|
|
page: this.page,
|
|
|
|
limit: PROFILES_PER_PAGE,
|
|
|
|
},
|
|
|
|
updateQuery: (previousResult, { fetchMoreResult }) => {
|
|
|
|
if (!fetchMoreResult) return previousResult;
|
|
|
|
const newProfiles = fetchMoreResult.persons.elements;
|
|
|
|
return {
|
|
|
|
persons: {
|
|
|
|
__typename: previousResult.persons.__typename,
|
|
|
|
total: previousResult.persons.total,
|
|
|
|
elements: [...previousResult.persons.elements, ...newProfiles],
|
|
|
|
},
|
|
|
|
};
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-11-27 19:27:44 +01:00
|
|
|
onFiltersChange({
|
|
|
|
preferredUsername,
|
|
|
|
domain,
|
|
|
|
}: {
|
|
|
|
preferredUsername: string;
|
|
|
|
domain: string;
|
|
|
|
}): void {
|
2020-06-11 19:13:21 +02:00
|
|
|
this.preferredUsername = preferredUsername;
|
|
|
|
this.domain = domain;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Watch("domain")
|
2020-11-27 19:27:44 +01:00
|
|
|
domainNotLocal(): void {
|
2020-06-11 19:13:21 +02:00
|
|
|
this.local = this.domain === "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
2020-06-19 19:27:10 +02:00
|
|
|
<style lang="scss" scoped>
|
|
|
|
a.profile {
|
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
</style>
|