Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "client",
"version": "0.21.1",
"version": "0.22.0",
"private": true,
"scripts": {
"prebuild": "scripts/copy-docs.sh && node scripts/generate-doc-manifest.js",
Expand Down
32 changes: 28 additions & 4 deletions client/src/store/modules/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,15 @@ export default {
}
},
async DELETE_CUE(context, cue) {
const response = await fetch(`${makeURL('/api/v1/show/cues')}`, {
const searchParams = new URLSearchParams({
cueId: cue.cueId,
lineId: cue.lineId,
});
const response = await fetch(`${makeURL('/api/v1/show/cues')}?${searchParams}`, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(cue),
});
if (response.ok) {
context.dispatch('LOAD_CUES');
Expand All @@ -202,6 +205,25 @@ export default {
Vue.$toast.error('Unable to delete cue');
}
},
async SEARCH_CUES(context, { identifier, cueTypeId }) {
const params = new URLSearchParams();
params.append('identifier', identifier);
params.append('cue_type_id', cueTypeId);

const response = await fetch(`${makeURL('/api/v1/show/cues/search')}?${params}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});

if (response.ok) {
const result = await response.json();
return result;
}
log.error('Unable to search for cue');
throw new Error('Cue search failed');
},
async GET_CUTS(context) {
const response = await fetch(`${makeURL('/api/v1/show/script/cuts')}`, {
method: 'GET',
Expand Down Expand Up @@ -265,12 +287,14 @@ export default {
}
},
async DELETE_STAGE_DIRECTION_STYLE(context, styleId) {
const response = await fetch(`${makeURL('/api/v1/show/script/stage_direction_styles')}`, {
const searchParams = new URLSearchParams({
id: styleId,
});
const response = await fetch(`${makeURL('/api/v1/show/script/stage_direction_styles')}?${searchParams}`, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ id: styleId }),
});
if (response.ok) {
context.dispatch('GET_STAGE_DIRECTION_STYLES');
Expand Down
140 changes: 126 additions & 14 deletions client/src/store/modules/show.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default {
micAllocations: [],
noLeaderToast: null,
scriptModes: [],
sessionTags: [],
},
mutations: {
SET_CAST_LIST(state, castList) {
Expand All @@ -45,6 +46,7 @@ export default {
state.characterList = [];
state.actList = [];
state.sceneList = [];
state.sessionTags = [];
},
SET_SESSIONS_LIST(state, sessions) {
state.sessions = sessions;
Expand All @@ -70,6 +72,9 @@ export default {
UPDATE_SCRIPT_MODES(state, modes) {
state.scriptModes = modes;
},
SET_SESSION_TAGS(state, tags) {
state.sessionTags = tags;
},
},
actions: {
async GET_CAST_LIST(context) {
Expand Down Expand Up @@ -98,12 +103,14 @@ export default {
}
},
async DELETE_CAST_MEMBER(context, castID) {
const response = await fetch(`${makeURL('/api/v1/show/cast')}`, {
const searchParams = new URLSearchParams({
id: castID,
});
const response = await fetch(`${makeURL('/api/v1/show/cast')}?${searchParams}`, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ id: castID }),
});
if (response.ok) {
context.dispatch('GET_CAST_LIST');
Expand Down Expand Up @@ -155,12 +162,14 @@ export default {
}
},
async DELETE_CHARACTER(context, characterID) {
const response = await fetch(`${makeURL('/api/v1/show/character')}`, {
const searchParams = new URLSearchParams({
id: characterID,
});
const response = await fetch(`${makeURL('/api/v1/show/character')}?${searchParams}`, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ id: characterID }),
});
if (response.ok) {
context.dispatch('GET_CHARACTER_LIST');
Expand Down Expand Up @@ -213,12 +222,14 @@ export default {
}
},
async DELETE_CHARACTER_GROUP(context, characterGroupID) {
const response = await fetch(`${makeURL('/api/v1/show/character/group')}`, {
const searchParams = new URLSearchParams({
id: characterGroupID,
});
const response = await fetch(`${makeURL('/api/v1/show/character/group')}?${searchParams}`, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ id: characterGroupID }),
});
if (response.ok) {
context.dispatch('GET_CHARACTER_GROUP_LIST');
Expand Down Expand Up @@ -270,12 +281,14 @@ export default {
}
},
async DELETE_ACT(context, actID) {
const response = await fetch(`${makeURL('/api/v1/show/act')}`, {
const searchParams = new URLSearchParams({
id: actID,
});
const response = await fetch(`${makeURL('/api/v1/show/act')}?${searchParams}`, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ id: actID }),
});
if (response.ok) {
context.dispatch('GET_ACT_LIST');
Expand Down Expand Up @@ -344,12 +357,14 @@ export default {
}
},
async DELETE_SCENE(context, sceneID) {
const response = await fetch(`${makeURL('/api/v1/show/scene')}`, {
const searchParams = new URLSearchParams({
id: sceneID,
});
const response = await fetch(`${makeURL('/api/v1/show/scene')}?${searchParams}`, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ id: sceneID }),
});
if (response.ok) {
context.dispatch('GET_SCENE_LIST');
Expand Down Expand Up @@ -403,12 +418,14 @@ export default {
}
},
async DELETE_CUE_TYPE(context, cueTypeID) {
const response = await fetch(`${makeURL('/api/v1/show/cues/types')}`, {
const searchParams = new URLSearchParams({
id: cueTypeID,
});
const response = await fetch(`${makeURL('/api/v1/show/cues/types')}?${searchParams}`, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ id: cueTypeID }),
});
if (response.ok) {
context.dispatch('GET_CUE_TYPES');
Expand Down Expand Up @@ -493,12 +510,14 @@ export default {
}
},
async DELETE_MICROPHONE(context, microphoneId) {
const response = await fetch(`${makeURL('/api/v1/show/microphones')}`, {
const searchParams = new URLSearchParams({
id: microphoneId,
});
const response = await fetch(`${makeURL('/api/v1/show/microphones')}?${searchParams}`, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ id: microphoneId }),
});
if (response.ok) {
context.dispatch('GET_MICROPHONE_LIST');
Expand Down Expand Up @@ -558,6 +577,83 @@ export default {
log.error('Unable to fetch script modes');
}
},
async GET_SESSION_TAGS(context) {
const response = await fetch(`${makeURL('/api/v1/show/session/tags')}`);
if (response.ok) {
const data = await response.json();
context.commit('SET_SESSION_TAGS', data.tags);
} else {
log.error('Unable to get session tags');
}
},
async ADD_SESSION_TAG(context, tag) {
const response = await fetch(`${makeURL('/api/v1/show/session/tags')}`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(tag),
});
if (response.ok) {
context.dispatch('GET_SESSION_TAGS');
Vue.$toast.success('Added new session tag!');
} else {
log.error('Unable to add session tag');
Vue.$toast.error('Unable to add session tag');
}
},
async UPDATE_SESSION_TAG(context, tag) {
const response = await fetch(`${makeURL('/api/v1/show/session/tags')}`, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(tag),
});
if (response.ok) {
context.dispatch('GET_SESSION_TAGS');
Vue.$toast.success('Updated session tag!');
} else {
log.error('Unable to edit session tag');
Vue.$toast.error('Unable to edit session tag');
}
},
async DELETE_SESSION_TAG(context, tagId) {
const response = await fetch(`${makeURL('/api/v1/show/session/tags')}?id=${tagId}`, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json',
},
});
if (response.ok) {
context.dispatch('GET_SESSION_TAGS');
Vue.$toast.success('Deleted session tag!');
} else {
log.error('Unable to delete session tag');
Vue.$toast.error('Unable to delete session tag');
}
},
async UPDATE_SESSION_TAGS(context, { sessionId, tagIds }) {
const response = await fetch(`${makeURL('/api/v1/show/sessions/assign-tags')}`, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
session_id: sessionId,
tag_ids: tagIds,
}),
});
if (response.ok) {
await context.dispatch('GET_SHOW_SESSION_DATA');
Vue.$toast.success('Updated session tags!');
} else {
const errorData = await response.json().catch(() => ({}));
log.error('Unable to update session tags:', errorData);
Vue.$toast.error(errorData.message || 'Unable to update session tags');
throw new Error('Failed to update session tags');
}
},
},
getters: {
CAST_LIST(state) {
Expand Down Expand Up @@ -741,5 +837,21 @@ export default {
SCRIPT_MODES(state) {
return state.scriptModes;
},
SESSION_TAGS(state) {
return state.sessionTags;
},
SESSION_TAGS_DICT(state) {
return Object.fromEntries(state.sessionTags.map((tag) => [tag.id, tag]));
},
SESSION_TAG_BY_ID: (state, getters) => (tagId) => {
if (tagId == null) {
return null;
}
const tagStr = tagId.toString();
if (Object.keys(getters.SESSION_TAGS_DICT).includes(tagStr)) {
return getters.SESSION_TAGS_DICT[tagStr];
}
return null;
},
},
};
Loading
Loading