mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-12 15:44:06 -08:00
fix(editor): Add select placeholder
This commit is contained in:
parent
8901a7ccfc
commit
e2fc7d31e8
|
@ -28,6 +28,7 @@ const toast = useToast();
|
||||||
const projectsStore = useProjectsStore();
|
const projectsStore = useProjectsStore();
|
||||||
const telemetry = useTelemetry();
|
const telemetry = useTelemetry();
|
||||||
|
|
||||||
|
const filter = ref('');
|
||||||
const projectId = ref<string | null>(null);
|
const projectId = ref<string | null>(null);
|
||||||
const processedName = computed(
|
const processedName = computed(
|
||||||
() => processProjectName(props.data.resource.homeProject?.name ?? '') ?? '',
|
() => processProjectName(props.data.resource.homeProject?.name ?? '') ?? '',
|
||||||
|
@ -36,6 +37,7 @@ const availableProjects = computed(() =>
|
||||||
projectsStore.availableProjects
|
projectsStore.availableProjects
|
||||||
.filter(
|
.filter(
|
||||||
(p) =>
|
(p) =>
|
||||||
|
p.name?.toLowerCase().includes(filter.value.toLowerCase()) &&
|
||||||
p.id !== props.data.resource.homeProject?.id &&
|
p.id !== props.data.resource.homeProject?.id &&
|
||||||
(!p.scopes || getResourcePermissions(p.scopes)[props.data.resourceType].create),
|
(!p.scopes || getResourcePermissions(p.scopes)[props.data.resourceType].create),
|
||||||
)
|
)
|
||||||
|
@ -62,6 +64,10 @@ const closeModal = () => {
|
||||||
uiStore.closeModal(props.modalName);
|
uiStore.closeModal(props.modalName);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const setFilter = (query: string) => {
|
||||||
|
filter.value = query;
|
||||||
|
};
|
||||||
|
|
||||||
const moveResource = async () => {
|
const moveResource = async () => {
|
||||||
if (!selectedProject.value) return;
|
if (!selectedProject.value) return;
|
||||||
try {
|
try {
|
||||||
|
@ -92,6 +98,7 @@ const moveResource = async () => {
|
||||||
targetProject: selectedProject.value,
|
targetProject: selectedProject.value,
|
||||||
}),
|
}),
|
||||||
type: 'success',
|
type: 'success',
|
||||||
|
duration: 5000,
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.showError(
|
toast.showError(
|
||||||
|
@ -150,10 +157,15 @@ onMounted(() => {
|
||||||
<N8nSelect
|
<N8nSelect
|
||||||
class="mr-2xs mb-xs"
|
class="mr-2xs mb-xs"
|
||||||
:model-value="projectId"
|
: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"
|
data-test-id="project-move-resource-modal-select"
|
||||||
@update:model-value="updateProject"
|
@update:model-value="updateProject"
|
||||||
>
|
>
|
||||||
|
<template #prefix>
|
||||||
|
<N8nIcon icon="search" />
|
||||||
|
</template>
|
||||||
<N8nOption
|
<N8nOption
|
||||||
v-for="p in availableProjects"
|
v-for="p in availableProjects"
|
||||||
:key="p.id"
|
:key="p.id"
|
||||||
|
|
|
@ -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.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.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.button": "Move {resourceTypeLabel}",
|
||||||
|
"projects.move.resource.modal.selectPlaceholder": "Select project or user...",
|
||||||
"projects.move.resource.error.title": "Error moving {resourceName} {resourceTypeLabel}",
|
"projects.move.resource.error.title": "Error moving {resourceName} {resourceTypeLabel}",
|
||||||
"projects.move.resource.success.title": "Successfully moved {resourceTypeLabel}",
|
"projects.move.resource.success.title": "Successfully moved {resourceTypeLabel}",
|
||||||
"projects.move.resource.success.message": "{resourceName} {resourceTypeLabel} was moved to {targetProjectName}. {workflow} {link}",
|
"projects.move.resource.success.message": "{resourceName} {resourceTypeLabel} was moved to {targetProjectName}. {workflow} {link}",
|
||||||
|
|
Loading…
Reference in a new issue