fix(editor): Add select placeholder

This commit is contained in:
Csaba Tuncsik 2024-09-18 16:39:10 +02:00
parent 8901a7ccfc
commit e2fc7d31e8
No known key found for this signature in database
2 changed files with 14 additions and 1 deletions

View file

@ -28,6 +28,7 @@ const toast = useToast();
const projectsStore = useProjectsStore();
const telemetry = useTelemetry();
const filter = ref('');
const projectId = ref<string | null>(null);
const processedName = computed(
() => processProjectName(props.data.resource.homeProject?.name ?? '') ?? '',
@ -36,6 +37,7 @@ const availableProjects = computed(() =>
projectsStore.availableProjects
.filter(
(p) =>
p.name?.toLowerCase().includes(filter.value.toLowerCase()) &&
p.id !== props.data.resource.homeProject?.id &&
(!p.scopes || getResourcePermissions(p.scopes)[props.data.resourceType].create),
)
@ -62,6 +64,10 @@ const closeModal = () => {
uiStore.closeModal(props.modalName);
};
const setFilter = (query: string) => {
filter.value = query;
};
const moveResource = async () => {
if (!selectedProject.value) return;
try {
@ -92,6 +98,7 @@ const moveResource = async () => {
targetProject: selectedProject.value,
}),
type: 'success',
duration: 5000,
});
} catch (error) {
toast.showError(
@ -150,10 +157,15 @@ onMounted(() => {
<N8nSelect
class="mr-2xs mb-xs"
:model-value="projectId"
size="small"
:filterable="true"
:filter-method="setFilter"
:placeholder="i18n.baseText('projects.move.resource.modal.selectPlaceholder')"
data-test-id="project-move-resource-modal-select"
@update:model-value="updateProject"
>
<template #prefix>
<N8nIcon icon="search" />
</template>
<N8nOption
v-for="p in availableProjects"
:key="p.id"

View file

@ -2525,6 +2525,7 @@
"projects.move.resource.modal.message.sharingInfo": "(Currently shared with {numberOfProjects} project) | (Currently shared with {numberOfProjects} projects)",
"projects.move.resource.modal.message.noProjects": "Currently there are not any projects or users available for you to move this {resourceTypeLabel} to.",
"projects.move.resource.modal.button": "Move {resourceTypeLabel}",
"projects.move.resource.modal.selectPlaceholder": "Select project or user...",
"projects.move.resource.error.title": "Error moving {resourceName} {resourceTypeLabel}",
"projects.move.resource.success.title": "Successfully moved {resourceTypeLabel}",
"projects.move.resource.success.message": "{resourceName} {resourceTypeLabel} was moved to {targetProjectName}. {workflow} {link}",