mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
refactor(editor): Cleanup template variant experiment (#6929)
* cleanup template variant experiment * remove template preveting search to render
This commit is contained in:
parent
7ce05b08c7
commit
6c607635ed
|
@ -525,14 +525,7 @@ export const KEEP_AUTH_IN_NDV_FOR_NODES = [
|
||||||
export const MAIN_AUTH_FIELD_NAME = 'authentication';
|
export const MAIN_AUTH_FIELD_NAME = 'authentication';
|
||||||
export const NODE_RESOURCE_FIELD_NAME = 'resource';
|
export const NODE_RESOURCE_FIELD_NAME = 'resource';
|
||||||
|
|
||||||
export const TEMPLATES_EXPERIMENT = {
|
export const EXPERIMENTS_TO_TRACK = [];
|
||||||
name: '008_template_variants',
|
|
||||||
control: 'control',
|
|
||||||
variant: 'variant',
|
|
||||||
variantIds: ['1932', '1930', '1931', '1933', '1750', '1748', '1435'],
|
|
||||||
};
|
|
||||||
|
|
||||||
export const EXPERIMENTS_TO_TRACK = [TEMPLATES_EXPERIMENT.name];
|
|
||||||
|
|
||||||
export const NODE_TYPES_EXCLUDED_FROM_OUTPUT_NAME_APPEND = [FILTER_NODE_TYPE];
|
export const NODE_TYPES_EXCLUDED_FROM_OUTPUT_NAME_APPEND = [FILTER_NODE_TYPE];
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
</template>
|
</template>
|
||||||
<template #content>
|
<template #content>
|
||||||
<div :class="$style.contentWrapper">
|
<div :class="$style.contentWrapper">
|
||||||
<div :class="$style.filters" v-if="!isFixedListExperiment">
|
<div :class="$style.filters">
|
||||||
<TemplateFilters
|
<TemplateFilters
|
||||||
:categories="templatesStore.allCategories"
|
:categories="templatesStore.allCategories"
|
||||||
:sortOnPopulate="areCategoriesPrepopulated"
|
:sortOnPopulate="areCategoriesPrepopulated"
|
||||||
|
@ -30,41 +30,35 @@
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div :class="$style.search">
|
<div :class="$style.search">
|
||||||
<template v-if="!isFixedListExperiment">
|
<n8n-input
|
||||||
<n8n-input
|
:modelValue="search"
|
||||||
:modelValue="search"
|
:placeholder="$locale.baseText('templates.searchPlaceholder')"
|
||||||
:placeholder="$locale.baseText('templates.searchPlaceholder')"
|
@update:modelValue="onSearchInput"
|
||||||
@update:modelValue="onSearchInput"
|
@blur="trackSearch"
|
||||||
@blur="trackSearch"
|
clearable
|
||||||
clearable
|
>
|
||||||
>
|
<template #prefix>
|
||||||
<template #prefix>
|
<font-awesome-icon icon="search" />
|
||||||
<font-awesome-icon icon="search" />
|
</template>
|
||||||
</template>
|
</n8n-input>
|
||||||
</n8n-input>
|
<div :class="$style.carouselContainer" v-show="collections.length || loadingCollections">
|
||||||
<div
|
<div :class="$style.header">
|
||||||
:class="$style.carouselContainer"
|
<n8n-heading :bold="true" size="medium" color="text-light">
|
||||||
v-show="collections.length || loadingCollections"
|
{{ $locale.baseText('templates.collections') }}
|
||||||
>
|
<span v-if="!loadingCollections" v-text="`(${collections.length})`" />
|
||||||
<div :class="$style.header">
|
</n8n-heading>
|
||||||
<n8n-heading :bold="true" size="medium" color="text-light">
|
|
||||||
{{ $locale.baseText('templates.collections') }}
|
|
||||||
<span v-if="!loadingCollections" v-text="`(${collections.length})`" />
|
|
||||||
</n8n-heading>
|
|
||||||
</div>
|
|
||||||
<CollectionsCarousel
|
|
||||||
:collections="collections"
|
|
||||||
:loading="loadingCollections"
|
|
||||||
@openCollection="onOpenCollection"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
<CollectionsCarousel
|
||||||
|
:collections="collections"
|
||||||
|
:loading="loadingCollections"
|
||||||
|
@openCollection="onOpenCollection"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<TemplateList
|
<TemplateList
|
||||||
:infinite-scroll-enabled="!isFixedListExperiment"
|
:infinite-scroll-enabled="true"
|
||||||
:loading="loadingWorkflows"
|
:loading="loadingWorkflows"
|
||||||
:total-workflows="totalWorkflows"
|
:total-workflows="totalWorkflows"
|
||||||
:workflows="isFixedListExperiment ? fixedTemplatesList : workflows"
|
:workflows="workflows"
|
||||||
:simple-view="isFixedListExperiment"
|
|
||||||
@loadMore="onLoadMore"
|
@loadMore="onLoadMore"
|
||||||
@openTemplate="onOpenTemplate"
|
@openTemplate="onOpenTemplate"
|
||||||
/>
|
/>
|
||||||
|
@ -96,7 +90,7 @@ import type {
|
||||||
} from '@/Interface';
|
} from '@/Interface';
|
||||||
import type { IDataObject } from 'n8n-workflow';
|
import type { IDataObject } from 'n8n-workflow';
|
||||||
import { setPageTitle } from '@/utils';
|
import { setPageTitle } from '@/utils';
|
||||||
import { TEMPLATES_EXPERIMENT, VIEWS } from '@/constants';
|
import { VIEWS } from '@/constants';
|
||||||
import { debounceHelper } from '@/mixins/debounce';
|
import { debounceHelper } from '@/mixins/debounce';
|
||||||
import { useSettingsStore } from '@/stores/settings.store';
|
import { useSettingsStore } from '@/stores/settings.store';
|
||||||
import { useUsersStore } from '@/stores/users.store';
|
import { useUsersStore } from '@/stores/users.store';
|
||||||
|
@ -142,17 +136,6 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapStores(useSettingsStore, useTemplatesStore, useUIStore, useUsersStore, usePostHog),
|
...mapStores(useSettingsStore, useTemplatesStore, useUIStore, useUsersStore, usePostHog),
|
||||||
isFixedListExperiment() {
|
|
||||||
return this.posthogStore.isVariantEnabled(
|
|
||||||
TEMPLATES_EXPERIMENT.name,
|
|
||||||
TEMPLATES_EXPERIMENT.variant,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
fixedTemplatesList() {
|
|
||||||
return TEMPLATES_EXPERIMENT.variantIds
|
|
||||||
.map((id) => this.templatesStore.workflows[id])
|
|
||||||
.filter(Boolean);
|
|
||||||
},
|
|
||||||
totalWorkflows(): number {
|
totalWorkflows(): number {
|
||||||
return this.templatesStore.getSearchedWorkflowsTotal(this.query);
|
return this.templatesStore.getSearchedWorkflowsTotal(this.query);
|
||||||
},
|
},
|
||||||
|
@ -405,15 +388,6 @@ export default defineComponent({
|
||||||
}, 100);
|
}, 100);
|
||||||
},
|
},
|
||||||
async created() {
|
async created() {
|
||||||
if (this.isFixedListExperiment) {
|
|
||||||
// Templates are lazy-loaded so we need to make sure the fixed ids are loaded
|
|
||||||
TEMPLATES_EXPERIMENT.variantIds.forEach(async (templateId) =>
|
|
||||||
this.templatesStore.fetchTemplateById(templateId),
|
|
||||||
);
|
|
||||||
// Categorization and filtering based on search is not supported if fixed list is enabled
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.$route.query.search && typeof this.$route.query.search === 'string') {
|
if (this.$route.query.search && typeof this.$route.query.search === 'string') {
|
||||||
this.search = this.$route.query.search;
|
this.search = this.$route.query.search;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue