From 5ed1b65aa658bc661e27b97e70481abf886fc996 Mon Sep 17 00:00:00 2001 From: Buster Neece Date: Fri, 17 Jan 2025 04:33:34 -0600 Subject: [PATCH 1/4] Even more TS fixes. --- frontend/components/Admin/Index.vue | 21 +++++++++---- .../Admin/Stations/Form/BackendForm.vue | 2 -- .../Admin/Stations/Form/HlsForm.vue | 7 +---- .../Admin/Stations/Form/RequestsForm.vue | 7 +---- .../Admin/Stations/Form/StreamersForm.vue | 7 +---- .../components/Admin/Stations/StationForm.vue | 30 +++++-------------- frontend/components/Admin/Updates.vue | 12 ++++++-- frontend/components/Common/BitrateOptions.vue | 17 ++++++----- .../components/Common/DateRangeDropdown.vue | 6 +++- .../components/Form/FormGroupCheckbox.vue | 7 +++-- frontend/components/Form/FormGroupField.vue | 24 +++++++-------- frontend/components/Form/VuelidateError.vue | 6 ++-- frontend/components/Form/useFormField.ts | 6 ++-- .../components/Public/Podcasts/Podcast.vue | 2 +- .../Public/Podcasts/PodcastList.vue | 2 +- .../components/Public/WebDJ/SettingsPanel.vue | 6 +++- frontend/components/Stations/Podcasts.vue | 7 ++--- .../Stations/Podcasts/EpisodeEditModal.vue | 3 +- .../Stations/Streamers/EditModal.vue | 4 ++- 19 files changed, 86 insertions(+), 90 deletions(-) diff --git a/frontend/components/Admin/Index.vue b/frontend/components/Admin/Index.vue index bd905227cd..e26abdb896 100644 --- a/frontend/components/Admin/Index.vue +++ b/frontend/components/Admin/Index.vue @@ -203,10 +203,11 @@ const {state: stats, isLoading} = useAutoRefreshingAsyncState( { cpu: { total: { - name: 'Total', - steal: 0, - io_wait: 0, - usage: 0 + name: "Total", + usage: "", + idle: "", + io_wait: "", + steal: "", }, cores: [], load: [0, 0, 0] @@ -214,13 +215,21 @@ const {state: stats, isLoading} = useAutoRefreshingAsyncState( memory: { bytes: { total: "0", + free: "0", + buffers: "0", + cached: "0", + sReclaimable: "0", + shmem: "0", used: "0", - cached: "0" }, readable: { total: "", + free: "", + buffers: "", + cached: "", + sReclaimable: "", + shmem: "", used: "", - cached: "" } }, swap: { diff --git a/frontend/components/Admin/Stations/Form/BackendForm.vue b/frontend/components/Admin/Stations/Form/BackendForm.vue index 84bb3fda1b..7d1653262c 100644 --- a/frontend/components/Admin/Stations/Form/BackendForm.vue +++ b/frontend/components/Admin/Stations/Form/BackendForm.vue @@ -308,10 +308,8 @@ import {FormTabEmits, FormTabProps, useVuelidateOnFormTab} from "~/functions/use import {decimal, numeric, required} from "@vuelidate/validators"; import {useAzuraCast} from "~/vendor/azuracast"; import Tab from "~/components/Common/Tab.vue"; -import {Station} from "~/entities/ApiInterfaces.ts"; interface StationBackendFormProps extends FormTabProps { - station: Station, isStereoToolInstalled: boolean } diff --git a/frontend/components/Admin/Stations/Form/HlsForm.vue b/frontend/components/Admin/Stations/Form/HlsForm.vue index 87afeefdd2..ee9fc5b30c 100644 --- a/frontend/components/Admin/Stations/Form/HlsForm.vue +++ b/frontend/components/Admin/Stations/Form/HlsForm.vue @@ -91,13 +91,8 @@ import {FormTabEmits, FormTabProps, useVuelidateOnFormTab} from "~/functions/use import {numeric} from "@vuelidate/validators"; import {useAzuraCast} from "~/vendor/azuracast"; import Tab from "~/components/Common/Tab.vue"; -import {Station} from "~/entities/ApiInterfaces.ts"; -interface StationHlsFormProps extends FormTabProps { - station: Station, -} - -const props = defineProps(); +const props = defineProps(); const emit = defineEmits(); const {enableAdvancedFeatures} = useAzuraCast(); diff --git a/frontend/components/Admin/Stations/Form/RequestsForm.vue b/frontend/components/Admin/Stations/Form/RequestsForm.vue index 5738e9eaf1..beb3bfd024 100644 --- a/frontend/components/Admin/Stations/Form/RequestsForm.vue +++ b/frontend/components/Admin/Stations/Form/RequestsForm.vue @@ -62,13 +62,8 @@ import {computed} from "vue"; import {FormTabEmits, FormTabProps, useVuelidateOnFormTab} from "~/functions/useVuelidateOnFormTab"; import {numeric} from "@vuelidate/validators"; import Tab from "~/components/Common/Tab.vue"; -import {Station} from "~/entities/ApiInterfaces.ts"; -interface StationRequestsFormProps extends FormTabProps { - station: Station, -} - -const props = defineProps(); +const props = defineProps(); const emit = defineEmits(); const {form, v$, tabClass} = useVuelidateOnFormTab( diff --git a/frontend/components/Admin/Stations/Form/StreamersForm.vue b/frontend/components/Admin/Stations/Form/StreamersForm.vue index 8eeb81bb4e..5d3c7d28bc 100644 --- a/frontend/components/Admin/Stations/Form/StreamersForm.vue +++ b/frontend/components/Admin/Stations/Form/StreamersForm.vue @@ -137,13 +137,8 @@ import {numeric} from "@vuelidate/validators"; import {useAzuraCast} from "~/vendor/azuracast"; import Tab from "~/components/Common/Tab.vue"; import BitrateOptions from "~/components/Common/BitrateOptions.vue"; -import {Station} from "~/entities/ApiInterfaces.ts"; -interface StationStreamersFormProps extends FormTabProps { - station: Station, -} - -const props = defineProps(); +const props = defineProps(); const emit = defineEmits(); const {enableAdvancedFeatures} = useAzuraCast(); diff --git a/frontend/components/Admin/Stations/StationForm.vue b/frontend/components/Admin/Stations/StationForm.vue index eca6cafdf2..3d4146b811 100644 --- a/frontend/components/Admin/Stations/StationForm.vue +++ b/frontend/components/Admin/Stations/StationForm.vue @@ -26,23 +26,19 @@ (); const showAdminTab = userAllowed(GlobalPermission.Stations); @@ -142,35 +142,21 @@ watch(isLoading, (newValue) => { const error = ref(null); -const blankStation = { - stereo_tool_configuration_file_path: null, - links: { - stereo_tool_configuration: null - } -}; - -const {record: station, reset: resetStation} = useResettableRef(blankStation); - const clear = () => { resetForm(); - resetStation(); isLoading.value = false; error.value = null; }; -const populateForm = (data) => { - form.value = mergeExisting(form.value, data); -}; - const {notifySuccess} = useNotify(); const {axios} = useAxios(); const doLoad = () => { isLoading.value = true; - axios.get(props.editUrl).then((resp) => { - populateForm(resp.data); + axios.get(props.editUrl).then(({data}) => { + form.value = mergeExisting(form.value, data); }).catch((err) => { emit('error', err); }).finally(() => { diff --git a/frontend/components/Admin/Updates.vue b/frontend/components/Admin/Updates.vue index 50ff485ffe..4c109159e5 100644 --- a/frontend/components/Admin/Updates.vue +++ b/frontend/components/Admin/Updates.vue @@ -162,14 +162,22 @@ import {getApiUrl} from "~/router"; import {IconInfo, IconSync, IconUpdate, IconUpload} from "~/components/Common/icons"; import {useDialog} from "~/functions/useDialog.ts"; +interface UpdateInfo { + needs_release_update?: boolean, + needs_rolling_update?: boolean, +} + const props = withDefaults( defineProps<{ releaseChannel: string, - initialUpdateInfo?: object, + initialUpdateInfo?: UpdateInfo, enableWebUpdates: boolean, }>(), { - initialUpdateInfo: () => ({}) + initialUpdateInfo: () => ({ + needs_release_update: false, + needs_rolling_update: false, + }) } ); diff --git a/frontend/components/Common/BitrateOptions.vue b/frontend/components/Common/BitrateOptions.vue index 5948816942..2f38dbed94 100644 --- a/frontend/components/Common/BitrateOptions.vue +++ b/frontend/components/Common/BitrateOptions.vue @@ -70,7 +70,7 @@ -