Skip to content

Commit

Permalink
Merge pull request #391 from metrico/feat/dynamic_base_url_388
Browse files Browse the repository at this point in the history
fix: #388 custom base app url
  • Loading branch information
jacovinus authored Feb 1, 2024
2 parents e9005de + 45844c6 commit d00f560
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 18 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/node_modules/*
dist
dist
server
3 changes: 2 additions & 1 deletion packages/main/.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
VITE_API_URL=
VITE_APP_VERSION=
VITE_APP_VERSION=
VITE_APP_BASE_URL=/
2 changes: 1 addition & 1 deletion packages/main/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@ui/main",
"private": true,
"version": "0.28.2",
"version": "0.28.8",
"type": "module",
"scripts": {
"dev": "VITE_APP_VERSION=$npm_package_version vite",
Expand Down
2 changes: 1 addition & 1 deletion packages/main/plugins/settingsmenu/MainMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export default function MainMenu() {
</MenuItem>
<Divider />

<Link to="/">
<Link to="">
<MenuItem className={"item"}>
<TravelExploreIcon className="icon" />
Search
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,12 @@ const QueryBar: React.FC<QueryBarProps> = (props) => {

let customStep = 0;

const dateStart = new Date(start);
const dateStop = new Date(stop);

if (query.includes(`$__interval`)) {
const timeDiff = (stop.getTime() - start.getTime()) / 1000;
const timeDiff =
(dateStop?.getTime() - dateStart?.getTime()) / 1000;

const timeProportion = timeDiff / 30;

Expand Down Expand Up @@ -661,7 +665,8 @@ const QueryBar: React.FC<QueryBarProps> = (props) => {

if (queryExpr.includes("$__interval")) {
isMatrix = true;
const timeDiff = (data.stop.getTime() - data.start.getTime()) / 1000;
const timeDiff =
(data.stop.getTime() - data.start.getTime()) / 1000;
const timeProportion = timeDiff / 30;
const screenProportion = Number(
(width / window.innerWidth).toFixed(1)
Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
<React.StrictMode>
<CookiesProvider>
<Provider store={store}>
<HashRouter basename="/">
<HashRouter basename="">
<Suspense fallback={<ScreenLoader />}>
<Routes>
<Route path="/" element={<AppRoute />}>
Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/providers/ProtectedRoute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default function ProtectedRoute({ children }: { children: any }) {
}, []);

if (cookieMemo.cookie || (userType !== 'admin' && userType !== 'superAdmin')) {
return <Navigate to={"/"} />;
return <Navigate to={""} />;
}
return children;
}
2 changes: 1 addition & 1 deletion packages/main/views/DataSources/DataSource.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export function DataSourceSetting(props: any) {
setCookie(
"qryn-settings",
setCookieFromParams(url, user.value, password.value),
{ path: "/" }
{ path: "" }
);
} catch (e) {
console.log(e);
Expand Down
3 changes: 1 addition & 2 deletions packages/main/views/DataSources/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export interface HeaderProps {
}

export function Header(props: HeaderProps) {
console.log(props)
const navigate = useNavigate();
const theme = useTheme();
const urlLocation = useSelector((store: any) => store.urlLocation);
Expand All @@ -35,7 +34,7 @@ export function Header(props: HeaderProps) {
) {
navigate(-1);
} else {
navigate("/");
navigate("");
}
};

Expand Down
2 changes: 1 addition & 1 deletion packages/main/views/Main/Breadcrumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const Breadcrumbs = () => {
if (el === "" && id === 0) {
return {
name: "home",
link: "/",
link: "",
};
}
return {
Expand Down
13 changes: 7 additions & 6 deletions packages/main/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ const customTransformers = [
ignorePlugin.contextRegExp.test(id)
);
},
transform: () => 'export {}',
transform: () => "export {}",
},
];

let configOpts = {
base: "",
server: {},
plugins: [
basicSsl(),
Expand All @@ -38,12 +39,13 @@ let configOpts = {
globals: true,
environment: "happy-dom",
},
optimizeDeps:{
exclude: ['moment'], // Exclude 'moment' from automatic dependency optimization
include: ['**/*.+(js|ts)'], // Include JavaScript and TypeScript files for manual dependency optimization
customTransformers
optimizeDeps: {
exclude: ["moment"], // Exclude 'moment' from automatic dependency optimization
include: ["**/*.+(js|ts)"], // Include JavaScript and TypeScript files for manual dependency optimization
customTransformers,
},
build: {
base: "",
sourcemap: false,
rollupOptions: {
output: {
Expand All @@ -69,7 +71,6 @@ let configOpts = {
"prismjs",
"javascript-time-ago",
"json-markup",

],
reactDnd: ["react-dnd", "react-dnd-html5-backend"],
memoize: [
Expand Down

0 comments on commit d00f560

Please sign in to comment.