Skip to content

Commit

Permalink
client: auto submit room settings on change (#1766)
Browse files Browse the repository at this point in the history
closes #1593
  • Loading branch information
dyc3 committed Apr 30, 2024
1 parent c2f3921 commit df311e3
Showing 1 changed file with 19 additions and 5 deletions.
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

0 comments on commit df311e3

Please sign in to comment.