diff --git a/frontend/components/ConfigChannel.vue b/frontend/components/ConfigChannel.vue index 47b2b186..37d462ec 100644 --- a/frontend/components/ConfigChannel.vue +++ b/frontend/components/ConfigChannel.vue @@ -127,6 +127,7 @@ async function addUpdateChannel() { indexStore.msgAlert('success', t('config.updateChannelSuccess'), 2) await configStore.getPlayoutConfig() + await configStore.getUserConfig() } else { indexStore.msgAlert('error', t('config.updateChannelFailed'), 2) @@ -152,6 +153,7 @@ async function deleteChannel() { i.value = configStore.i - 1 await configStore.getChannelConfig() await configStore.getPlayoutConfig() + await configStore.getUserConfig() if (response.status === 200) { indexStore.msgAlert('success', t('config.errorChannelDelete'), 2) diff --git a/frontend/components/ConfigUser.vue b/frontend/components/ConfigUser.vue index a9fa5dde..57c72284 100644 --- a/frontend/components/ConfigUser.vue +++ b/frontend/components/ConfigUser.vue @@ -144,7 +144,7 @@ const user = ref({ password: '', confirm: '', admin: false, - channel_ids: [1], + channel_ids: [configStore.channels[configStore.i]?.id ?? 1], role_id: 3, } as User) diff --git a/frontend/composables/helper.ts b/frontend/composables/helper.ts index 86eb9ee5..8bf70e7d 100644 --- a/frontend/composables/helper.ts +++ b/frontend/composables/helper.ts @@ -39,12 +39,12 @@ export const stringFormatter = () => { .replace(/\[Validator\]/g, '[Validator]') } - function timeToSeconds(time: string) { + function timeToSeconds(time: string): number { const t = time.split(':') return parseInt(t[0]) * 3600 + parseInt(t[1]) * 60 + parseInt(t[2]) } - function secToHMS(sec: number) { + function secToHMS(sec: number): string { const sign = Math.sign(sec) sec = Math.abs(sec) @@ -62,7 +62,7 @@ export const stringFormatter = () => { return `${hString}:${m}:${s}` } - function numberToHex(num: number) { + function numberToHex(num: number): string { return '0x' + Math.round(num * 255).toString(16) } @@ -70,7 +70,7 @@ export const stringFormatter = () => { return parseFloat((parseFloat(parseInt(num, 16).toString()) / 255).toFixed(2)) } - function filename(path: string) { + function filename(path: string): string { if (path) { const pathArr = path.split('/') const name = pathArr[pathArr.length - 1] @@ -85,7 +85,7 @@ export const stringFormatter = () => { } } - function parent(path: string) { + function parent(path: string): string { if (path) { const pathArr = path.split('/') pathArr.pop() @@ -100,7 +100,7 @@ export const stringFormatter = () => { } } - function toMin(sec: number) { + function toMin(sec: number): string { if (sec) { const minutes = Math.floor(sec / 60) const seconds = Math.round(sec - minutes * 60) @@ -167,6 +167,14 @@ export const stringFormatter = () => { return null } + function dir_file(path: string): {dir: string, file: string} { + const index = path.lastIndexOf('/') + const dir = path.substring(0, index + 1) || '/' + const file = path.substring(index + 1) + + return {dir, file} + } + return { fileSize, formatLog, @@ -179,6 +187,7 @@ export const stringFormatter = () => { toMin, secondsToTime, mediaType, + dir_file, } } diff --git a/frontend/i18n/locales/de-DE.js b/frontend/i18n/locales/de-DE.js index dd7abd9d..1568c1f8 100644 --- a/frontend/i18n/locales/de-DE.js +++ b/frontend/i18n/locales/de-DE.js @@ -93,7 +93,9 @@ export default { notExists: 'Speicher existiert nicht!', create: 'Ordner erstellen', upload: 'Dateien hochladen', - deleteTitle: 'Datei/Ordner löschen', + delete: 'Lösche', + file: 'Datei', + folder: 'Ordner', deleteQuestion: 'Sind Sie sicher, dass Sie löschen möchten', preview: 'Vorschau', rename: 'Datei umbenennen', diff --git a/frontend/i18n/locales/en-US.js b/frontend/i18n/locales/en-US.js index e8cf85e7..feb68c0c 100644 --- a/frontend/i18n/locales/en-US.js +++ b/frontend/i18n/locales/en-US.js @@ -93,7 +93,9 @@ export default { notExists: 'Storage not exist!', create: 'Create Folder', upload: 'Upload Files', - deleteTitle: 'Delete File/Folder', + delete: 'Delete', + file: 'File', + folder: 'Folder', deleteQuestion: 'Are you sure that you want to delete', preview: 'Preview', rename: 'Rename File', diff --git a/frontend/i18n/locales/pt-BR.js b/frontend/i18n/locales/pt-BR.js index 0a9d2d13..cd163d5c 100644 --- a/frontend/i18n/locales/pt-BR.js +++ b/frontend/i18n/locales/pt-BR.js @@ -93,7 +93,9 @@ export default { notExists: 'O armazenamento não existe!', create: 'Criar Pasta', upload: 'Enviar Arquivos', - deleteTitle: 'Deletar Arquivo/Pasta', + delete: 'Deletar', + file: 'Arquivo', + folder: 'Pasta', deleteQuestion: 'Tem certeza que deseja deletar?', preview: 'Visualizar', rename: 'Renomear Arquivo', diff --git a/frontend/i18n/locales/ru-RU.js b/frontend/i18n/locales/ru-RU.js index 4dda70a6..7028928b 100644 --- a/frontend/i18n/locales/ru-RU.js +++ b/frontend/i18n/locales/ru-RU.js @@ -93,7 +93,9 @@ export default { notExists: 'Папки не существует!', create: 'Сделать папку', upload: 'Загрузить файлы', - deleteTitle: 'Удалить Файл/Папку', + delete: 'Удалить', + file: 'Файл', + folder: 'Папку', deleteQuestion: 'Вы уверены что хотите это удалить', preview: 'Просмотр', rename: 'Переименовать файл', diff --git a/frontend/pages/media.vue b/frontend/pages/media.vue index 9df1bc78..e0167c67 100644 --- a/frontend/pages/media.vue +++ b/frontend/pages/media.vue @@ -230,12 +230,12 @@ - + @@ -321,7 +321,7 @@ const authStore = useAuth() const configStore = useConfig() const indexStore = useIndex() const mediaStore = useMedia() -const { toMin, mediaType, filename, parent } = stringFormatter() +const { toMin, mediaType, filename, parent, dir_file } = stringFormatter() const { i } = storeToRefs(useConfig()) useHead({ @@ -528,13 +528,11 @@ async function deleteFileOrFolder(del: boolean) { } function setRenameValues(path: string) { - const index = path.lastIndexOf('/') - const dir = path.substring(0, index + 1) || '/' - const file = path.substring(index + 1) + const filepath = dir_file(path) - renameOldName.value = file - renameOldPath.value = dir - renameNewName.value = file + renameOldName.value = filepath.file + renameOldPath.value = filepath.dir + renameNewName.value = filepath.file } async function renameFile(ren: boolean) {