 11ca358242
			
		
	
	11ca358242
	
	
	
		
			
			* web/admin: fix duplicate RBAC preview banner on permission modal Signed-off-by: Jens Langhammer <jens@goauthentik.io> * switch non-embedded permission page to use vertical tabs Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix some leftover html? Signed-off-by: Jens Langhammer <jens@goauthentik.io> * move stuff into vertical subtab Signed-off-by: Jens Langhammer <jens@goauthentik.io> * show all of users permission tabs on one main tab Signed-off-by: Jens Langhammer <jens@goauthentik.io> * rework role page to match user page Signed-off-by: Jens Langhammer <jens@goauthentik.io> * use separate tabs Signed-off-by: Jens Langhammer <jens@goauthentik.io> * rename role permission tables to match user tables Signed-off-by: Jens Langhammer <jens@goauthentik.io> * rename to credentials and tokens Signed-off-by: Jens Langhammer <jens@goauthentik.io> * add country icon to session list Signed-off-by: Jens Langhammer <jens@goauthentik.io> * add oauth access token list Signed-off-by: Jens Langhammer <jens@goauthentik.io> * add helper to get relative time Signed-off-by: Jens Langhammer <jens@goauthentik.io> * use pfdivider Signed-off-by: Jens Langhammer <jens@goauthentik.io> * replace plain hr with pf-c-divider Signed-off-by: Jens Langhammer <jens@goauthentik.io> * use new logic for showing relative time in charts Signed-off-by: Jens Langhammer <jens@goauthentik.io> * use consistent relative time for event display Signed-off-by: Jens Langhammer <jens@goauthentik.io> * remove more leftovers Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix some alignment issues on the admin dashboard Signed-off-by: Jens Langhammer <jens@goauthentik.io> * update storybook map Signed-off-by: Jens Langhammer <jens@goauthentik.io> * add sanity check to event app lookup Signed-off-by: Jens Langhammer <jens@goauthentik.io> * make api drawer header fixed Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix table padding for toggle Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix notification drawer for user interface Signed-off-by: Jens Langhammer <jens@goauthentik.io> * enable system task search Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix formatting, exclude generated script from formatting Signed-off-by: Jens Langhammer <jens@goauthentik.io> * web: minor fixes There's a renderer (it's not a component, not yet) for producing definition lists without the risk of missing a class or tag. Breaking conditionally rendered components out to make their use easier to identify. * fix prettier Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix outpost form Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix more flaky tests Signed-off-by: Jens Langhammer <jens@goauthentik.io> * re-create locale Signed-off-by: Jens Langhammer <jens@goauthentik.io> * add some description for different permission views Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix system task search Signed-off-by: Jens Langhammer <jens@goauthentik.io> * update docs Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io> Co-authored-by: Ken Sternberg <ken@goauthentik.io>
		
			
				
	
	
		
			92 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			92 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import fs from "fs";
 | |
| import path from "path";
 | |
| import { fileURLToPath } from "url";
 | |
| 
 | |
| const __dirname = fileURLToPath(new URL(".", import.meta.url));
 | |
| 
 | |
| // eslint-disable-next-line @typescript-eslint/no-explicit-any
 | |
| function* walkFilesystem(dir: string): Generator<string, undefined, any> {
 | |
|     const openeddir = fs.opendirSync(dir);
 | |
|     if (!openeddir) {
 | |
|         return;
 | |
|     }
 | |
| 
 | |
|     let d: fs.Dirent | null;
 | |
|     while ((d = openeddir?.readSync())) {
 | |
|         if (!d) {
 | |
|             break;
 | |
|         }
 | |
|         const entry = path.join(dir, d.name);
 | |
|         if (d.isDirectory()) yield* walkFilesystem(entry);
 | |
|         else if (d.isFile()) yield entry;
 | |
|     }
 | |
|     openeddir.close();
 | |
| }
 | |
| 
 | |
| const import_re = /^(import \w+ from .*\.css)";/;
 | |
| function extractImportLinesFromFile(path: string) {
 | |
|     const source = fs.readFileSync(path, { encoding: "utf8", flag: "r" });
 | |
|     const lines = source?.split("\n") ?? [];
 | |
|     return lines.filter((l) => import_re.test(l));
 | |
| }
 | |
| 
 | |
| function createOneImportLine(line: string) {
 | |
|     const importMatch = import_re.exec(line);
 | |
|     if (!importMatch) {
 | |
|         throw new Error("How did an unmatchable line get here?");
 | |
|     }
 | |
|     const importContent = importMatch[1];
 | |
|     if (!importContent) {
 | |
|         throw new Error("How did an unmatchable line get here!?");
 | |
|     }
 | |
|     return `    '${importContent}";',`;
 | |
| }
 | |
| 
 | |
| const isSourceFile = /\.ts$/;
 | |
| function getTheSourceFiles() {
 | |
|     return Array.from(walkFilesystem(path.join(__dirname, "..", "src"))).filter((path) =>
 | |
|         isSourceFile.test(path),
 | |
|     );
 | |
| }
 | |
| 
 | |
| function getTheImportLines(importPaths: string[]) {
 | |
|     const importLines: string[] = importPaths.reduce(
 | |
|         (acc: string[], path) => [...acc, extractImportLinesFromFile(path)].flat(),
 | |
|         [],
 | |
|     );
 | |
|     const uniqueImportLines = new Set(importLines);
 | |
|     const sortedImportLines = Array.from(uniqueImportLines.keys());
 | |
|     sortedImportLines.sort();
 | |
|     return sortedImportLines;
 | |
| }
 | |
| 
 | |
| const importPaths = getTheSourceFiles();
 | |
| const importLines = getTheImportLines(importPaths);
 | |
| 
 | |
| const outputFile = `// THIS IS A GENERATED FILE.  DO NOT EDIT BY HAND.
 | |
| //
 | |
| // This file is generated by the build-storybook-import-maps script in the UI's base directory.
 | |
| // This is a *hack* to work around an inconsistency in the way rollup, vite, and storybook
 | |
| // import CSS modules.
 | |
| //
 | |
| // Sometime around 2030 or so, the Javascript community may finally get its collective act together
 | |
| // and we'll have one unified way of doing this.  I can only hope.
 | |
| 
 | |
| const rawCssImportMaps = [
 | |
| ${importLines.map(createOneImportLine).join("\n")}
 | |
| ];
 | |
| 
 | |
| const cssImportMaps = rawCssImportMaps.reduce(
 | |
|     (acc, line) => ({ ...acc, [line]: line.replace(/\\.css/, ".css?inline") }),
 | |
|     {},
 | |
| );
 | |
| 
 | |
| export { cssImportMaps };
 | |
| export default cssImportMaps;
 | |
| `;
 | |
| 
 | |
| fs.writeFileSync(path.join(__dirname, "..", ".storybook", "css-import-maps.ts"), outputFile, {
 | |
|     encoding: "utf8",
 | |
|     flag: "w",
 | |
| });
 |