mirror of
https://github.com/inventree/InvenTree.git
synced 2026-11-18 14:07:41 +00:00
feat: Add First Time User Guide and tipp backend data structure (#12978)
* add backend stuff * update str method * add to admin * [FR] Add FTUE Fixes #2907 * bump deps * bump api * add missing ruleset entry * fix init * add jumpoff to nav * try disableing specific test * fix lookup * fix mounting * disable more * make tour conditional * only show ftue once * remove temp disable * add actual content * enable using the menu as well * reorder steps * finish propagation * only allow delete * lower testing runtime for now * fix nitpicks * revert frontend debug changes * fix migration * patch out ftu behaviour on the backend * rename to first time use guide * change tipp (DE) to tip (EN) * deduplicate notification
This commit is contained in:
1 parent
9b8fdeb06d
commit
2f139f94b4
25 files changed
+764
-250
No files matched your search
@@ -14,3 +14,29 @@ export const createApi = ({
|
||||
Authorization: `Basic ${btoa(`${username || adminuser.username}:${password || adminuser.testcred}`)}`
|
||||
}
|
||||
});
|
||||
|
||||
export const dismissFtu = async ({
|
||||
username,
|
||||
password
|
||||
}: {
|
||||
username: string;
|
||||
password: string;
|
||||
}) => {
|
||||
const api = await createApi({ username, password });
|
||||
|
||||
// find tip and patch out ftu
|
||||
try {
|
||||
const response = await api.get('user/me/');
|
||||
if (!response.ok()) return;
|
||||
const tip = ((await response.json())?.tips ?? []).find(
|
||||
(t: any) => t.tip_id === 'org.inventree.i.tip.ftug'
|
||||
);
|
||||
if (tip && !tip.finished) {
|
||||
await api.patch(`user/me/tips/${tip.pk}/`, {
|
||||
data: { finished: true }
|
||||
});
|
||||
}
|
||||
} finally {
|
||||
await api.dispose();
|
||||
}
|
||||
};
|
||||
@@ -1,4 +1,7 @@
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import type { Browser, Page } from '@playwright/test';
|
||||
import { dismissFtu } from './api';
|
||||
import {
|
||||
type UserType,
|
||||
allaccessuser,
|
||||
@@ -6,9 +9,6 @@ import {
|
||||
logoutUrl,
|
||||
webUrl
|
||||
} from './defaults';
|
||||
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { navigate } from './helpers.js';
|
||||
|
||||
interface LoginOptions {
|
||||
@@ -28,6 +28,7 @@ export const doLogin = async (page: Page, options?: LoginOptions) => {
|
||||
options?.password ?? options?.user?.testcred ?? allaccessuser.testcred;
|
||||
|
||||
console.log('- Logging in with username:', username);
|
||||
await dismissFtu({ username, password });
|
||||
|
||||
await navigate(page, loginUrl, {
|
||||
baseUrl: options?.baseUrl,
|
||||
|
||||
Reference in new issue
Block a user