Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
218 changes: 126 additions & 92 deletions client-v3/package-lock.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions client-v3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"d3-zoom": "^3.0.0",
"deep-object-diff": "1.1.9",
"dompurify": "^3.4.8",
"fuse.js": "^7.4.1",
"fuse.js": "^7.4.2",
"lodash": "^4.18.1",
"loglevel": "^1.9.2",
"marked": "^18.0.5",
Expand All @@ -55,14 +55,14 @@
"vue-toast-notification": "^3.1.3"
},
"devDependencies": {
"@emnapi/core": "1.10.0",
"@emnapi/runtime": "1.10.0",
"@emnapi/core": "1.11.0",
"@emnapi/runtime": "1.11.0",
"@eslint/js": "^10.0.1",
"@iconify-json/mdi": "^1.2.3",
"@types/lodash": "~4.17.24",
"@types/node": ">=22.12.0",
"@typescript-eslint/eslint-plugin": "^8.60.1",
"@typescript-eslint/parser": "^8.60.1",
"@typescript-eslint/eslint-plugin": "^8.61.0",
"@typescript-eslint/parser": "^8.61.0",
"@vitejs/plugin-vue": "^6.0.7",
"@vitest/ui": "^4.1.8",
"@vue/test-utils": "^2.4.11",
Expand All @@ -76,7 +76,7 @@
"prettier": "^3.8.3",
"sass": "1.100.0",
"typescript": "^6.0.3",
"typescript-eslint": "^8.60.1",
"typescript-eslint": "^8.61.0",
"unplugin-icons": "^23.0.1",
"unplugin-vue-components": "^32.1.0",
"vite": "^8.0.16",
Expand Down
2 changes: 1 addition & 1 deletion client-v3/src/components/config/ConfigShows.vue
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ const isSubmittingLoad = ref(false);
const isSubmittingShow = ref(false);
const isDeleting = ref(false);
const deletingId = ref<number | null>(null);
const { perPage, currentPage } = usePagination();
const { perPage, currentPage } = usePagination(15, 'config_shows');

const showFields = [
{ key: 'id', label: 'ID' },
Expand Down
2 changes: 1 addition & 1 deletion client-v3/src/components/config/ConfigSystem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const { connectedSessions, versionStatus, serverInfo } = storeToRefs(systemStore

const loading = ref(true);
const isCheckingVersion = ref(false);
const { perPage, currentPage } = usePagination();
const { perPage, currentPage } = usePagination(15, 'config_system_clients');
const clientsModal = ref<InstanceType<typeof BModal>>();

const clientFields = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const showStore = useShowStore();
const { confirm } = useConfirm();

const loading = ref(true);
const { perPage, currentPage } = usePagination();
const { perPage, currentPage } = usePagination(15, 'config_acts');
const submittingNewAct = ref(false);
const submittingEditAct = ref(false);
const deletingAct = ref(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ const showStore = useShowStore();
const { confirm } = useConfirm();

const loading = ref(true);
const { perPage, currentPage } = usePagination();
const { perPage, currentPage } = usePagination(15, 'config_scenes');
const submittingNewScene = ref(false);
const submittingEditScene = ref(false);
const submittingFirstScene = ref(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ const showStore = useShowStore();
const { confirm } = useConfirm();

const loading = ref(true);
const { perPage, currentPage } = usePagination();
const { perPage, currentPage } = usePagination(15, 'config_character_groups');
const submittingNewGroup = ref(false);
const submittingEditGroup = ref(false);
const deletingGroup = ref(false);
Expand Down
2 changes: 1 addition & 1 deletion client-v3/src/components/show/config/mics/MicList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const systemStore = useSystemStore();
const { confirm } = useConfirm();
const { validationState } = useFormValidation();

const { perPage, currentPage } = usePagination();
const { perPage, currentPage } = usePagination(15, 'config_mics');
const isSubmitting = ref(false);

const newModal = ref<InstanceType<typeof BModal>>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ const systemStore = useSystemStore();
const { confirm } = useConfirm();
const { validationState } = useFormValidation();

const { perPage, currentPage } = usePagination();
const { perPage, currentPage } = usePagination(15, 'show_stage_direction_styles');
const isSubmittingNew = ref(false);
const isSubmittingEdit = ref(false);
const isDeleting = ref(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ const systemStore = useSystemStore();
const showStore = useShowStore();
const { confirm } = useConfirm();

const { perPage, currentPage } = usePagination();
const { perPage, currentPage } = usePagination(15, 'config_session_tags');
const isSubmittingNewTag = ref(false);
const isSubmittingEditTag = ref(false);
const isSubmittingDeleteTag = ref(false);
Expand Down
2 changes: 1 addition & 1 deletion client-v3/src/components/show/config/stage/CrewList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const systemStore = useSystemStore();
const { confirm } = useConfirm();
const { validationState } = useFormValidation();

const { perPage, currentPage } = usePagination();
const { perPage, currentPage } = usePagination(15, 'config_crew');
const isSubmitting = ref(false);

const newModal = ref<InstanceType<typeof BModal>>();
Expand Down
7 changes: 5 additions & 2 deletions client-v3/src/components/show/config/stage/PropsList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,11 @@ const systemStore = useSystemStore();
const { confirm } = useConfirm();
const { validationState } = useFormValidation();

const { perPage: propTypesPerPage, currentPage: currentPropTypesPage } = usePagination();
const { perPage: propsPerPage, currentPage: currentPropsPage } = usePagination();
const { perPage: propTypesPerPage, currentPage: currentPropTypesPage } = usePagination(
15,
'config_prop_types'
);
const { perPage: propsPerPage, currentPage: currentPropsPage } = usePagination(15, 'config_props');
const isSubmitting = ref(false);

const newPropTypeModal = ref<InstanceType<typeof BModal>>();
Expand Down
10 changes: 8 additions & 2 deletions client-v3/src/components/show/config/stage/SceneryList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,14 @@ const systemStore = useSystemStore();
const { confirm } = useConfirm();
const { validationState } = useFormValidation();

const { perPage: sceneryTypesPerPage, currentPage: currentSceneryTypesPage } = usePagination();
const { perPage: sceneryPerPage, currentPage: currentSceneryPage } = usePagination();
const { perPage: sceneryTypesPerPage, currentPage: currentSceneryTypesPage } = usePagination(
15,
'config_scenery_types'
);
const { perPage: sceneryPerPage, currentPage: currentSceneryPage } = usePagination(
15,
'config_scenery'
);
const isSubmitting = ref(false);

const newSceneryTypeModal = ref<InstanceType<typeof BModal>>();
Expand Down
10 changes: 8 additions & 2 deletions client-v3/src/components/show/config/stage/StageManager.vue
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,14 @@ const setExpanded = ref(false);
const strikeExpanded = ref(false);
const savingAssignment = ref(false);
const newCrewSelections = ref<Record<string, number | null>>({});
const { perPage: sceneryAllocPerPage, currentPage: currentSceneryAllocPage } = usePagination();
const { perPage: propsAllocPerPage, currentPage: currentPropsAllocPage } = usePagination();
const { perPage: sceneryAllocPerPage, currentPage: currentSceneryAllocPage } = usePagination(
15,
'config_stage_scenery_alloc'
);
const { perPage: propsAllocPerPage, currentPage: currentPropsAllocPage } = usePagination(
15,
'config_stage_props_alloc'
);

const goToSceneModal = ref<InstanceType<typeof BModal>>();
const addSceneryModal = ref<InstanceType<typeof BModal>>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ const columns = [
{ key: 'example', label: 'Example Cue Button' },
{ key: 'btn', label: '' },
];
const { perPage, currentPage } = usePagination();
const { perPage, currentPage } = usePagination(15, 'user_cue_colour_prefs');

const cueTypes = ref<CueType[]>([]);
const isSubmittingNew = ref(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ const columns = [
{ key: 'example', label: 'Example Stage Direction' },
{ key: 'btn', label: '' },
];
const { perPage, currentPage } = usePagination();
const { perPage, currentPage } = usePagination(15, 'user_stage_direction_styles');

const stageDirectionStyles = ref<StageDirectionStyle[]>([]);
const isSubmittingNew = ref(false);
Expand Down
17 changes: 14 additions & 3 deletions client-v3/src/composables/usePagination.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { ref, watch } from 'vue';
import { useUserStore } from '@/stores/user';
import type { UserSettings } from '@/types/api/user';

export const PER_PAGE_OPTIONS = [
{ value: 10, text: '10' },
Expand All @@ -8,12 +10,21 @@ export const PER_PAGE_OPTIONS = [
{ value: 0, text: 'All' },
] as const;

export function usePagination(defaultPerPage = 15) {
const perPage = ref(defaultPerPage);
export function usePagination(defaultPerPage = 15, tableKey?: string) {
const userStore = useUserStore();

const storedValue = tableKey
? ((userStore.userSettings as UserSettings).table_page_sizes?.[tableKey] ?? defaultPerPage)
: defaultPerPage;

const perPage = ref(storedValue);
const currentPage = ref(1);

watch(perPage, () => {
watch(perPage, (newValue) => {
currentPage.value = 1;
if (tableKey) {
userStore.updateTablePageSize(tableKey, newValue);
}
});

return { perPage, currentPage };
Expand Down
9 changes: 9 additions & 0 deletions client-v3/src/stores/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,15 @@ export const useUserStore = defineStore('user', {
}
},

async updateTablePageSize(tableKey: string, value: number): Promise<void> {
const current = (this.userSettings as UserSettings).table_page_sizes ?? {};
await fetch(makeURL('/api/v1/user/settings'), {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ table_page_sizes: { ...current, [tableKey]: value } }),
});
},

async setupTokenRefresh(): Promise<void> {
if (this.tokenRefreshInterval) clearInterval(this.tokenRefreshInterval);
const refreshInterval = setInterval(
Expand Down
1 change: 1 addition & 0 deletions client-v3/src/types/api/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ export interface UserSettings {
character_mru_sort: boolean;
character_combined_dropdown: boolean;
preferred_ui: string | null;
table_page_sizes: Record<string, number> | null;
}
2 changes: 1 addition & 1 deletion client-v3/src/views/show/config/ConfigCast.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ const systemStore = useSystemStore();
const showStore = useShowStore();
const { confirm } = useConfirm();

const { perPage, currentPage } = usePagination();
const { perPage, currentPage } = usePagination(15, 'config_cast');
const submittingNewCast = ref(false);
const submittingEditCast = ref(false);
const deletingCast = ref(false);
Expand Down
2 changes: 1 addition & 1 deletion client-v3/src/views/show/config/ConfigCharacters.vue
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ const systemStore = useSystemStore();
const showStore = useShowStore();
const { confirm } = useConfirm();

const { perPage, currentPage } = usePagination();
const { perPage, currentPage } = usePagination(15, 'config_characters');
const submittingNewCharacter = ref(false);
const submittingEditCharacter = ref(false);
const deletingCharacter = ref(false);
Expand Down
2 changes: 1 addition & 1 deletion client-v3/src/views/show/config/ConfigCues.vue
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ const systemStore = useSystemStore();
const showStore = useShowStore();
const { confirm } = useConfirm();

const { perPage, currentPage } = usePagination();
const { perPage, currentPage } = usePagination(15, 'config_cues');
const submittingNewCueType = ref(false);
const submittingEditCueType = ref(false);
const deletingCueType = ref(false);
Expand Down
Loading
Loading