mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-13 20:57:24 +01:00
* log armoire, quoest response and cron events to history * show user history in admin panel * allow stats to be edited from admin panel * Improve admin panel stats input * improve setting client in history * fix tests * fix lint * fix armoire buying issue * Improve hero saving * Formatting fix * Improve user history logging * allow class to be changed from admin panel * make terminating subscriptions easier * support decimal extraMonths * Fix editing some achievements in admin panel * log if a user invites party to quest * Log more quest events into user history * make userhistory length configurable * fix some numbered achievements * fix extraMonths field * Automatically set up group plan subs with admin panel * show party info nicer in admin panel * improve admin panel sub handling * add missing brace * display when there are unsaved changes * fix setting group plan * fix showing group id * Display group plan info in admin panel * fix setting hourglass promo date * Improve termination handling in admin panel * reload data after certain save events in admin panel * remove console * fix plan.extraMonths not being reset if terminating a sub * add more options when cancelling subs * reload data after group plan change * Add a way to remove users from a party * fix issue with removing user from party * pass party id correctly * correctly call async function * Improve sub display in admin panel * fix line length * fix line * shorter * plaid * fix(lint): vue code style --------- Co-authored-by: Kalista Payne <sabrecat@gmail.com>
119 lines
2.9 KiB
Vue
119 lines
2.9 KiB
Vue
<template>
|
|
<div class="row standard-page col-12 d-flex justify-content-center">
|
|
<div class="admin-panel-content">
|
|
<h1>Admin Panel</h1>
|
|
<form
|
|
class="form-inline"
|
|
@submit.prevent="searchUsers(userIdentifier)"
|
|
>
|
|
<div class="input-group col pl-0 pr-0">
|
|
<input
|
|
v-model="userIdentifier"
|
|
class="form-control"
|
|
type="text"
|
|
:placeholder="'UserID, username, email, or leave blank for your account'"
|
|
>
|
|
<div class="input-group-append">
|
|
<button
|
|
class="btn btn-primary"
|
|
type="button"
|
|
@click="loadUser(userIdentifier)"
|
|
>
|
|
Load User
|
|
</button>
|
|
<button
|
|
class="btn btn-secondary"
|
|
type="button"
|
|
@click="searchUsers(userIdentifier)"
|
|
>
|
|
Search
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
<router-view
|
|
class="mt-3"
|
|
@changeUserIdentifier="changeUserIdentifier"
|
|
/>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<style lang="scss" scoped>
|
|
.uidField {
|
|
min-width: 45ch;
|
|
}
|
|
|
|
.input-group-append {
|
|
width:auto;
|
|
}
|
|
|
|
.admin-panel-content {
|
|
flex: 0 0 800px;
|
|
max-width: 800px;
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
import VueRouter from 'vue-router';
|
|
import { mapState } from '@/libs/store';
|
|
|
|
const { isNavigationFailure, NavigationFailureType } = VueRouter;
|
|
|
|
export default {
|
|
data () {
|
|
return {
|
|
userIdentifier: '',
|
|
};
|
|
},
|
|
computed: {
|
|
...mapState({ user: 'user.data' }),
|
|
},
|
|
mounted () {
|
|
this.$store.dispatch('common:setTitle', {
|
|
section: 'Admin Panel',
|
|
});
|
|
},
|
|
methods: {
|
|
changeUserIdentifier (newId) {
|
|
// If we've accessed the admin panel from a URL that had a user identifier in it,
|
|
// this method will insert that identifier into the "Load User" form field
|
|
// (useful if we want to re-fetch the user after making changes).
|
|
this.userIdentifier = newId;
|
|
},
|
|
async searchUsers (userIdentifier) {
|
|
if (!userIdentifier || userIdentifier === '') {
|
|
this.loadUser();
|
|
return;
|
|
}
|
|
this.$router.push({
|
|
name: 'adminPanelSearch',
|
|
params: { userIdentifier },
|
|
}).catch(failure => {
|
|
if (isNavigationFailure(failure, NavigationFailureType.duplicated)) {
|
|
this.$router.go();
|
|
}
|
|
});
|
|
},
|
|
|
|
async loadUser (userIdentifier) {
|
|
const id = userIdentifier || this.user._id;
|
|
if (this.$router.currentRoute.name === 'adminPanelUser') {
|
|
await this.$router.push({
|
|
name: 'adminPanel',
|
|
});
|
|
}
|
|
await this.$router.push({
|
|
name: 'adminPanelUser',
|
|
params: { userIdentifier: id },
|
|
}).catch(failure => {
|
|
if (isNavigationFailure(failure, NavigationFailureType.duplicated)) {
|
|
this.$router.go();
|
|
}
|
|
});
|
|
},
|
|
},
|
|
};
|
|
</script>
|