Skip to content

Commit cb235b1

Browse files
authored
Merge pull request #816 from dreamteamprod/dev
Release 0.22.0
2 parents 421af0d + 845fcb1 commit cb235b1

File tree

35 files changed

+3250
-173
lines changed

35 files changed

+3250
-173
lines changed

client/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "client",
3-
"version": "0.21.1",
3+
"version": "0.22.0",
44
"private": true,
55
"scripts": {
66
"prebuild": "scripts/copy-docs.sh && node scripts/generate-doc-manifest.js",

client/src/store/modules/script.js

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,15 @@ export default {
187187
}
188188
},
189189
async DELETE_CUE(context, cue) {
190-
const response = await fetch(`${makeURL('/api/v1/show/cues')}`, {
190+
const searchParams = new URLSearchParams({
191+
cueId: cue.cueId,
192+
lineId: cue.lineId,
193+
});
194+
const response = await fetch(`${makeURL('/api/v1/show/cues')}?${searchParams}`, {
191195
method: 'DELETE',
192196
headers: {
193197
'Content-Type': 'application/json',
194198
},
195-
body: JSON.stringify(cue),
196199
});
197200
if (response.ok) {
198201
context.dispatch('LOAD_CUES');
@@ -202,6 +205,25 @@ export default {
202205
Vue.$toast.error('Unable to delete cue');
203206
}
204207
},
208+
async SEARCH_CUES(context, { identifier, cueTypeId }) {
209+
const params = new URLSearchParams();
210+
params.append('identifier', identifier);
211+
params.append('cue_type_id', cueTypeId);
212+
213+
const response = await fetch(`${makeURL('/api/v1/show/cues/search')}?${params}`, {
214+
method: 'GET',
215+
headers: {
216+
'Content-Type': 'application/json',
217+
},
218+
});
219+
220+
if (response.ok) {
221+
const result = await response.json();
222+
return result;
223+
}
224+
log.error('Unable to search for cue');
225+
throw new Error('Cue search failed');
226+
},
205227
async GET_CUTS(context) {
206228
const response = await fetch(`${makeURL('/api/v1/show/script/cuts')}`, {
207229
method: 'GET',
@@ -265,12 +287,14 @@ export default {
265287
}
266288
},
267289
async DELETE_STAGE_DIRECTION_STYLE(context, styleId) {
268-
const response = await fetch(`${makeURL('/api/v1/show/script/stage_direction_styles')}`, {
290+
const searchParams = new URLSearchParams({
291+
id: styleId,
292+
});
293+
const response = await fetch(`${makeURL('/api/v1/show/script/stage_direction_styles')}?${searchParams}`, {
269294
method: 'DELETE',
270295
headers: {
271296
'Content-Type': 'application/json',
272297
},
273-
body: JSON.stringify({ id: styleId }),
274298
});
275299
if (response.ok) {
276300
context.dispatch('GET_STAGE_DIRECTION_STYLES');

client/src/store/modules/show.js

Lines changed: 126 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export default {
2020
micAllocations: [],
2121
noLeaderToast: null,
2222
scriptModes: [],
23+
sessionTags: [],
2324
},
2425
mutations: {
2526
SET_CAST_LIST(state, castList) {
@@ -45,6 +46,7 @@ export default {
4546
state.characterList = [];
4647
state.actList = [];
4748
state.sceneList = [];
49+
state.sessionTags = [];
4850
},
4951
SET_SESSIONS_LIST(state, sessions) {
5052
state.sessions = sessions;
@@ -70,6 +72,9 @@ export default {
7072
UPDATE_SCRIPT_MODES(state, modes) {
7173
state.scriptModes = modes;
7274
},
75+
SET_SESSION_TAGS(state, tags) {
76+
state.sessionTags = tags;
77+
},
7378
},
7479
actions: {
7580
async GET_CAST_LIST(context) {
@@ -98,12 +103,14 @@ export default {
98103
}
99104
},
100105
async DELETE_CAST_MEMBER(context, castID) {
101-
const response = await fetch(`${makeURL('/api/v1/show/cast')}`, {
106+
const searchParams = new URLSearchParams({
107+
id: castID,
108+
});
109+
const response = await fetch(`${makeURL('/api/v1/show/cast')}?${searchParams}`, {
102110
method: 'DELETE',
103111
headers: {
104112
'Content-Type': 'application/json',
105113
},
106-
body: JSON.stringify({ id: castID }),
107114
});
108115
if (response.ok) {
109116
context.dispatch('GET_CAST_LIST');
@@ -155,12 +162,14 @@ export default {
155162
}
156163
},
157164
async DELETE_CHARACTER(context, characterID) {
158-
const response = await fetch(`${makeURL('/api/v1/show/character')}`, {
165+
const searchParams = new URLSearchParams({
166+
id: characterID,
167+
});
168+
const response = await fetch(`${makeURL('/api/v1/show/character')}?${searchParams}`, {
159169
method: 'DELETE',
160170
headers: {
161171
'Content-Type': 'application/json',
162172
},
163-
body: JSON.stringify({ id: characterID }),
164173
});
165174
if (response.ok) {
166175
context.dispatch('GET_CHARACTER_LIST');
@@ -213,12 +222,14 @@ export default {
213222
}
214223
},
215224
async DELETE_CHARACTER_GROUP(context, characterGroupID) {
216-
const response = await fetch(`${makeURL('/api/v1/show/character/group')}`, {
225+
const searchParams = new URLSearchParams({
226+
id: characterGroupID,
227+
});
228+
const response = await fetch(`${makeURL('/api/v1/show/character/group')}?${searchParams}`, {
217229
method: 'DELETE',
218230
headers: {
219231
'Content-Type': 'application/json',
220232
},
221-
body: JSON.stringify({ id: characterGroupID }),
222233
});
223234
if (response.ok) {
224235
context.dispatch('GET_CHARACTER_GROUP_LIST');
@@ -270,12 +281,14 @@ export default {
270281
}
271282
},
272283
async DELETE_ACT(context, actID) {
273-
const response = await fetch(`${makeURL('/api/v1/show/act')}`, {
284+
const searchParams = new URLSearchParams({
285+
id: actID,
286+
});
287+
const response = await fetch(`${makeURL('/api/v1/show/act')}?${searchParams}`, {
274288
method: 'DELETE',
275289
headers: {
276290
'Content-Type': 'application/json',
277291
},
278-
body: JSON.stringify({ id: actID }),
279292
});
280293
if (response.ok) {
281294
context.dispatch('GET_ACT_LIST');
@@ -344,12 +357,14 @@ export default {
344357
}
345358
},
346359
async DELETE_SCENE(context, sceneID) {
347-
const response = await fetch(`${makeURL('/api/v1/show/scene')}`, {
360+
const searchParams = new URLSearchParams({
361+
id: sceneID,
362+
});
363+
const response = await fetch(`${makeURL('/api/v1/show/scene')}?${searchParams}`, {
348364
method: 'DELETE',
349365
headers: {
350366
'Content-Type': 'application/json',
351367
},
352-
body: JSON.stringify({ id: sceneID }),
353368
});
354369
if (response.ok) {
355370
context.dispatch('GET_SCENE_LIST');
@@ -403,12 +418,14 @@ export default {
403418
}
404419
},
405420
async DELETE_CUE_TYPE(context, cueTypeID) {
406-
const response = await fetch(`${makeURL('/api/v1/show/cues/types')}`, {
421+
const searchParams = new URLSearchParams({
422+
id: cueTypeID,
423+
});
424+
const response = await fetch(`${makeURL('/api/v1/show/cues/types')}?${searchParams}`, {
407425
method: 'DELETE',
408426
headers: {
409427
'Content-Type': 'application/json',
410428
},
411-
body: JSON.stringify({ id: cueTypeID }),
412429
});
413430
if (response.ok) {
414431
context.dispatch('GET_CUE_TYPES');
@@ -493,12 +510,14 @@ export default {
493510
}
494511
},
495512
async DELETE_MICROPHONE(context, microphoneId) {
496-
const response = await fetch(`${makeURL('/api/v1/show/microphones')}`, {
513+
const searchParams = new URLSearchParams({
514+
id: microphoneId,
515+
});
516+
const response = await fetch(`${makeURL('/api/v1/show/microphones')}?${searchParams}`, {
497517
method: 'DELETE',
498518
headers: {
499519
'Content-Type': 'application/json',
500520
},
501-
body: JSON.stringify({ id: microphoneId }),
502521
});
503522
if (response.ok) {
504523
context.dispatch('GET_MICROPHONE_LIST');
@@ -558,6 +577,83 @@ export default {
558577
log.error('Unable to fetch script modes');
559578
}
560579
},
580+
async GET_SESSION_TAGS(context) {
581+
const response = await fetch(`${makeURL('/api/v1/show/session/tags')}`);
582+
if (response.ok) {
583+
const data = await response.json();
584+
context.commit('SET_SESSION_TAGS', data.tags);
585+
} else {
586+
log.error('Unable to get session tags');
587+
}
588+
},
589+
async ADD_SESSION_TAG(context, tag) {
590+
const response = await fetch(`${makeURL('/api/v1/show/session/tags')}`, {
591+
method: 'POST',
592+
headers: {
593+
'Content-Type': 'application/json',
594+
},
595+
body: JSON.stringify(tag),
596+
});
597+
if (response.ok) {
598+
context.dispatch('GET_SESSION_TAGS');
599+
Vue.$toast.success('Added new session tag!');
600+
} else {
601+
log.error('Unable to add session tag');
602+
Vue.$toast.error('Unable to add session tag');
603+
}
604+
},
605+
async UPDATE_SESSION_TAG(context, tag) {
606+
const response = await fetch(`${makeURL('/api/v1/show/session/tags')}`, {
607+
method: 'PATCH',
608+
headers: {
609+
'Content-Type': 'application/json',
610+
},
611+
body: JSON.stringify(tag),
612+
});
613+
if (response.ok) {
614+
context.dispatch('GET_SESSION_TAGS');
615+
Vue.$toast.success('Updated session tag!');
616+
} else {
617+
log.error('Unable to edit session tag');
618+
Vue.$toast.error('Unable to edit session tag');
619+
}
620+
},
621+
async DELETE_SESSION_TAG(context, tagId) {
622+
const response = await fetch(`${makeURL('/api/v1/show/session/tags')}?id=${tagId}`, {
623+
method: 'DELETE',
624+
headers: {
625+
'Content-Type': 'application/json',
626+
},
627+
});
628+
if (response.ok) {
629+
context.dispatch('GET_SESSION_TAGS');
630+
Vue.$toast.success('Deleted session tag!');
631+
} else {
632+
log.error('Unable to delete session tag');
633+
Vue.$toast.error('Unable to delete session tag');
634+
}
635+
},
636+
async UPDATE_SESSION_TAGS(context, { sessionId, tagIds }) {
637+
const response = await fetch(`${makeURL('/api/v1/show/sessions/assign-tags')}`, {
638+
method: 'PATCH',
639+
headers: {
640+
'Content-Type': 'application/json',
641+
},
642+
body: JSON.stringify({
643+
session_id: sessionId,
644+
tag_ids: tagIds,
645+
}),
646+
});
647+
if (response.ok) {
648+
await context.dispatch('GET_SHOW_SESSION_DATA');
649+
Vue.$toast.success('Updated session tags!');
650+
} else {
651+
const errorData = await response.json().catch(() => ({}));
652+
log.error('Unable to update session tags:', errorData);
653+
Vue.$toast.error(errorData.message || 'Unable to update session tags');
654+
throw new Error('Failed to update session tags');
655+
}
656+
},
561657
},
562658
getters: {
563659
CAST_LIST(state) {
@@ -741,5 +837,21 @@ export default {
741837
SCRIPT_MODES(state) {
742838
return state.scriptModes;
743839
},
840+
SESSION_TAGS(state) {
841+
return state.sessionTags;
842+
},
843+
SESSION_TAGS_DICT(state) {
844+
return Object.fromEntries(state.sessionTags.map((tag) => [tag.id, tag]));
845+
},
846+
SESSION_TAG_BY_ID: (state, getters) => (tagId) => {
847+
if (tagId == null) {
848+
return null;
849+
}
850+
const tagStr = tagId.toString();
851+
if (Object.keys(getters.SESSION_TAGS_DICT).includes(tagStr)) {
852+
return getters.SESSION_TAGS_DICT[tagStr];
853+
}
854+
return null;
855+
},
744856
},
745857
};

0 commit comments

Comments
 (0)