refactor: modular navigation and custom api calls (#3613)

* Added customization files

* Added custom API headers and changed logout mutation

* Changed mutationLogout on authGuard

* Renamed feature flags

* Changed auto login to run after primary loading

* Removed unused code

* Added undefined on mutationfunctiontype to have options

* Changed logout to mutationLogout

* Return data on getConfig

* Added custom wrapper

* changed hasStore to be the constant by default

* Added custom header

* Added customParam feature flag

* Fix routes and custom link and navigate to consider absolute and relative paths

* Fixed regex on  tabs search component

* Added CustomNavigate

* Added basename and ports and URLs config

* [autofix.ci] apply automated fixes

* Update config-constants.ts

* Update index.tsx

* Fixed path comparations

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
Lucas Oliveira 2024-08-29 12:05:23 -03:00 • committed by GitHub
commit 06ea6c408b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
54 changed files with 300 additions and 215 deletions

View file

@ -4,17 +4,24 @@ import path from "path";
import { defineConfig } from "vite";
import svgr from "vite-plugin-svgr";
import tsconfigPaths from "vite-tsconfig-paths";
import {
API_ROUTES,
BASENAME,
PORT,
PROXY_TARGET,
} from "./src/customization/config-constants";
export default defineConfig(({ mode }) => {
dotenv.config({ path: path.resolve(__dirname, "../../.env") });
const apiRoutes = ["^/api/v1/", "/health"];
const apiRoutes = API_ROUTES || ["^/api/v1/", "/health"];
// Use environment variable to determine the target.
const target = process.env.VITE_PROXY_TARGET || "http://127.0.0.1:7860";
const target =
process.env.VITE_PROXY_TARGET || PROXY_TARGET || "http://127.0.0.1:7860";
// Use environment variable to determine the UI server port
const port = Number(process.env.VITE_PORT) || 3000;
const port = Number(process.env.VITE_PORT) || PORT || 3000;
const proxyTargets = apiRoutes.reduce((proxyObj, route) => {
proxyObj[route] = {
@ -27,6 +34,7 @@ export default defineConfig(({ mode }) => {
}, {});
return {
basename: (BASENAME || "") + "/",
build: {
outDir: "build",
},