Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.7.14 #555

Merged
merged 11 commits into from
Jul 15, 2024
29,342 changes: 22,608 additions & 6,734 deletions client/package-lock.json

Large diffs are not rendered by default.

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.7.13",
"version": "0.7.14",
"private": true,
"scripts": {
"build": "vite build",
Expand Down
22 changes: 22 additions & 0 deletions client/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@
>
Stop Session
</b-dropdown-item-button>
<b-dropdown-item-btn
:disabled="CURRENT_SHOW_SESSION == null || !WEBSOCKET_HEALTHY || stoppingSession ||
startingSession"
@click.stop.prevent="reloadClients"
>
Reload Clients
</b-dropdown-item-btn>
</b-nav-item-dropdown>
</template>
<b-nav-item
Expand Down Expand Up @@ -92,7 +99,7 @@
</b-navbar-nav>
</b-collapse>
</b-navbar>
<template>

Check warning on line 102 in client/src/App.vue

View workflow job for this annotation

GitHub Actions / build

`<template>` require directive
<div
v-if="!loaded"
class="text-center center-spinner"
Expand Down Expand Up @@ -211,8 +218,23 @@
}
this.startingSession = false;
},
async reloadClients() {
if (this.INTERNAL_UUID == null) {
this.$toast.error('Unable to start new show session');
return;
}
this.startingSession = true;
const msg = 'Are you sure you want to reload all connected clients?';
const action = await this.$bvModal.msgBoxConfirm(msg, {});
if (action === true) {
this.$socket.sendObj({
OP: 'RELOAD_CLIENTS',
DATA: {},
});
}
},
},
computed: {

Check warning on line 237 in client/src/App.vue

View workflow job for this annotation

GitHub Actions / build

The "computed" property should be above the "methods" property on line 155
isAdminUser() {
return this.CURRENT_USER != null && this.CURRENT_USER.is_admin;
},
Expand Down Expand Up @@ -241,7 +263,7 @@
...mapGetters(['WEBSOCKET_HEALTHY', 'CURRENT_SHOW_SESSION', 'SETTINGS', 'CURRENT_USER',
'RBAC_ROLES', 'CURRENT_USER_RBAC', 'INTERNAL_UUID']),
},
async created() {

Check warning on line 266 in client/src/App.vue

View workflow job for this annotation

GitHub Actions / build

The "created" property should be above the "methods" property on line 155
this.$router.beforeEach(async (to, from, next) => {
if (!this.SETTINGS.has_admin_user) {
this.$toast.error('Please create an admin user before continuing');
Expand Down
21 changes: 18 additions & 3 deletions client/src/store/modules/show.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default {
sessionFollowData: {},
microphones: [],
micAllocations: [],
noLeaderToast: null,
},
mutations: {
SET_CAST_LIST(state, castList) {
Expand Down Expand Up @@ -57,6 +58,9 @@ export default {
SET_MIC_ALLOCATIONS_LIST(state, micAllocations) {
state.micAllocations = micAllocations;
},
SET_TOAST_INSTANCE(state, toast) {
state.noLeaderToast = toast;
},
},
actions: {
async GET_CAST_LIST(context) {
Expand Down Expand Up @@ -427,6 +431,11 @@ export default {
const sessions = await response.json();
context.commit('SET_SESSIONS_LIST', sessions.sessions);
context.commit('SET_CURRENT_SESSION', sessions.current_session);
if (context.getters.NO_LEADER_TOAST
&& context.getters.CURRENT_SHOW_SESSION.client_internal_id != null) {
context.getters.NO_LEADER_TOAST.dismiss();
context.commit('SET_TOAST_INSTANCE', null);
}
} else {
log.error('Unable to get show sessions');
}
Expand All @@ -438,9 +447,12 @@ export default {
},
async NO_LEADER(context, payload) {
await context.dispatch('GET_SHOW_SESSION_DATA');
Vue.$toast.warning('There is no script leader. Please scroll your own script!', {
duration: 0,
});
if (context.getters.NO_LEADER_TOAST == null) {
const instance = Vue.$toast.warning('There is no script leader. Please scroll your own script!', {
duration: 0,
});
context.commit('SET_TOAST_INSTANCE', instance);
}
},
SCRIPT_SCROLL(context, payload) {
context.commit('SET_SESSION_FOLLOW_DATA', payload.DATA);
Expand Down Expand Up @@ -614,6 +626,9 @@ export default {
MIC_ALLOCATIONS(state) {
return state.micAllocations;
},
NO_LEADER_TOAST(state) {
return state.noLeaderToast;
},
}
,
};
6 changes: 6 additions & 0 deletions client/src/store/modules/websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ export default {
if (state.errorCount !== 0) {
Vue.$toast.success(`Websocket reconnected after ${state.errorCount} attempts`);
state.errorCount = 0;
if (router.currentRoute !== '/') {
window.location.reload();
}
}
},
SOCKET_ONCLOSE(state, event) {
Expand Down Expand Up @@ -66,6 +69,9 @@ export default {
router.push('/');
}
break;
case 'RELOAD_CLIENT':
window.location.reload();
break;
default:
log.error(`Unknown OP received from websocket: ${message.OP}`);
}
Expand Down
54 changes: 40 additions & 14 deletions client/src/views/show/ShowLiveView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -161,17 +161,26 @@
if (this.isScriptFollowing || this.isScriptLeader) {
if (this.CURRENT_SHOW_SESSION.latest_line_ref != null) {
const loadCurrentPage = parseInt(this.CURRENT_SHOW_SESSION.latest_line_ref.split('_')[1], 10);
this.currentMinLoadedPage = Math.max(0, loadCurrentPage - this.pageBatchSize - 1);
this.currentLoadedPage = this.currentMinLoadedPage;
for (let loadIndex = this.currentMinLoadedPage;
loadIndex < loadCurrentPage + this.pageBatchSize; loadIndex++) {
// eslint-disable-next-line no-await-in-loop
await this.loadNextPage();

if (this.SETTINGS.enable_lazy_loading === false) {
this.currentMinLoadedPage = 1;
for (let loadIndex = 0; loadIndex < this.currentMaxPage; loadIndex++) {
// eslint-disable-next-line no-await-in-loop
await this.loadNextPage();
}
} else {
this.currentMinLoadedPage = Math.max(0, loadCurrentPage - this.pageBatchSize - 1);
this.currentLoadedPage = this.currentMinLoadedPage;
for (let loadIndex = this.currentMinLoadedPage;
loadIndex < loadCurrentPage + this.pageBatchSize; loadIndex++) {
// eslint-disable-next-line no-await-in-loop
await this.loadNextPage();
}
this.currentMinLoadedPage += 1;
}
this.currentMinLoadedPage += 1;

this.currentFirstPage = loadCurrentPage;
this.currentLastPage = loadCurrentPage;

await this.$nextTick();
this.initialLoad = true;
await this.$nextTick();
Expand All @@ -183,14 +192,28 @@
this.computeScriptBoundaries();
} else {
this.currentMinLoadedPage = 1;
await this.loadNextPage();
if (this.SETTINGS.enable_lazy_loading === false) {
for (let loadIndex = 0; loadIndex < this.currentMaxPage; loadIndex++) {
// eslint-disable-next-line no-await-in-loop
await this.loadNextPage();
}
} else {
await this.loadNextPage();
}
this.initialLoad = true;
await this.$nextTick();
this.computeScriptBoundaries();
}
} else {
this.currentMinLoadedPage = 1;
await this.loadNextPage();
if (this.SETTINGS.enable_lazy_loading === false) {
for (let loadIndex = 0; loadIndex < this.currentMaxPage; loadIndex++) {
// eslint-disable-next-line no-await-in-loop
await this.loadNextPage();
}
} else {
await this.loadNextPage();
}
this.initialLoad = true;
await this.$nextTick();
this.computeScriptBoundaries();
Expand Down Expand Up @@ -225,7 +248,7 @@
const cutoffBottom = scriptContainer.offset().top + scriptContainer.outerHeight();
const scriptSelector = $('.script-item');

scriptSelector.each(function () {

Check warning on line 251 in client/src/views/show/ShowLiveView.vue

View workflow job for this annotation

GitHub Actions / build

Unexpected unnamed function
if ($(this).offset().top >= cutoffTop) {
if (!$(this).attr('class').split(/\s+/).includes('first-script-element')) {
scriptSelector.removeClass('first-script-element');
Expand All @@ -238,7 +261,7 @@

let assignedLastScript = false;
let lastObject = null;
scriptSelector.each(function () {

Check warning on line 264 in client/src/views/show/ShowLiveView.vue

View workflow job for this annotation

GitHub Actions / build

Unexpected unnamed function
if (lastObject == null) {
lastObject = this;
} else if ($(this).offset().top > $(lastObject).offset().top
Expand Down Expand Up @@ -394,11 +417,14 @@
'GET_CHARACTER_LIST', 'GET_CHARACTER_GROUP_LIST', 'LOAD_CUES', 'GET_CUE_TYPES',
'GET_CUTS']),
},
computed: {

Check warning on line 420 in client/src/views/show/ShowLiveView.vue

View workflow job for this annotation

GitHub Actions / build

The "computed" property should be above the "destroyed" property on line 225
pageIter() {
return [...Array(this.currentLoadedPage).keys()].map((x) => (x + 1)).filter((x) => (
x <= this.currentLastPage + this.pageBatchSize
&& x >= this.currentFirstPage - this.pageBatchSize));
if (this.SETTINGS.enable_live_batching) {
return [...Array(this.currentLoadedPage).keys()].map((x) => (x + 1)).filter((x) => (
x <= this.currentLastPage + this.pageBatchSize
&& x >= this.currentFirstPage - this.pageBatchSize));
}
return [...Array(this.currentMaxPage).keys()];
},
isScriptFollowing() {
if (this.loadedSessionData) {
Expand All @@ -414,9 +440,9 @@
},
...mapGetters(['CURRENT_SHOW_SESSION', 'GET_SCRIPT_PAGE', 'ACT_LIST', 'SCENE_LIST',
'CHARACTER_LIST', 'CHARACTER_GROUP_LIST', 'CURRENT_SHOW', 'CUE_TYPES', 'SCRIPT_CUES',
'INTERNAL_UUID', 'SESSION_FOLLOW_DATA', 'SCRIPT_CUTS']),
'INTERNAL_UUID', 'SESSION_FOLLOW_DATA', 'SCRIPT_CUTS', 'SETTINGS']),
},
watch: {

Check warning on line 445 in client/src/views/show/ShowLiveView.vue

View workflow job for this annotation

GitHub Actions / build

The "watch" property should be above the "destroyed" property on line 225
SESSION_FOLLOW_DATA() {
if (this.isScriptFollowing) {
let scrollToLine;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
</b-button>
<b-button
class="cue-button"
:disabled="isWholeLineCut(line)"
@click.stop="openNewForm"
>
<b-icon-plus-square-fill variant="success" />
Expand All @@ -41,7 +42,12 @@
:key="`line_${lineIndex}_stage_direction`"
style="text-align: center"
>
<i class="viewable-line">{{ line.line_parts[0].line_text }}</i>
<i
class="viewable-line"
style="background-color: darkslateblue"
>
{{ line.line_parts[0].line_text }}
</i>
</b-col>
</template>
<template v-else>
Expand Down Expand Up @@ -360,6 +366,10 @@ export default {
cueBackgroundColour(cue) {
return this.cueTypes.find((cueType) => (cueType.id === cue.cue_type_id)).colour;
},
isWholeLineCut(line) {
return line.line_parts.every((linePart) => (this.linePartCuts.includes(linePart.id)
|| linePart.line_text == null || linePart.line_text.trim().length === 0), this);
},
...mapActions(['ADD_NEW_CUE', 'EDIT_CUE', 'DELETE_CUE']),
},
computed: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,12 @@
:key="`line_${lineIndex}_stage_direction`"
style="text-align: center"
>
<i class="viewable-line">{{ line.line_parts[0].line_text }}</i>
<i
class="viewable-line"
style="background-color: darkslateblue"
>
{{ line.line_parts[0].line_text }}
</i>
</b-col>
</template>
<b-col
Expand Down
5 changes: 4 additions & 1 deletion client/src/vue_components/show/live/ScriptLineViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@
:key="`line_${lineIndex}_stage_direction`"
style="text-align: center"
>
<i class="viewable-line">{{ line.line_parts[0].line_text }}</i>
<i
class="viewable-line"
style="background-color: darkslateblue"
>{{ line.line_parts[0].line_text }}</i>
</b-col>
</template>
<template v-else>
Expand Down
9 changes: 9 additions & 0 deletions server/controllers/ws_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,15 @@ async def on_message(self, message: Union[str, bytes]): # pylint: disable=invali
'SCRIPT_SCROLL',
message['DATA']
)
elif ws_op == 'RELOAD_CLIENTS':
if show and show.current_session_id:
show_session = session.query(ShowSession).get(show.current_session_id)
if show_session and show_session.client_internal_id == self.__getattribute__('internal_id'):
await self.application.ws_send_to_all(
'RELOAD_CLIENT',
'NOOP',
{}
)
else:
get_logger().warning(f'Unknown OP {ws_op} received from '
f'WebSocket connection {self.request.remote_ip}')
Expand Down
2 changes: 2 additions & 0 deletions server/digi_server/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ def __init__(self, application: DigiScriptServer, settings_path=None):
self._application.regen_logging)
self.define('db_max_log_mb', int, 100, True, self._application.regen_logging)
self.define('db_log_backups', int, 5, True, self._application.regen_logging)
self.define('enable_lazy_loading', bool, True, True)
self.define('enable_live_batching', bool, True, True)

self._load(spawn_callbacks=False)

Expand Down
Loading