From e34b173b54db5f0ec0269a613d8a23dc8f42cd20 Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Wed, 18 Mar 2020 18:51:35 +0000 Subject: [PATCH] Merge branch 'feature/display-status-counts-by-scope' into 'develop' Display status counts by scope Closes #54 See merge request pleroma/admin-fe!104 (cherry picked from commit ce3d3387cf009a64417fda325f41b6adfdcaaa39) 4f61344c Add api function and action that fetches statuses count by scope 1d21dc51 Update header margin 85664ffb Display status count by visibility scope --- src/api/status.js | 9 +++++++++ src/lang/en.js | 8 ++++++-- src/store/modules/status.js | 14 ++++++++++++-- src/views/emojiPacks/index.vue | 2 +- src/views/invites/index.vue | 2 +- src/views/moderation_log/index.vue | 2 +- src/views/reports/index.vue | 2 +- src/views/settings/styles/main.scss | 2 +- src/views/statuses/index.vue | 16 +++++++++++++--- src/views/users/index.vue | 2 +- 10 files changed, 46 insertions(+), 13 deletions(-) diff --git a/src/api/status.js b/src/api/status.js index 37f7e0c2..fcc820e0 100644 --- a/src/api/status.js +++ b/src/api/status.js @@ -30,6 +30,15 @@ export async function fetchStatuses({ godmode, localOnly, authHost, token, pageS }) } +export async function fetchStatusesCount(authHost, token) { + return await request({ + baseURL: baseName(authHost), + url: `/api/pleroma/admin/stats`, + method: 'get', + headers: authHeaders(token) + }) +} + export async function fetchStatusesByInstance({ instance, authHost, token, pageSize, page }) { return await request({ baseURL: baseName(authHost), diff --git a/src/lang/en.js b/src/lang/en.js index 8b8e9ff7..7311c097 100644 --- a/src/lang/en.js +++ b/src/lang/en.js @@ -241,12 +241,16 @@ export default { resendConfirmation: 'Resend confirmation email' }, statuses: { - statuses: 'Statuses by instance', + statuses: 'Statuses', instanceFilter: 'Instance filter', loadMore: 'Load more', noInstances: 'No other instances found', onlyLocalStatuses: 'Show only local statuses', - showPrivateStatuses: 'Show private statuses' + showPrivateStatuses: 'Show private statuses', + direct: 'Direct', + private: 'Private', + public: 'Public', + unlisted: 'Unlisted' }, userProfile: { tags: 'Tags', diff --git a/src/store/modules/status.js b/src/store/modules/status.js index e0cc5d97..8847e8bf 100644 --- a/src/store/modules/status.js +++ b/src/store/modules/status.js @@ -1,4 +1,4 @@ -import { changeStatusScope, deleteStatus, fetchStatuses, fetchStatusesByInstance } from '@/api/status' +import { changeStatusScope, deleteStatus, fetchStatuses, fetchStatusesCount, fetchStatusesByInstance } from '@/api/status' const status = { state: { @@ -12,7 +12,8 @@ const status = { pageSize: 20, buttonLoading: false, allLoaded: false - } + }, + statusVisibility: {} }, mutations: { CHANGE_GODMODE_CHECKBOX_VALUE: (state, value) => { @@ -41,6 +42,9 @@ const status = { }, SET_LOADING: (state, status) => { state.loading = status + }, + SET_STATUS_VISIBILITY: (state, visibility) => { + state.statusVisibility = visibility } }, actions: { @@ -64,6 +68,12 @@ const status = { dispatch('FetchStatusesByInstance') } }, + async FetchStatusesCount({ commit, getters }) { + commit('SET_LOADING', true) + const { data } = await fetchStatusesCount(getters.authHost, getters.token) + commit('SET_STATUS_VISIBILITY', data.status_visibility) + commit('SET_LOADING', false) + }, async FetchStatusesByInstance({ commit, getters, state, rootState }) { commit('SET_LOADING', true) if (state.statusesByInstance.selectedInstance === '') { diff --git a/src/views/emojiPacks/index.vue b/src/views/emojiPacks/index.vue index e13df39a..2757e3a4 100644 --- a/src/views/emojiPacks/index.vue +++ b/src/views/emojiPacks/index.vue @@ -155,7 +155,7 @@ export default { margin: 0 30px; } .emoji-packs-header { - margin: 22px 0 20px 15px; + margin: 10px 0 20px 15px; } .import-pack-button { margin-left: 10px; diff --git a/src/views/invites/index.vue b/src/views/invites/index.vue index 2497bfc0..60111430 100644 --- a/src/views/invites/index.vue +++ b/src/views/invites/index.vue @@ -246,7 +246,7 @@ export default { padding: 5px 20px 0 20px } h1 { - margin: 22px 0 0 15px; + margin: 10px 0 0 15px; } .icon { margin-right: 5px; diff --git a/src/views/moderation_log/index.vue b/src/views/moderation_log/index.vue index 2e249b80..9dcee370 100644 --- a/src/views/moderation_log/index.vue +++ b/src/views/moderation_log/index.vue @@ -130,7 +130,7 @@ export default { margin: 0 15px; } h1 { - margin: 22px 0 20px 0; + margin: 10px 0 20px 0; } .el-timeline { margin: 25px 45px 0 0; diff --git a/src/views/reports/index.vue b/src/views/reports/index.vue index 64993da3..729cbe64 100644 --- a/src/views/reports/index.vue +++ b/src/views/reports/index.vue @@ -50,7 +50,7 @@ export default { padding-bottom: 0 } h1 { - margin: 22px 0 0 15px; + margin: 10px 0 0 15px; } .no-reports-message { color: gray; diff --git a/src/views/settings/styles/main.scss b/src/views/settings/styles/main.scss index 562308b5..8e6cb4cf 100644 --- a/src/views/settings/styles/main.scss +++ b/src/views/settings/styles/main.scss @@ -444,7 +444,7 @@ margin: 0; } .settings-header-container { - margin: 15px; + margin: 10px 15px 15px 15px; } .nav-container { display: flex; diff --git a/src/views/statuses/index.vue b/src/views/statuses/index.vue index 74e3f55b..88bfab6c 100644 --- a/src/views/statuses/index.vue +++ b/src/views/statuses/index.vue @@ -3,6 +3,12 @@

{{ $t('statuses.statuses') }}

+ + {{ $t('statuses.direct') }}: {{ statusVisibility.direct }} + {{ $t('statuses.private') }}: {{ statusVisibility.private }} + {{ $t('statuses.public') }}: {{ statusVisibility.public }} + {{ $t('statuses.unlisted') }}: {{ statusVisibility.unlisted }} +
.statuses-container { padding: 0 15px; + h1 { + margin: 10px 0 15px 0; + } .status-container { margin: 0 0 10px; } @@ -163,9 +176,6 @@ export default { padding: 15px 0; text-align: center; } -h1 { - margin: 22px 0 0 0; -} @media only screen and (max-width:480px) { .checkbox-container { diff --git a/src/views/users/index.vue b/src/views/users/index.vue index 780f9b39..d6b12e68 100644 --- a/src/views/users/index.vue +++ b/src/views/users/index.vue @@ -245,7 +245,7 @@ export default { } .users-container { h1 { - margin: 22px 0 0 15px; + margin: 10px 0 0 15px; } .pagination {