Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix(editor): Update tags filter/editor to not show non existing tag as a selectable option #10297

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions cypress/e2e/17-workflow-tags.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { WorkflowPage } from '../pages';
import { getVisibleSelect } from '../utils';

const wf = new WorkflowPage();

Expand Down Expand Up @@ -70,4 +71,20 @@ describe('Workflow tags', () => {
wf.getters.workflowTags().click();
wf.getters.tagPills().should('have.length', TEST_TAGS.length - 1);
});

it('should not show non existing tag as a selectable option', () => {
const NON_EXISTING_TAG = 'My Test Tag';

wf.getters.createTagButton().click();
wf.actions.addTags(TEST_TAGS);
cy.get('body').click(0, 0);
wf.getters.workflowTags().click();
wf.getters.tagsDropdown().find('input:focus').type(NON_EXISTING_TAG);

getVisibleSelect()
.find('li')
.should('have.length', 2)
.filter(`:contains("${NON_EXISTING_TAG}")`)
.should('not.have.length');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,6 @@ function showCreateWorkflowSuccessToast(id?: string) {
v-if="isTagsEditEnabled && !readOnly"
ref="dropdown"
v-model="appliedTagIds"
:create-enabled="true"
:event-bus="tagsEventBus"
:placeholder="$locale.baseText('workflowDetails.chooseOrCreateATag')"
class="tags-edit"
Expand Down
13 changes: 4 additions & 9 deletions packages/editor-ui/src/components/TagsDropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
:filter-method="filterOptions"
filterable
multiple
:allow-create="createEnabled"
:reserve-keyword="false"
loading-text="..."
popper-class="tags-dropdown"
Expand All @@ -23,7 +22,7 @@
@remove-tag="onRemoveTag"
>
<n8n-option
v-if="options.length === 0 && filter && createEnabled"
v-if="options.length === 0 && filter"
:key="CREATE_KEY"
ref="createRef"
:value="CREATE_KEY"
Expand All @@ -35,11 +34,11 @@
</span>
</n8n-option>
<n8n-option v-else-if="options.length === 0" value="message" disabled>
<span v-if="createEnabled">{{ i18n.baseText('tagsDropdown.typeToCreateATag') }}</span>
<span v-else-if="allTags.length > 0">{{
<span>{{ i18n.baseText('tagsDropdown.typeToCreateATag') }}</span>
<span v-if="allTags.length > 0">{{
i18n.baseText('tagsDropdown.noMatchingTagsExist')
}}</span>
<span v-else>{{ i18n.baseText('tagsDropdown.noTagsExist') }}</span>
<span v-else-if="filter">{{ i18n.baseText('tagsDropdown.noTagsExist') }}</span>
</n8n-option>

<!-- key is id+index for keyboard navigation to work well with filter -->
Expand Down Expand Up @@ -90,10 +89,6 @@ export default defineComponent({
type: Array as PropType<string[]>,
default: () => [],
},
createEnabled: {
type: Boolean,
default: false,
},
eventBus: {
type: Object as PropType<EventBus>,
default: null,
Expand Down
Loading