Skip to content

Commit 791013a

Browse files
iceteabottlerohityadavcloud
authored andcommitted
Make the api url for development configurable via env file (#33)
Make the api url for development configurable via env file Signed-off-by: Rohit Yadav <[email protected]>
1 parent c30cbbe commit 791013a

File tree

6 files changed

+14
-9
lines changed

6 files changed

+14
-9
lines changed

ui/.env.local

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
API_URL=http://localhost:8080/client/api

ui/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ Fix issues and vulnerabilities:
3434

3535
npm audit
3636

37+
Override the default CloudStack API URL:
38+
39+
Change the `API_URL` in the `.env.local` file
40+
3741
## History
3842

3943
The project was created by Rohit Yadav over several weekends during late 2018.

ui/src/components/CloudMonkey/Resource.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,6 @@ import DataView from '@/components/widgets/DataView'
280280
import InstanceView from '@/components/widgets/InstanceView'
281281
import Status from '@/components/widgets/Status'
282282
import { mixinDevice } from '@/utils/mixin.js'
283-
import { constants } from 'crypto';
284283
285284
export default {
286285
name: 'Resource',
@@ -558,7 +557,7 @@ export default {
558557
if (obj.includes('response')) {
559558
for (const res in json[obj]) {
560559
if (res === 'jobid') {
561-
this.$store.dispatch('AddAsyncJob', { 'title': this.currentAction.label, 'jobid': json[obj][res], 'description': this.resource.name, 'status': 'progress'})
560+
this.$store.dispatch('AddAsyncJob', { 'title': this.currentAction.label, 'jobid': json[obj][res], 'description': this.resource.name, 'status': 'progress' })
562561
break
563562
}
564563
}

ui/src/components/tools/HeaderNotice.vue

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
<script>
3535
import { api } from '@/api'
3636
import store from '@/store'
37-
import { constants } from 'crypto';
3837
3938
export default {
4039
name: 'HeaderNotice',
@@ -60,7 +59,7 @@ export default {
6059
this.jobs = []
6160
this.$store.commit('SET_ASYNC_JOB_IDS', [])
6261
},
63-
startPolling() {
62+
startPolling () {
6463
this.poller = setInterval(() => {
6564
this.pollJobs()
6665
}, 2500)
@@ -69,7 +68,7 @@ export default {
6968
var hasUpdated = false
7069
for (var i in this.jobs) {
7170
if (this.jobs[i].status === 'progress') {
72-
await api('queryAsyncJobResult', {'jobid': this.jobs[i].jobid}).then(json => {
71+
await api('queryAsyncJobResult', { 'jobid': this.jobs[i].jobid }).then(json => {
7372
var result = json.queryasyncjobresultresponse
7473
if (result.jobstatus === 1 && this.jobs[i].status !== 'done') {
7574
hasUpdated = true
@@ -100,10 +99,10 @@ export default {
10099
}
101100
},
102101
beforeDestroy () {
103-
clearInterval(this.poller)
102+
clearInterval(this.poller)
104103
},
105104
created () {
106-
this.startPolling()
105+
this.startPolling()
107106
},
108107
mounted () {
109108
this.jobs = store.getters.asyncJobIds.reverse()

ui/src/components/tools/TranslationMenu.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import plPL from 'ant-design-vue/lib/locale-provider/pl_PL'
4545
import ptBR from 'ant-design-vue/lib/locale-provider/pt_BR'
4646
import ruRU from 'ant-design-vue/lib/locale-provider/ru_RU'
4747
import zhCN from 'ant-design-vue/lib/locale-provider/zh_CN'
48+
import hi from 'ant-design-vue/lib/locale-provider/he_IL'
4849
import moment from 'moment'
4950
import 'moment/locale/zh-cn'
5051
@@ -76,7 +77,8 @@ export default {
7677
plPL,
7778
ptBR,
7879
ruRU,
79-
zhCN
80+
zhCN,
81+
hi
8082
}
8183
},
8284
methods: {

ui/vue.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ module.exports = {
8787
port: 5050,
8888
proxy: {
8989
'/client/api': {
90-
target: 'http://localhost:8080/client/api',
90+
target: process.env.API_URL || 'http://localhost:8080/client/api',
9191
ws: false,
9292
changeOrigin: true
9393
}

0 commit comments

Comments
 (0)