mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
add to resource list
This commit is contained in:
parent
59684a026c
commit
3d96768cad
|
@ -13,6 +13,8 @@ import { useDebounce } from '@/composables/useDebounce';
|
||||||
import { useTelemetry } from '@/composables/useTelemetry';
|
import { useTelemetry } from '@/composables/useTelemetry';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useProjectsStore } from '@/stores/projects.store';
|
import { useProjectsStore } from '@/stores/projects.store';
|
||||||
|
import { N8nIconButton, N8nNavigationDropdown } from 'n8n-design-system';
|
||||||
|
import { useGlobalEntityCreation } from '@/composables/useGlobalEntityCreation';
|
||||||
|
|
||||||
import type { BaseTextKey } from '@/plugins/i18n';
|
import type { BaseTextKey } from '@/plugins/i18n';
|
||||||
import type { Scope } from '@n8n/permissions';
|
import type { Scope } from '@n8n/permissions';
|
||||||
|
@ -350,6 +352,20 @@ const projectName = computed(() => {
|
||||||
return projectsStore.currentProject.name;
|
return projectsStore.currentProject.name;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const { menu, handleSelect } = useGlobalEntityCreation(
|
||||||
|
computed(() => !Boolean(projectsStore.currentProject)),
|
||||||
|
);
|
||||||
|
|
||||||
|
const createLabel = computed(() => {
|
||||||
|
if (!projectsStore.currentProject) {
|
||||||
|
return 'Create';
|
||||||
|
} else if (projectsStore.currentProject.type === ProjectTypes.Personal) {
|
||||||
|
return 'Create personal';
|
||||||
|
} else {
|
||||||
|
return 'Create in project';
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -359,6 +375,11 @@ const projectName = computed(() => {
|
||||||
<template #title>
|
<template #title>
|
||||||
{{ projectName }}
|
{{ projectName }}
|
||||||
</template>
|
</template>
|
||||||
|
<template #actions>
|
||||||
|
<N8nNavigationDropdown :menu @select="handleSelect">
|
||||||
|
<N8nIconButton :label="createLabel" icon="plus" style="width: auto" />
|
||||||
|
</N8nNavigationDropdown>
|
||||||
|
</template>
|
||||||
</ResourceListHeader>
|
</ResourceListHeader>
|
||||||
<slot name="header" />
|
<slot name="header" />
|
||||||
</template>
|
</template>
|
||||||
|
@ -435,16 +456,6 @@ const projectName = computed(() => {
|
||||||
</n8n-select>
|
</n8n-select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<slot name="add-button" :disabled="disabled">
|
|
||||||
<n8n-button
|
|
||||||
size="large"
|
|
||||||
:disabled="disabled"
|
|
||||||
data-test-id="resources-list-add"
|
|
||||||
@click="onAddButtonClick"
|
|
||||||
>
|
|
||||||
{{ i18n.baseText(`${resourceKey}.add` as BaseTextKey) }}
|
|
||||||
</n8n-button>
|
|
||||||
</slot>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<slot name="callout"></slot>
|
<slot name="callout"></slot>
|
||||||
|
|
Loading…
Reference in a new issue