[FIX] website: fix lints in tour_utils
Due to a problem with eslint configuration,
few eslint errors were introduced during
09535ef5e6.
In this commit, these errors are fixed.
closes odoo/odoo#132963
Signed-off-by: Luca Vitali (luvi) <luvi@odoo.com>
This commit is contained in:
@@ -319,58 +319,58 @@ function clickOnExtraMenuItem(stepOptions, backend = false) {
|
||||
* @param {object} options The tour options
|
||||
* @param {string} options.url The page to edit
|
||||
* @param {boolean} [options.edition] If the tour starts in edit mode
|
||||
* @param {() => TourStep[]} steps The steps of the tour. Has to be a function to avoid direct interpolation of steps.
|
||||
* @param {() => TourStep[]} steps The steps of the tour. Has to be a function to avoid direct interpolation of steps.
|
||||
*/
|
||||
function registerWebsitePreviewTour(name, options, steps) {
|
||||
if(typeof steps !== "function") {
|
||||
throw new Error(`tour.steps has to be a function that returns TourStep[]`)
|
||||
if (typeof steps !== "function") {
|
||||
throw new Error(`tour.steps has to be a function that returns TourStep[]`);
|
||||
}
|
||||
return registry
|
||||
.category("web_tour.tours")
|
||||
.add(name, {
|
||||
...options,
|
||||
url : getClientActionUrl(options.url, !!options.edition),
|
||||
steps: () => {
|
||||
const tourSteps = [...steps()];
|
||||
// Note: for both non edit mode and edit mode, we set a high timeout for the
|
||||
// first step. Indeed loading both the backend and the frontend (in the
|
||||
// iframe) and potentially starting the edit mode can take a long time in
|
||||
// automatic tests. We'll try and decrease the need for this high timeout
|
||||
// of course.
|
||||
if (options.edition) {
|
||||
tourSteps.unshift({
|
||||
content: "Wait for the edit mode to be started",
|
||||
trigger: '.o_website_preview.editor_enable.editor_has_snippets',
|
||||
timeout: 30000,
|
||||
auto: true,
|
||||
run: () => {}, // It's a check
|
||||
});
|
||||
} else {
|
||||
tourSteps[0].timeout = 20000;
|
||||
}
|
||||
return tourSteps;
|
||||
return registry.category("web_tour.tours").add(name, {
|
||||
...options,
|
||||
url: getClientActionUrl(options.url, !!options.edition),
|
||||
steps: () => {
|
||||
const tourSteps = [...steps()];
|
||||
// Note: for both non edit mode and edit mode, we set a high timeout for the
|
||||
// first step. Indeed loading both the backend and the frontend (in the
|
||||
// iframe) and potentially starting the edit mode can take a long time in
|
||||
// automatic tests. We'll try and decrease the need for this high timeout
|
||||
// of course.
|
||||
if (options.edition) {
|
||||
tourSteps.unshift({
|
||||
content: "Wait for the edit mode to be started",
|
||||
trigger: ".o_website_preview.editor_enable.editor_has_snippets",
|
||||
timeout: 30000,
|
||||
auto: true,
|
||||
run: () => {}, // It's a check
|
||||
});
|
||||
} else {
|
||||
tourSteps[0].timeout = 20000;
|
||||
}
|
||||
});
|
||||
return tourSteps;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function registerThemeHomepageTour(name, steps) {
|
||||
if(typeof steps !== "function") {
|
||||
throw new Error(`tour.steps has to be a function that returns TourStep[]`)
|
||||
if (typeof steps !== "function") {
|
||||
throw new Error(`tour.steps has to be a function that returns TourStep[]`);
|
||||
}
|
||||
return registerWebsitePreviewTour(name, {
|
||||
url: '/',
|
||||
edition: true,
|
||||
sequence: 1010,
|
||||
saveAs: "homepage",
|
||||
}, () => prepend_trigger(
|
||||
steps().concat(clickOnSave()),
|
||||
},
|
||||
() =>
|
||||
prepend_trigger(
|
||||
steps().concat(clickOnSave()),
|
||||
".o_website_preview[data-view-xmlid='website.homepage'] "
|
||||
));
|
||||
}
|
||||
|
||||
function registerBackendAndFrontendTour(name, options, steps) {
|
||||
if(typeof steps !== "function") {
|
||||
throw new Error(`tour.steps has to be a function that returns TourStep[]`)
|
||||
if (typeof steps !== "function") {
|
||||
throw new Error(`tour.steps has to be a function that returns TourStep[]`);
|
||||
}
|
||||
if (window.location.pathname === '/web') {
|
||||
return registerWebsitePreviewTour(name, options, () => {
|
||||
@@ -383,14 +383,14 @@ function registerBackendAndFrontendTour(name, options, steps) {
|
||||
}
|
||||
newSteps.push(newStep);
|
||||
}
|
||||
return newSteps
|
||||
return newSteps;
|
||||
});
|
||||
}
|
||||
|
||||
return registry.category("web_tour.tours").add(name, {
|
||||
url: options.url,
|
||||
steps: () => {
|
||||
return steps()
|
||||
return steps();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user