Consolidate translations and reduce number of toasts

This commit is contained in:
advplyr 2024-08-30 17:41:58 -05:00
parent 3dfbddda33
commit c273626c3d
18 changed files with 15 additions and 48 deletions

View file

@ -127,7 +127,6 @@ export default {
.$patch(`/api/notifications/${this.notification.id}`, payload) .$patch(`/api/notifications/${this.notification.id}`, payload)
.then((updatedSettings) => { .then((updatedSettings) => {
this.$emit('update', updatedSettings) this.$emit('update', updatedSettings)
this.$toast.success(this.$strings.ToastNotificationEnabled)
}) })
.catch((error) => { .catch((error) => {
console.error('Failed to update notification', error) console.error('Failed to update notification', error)
@ -155,7 +154,6 @@ export default {
.$delete(`/api/notifications/${this.notification.id}`) .$delete(`/api/notifications/${this.notification.id}`)
.then((updatedSettings) => { .then((updatedSettings) => {
this.$emit('update', updatedSettings) this.$emit('update', updatedSettings)
this.$toast.success(this.$strings.ToastNotificationDeleteSuccess)
}) })
.catch((error) => { .catch((error) => {
console.error('Failed', error) console.error('Failed', error)

View file

@ -159,7 +159,7 @@ export default {
}) })
.catch((error) => { .catch((error) => {
console.error('Failed to get ffprobe data', error) console.error('Failed to get ffprobe data', error)
this.$toast.error(this.$strings.ToastFfprobeFailed) this.$toast.error(this.$strings.ToastFailedToLoadData)
}) })
.finally(() => { .finally(() => {
this.probingFile = false this.probingFile = false

View file

@ -206,7 +206,6 @@ export default {
this.$axios this.$axios
.$post(`/api/session/${this._session.id}/close`) .$post(`/api/session/${this._session.id}/close`)
.then(() => { .then(() => {
this.$toast.success(this.$strings.ToastSessionCloseSuccess)
this.show = false this.show = false
this.$emit('closedSession') this.$emit('closedSession')
}) })

View file

@ -15,7 +15,7 @@
</template> </template>
<form class="flex items-center justify-center px-6 py-3" @submit.prevent="submitCustomTime"> <form class="flex items-center justify-center px-6 py-3" @submit.prevent="submitCustomTime">
<ui-text-input v-model="customTime" type="number" step="any" min="0.1" :placeholder="$strings.LabelTimeInMinutes" class="w-48" /> <ui-text-input v-model="customTime" type="number" step="any" min="0.1" :placeholder="$strings.LabelTimeInMinutes" class="w-48" />
<ui-btn color="success" type="submit" :padding-x="0" class="h-9 w-12 flex items-center justify-center ml-1">{{ $strings.ButtonSet }}</ui-btn> <ui-btn color="success" type="submit" :padding-x="0" class="h-9 w-18 flex items-center justify-center ml-1">{{ $strings.ButtonSubmit }}</ui-btn>
</form> </form>
</div> </div>
<div v-if="timerSet" class="w-full p-4"> <div v-if="timerSet" class="w-full p-4">

View file

@ -78,7 +78,6 @@ export default {
if (data.error) { if (data.error) {
this.$toast.error(data.error) this.$toast.error(data.error)
} else { } else {
this.$toast.success(this.$strings.ToastCoverUploaded)
this.resetCoverPreview() this.resetCoverPreview()
} }
this.processingUpload = false this.processingUpload = false

View file

@ -174,7 +174,6 @@ export default {
.$post(`/api/emails/ereader-devices`, payload) .$post(`/api/emails/ereader-devices`, payload)
.then((data) => { .then((data) => {
this.$emit('update', data.ereaderDevices) this.$emit('update', data.ereaderDevices)
this.$toast.success(this.$strings.ToastDeviceUpdateSuccess)
this.show = false this.show = false
}) })
.catch((error) => { .catch((error) => {
@ -201,7 +200,6 @@ export default {
.$post('/api/emails/ereader-devices', payload) .$post('/api/emails/ereader-devices', payload)
.then((data) => { .then((data) => {
this.$emit('update', data.ereaderDevices || []) this.$emit('update', data.ereaderDevices || [])
this.$toast.success(this.$strings.ToastDeviceAddSuccess)
this.show = false this.show = false
}) })
.catch((error) => { .catch((error) => {

View file

@ -194,7 +194,6 @@ export default {
if (data.error) { if (data.error) {
this.$toast.error(data.error) this.$toast.error(data.error)
} else { } else {
this.$toast.success(this.$strings.ToastCoverUploaded)
this.resetCoverPreview() this.resetCoverPreview()
} }
this.processingUpload = false this.processingUpload = false
@ -264,7 +263,6 @@ export default {
.$post(`/api/items/${this.libraryItemId}/cover`, { url: cover }) .$post(`/api/items/${this.libraryItemId}/cover`, { url: cover })
.then(() => { .then(() => {
this.imageUrl = '' this.imageUrl = ''
this.$toast.success(this.$strings.ToastCoverUpdateSuccess)
}) })
.catch((error) => { .catch((error) => {
console.error('Failed to update cover', error) console.error('Failed to update cover', error)
@ -308,9 +306,6 @@ export default {
this.isProcessing = true this.isProcessing = true
this.$axios this.$axios
.$patch(`/api/items/${this.libraryItemId}/cover`, { cover: coverFile.metadata.path }) .$patch(`/api/items/${this.libraryItemId}/cover`, { cover: coverFile.metadata.path })
.then(() => {
this.$toast.success(this.$strings.ToastCoverUpdateSuccess)
})
.catch((error) => { .catch((error) => {
console.error('Failed to set local cover', error) console.error('Failed to set local cover', error)
this.$toast.error(error.response?.data || this.$strings.ToastCoverUpdateFailed) this.$toast.error(error.response?.data || this.$strings.ToastCoverUpdateFailed)

View file

@ -162,7 +162,7 @@ export default {
}) })
.catch((error) => { .catch((error) => {
console.error('Failed to get filesystem paths', error) console.error('Failed to get filesystem paths', error)
this.$toast.error(this.$strings.ToastGetFilesystemPathsFailed) this.$toast.error(this.$strings.ToastFailedToLoadData)
return [] return []
}) })
.finally(() => { .finally(() => {

View file

@ -149,7 +149,6 @@ export default {
.$post('/api/notifications', payload) .$post('/api/notifications', payload)
.then((updatedSettings) => { .then((updatedSettings) => {
this.$emit('update', updatedSettings) this.$emit('update', updatedSettings)
this.$toast.success(this.$strings.ToastNotificationCreateSuccess)
this.show = false this.show = false
}) })
.catch((error) => { .catch((error) => {

View file

@ -133,13 +133,13 @@ export default {
this.$toast.success(this.$strings.ToastUserPasswordChangeSuccess) this.$toast.success(this.$strings.ToastUserPasswordChangeSuccess)
this.resetForm() this.resetForm()
} else { } else {
this.$toast.error(res.error || 'Unknown Error') this.$toast.error(res.error || this.$strings.ToastUnknownError)
} }
this.changingPassword = false this.changingPassword = false
}) })
.catch((error) => { .catch((error) => {
console.error(error) console.error(error)
this.$toast.error(this.$strings.ToastApiCallFailed) this.$toast.error(this.$strings.ToastUnknownError)
this.changingPassword = false this.changingPassword = false
}) })
} }

View file

@ -560,7 +560,7 @@ export default {
.catch((error) => { .catch((error) => {
this.findingChapters = false this.findingChapters = false
console.error('Failed to get chapter data', error) console.error('Failed to get chapter data', error)
this.$toast.error(this.$strings.ToastGetChaptersFailed) this.$toast.error(this.$strings.ToastFailedToLoadData)
this.showFindChaptersModal = false this.showFindChaptersModal = false
}) })
}, },

View file

@ -218,7 +218,6 @@ export default {
.$post(`/api/emails/ereader-devices`, payload) .$post(`/api/emails/ereader-devices`, payload)
.then((data) => { .then((data) => {
this.ereaderDevicesUpdated(data.ereaderDevices) this.ereaderDevicesUpdated(data.ereaderDevices)
this.$toast.success(this.$strings.ToastDeviceDeleteSuccess)
}) })
.catch((error) => { .catch((error) => {
console.error('Failed to delete device', error) console.error('Failed to delete device', error)

View file

@ -290,7 +290,6 @@ export default {
this.$axios this.$axios
.$post(`/api/sessions/batch/delete`, payload) .$post(`/api/sessions/batch/delete`, payload)
.then(() => { .then(() => {
this.$toast.success(this.$strings.ToastSessionsRemoved)
if (isAllSessions) { if (isAllSessions) {
// If all sessions were removed from the current page then go to the previous page // If all sessions were removed from the current page then go to the previous page
if (this.currentPage > 0) { if (this.currentPage > 0) {
@ -358,12 +357,13 @@ export default {
}) })
if (!libraryItem) { if (!libraryItem) {
this.$toast.error(this.$strings.ToastGetLibraryItemFailed) this.$toast.error(this.$strings.ToastFailedToLoadData)
this.processingGoToTimestamp = false this.processingGoToTimestamp = false
return return
} }
if (session.episodeId && !libraryItem.media.episodes.some((ep) => ep.id === session.episodeId)) { if (session.episodeId && !libraryItem.media.episodes.some((ep) => ep.id === session.episodeId)) {
this.$toast.error(this.$strings.ToastGetPodcastEpisodeFailed) console.error('Episode not found in library item', session.episodeId, libraryItem.media.episodes)
this.$toast.error(this.$strings.ToastFailedToLoadData)
this.processingGoToTimestamp = false this.processingGoToTimestamp = false
return return
} }

View file

@ -127,12 +127,13 @@ export default {
}) })
if (!libraryItem) { if (!libraryItem) {
this.$toast.error(this.$strings.ToastGetLibraryItemFailed) this.$toast.error(this.$strings.ToastFailedToLoadData)
this.processingGoToTimestamp = false this.processingGoToTimestamp = false
return return
} }
if (session.episodeId && !libraryItem.media.episodes.some((ep) => ep.id === session.episodeId)) { if (session.episodeId && !libraryItem.media.episodes.some((ep) => ep.id === session.episodeId)) {
this.$toast.error(this.$strings.ToastGetPodcastEpisodeFailed) console.error('Episode not found in library item', session.episodeId, libraryItem.media.episodes)
this.$toast.error(this.$strings.ToastFailedToLoadData)
this.processingGoToTimestamp = false this.processingGoToTimestamp = false
return return
} }

View file

@ -628,7 +628,6 @@ export default {
.$delete(`/api/me/progress/${this.userMediaProgress.id}`) .$delete(`/api/me/progress/${this.userMediaProgress.id}`)
.then(() => { .then(() => {
console.log('Progress reset complete') console.log('Progress reset complete')
this.$toast.success(this.$strings.ToastProgressReset)
this.resettingProgress = false this.resettingProgress = false
}) })
.catch((error) => { .catch((error) => {

View file

@ -111,7 +111,7 @@ export default {
this.processing = true this.processing = true
const queuePayload = await this.$axios.$get(`/api/libraries/${this.libraryId}/episode-downloads`).catch((error) => { const queuePayload = await this.$axios.$get(`/api/libraries/${this.libraryId}/episode-downloads`).catch((error) => {
console.error('Failed to get download queue', error) console.error('Failed to get download queue', error)
this.$toast.error(this.$strings.ToastGetDownloadQueueFailed) this.$toast.error(this.$strings.ToastFailedToLoadData)
return null return null
}) })
this.processing = false this.processing = false

View file

@ -211,7 +211,7 @@ export default {
this.processing = true this.processing = true
const episodePayload = await this.$axios.$get(`/api/libraries/${this.libraryId}/recent-episodes?limit=25&page=${page}`).catch((error) => { const episodePayload = await this.$axios.$get(`/api/libraries/${this.libraryId}/recent-episodes?limit=25&page=${page}`).catch((error) => {
console.error('Failed to get recent episodes', error) console.error('Failed to get recent episodes', error)
this.$toast.error(this.$strings.ToastGetRecentEpisodesFailed) this.$toast.error(this.$strings.ToastFailedToLoadData)
return null return null
}) })
this.processing = false this.processing = false

View file

@ -89,7 +89,6 @@
"ButtonSearch": "Search", "ButtonSearch": "Search",
"ButtonSelectFolderPath": "Select Folder Path", "ButtonSelectFolderPath": "Select Folder Path",
"ButtonSeries": "Series", "ButtonSeries": "Series",
"ButtonSet": "Set",
"ButtonSetChaptersFromTracks": "Set chapters from tracks", "ButtonSetChaptersFromTracks": "Set chapters from tracks",
"ButtonShare": "Share", "ButtonShare": "Share",
"ButtonShiftTimes": "Shift Times", "ButtonShiftTimes": "Shift Times",
@ -693,6 +692,7 @@
"MessageConfirmRenameTag": "Are you sure you want to rename tag \"{0}\" to \"{1}\" for all items?", "MessageConfirmRenameTag": "Are you sure you want to rename tag \"{0}\" to \"{1}\" for all items?",
"MessageConfirmRenameTagMergeNote": "Note: This tag already exists so they will be merged.", "MessageConfirmRenameTagMergeNote": "Note: This tag already exists so they will be merged.",
"MessageConfirmRenameTagWarning": "Warning! A similar tag with a different casing already exists \"{0}\".", "MessageConfirmRenameTagWarning": "Warning! A similar tag with a different casing already exists \"{0}\".",
"MessageConfirmResetProgress": "Are you sure you want to reset your progress?",
"MessageConfirmSendEbookToDevice": "Are you sure you want to send {0} ebook \"{1}\" to device \"{2}\"?", "MessageConfirmSendEbookToDevice": "Are you sure you want to send {0} ebook \"{1}\" to device \"{2}\"?",
"MessageConfirmUnlinkOpenId": "Are you sure you want to unlink this user from OpenID?", "MessageConfirmUnlinkOpenId": "Are you sure you want to unlink this user from OpenID?",
"MessageDownloadingEpisode": "Downloading episode", "MessageDownloadingEpisode": "Downloading episode",
@ -766,7 +766,6 @@
"MessageRemoveUserWarning": "Are you sure you want to permanently delete user \"{0}\"?", "MessageRemoveUserWarning": "Are you sure you want to permanently delete user \"{0}\"?",
"MessageReportBugsAndContribute": "Report bugs, request features, and contribute on", "MessageReportBugsAndContribute": "Report bugs, request features, and contribute on",
"MessageResetChaptersConfirm": "Are you sure you want to reset chapters and undo the changes you made?", "MessageResetChaptersConfirm": "Are you sure you want to reset chapters and undo the changes you made?",
"MessageResetProgressConfirm": "Are you sure you want to reset your progress?",
"MessageRestoreBackupConfirm": "Are you sure you want to restore the backup created on", "MessageRestoreBackupConfirm": "Are you sure you want to restore the backup created on",
"MessageRestoreBackupWarning": "Restoring a backup will overwrite the entire database located at /config and cover images in /metadata/items & /metadata/authors.<br /><br />Backups do not modify any files in your library folders. If you have enabled server settings to store cover art and metadata in your library folders then those are not backed up or overwritten.<br /><br />All clients using your server will be automatically refreshed.", "MessageRestoreBackupWarning": "Restoring a backup will overwrite the entire database located at /config and cover images in /metadata/items & /metadata/authors.<br /><br />Backups do not modify any files in your library folders. If you have enabled server settings to store cover art and metadata in your library folders then those are not backed up or overwritten.<br /><br />All clients using your server will be automatically refreshed.",
"MessageSearchResultsFor": "Search results for", "MessageSearchResultsFor": "Search results for",
@ -819,7 +818,6 @@
"StatsYearInReview": "YEAR IN REVIEW", "StatsYearInReview": "YEAR IN REVIEW",
"ToastAccountUpdateFailed": "Failed to update account", "ToastAccountUpdateFailed": "Failed to update account",
"ToastAccountUpdateSuccess": "Account updated", "ToastAccountUpdateSuccess": "Account updated",
"ToastApiCallFailed": "API call failed",
"ToastAppriseUrlRequired": "Must enter an Apprise URL", "ToastAppriseUrlRequired": "Must enter an Apprise URL",
"ToastAuthorImageRemoveSuccess": "Author image removed", "ToastAuthorImageRemoveSuccess": "Author image removed",
"ToastAuthorNotFound": "Author \"{0}\" not found", "ToastAuthorNotFound": "Author \"{0}\" not found",
@ -861,18 +859,13 @@
"ToastCollectionUpdateFailed": "Failed to update collection", "ToastCollectionUpdateFailed": "Failed to update collection",
"ToastCollectionUpdateSuccess": "Collection updated", "ToastCollectionUpdateSuccess": "Collection updated",
"ToastCoverUpdateFailed": "Cover update failed", "ToastCoverUpdateFailed": "Cover update failed",
"ToastCoverUpdateSuccess": "Cover updated",
"ToastCoverUploaded": "Cover uploaded",
"ToastDeleteFileFailed": "Failed to delete file", "ToastDeleteFileFailed": "Failed to delete file",
"ToastDeleteFileSuccess": "File deleted", "ToastDeleteFileSuccess": "File deleted",
"ToastDeviceAddFailed": "Failed to add device", "ToastDeviceAddFailed": "Failed to add device",
"ToastDeviceAddSuccess": "Device added",
"ToastDeviceDeleteSuccess": "Device deleted",
"ToastDeviceNameAlreadyExists": "Ereader device with that name already exists", "ToastDeviceNameAlreadyExists": "Ereader device with that name already exists",
"ToastDeviceTestEmailFailed": "Failed to send test email", "ToastDeviceTestEmailFailed": "Failed to send test email",
"ToastDeviceTestEmailSuccess": "Test email sent", "ToastDeviceTestEmailSuccess": "Test email sent",
"ToastDeviceUpdateFailed": "Failed to update device", "ToastDeviceUpdateFailed": "Failed to update device",
"ToastDeviceUpdateSuccess": "Device updated",
"ToastEmailSettingsUpdateFailed": "Failed to update email settings", "ToastEmailSettingsUpdateFailed": "Failed to update email settings",
"ToastEmailSettingsUpdateSuccess": "Email settings updated", "ToastEmailSettingsUpdateSuccess": "Email settings updated",
"ToastEncodeCancelFailed": "Failed to cancel encode", "ToastEncodeCancelFailed": "Failed to cancel encode",
@ -884,13 +877,6 @@
"ToastFailedToShare": "Failed to share", "ToastFailedToShare": "Failed to share",
"ToastFailedToUpdateAccount": "Failed to update account", "ToastFailedToUpdateAccount": "Failed to update account",
"ToastFailedToUpdateUser": "Failed to update user", "ToastFailedToUpdateUser": "Failed to update user",
"ToastFfprobeFailed": "FFprobe failed",
"ToastGetChaptersFailed": "Failed to get chapters",
"ToastGetDownloadQueueFailed": "Failed to get download queue",
"ToastGetFilesystemPathsFailed": "Failed to get filesystem paths",
"ToastGetLibraryItemFailed": "Failed to get library item",
"ToastGetPodcastEpisodeFailed": "Failed to get podcast episode",
"ToastGetRecentEpisodesFailed": "Failed to get recent episodes",
"ToastInvalidImageUrl": "Invalid image URL", "ToastInvalidImageUrl": "Invalid image URL",
"ToastInvalidUrl": "Invalid URL", "ToastInvalidUrl": "Invalid URL",
"ToastItemCoverUpdateFailed": "Failed to update item cover", "ToastItemCoverUpdateFailed": "Failed to update item cover",
@ -923,10 +909,7 @@
"ToastNewUserUsernameError": "Enter a username", "ToastNewUserUsernameError": "Enter a username",
"ToastNoUpdatesNecessary": "No updates necessary", "ToastNoUpdatesNecessary": "No updates necessary",
"ToastNotificationCreateFailed": "Failed to create notification", "ToastNotificationCreateFailed": "Failed to create notification",
"ToastNotificationCreateSuccess": "Notification created",
"ToastNotificationDeleteFailed": "Failed to delete notification", "ToastNotificationDeleteFailed": "Failed to delete notification",
"ToastNotificationDeleteSuccess": "Notification deleted",
"ToastNotificationEnabled": "Notification enabled",
"ToastNotificationFailedMaximum": "Max failed attempts must be >= 0", "ToastNotificationFailedMaximum": "Max failed attempts must be >= 0",
"ToastNotificationQueueMaximum": "Max notification queue must be >= 0", "ToastNotificationQueueMaximum": "Max notification queue must be >= 0",
"ToastNotificationSettingsUpdateFailed": "Failed to update notification settings", "ToastNotificationSettingsUpdateFailed": "Failed to update notification settings",
@ -945,7 +928,6 @@
"ToastPodcastGetFeedFailed": "Failed to get podcast feed", "ToastPodcastGetFeedFailed": "Failed to get podcast feed",
"ToastPodcastNoEpisodesInFeed": "No episodes found in RSS feed", "ToastPodcastNoEpisodesInFeed": "No episodes found in RSS feed",
"ToastPodcastNoRssFeed": "Podcast does not have an RSS feed", "ToastPodcastNoRssFeed": "Podcast does not have an RSS feed",
"ToastProgressReset": "Your progress was reset",
"ToastProviderCreatedFailed": "Failed to add provider", "ToastProviderCreatedFailed": "Failed to add provider",
"ToastProviderCreatedSuccess": "New provider added", "ToastProviderCreatedSuccess": "New provider added",
"ToastProviderNameAndUrlRequired": "Name and Url required", "ToastProviderNameAndUrlRequired": "Name and Url required",
@ -971,10 +953,8 @@
"ToastServerSettingsUpdateFailed": "Failed to update server settings", "ToastServerSettingsUpdateFailed": "Failed to update server settings",
"ToastServerSettingsUpdateSuccess": "Server settings updated", "ToastServerSettingsUpdateSuccess": "Server settings updated",
"ToastSessionCloseFailed": "Failed to close session", "ToastSessionCloseFailed": "Failed to close session",
"ToastSessionCloseSuccess": "Session closed",
"ToastSessionDeleteFailed": "Failed to delete session", "ToastSessionDeleteFailed": "Failed to delete session",
"ToastSessionDeleteSuccess": "Session deleted", "ToastSessionDeleteSuccess": "Session deleted",
"ToastSessionsRemoved": "Sessions removed",
"ToastSlugMustChange": "Slug contains invalid characters", "ToastSlugMustChange": "Slug contains invalid characters",
"ToastSlugRequired": "Slug is required", "ToastSlugRequired": "Slug is required",
"ToastSocketConnected": "Socket connected", "ToastSocketConnected": "Socket connected",