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

client: auto submit room settings on change #1766

Merged
merged 1 commit into from
Apr 30, 2024
Merged
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
24 changes: 19 additions & 5 deletions client/src/components/RoomSettingsForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
<v-text-field
:label="$t('room-settings.title')"
v-model="settings.title.value"
:loading="isLoadingRoomSettings"
:loading="isLoadingRoomSettings || dirtySettings.includes('title')"
:disabled="!granted('configure-room.set-title')"
data-cy="input-title"
/>
<v-text-field
:label="$t('room-settings.description')"
v-model="settings.description.value"
:loading="isLoadingRoomSettings"
:loading="isLoadingRoomSettings || dirtySettings.includes('description')"
:disabled="!granted('configure-room.set-description')"
data-cy="input-description"
/>
Expand All @@ -22,7 +22,7 @@
{ title: $t('room-settings.unlisted'), value: Visibility.Unlisted },
]"
v-model="settings.visibility.value"
:loading="isLoadingRoomSettings"
:loading="isLoadingRoomSettings || dirtySettings.includes('visibility')"
:disabled="!granted('configure-room.set-visibility')"
data-cy="select-visibility"
>
Expand Down Expand Up @@ -55,7 +55,7 @@
},
]"
v-model="settings.queueMode.value"
:loading="isLoadingRoomSettings"
:loading="isLoadingRoomSettings || dirtySettings.includes('queueMode')"
:disabled="!granted('configure-room.set-queue-mode')"
data-cy="select-queueMode"
>
Expand All @@ -68,6 +68,9 @@
<v-select
v-model="settings.autoSkipSegmentCategories.value"
:items="ALL_SKIP_CATEGORIES"
:loading="
isLoadingRoomSettings || dirtySettings.includes('autoSkipSegmentCategories')
"
:disabled="!granted('configure-room.other')"
:label="$t('room-settings.auto-skip-text')"
chips
Expand All @@ -91,7 +94,7 @@
},
]"
v-model="settings.restoreQueueBehavior.value"
:loading="isLoadingRoomSettings"
:loading="isLoadingRoomSettings || dirtySettings.includes('restoreQueueBehavior')"
:disabled="!granted('configure-room.other')"
data-cy="select-restore-queue"
>
Expand Down Expand Up @@ -164,6 +167,7 @@ import { ALL_SKIP_CATEGORIES } from "ott-common/constants";
import { useGrants } from "./composables/grants";
import { useRoute } from "vue-router";
import { watch } from "vue";
import { watchDebounced } from "@vueuse/core";

const store = useStore();
const { t } = useI18n();
Expand Down Expand Up @@ -191,6 +195,16 @@ for (const key of Object.keys(inputRoomSettings) as (keyof RoomSettings)[]) {
}
});
}
watchDebounced(
inputRoomSettings,
async () => {
if (dirtySettings.value.length === 0) {
return;
}
await submitRoomSettings();
},
{ debounce: 1000 }
);

onMounted(async () => {
await loadRoomSettings();
Expand Down
Loading