fix(front): show correct label when adding a new calc or videoconference resource in resources

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2023-12-14 11:14:01 +01:00
parent 1d39eb5488
commit cecbea6db5
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773

View file

@ -106,13 +106,27 @@
{{ modalError }} {{ modalError }}
</o-notification> </o-notification>
<form @submit.prevent="createResource"> <form @submit.prevent="createResource">
<p v-if="newResource.type !== 'folder'"> <p v-if="newResource.type === 'pad'">
{{ {{
t("The pad will be created on {service}", { t("The pad will be created on {service}", {
service: newResourceHost, service: newResourceHost,
}) })
}} }}
</p> </p>
<p v-else-if="newResource.type === 'calc'">
{{
t("The calc will be created on {service}", {
service: newResourceHost,
})
}}
</p>
<p v-else-if="newResource.type === 'visio'">
{{
t("The videoconference will be created on {service}", {
service: newResourceHost,
})
}}
</p>
<o-field :label="t('Title')" label-for="new-resource-title"> <o-field :label="t('Title')" label-for="new-resource-title">
<o-input <o-input
ref="modalNewResourceInput" ref="modalNewResourceInput"
@ -299,8 +313,12 @@ const modalError = ref("");
const modalFieldErrors: Record<string, string> = reactive({}); const modalFieldErrors: Record<string, string> = reactive({});
const resourceRenameInput = ref<any>(); const resourceRenameInput = ref<any>();
const modalNewResourceInput = ref<HTMLElement>(); const modalNewResourceInput = ref<{
const modalNewResourceLinkInput = ref<HTMLElement>(); $refs: { inputRef: HTMLInputElement };
} | null>();
const modalNewResourceLinkInput = ref<{
$refs: { inputRef: HTMLInputElement };
} | null>();
const actualPath = computed((): string => { const actualPath = computed((): string => {
const path = Array.isArray(props.path) ? props.path.join("/") : props.path; const path = Array.isArray(props.path) ? props.path.join("/") : props.path;
@ -420,14 +438,14 @@ const createSentenceForType = (type: string): string => {
const createLinkModal = async (): Promise<void> => { const createLinkModal = async (): Promise<void> => {
createLinkResourceModal.value = true; createLinkResourceModal.value = true;
await nextTick(); await nextTick();
modalNewResourceLinkInput.value?.focus(); modalNewResourceLinkInput.value?.$refs.inputRef?.focus();
}; };
const createFolderModal = async (): Promise<void> => { const createFolderModal = async (): Promise<void> => {
newResource.type = "folder"; newResource.type = "folder";
createResourceModal.value = true; createResourceModal.value = true;
await nextTick(); await nextTick();
modalNewResourceInput.value?.focus(); modalNewResourceInput.value?.$refs.inputRef?.focus();
}; };
const createResourceFromProvider = async ( const createResourceFromProvider = async (
@ -437,7 +455,7 @@ const createResourceFromProvider = async (
newResource.type = provider.software; newResource.type = provider.software;
createResourceModal.value = true; createResourceModal.value = true;
await nextTick(); await nextTick();
modalNewResourceInput.value?.focus(); modalNewResourceInput.value?.$refs.inputRef?.focus();
}; };
const generateFullResourceUrl = (provider: IProvider): string => { const generateFullResourceUrl = (provider: IProvider): string => {