Skip to content

Commit a21e059

Browse files
committed
import.meta fixed
1 parent cfc7ad6 commit a21e059

File tree

8 files changed

+21
-19
lines changed

8 files changed

+21
-19
lines changed

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ VITE_HIDE_DEPLOYMENT_GROUPS=true
2323
VITE_HIDE_GITOPS_OR_HELM_OPTION=true
2424
VITE_CONFIGURABLE_TIMEOUT=
2525
VITE_HIDE_APPLICATION_GROUPS=true
26-
VITE_REACT_APP_K8S_CLIENT=false
26+
VITE_K8S_CLIENT=false
2727
VITE_USE_V2=false
2828
VITE_CLUSTER_TERMINAL_CONNECTION_POLLING_INTERVAL=7000
2929
VITE_CLUSTER_TERMINAL_CONNECTION_RETRY_COUNT=7

.env.development

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
VITE_REACT_APP_ORCHESTRATOR_ROOT="/orchestrator"
2-
VITE_REACT_APP_GRAFANA_ORG_ID=2
3-
VITE_REACT_APP_K8S_CLIENT=false
4-
VITE_NODE_ENV="development"
1+
VITE_ORCHESTRATOR_ROOT="/orchestrator"
2+
VITE_GRAFANA_ORG_ID=2
3+
VITE_K8S_CLIENT=false
4+
VITE_NODE_ENV="development"
5+
BASE_URL="/dashboard"

.env.production

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
VITE_REACT_APP_ORCHESTRATOR_ROOT="/orchestrator"
2-
VITE_REACT_APP_GRAFANA_ORG_ID=2
3-
VITE_NODE_ENV="production"
1+
VITE_ORCHESTRATOR_ROOT="/orchestrator"
2+
VITE_GRAFANA_ORG_ID=2
3+
VITE_NODE_ENV="production"
4+
BASE_URL="/dashboard"

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@ module.exports = function (app) {
148148
#### **`.env.development`**
149149

150150
```console
151-
GRAFANA_ORG_ID=2
151+
VITE_GRAFANA_ORG_ID=2
152152
REACT_APP_EDITOR=code
153-
VITE_REACT_APP_ORCHESTRATOR_ROOT=/orchestrator
153+
VITE_ORCHESTRATOR_ROOT=/orchestrator
154154
REACT_APP_PASSWORD=argocd-server-74b7b94945-nxxnh
155155
```
156156

@@ -159,9 +159,9 @@ REACT_APP_PASSWORD=argocd-server-74b7b94945-nxxnh
159159
#### **`.env.development`**
160160

161161
```console
162-
GRAFANA_ORG_ID=2
162+
VITE_GRAFANA_ORG_ID=2
163163
REACT_APP_EDITOR=code
164-
VITE_REACT_APP_ORCHESTRATOR_ROOT=http://demo.devtron.info:32080/orchestrator
164+
VITE_ORCHESTRATOR_ROOT=http://demo.devtron.info:32080/orchestrator
165165
REACT_APP_PASSWORD=argocd-server-74b7b94945-nxxnh
166166
```
167167

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"build": "NODE_OPTIONS=--max_old_space_size=8192 vite build",
6666
"serve": "vite preview",
6767
"build-light": "GENERATE_SOURCEMAP=false NODE_OPTIONS=--max_old_space_size=8192 vite build",
68-
"build-k8s-app": "GENERATE_SOURCEMAP=false NODE_OPTIONS=--max_old_space_size=8192 VITE_REACT_APP_K8S_CLIENT=true vite build",
68+
"build-k8s-app": "GENERATE_SOURCEMAP=false NODE_OPTIONS=--max_old_space_size=8192 VITE_K8S_CLIENT=true vite build",
6969
"test": "vitest test",
7070
"test-coverage:watch": "npm run test -- --coverage",
7171
"test-coverage": "npm run test -- --coverage --watchAll=false",

src/components/app/details/appDetails/utils.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ export function addQueryParamToGrafanaURL(
402402
): string {
403403
const startTime: string = calendarInputs.startDate
404404
const endTime: string = calendarInputs.endDate
405-
url += `?orgId=${import.meta.env.VITE_REACT_APP_GRAFANA_ORG_ID}`
405+
url += `?orgId=${window.__VITE_GRAFANA_ORG_ID__}`
406406
url += `&refresh=10s`
407407
url += `&var-app=${appId}`
408408
url += `&var-env=${envId}`

src/index.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,14 @@ declare global {
6464
Worker: any
6565
__BASE_URL__: string
6666
__REACT_APP_ORCHESTRATOR_ROOT__: string
67+
__VITE_GRAFANA_ORG_ID__: number
6768
}
6869
}
6970

7071
if (!window.__BASE_URL__ || !window.__REACT_APP_ORCHESTRATOR_ROOT__) {
71-
window.__BASE_URL__ = '/dashboard'
72-
window.__REACT_APP_ORCHESTRATOR_ROOT__ = 'orchestrator'
72+
window.__BASE_URL__ = import.meta.env.BASE_URL || '/dashboard'
73+
window.__REACT_APP_ORCHESTRATOR_ROOT__ = import.meta.env.VITE_ORCHESTRATOR_ROOT || 'orchestrator'
74+
window.__VITE_GRAFANA_ORG_ID__ = import.meta.env.VITE_GRAFANA_ORG_ID || 2
7375
}
7476

7577
const root = document.getElementById('root')
@@ -150,7 +152,7 @@ if (!window || !window._env_) {
150152
VITE_HIDE_DEPLOYMENT_GROUPS: true,
151153
VITE_HIDE_GITOPS_OR_HELM_OPTION: false,
152154
VITE_HIDE_APPLICATION_GROUPS: false,
153-
K8S_CLIENT: import.meta.env.VITE_REACT_APP_K8S_CLIENT === 'true',
155+
K8S_CLIENT: import.meta.env.VITE_K8S_CLIENT === 'true',
154156
VITE_USE_V2: true,
155157
VITE_CLUSTER_TERMINAL_CONNECTION_POLLING_INTERVAL: 7000,
156158
VITE_CLUSTER_TERMINAL_CONNECTION_RETRY_COUNT: 7,

vite.config.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,6 @@ export default defineConfig(({ mode }) => {
9494
console.log(mode)
9595
// Global override for node environment
9696
baseConfig['define'] = {
97-
// __BASE_URL__: '/dashboard/',
98-
// __REACT_APP_ORCHESTRATOR_ROOT__: '/orchestrator',
9997
global: 'globalThis',
10098
}
10199
// } else {

0 commit comments

Comments
 (0)