forked from AkkomaGang/admin-fe
Merge branch 'develop' into feature/add-streamer-and-oban-settings
This commit is contained in:
commit
5ab7618446
7 changed files with 146 additions and 34 deletions
|
@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Ability to see local statuses in Statuses by instance section
|
||||||
|
|
||||||
## [2.0] - 2020-02-27
|
## [2.0] - 2020-02-27
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -21,6 +21,15 @@ export async function deleteStatus(id, authHost, token) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function fetchStatuses({ godmode, localOnly, authHost, token, pageSize, page }) {
|
||||||
|
return await request({
|
||||||
|
baseURL: baseName(authHost),
|
||||||
|
url: `/api/pleroma/admin/statuses?godmode=${godmode}&local_only=${localOnly}&page=${page}&page_size=${pageSize}`,
|
||||||
|
method: 'get',
|
||||||
|
headers: authHeaders(token)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export async function fetchStatusesByInstance({ instance, authHost, token, pageSize, page }) {
|
export async function fetchStatusesByInstance({ instance, authHost, token, pageSize, page }) {
|
||||||
return await request({
|
return await request({
|
||||||
baseURL: baseName(authHost),
|
baseURL: baseName(authHost),
|
||||||
|
|
|
@ -244,7 +244,9 @@ export default {
|
||||||
statuses: 'Statuses by instance',
|
statuses: 'Statuses by instance',
|
||||||
instanceFilter: 'Instance filter',
|
instanceFilter: 'Instance filter',
|
||||||
loadMore: 'Load more',
|
loadMore: 'Load more',
|
||||||
noInstances: 'No other instances found'
|
noInstances: 'No other instances found',
|
||||||
|
onlyLocalStatuses: 'Show only local statuses',
|
||||||
|
showPrivateStatuses: 'Show private statuses'
|
||||||
},
|
},
|
||||||
userProfile: {
|
userProfile: {
|
||||||
tags: 'Tags',
|
tags: 'Tags',
|
||||||
|
@ -255,7 +257,6 @@ export default {
|
||||||
localUppercase: 'Local',
|
localUppercase: 'Local',
|
||||||
nickname: 'Nickname',
|
nickname: 'Nickname',
|
||||||
recentStatuses: 'Recent Statuses',
|
recentStatuses: 'Recent Statuses',
|
||||||
showPrivateStatuses: 'Show private statuses',
|
|
||||||
roles: 'Roles',
|
roles: 'Roles',
|
||||||
activeUppercase: 'Active',
|
activeUppercase: 'Active',
|
||||||
active: 'active',
|
active: 'active',
|
||||||
|
|
|
@ -17,8 +17,6 @@ const getters = {
|
||||||
errorLogs: state => state.errorLog.logs,
|
errorLogs: state => state.errorLog.logs,
|
||||||
users: state => state.users.fetchedUsers,
|
users: state => state.users.fetchedUsers,
|
||||||
authHost: state => state.user.authHost,
|
authHost: state => state.user.authHost,
|
||||||
settings: state => state.settings,
|
settings: state => state.settings
|
||||||
instances: state => state.peers.fetchedPeers,
|
|
||||||
statuses: state => state.status.fetchedStatuses
|
|
||||||
}
|
}
|
||||||
export default getters
|
export default getters
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { changeStatusScope, deleteStatus, fetchStatusesByInstance } from '@/api/status'
|
import { changeStatusScope, deleteStatus, fetchStatuses, fetchStatusesByInstance } from '@/api/status'
|
||||||
|
|
||||||
const status = {
|
const status = {
|
||||||
state: {
|
state: {
|
||||||
|
@ -6,11 +6,21 @@ const status = {
|
||||||
loading: false,
|
loading: false,
|
||||||
statusesByInstance: {
|
statusesByInstance: {
|
||||||
selectedInstance: '',
|
selectedInstance: '',
|
||||||
|
showLocal: false,
|
||||||
|
showPrivate: false,
|
||||||
page: 1,
|
page: 1,
|
||||||
pageSize: 30
|
pageSize: 20,
|
||||||
|
buttonLoading: false,
|
||||||
|
allLoaded: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
|
CHANGE_GODMODE_CHECKBOX_VALUE: (state, value) => {
|
||||||
|
state.statusesByInstance.showPrivate = value
|
||||||
|
},
|
||||||
|
CHANGE_LOCAL_CHECKBOX_VALUE: (state, value) => {
|
||||||
|
state.statusesByInstance.showLocal = value
|
||||||
|
},
|
||||||
CHANGE_PAGE: (state, page) => {
|
CHANGE_PAGE: (state, page) => {
|
||||||
state.statusesByInstance.page = page
|
state.statusesByInstance.page = page
|
||||||
},
|
},
|
||||||
|
@ -23,6 +33,12 @@ const status = {
|
||||||
PUSH_STATUSES: (state, statuses) => {
|
PUSH_STATUSES: (state, statuses) => {
|
||||||
state.fetchedStatuses = [...state.fetchedStatuses, ...statuses]
|
state.fetchedStatuses = [...state.fetchedStatuses, ...statuses]
|
||||||
},
|
},
|
||||||
|
SET_ALL_LOADED: (state, status) => {
|
||||||
|
state.statusesByInstance.allLoaded = status
|
||||||
|
},
|
||||||
|
SET_BUTTON_LOADING: (state, status) => {
|
||||||
|
state.statusesByInstance.buttonLoading = status
|
||||||
|
},
|
||||||
SET_LOADING: (state, status) => {
|
SET_LOADING: (state, status) => {
|
||||||
state.loading = status
|
state.loading = status
|
||||||
}
|
}
|
||||||
|
@ -48,10 +64,48 @@ const status = {
|
||||||
dispatch('FetchStatusesByInstance')
|
dispatch('FetchStatusesByInstance')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async FetchStatusesByInstance({ commit, getters, state }) {
|
async FetchStatusesByInstance({ commit, getters, state, rootState }) {
|
||||||
commit('SET_LOADING', true)
|
commit('SET_LOADING', true)
|
||||||
const statuses = state.statusesByInstance.selectedInstance === ''
|
if (state.statusesByInstance.selectedInstance === '') {
|
||||||
? { data: [] }
|
commit('SET_STATUSES_BY_INSTANCE', [])
|
||||||
|
} else {
|
||||||
|
const statuses = state.statusesByInstance.selectedInstance === rootState.user.authHost
|
||||||
|
? await fetchStatuses(
|
||||||
|
{
|
||||||
|
godmode: state.statusesByInstance.showPrivate,
|
||||||
|
localOnly: state.statusesByInstance.showLocal,
|
||||||
|
authHost: getters.authHost,
|
||||||
|
token: getters.token,
|
||||||
|
pageSize: state.statusesByInstance.pageSize,
|
||||||
|
page: state.statusesByInstance.page
|
||||||
|
})
|
||||||
|
: await fetchStatusesByInstance(
|
||||||
|
{
|
||||||
|
instance: state.statusesByInstance.selectedInstance,
|
||||||
|
authHost: getters.authHost,
|
||||||
|
token: getters.token,
|
||||||
|
pageSize: state.statusesByInstance.pageSize,
|
||||||
|
page: state.statusesByInstance.page
|
||||||
|
})
|
||||||
|
commit('SET_STATUSES_BY_INSTANCE', statuses.data)
|
||||||
|
if (statuses.data.length < state.statusesByInstance.pageSize) {
|
||||||
|
commit('SET_ALL_LOADED', true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
commit('SET_LOADING', false)
|
||||||
|
},
|
||||||
|
async FetchStatusesPageByInstance({ commit, getters, rootState, state }) {
|
||||||
|
commit('SET_BUTTON_LOADING', true)
|
||||||
|
const statuses = state.statusesByInstance.selectedInstance === rootState.user.authHost
|
||||||
|
? await fetchStatuses(
|
||||||
|
{
|
||||||
|
godmode: state.statusesByInstance.showPrivate,
|
||||||
|
localOnly: state.statusesByInstance.showLocal,
|
||||||
|
authHost: getters.authHost,
|
||||||
|
token: getters.token,
|
||||||
|
pageSize: state.statusesByInstance.pageSize,
|
||||||
|
page: state.statusesByInstance.page
|
||||||
|
})
|
||||||
: await fetchStatusesByInstance(
|
: await fetchStatusesByInstance(
|
||||||
{
|
{
|
||||||
instance: state.statusesByInstance.selectedInstance,
|
instance: state.statusesByInstance.selectedInstance,
|
||||||
|
@ -60,26 +114,29 @@ const status = {
|
||||||
pageSize: state.statusesByInstance.pageSize,
|
pageSize: state.statusesByInstance.pageSize,
|
||||||
page: state.statusesByInstance.page
|
page: state.statusesByInstance.page
|
||||||
})
|
})
|
||||||
|
|
||||||
commit('SET_STATUSES_BY_INSTANCE', statuses.data)
|
|
||||||
commit('SET_LOADING', false)
|
|
||||||
},
|
|
||||||
async FetchStatusesPageByInstance({ commit, getters, state }) {
|
|
||||||
commit('SET_LOADING', true)
|
|
||||||
const statuses = await fetchStatusesByInstance(
|
|
||||||
{
|
|
||||||
instance: state.statusesByInstance.selectedInstance,
|
|
||||||
authHost: getters.authHost,
|
|
||||||
token: getters.token,
|
|
||||||
pageSize: state.statusesByInstance.pageSize,
|
|
||||||
page: state.statusesByInstance.page
|
|
||||||
})
|
|
||||||
|
|
||||||
commit('PUSH_STATUSES', statuses.data)
|
commit('PUSH_STATUSES', statuses.data)
|
||||||
commit('SET_LOADING', false)
|
commit('SET_BUTTON_LOADING', false)
|
||||||
|
if (statuses.data.length < state.statusesByInstance.pageSize) {
|
||||||
|
commit('SET_ALL_LOADED', true)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
HandleGodmodeCheckboxChange({ commit, dispatch }, value) {
|
||||||
|
dispatch('HandlePageChange', 1)
|
||||||
|
commit('SET_ALL_LOADED', false)
|
||||||
|
|
||||||
|
commit('CHANGE_GODMODE_CHECKBOX_VALUE', value)
|
||||||
|
dispatch('FetchStatusesByInstance')
|
||||||
|
},
|
||||||
|
HandleLocalCheckboxChange({ commit, dispatch }, value) {
|
||||||
|
dispatch('HandlePageChange', 1)
|
||||||
|
commit('SET_ALL_LOADED', false)
|
||||||
|
|
||||||
|
commit('CHANGE_LOCAL_CHECKBOX_VALUE', value)
|
||||||
|
dispatch('FetchStatusesByInstance')
|
||||||
},
|
},
|
||||||
HandleFilterChange({ commit }, instance) {
|
HandleFilterChange({ commit }, instance) {
|
||||||
commit('CHANGE_SELECTED_INSTANCE', instance)
|
commit('CHANGE_SELECTED_INSTANCE', instance)
|
||||||
|
commit('SET_ALL_LOADED', false)
|
||||||
},
|
},
|
||||||
HandlePageChange({ commit }, page) {
|
HandlePageChange({ commit }, page) {
|
||||||
commit('CHANGE_PAGE', page)
|
commit('CHANGE_PAGE', page)
|
||||||
|
|
|
@ -22,6 +22,15 @@
|
||||||
:selected-users="selectedUsers"
|
:selected-users="selectedUsers"
|
||||||
@apply-action="clearSelection"/>
|
@apply-action="clearSelection"/>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="currentInstance" class="checkbox-container">
|
||||||
|
<el-checkbox v-model="showLocal" class="show-private-statuses">
|
||||||
|
{{ $t('statuses.onlyLocalStatuses') }}
|
||||||
|
</el-checkbox>
|
||||||
|
<el-checkbox v-model="showPrivate" class="show-private-statuses">
|
||||||
|
{{ $t('statuses.showPrivateStatuses') }}
|
||||||
|
</el-checkbox>
|
||||||
|
</div>
|
||||||
|
<p v-if="statuses.length === 0" class="no-statuses">{{ $t('userProfile.noStatuses') }}</p>
|
||||||
<div v-for="status in statuses" :key="status.id" class="status-container">
|
<div v-for="status in statuses" :key="status.id" class="status-container">
|
||||||
<status
|
<status
|
||||||
:status="status"
|
:status="status"
|
||||||
|
@ -30,13 +39,13 @@
|
||||||
@status-selection="handleStatusSelection" />
|
@status-selection="handleStatusSelection" />
|
||||||
</div>
|
</div>
|
||||||
<div v-if="statuses.length > 0" class="statuses-pagination">
|
<div v-if="statuses.length > 0" class="statuses-pagination">
|
||||||
<el-button @click="handleLoadMore">{{ $t('statuses.loadMore') }}</el-button>
|
<el-button v-if="!allLoaded" :loading="buttonLoading" @click="handleLoadMore">{{ $t('statuses.loadMore') }}</el-button>
|
||||||
|
<el-button v-else icon="el-icon-check" circle/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex'
|
|
||||||
import MultipleUsersMenu from '@/views/users/components/MultipleUsersMenu'
|
import MultipleUsersMenu from '@/views/users/components/MultipleUsersMenu'
|
||||||
import Status from '@/components/Status'
|
import Status from '@/components/Status'
|
||||||
|
|
||||||
|
@ -52,10 +61,18 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters([
|
allLoaded() {
|
||||||
'instances',
|
return this.$store.state.status.statusesByInstance.allLoaded
|
||||||
'statuses'
|
},
|
||||||
]),
|
buttonLoading() {
|
||||||
|
return this.$store.state.status.statusesByInstance.buttonLoading
|
||||||
|
},
|
||||||
|
currentInstance() {
|
||||||
|
return this.selectedInstance === this.$store.state.user.authHost
|
||||||
|
},
|
||||||
|
instances() {
|
||||||
|
return [this.$store.state.user.authHost, ...this.$store.state.peers.fetchedPeers]
|
||||||
|
},
|
||||||
isDesktop() {
|
isDesktop() {
|
||||||
return this.$store.state.app.device === 'desktop'
|
return this.$store.state.app.device === 'desktop'
|
||||||
},
|
},
|
||||||
|
@ -75,6 +92,25 @@ export default {
|
||||||
set(instance) {
|
set(instance) {
|
||||||
this.$store.dispatch('HandleFilterChange', instance)
|
this.$store.dispatch('HandleFilterChange', instance)
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
showLocal: {
|
||||||
|
get() {
|
||||||
|
return this.$store.state.status.statusesByInstance.showLocal
|
||||||
|
},
|
||||||
|
set(value) {
|
||||||
|
this.$store.dispatch('HandleLocalCheckboxChange', value)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
showPrivate: {
|
||||||
|
get() {
|
||||||
|
return this.$store.state.status.statusesByInstance.showPrivate
|
||||||
|
},
|
||||||
|
set(value) {
|
||||||
|
this.$store.dispatch('HandleGodmodeCheckboxChange', value)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
statuses() {
|
||||||
|
return this.$store.state.status.fetchedStatuses
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
@ -97,7 +133,6 @@ export default {
|
||||||
if (this.selectedUsers.find(selectedUser => user.id === selectedUser.id) !== undefined) {
|
if (this.selectedUsers.find(selectedUser => user.id === selectedUser.id) !== undefined) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this.selectedUsers = [...this.selectedUsers, user]
|
this.selectedUsers = [...this.selectedUsers, user]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,6 +146,9 @@ export default {
|
||||||
margin: 0 0 10px;
|
margin: 0 0 10px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.checkbox-container {
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
.filter-container {
|
.filter-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
height: 36px;
|
height: 36px;
|
||||||
|
@ -130,6 +168,9 @@ h1 {
|
||||||
}
|
}
|
||||||
|
|
||||||
@media only screen and (max-width:480px) {
|
@media only screen and (max-width:480px) {
|
||||||
|
.checkbox-container {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
.filter-container {
|
.filter-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
height: 36px;
|
height: 36px;
|
||||||
|
|
|
@ -80,7 +80,7 @@
|
||||||
<div class="recent-statuses-container">
|
<div class="recent-statuses-container">
|
||||||
<h2 class="recent-statuses">{{ $t('userProfile.recentStatuses') }}</h2>
|
<h2 class="recent-statuses">{{ $t('userProfile.recentStatuses') }}</h2>
|
||||||
<el-checkbox v-model="showPrivate" class="show-private-statuses" @change="onTogglePrivate">
|
<el-checkbox v-model="showPrivate" class="show-private-statuses" @change="onTogglePrivate">
|
||||||
{{ $t('userProfile.showPrivateStatuses') }}
|
{{ $t('statuses.showPrivateStatuses') }}
|
||||||
</el-checkbox>
|
</el-checkbox>
|
||||||
<el-timeline v-if="!statusesLoading" class="statuses">
|
<el-timeline v-if="!statusesLoading" class="statuses">
|
||||||
<el-timeline-item v-for="status in statuses" :key="status.id">
|
<el-timeline-item v-for="status in statuses" :key="status.id">
|
||||||
|
|
Loading…
Reference in a new issue