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

feat(web): ws - on_config_update #4378

Merged
merged 1 commit into from
Oct 7, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import SettingInputField, { SettingInputFieldType } from '../setting-input-field.svelte';
import SettingSwitch from '../setting-switch.svelte';
import SettingSelect from '../setting-select.svelte';
import { loadConfig } from '$lib/stores/server-config.store';

export let config: SystemConfigDto; // this is the config that is being edited
export let disabled = false;
Expand Down Expand Up @@ -48,9 +47,6 @@
savedConfig = cloneDeep(updated);

notificationController.show({ message: 'Settings saved', type: NotificationType.Info });
// TODO: Use websockets to reload feature params instead once websocket for client is merged
// Reload feature params in the background
loadConfig();
} catch (error) {
handleError(error, 'Unable to save settings');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import SettingButtonsRow from '../setting-buttons-row.svelte';
import SettingSwitch from '../setting-switch.svelte';
import SettingInputField, { SettingInputFieldType } from '../setting-input-field.svelte';
import { loadConfig } from '$lib/stores/server-config.store';

export let trashConfig: SystemConfigTrashDto; // this is the config that is being edited
export let disabled = false;
Expand All @@ -36,9 +35,6 @@
savedConfig = { ...updated.trash };

notificationController.show({ message: 'Settings saved', type: NotificationType.Info });
// TODO: Use websockets to reload feature params instead once websocket for client is merged
// Reload feature params in the background
loadConfig();
} catch (error) {
handleError(error, 'Unable to save settings');
}
Expand Down
2 changes: 2 additions & 0 deletions web/src/lib/stores/websocket.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { AssetResponseDto, ServerVersionResponseDto } from '@api';
import { io } from 'socket.io-client';
import { writable } from 'svelte/store';
import { loadConfig } from './server-config.store';

export const websocketStore = {
onUploadSuccess: writable<AssetResponseDto>(),
Expand Down Expand Up @@ -29,6 +30,7 @@ export const openWebsocketConnection = () => {
.on('on_asset_trash', (data) => websocketStore.onAssetTrash.set(JSON.parse(data) as string[]))
.on('on_person_thumbnail', (data) => websocketStore.onPersonThumbnail.set(JSON.parse(data) as string))
.on('on_server_version', (data) => websocketStore.serverVersion.set(JSON.parse(data) as ServerVersionResponseDto))
.on('on_config_update', () => loadConfig())
.on('error', (e) => console.log('Websocket Error', e));

return () => websocket?.close();
Expand Down
Loading