Skip to content

Commit f23d961

Browse files
authored
Move character groups config into tab in characters page (#849)
1 parent b32e5c5 commit f23d961

File tree

4 files changed

+64
-75
lines changed

4 files changed

+64
-75
lines changed

client/src/router/index.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,6 @@ const routes = [
4545
component: () => import('../views/show/config/ConfigCharacters.vue'),
4646
meta: { requiresAuth: true, requiresShowAccess: true },
4747
},
48-
{
49-
name: 'show-config-character-groups',
50-
path: 'character-groups',
51-
component: () => import('../views/show/config/ConfigCharacterGroups.vue'),
52-
meta: { requiresAuth: true, requiresShowAccess: true },
53-
},
5448
{
5549
name: 'show-config-acts',
5650
path: 'acts',

client/src/views/show/ShowConfigView.vue

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,6 @@
3232
>
3333
Characters
3434
</b-button>
35-
<b-button
36-
:disabled="!shouldViewShowConfig"
37-
replace
38-
:to="{ name: 'show-config-character-groups' }"
39-
variant="outline-info"
40-
active-class="active"
41-
>
42-
Character Groups
43-
</b-button>
4435
<b-button
4536
:disabled="!shouldViewShowConfig"
4637
replace

client/src/views/show/config/ConfigCharacters.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@
5353
class="justify-content-center"
5454
/>
5555
</b-tab>
56+
<b-tab title="Character Groups">
57+
<character-groups />
58+
</b-tab>
5659
<b-tab title="Line Counts">
5760
<character-line-stats />
5861
</b-tab>
@@ -154,10 +157,11 @@ import { required } from 'vuelidate/lib/validators';
154157
import { mapGetters, mapActions } from 'vuex';
155158
import CharacterLineStats from '@/vue_components/show/config/characters/CharacterLineStats.vue';
156159
import log from 'loglevel';
160+
import CharacterGroups from '@/vue_components/show/config/characters/CharacterGroups.vue';
157161
158162
export default {
159163
name: 'ConfigCharacters',
160-
components: { CharacterLineStats },
164+
components: { CharacterGroups, CharacterLineStats },
161165
data() {
162166
return {
163167
rowsPerPage: 15,

client/src/views/show/config/ConfigCharacterGroups.vue renamed to client/src/vue_components/show/config/characters/CharacterGroups.vue

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,56 @@
11
<template>
2-
<b-container class="mx-0" fluid>
3-
<b-row>
4-
<b-col>
5-
<h5>Character Groups</h5>
6-
<b-table
7-
id="character-group-table"
8-
:items="CHARACTER_GROUP_LIST"
9-
:fields="characterGroupFields"
10-
:per-page="rowsPerPage"
11-
:current-page="currentPage"
12-
show-empty
13-
>
14-
<template #head(btn)="data">
15-
<b-button v-if="IS_SHOW_EDITOR" v-b-modal.new-character-group variant="outline-success">
16-
New Character Group
17-
</b-button>
18-
</template>
19-
<template #cell(characters)="data">
20-
<div style="overflow-wrap: break-word">
21-
<p>
22-
{{
23-
CHARACTER_LIST.filter((c) => data.item.characters.includes(c.id))
24-
.map((c) => c.name)
25-
.join(', ')
26-
}}
27-
</p>
28-
</div>
29-
</template>
30-
<template #cell(btn)="data">
31-
<b-button-group v-if="IS_SHOW_EDITOR">
32-
<b-button
33-
variant="warning"
34-
:disabled="submittingEditGroup || deletingGroup"
35-
@click="openEditForm(data)"
36-
>
37-
Edit
38-
</b-button>
39-
<b-button
40-
variant="danger"
41-
:disabled="submittingEditGroup || deletingGroup"
42-
@click="deleteCharacterGroup(data)"
43-
>
44-
Delete
45-
</b-button>
46-
</b-button-group>
47-
</template>
48-
</b-table>
49-
<b-pagination
50-
v-show="CHARACTER_GROUP_LIST.length > rowsPerPage"
51-
v-model="currentPage"
52-
:total-rows="CHARACTER_GROUP_LIST.length"
53-
:per-page="rowsPerPage"
54-
aria-controls="character-group-table"
55-
class="justify-content-center"
56-
/>
57-
</b-col>
58-
</b-row>
2+
<span v-if="!loading">
3+
<b-table
4+
id="character-group-table"
5+
:items="CHARACTER_GROUP_LIST"
6+
:fields="characterGroupFields"
7+
:per-page="rowsPerPage"
8+
:current-page="currentPage"
9+
show-empty
10+
>
11+
<template #head(btn)="data">
12+
<b-button v-if="IS_SHOW_EDITOR" v-b-modal.new-character-group variant="outline-success">
13+
New Character Group
14+
</b-button>
15+
</template>
16+
<template #cell(characters)="data">
17+
<div style="overflow-wrap: break-word">
18+
<p>
19+
{{
20+
CHARACTER_LIST.filter((c) => data.item.characters.includes(c.id))
21+
.map((c) => c.name)
22+
.join(', ')
23+
}}
24+
</p>
25+
</div>
26+
</template>
27+
<template #cell(btn)="data">
28+
<b-button-group v-if="IS_SHOW_EDITOR">
29+
<b-button
30+
variant="warning"
31+
:disabled="submittingEditGroup || deletingGroup"
32+
@click="openEditForm(data)"
33+
>
34+
Edit
35+
</b-button>
36+
<b-button
37+
variant="danger"
38+
:disabled="submittingEditGroup || deletingGroup"
39+
@click="deleteCharacterGroup(data)"
40+
>
41+
Delete
42+
</b-button>
43+
</b-button-group>
44+
</template>
45+
</b-table>
46+
<b-pagination
47+
v-show="CHARACTER_GROUP_LIST.length > rowsPerPage"
48+
v-model="currentPage"
49+
:total-rows="CHARACTER_GROUP_LIST.length"
50+
:per-page="rowsPerPage"
51+
aria-controls="character-group-table"
52+
class="justify-content-center"
53+
/>
5954
<b-modal
6055
id="new-character-group"
6156
ref="new-character"
@@ -155,7 +150,10 @@
155150
</b-form-group>
156151
</b-form>
157152
</b-modal>
158-
</b-container>
153+
</span>
154+
<div v-else class="text-center py-5">
155+
<b-spinner label="Loading" />
156+
</div>
159157
</template>
160158

161159
<script>
@@ -164,9 +162,10 @@ import { required } from 'vuelidate/lib/validators';
164162
import log from 'loglevel';
165163
166164
export default {
167-
name: 'ConfigCharacterGroups',
165+
name: 'CharacterGroups',
168166
data() {
169167
return {
168+
loading: true,
170169
characterGroupFields: ['name', 'description', 'characters', { key: 'btn', label: '' }],
171170
rowsPerPage: 15,
172171
currentPage: 1,
@@ -210,6 +209,7 @@ export default {
210209
async mounted() {
211210
await this.GET_CHARACTER_LIST();
212211
await this.GET_CHARACTER_GROUP_LIST();
212+
this.loading = false;
213213
},
214214
methods: {
215215
newSelectChanged(value, id) {

0 commit comments

Comments
 (0)