Skip to content

Commit

Permalink
feat: change query previews for docker environment (#484)
Browse files Browse the repository at this point in the history
  • Loading branch information
diegopf authored May 14, 2024
1 parent f33aa98 commit ba4d966
Showing 1 changed file with 77 additions and 63 deletions.
140 changes: 77 additions & 63 deletions src/x-components/plugin.options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ import { mergeSemanticQueriesConfigWire } from './wiring/semantic-queries.wiring
const device = useDevice();

const setSearchQueryFiltered = filter(
setSearchQuery,
({ eventPayload }) => !eventPayload.startsWith('::')
setSearchQuery,
({ eventPayload }) => !eventPayload.startsWith('::')
);

const addQueryToHistoryQueriesFiltered = filter(
addQueryToHistoryQueries,
({ eventPayload }) => !eventPayload.startsWith('::')
addQueryToHistoryQueries,
({ eventPayload }) => !eventPayload.startsWith('::')
);

const setUrlQueryFiltered = filter(
Expand All @@ -33,70 +33,84 @@ const setUrlQueryFiltered = filter(
* Returns - the InstallXOptions.
*/
export async function getInstallXOptions(): Promise<InstallXOptions> {
if (process.env.VUE_APP_DEVELOPMENT_DOCKER) {
const { overrideAdapter } = await import('../adapter/docker.adapter');
overrideAdapter(adapter);
}
return {
adapter,
store,
app: App,
domElement: getDomElement,
xModules: {
facets: {
config: {
filtersStrategyForRequest: 'leaves-only'
}
},
semanticQueries: {
config: {
threshold: 50,
maxItemsToRequest: 10
},
wiring: {
SemanticQueriesConfigProvided: {
mergeSemanticQueriesConfigWire
}
}
},
search: {
wiring: {
UserAcceptedAQuery: {
setSearchQuery: setSearchQueryFiltered
}
if (process.env.VUE_APP_DEVELOPMENT_DOCKER) {
const { overrideAdapter } = await import('../adapter/docker.adapter');
overrideAdapter(adapter);
(window.initX as SnippetConfig)!.queriesPreview = [
{
query: 'short',
title: 'Short'
},
{
query: 'comedy',
title: 'Comedy'
},
{
query: 'family',
title: 'Family'
}
},
historyQueries: {
wiring: {
UserAcceptedAQuery: {
addQueryToHistoryQueries: addQueryToHistoryQueriesFiltered
];
}
return {
adapter,
store,
app: App,
domElement: getDomElement,
xModules: {
facets: {
config: {
filtersStrategyForRequest: 'leaves-only'
}
},
semanticQueries: {
config: {
threshold: 50,
maxItemsToRequest: 10
},
wiring: {
SemanticQueriesConfigProvided: {
mergeSemanticQueriesConfigWire
}
}
},
search: {
wiring: {
UserAcceptedAQuery: {
setSearchQuery: setSearchQueryFiltered
}
}
},
historyQueries: {
wiring: {
UserAcceptedAQuery: {
addQueryToHistoryQueries: addQueryToHistoryQueriesFiltered
}
}
},
url: {
wiring: {
UserAcceptedAQuery: {
setUrlQuery: setUrlQueryFiltered
}
}
}
},
url: {
wiring: {
UserAcceptedAQuery: {
setUrlQuery: setUrlQueryFiltered
}
}
}
},
async installExtraPlugins({ vue, snippet }) {
const i18n = await I18n.create({
locale: snippet.uiLang,
device: (snippet.device as string) ?? device.deviceName.value,
fallbackLocale: 'en',
messages
});
vue.use(i18n);
vue.prototype.$setLocale = i18n.setLocale.bind(i18n);
vue.prototype.$setLocaleDevice = i18n.setDevice.bind(i18n);
async installExtraPlugins({ vue, snippet }) {
const i18n = await I18n.create({
locale: snippet.uiLang,
device: (snippet.device as string) ?? device.deviceName.value,
fallbackLocale: 'en',
messages
});
vue.use(i18n);
vue.prototype.$setLocale = i18n.setLocale.bind(i18n);
vue.prototype.$setLocaleDevice = i18n.setDevice.bind(i18n);

return {
i18n: i18n.vueI18n
};
}
};
return {
i18n: i18n.vueI18n
};
}
};
}

/**
Expand Down

0 comments on commit ba4d966

Please sign in to comment.