@@ -0,0 +1,47 @@ | |||||
# Dashboard | |||||
The dashboard project uses vue 2 to build, and the UI uses bootstrap 4. | |||||
## Local Development | |||||
### Install dependent packages | |||||
> cd src\DotNetCore.CAP.Dashboard\wwwroot | |||||
```sh | |||||
npm install -g @vue/cli @vue/cli-service-global | |||||
npm install | |||||
``` | |||||
### Update backend api | |||||
Update the `baseURL` in `global.js` of development to specify the backend service api. | |||||
``` | |||||
switch (process.env.NODE_ENV) { | |||||
case 'development': | |||||
baseURL = 'http://localhost:5000'; // backend api | |||||
break | |||||
default: | |||||
baseURL = window.serverUrl; | |||||
break | |||||
} | |||||
``` | |||||
### Run | |||||
The backend api needs to allow cross-domain access. | |||||
``` | |||||
npm run serve | |||||
``` | |||||
## Publish | |||||
The release will be generated into the `dist` folder, and the contents of this folder will be embedded in the dotnet csproj assembly. | |||||
``` | |||||
npm run build | |||||
``` | |||||
@@ -1 +1 @@ | |||||
.nav-item[data-v-57ea412e]{padding:0 10px}#app{font-family:Avenir,Helvetica,Arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-align:center;color:#2c3e50;padding-bottom:50px}.page-line{text-align:left;line-height:38px;padding-bottom:9px;border-bottom:1px solid #eee}.chart[data-v-da293f9a]{height:500px;width:100%} | |||||
.nav-item[data-v-4ff86e0d]{padding:0 10px}#app{font-family:Avenir,Helvetica,Arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-align:center;color:#2c3e50;padding-bottom:50px}.page-line{text-align:left;line-height:38px;padding-bottom:9px;border-bottom:1px solid #eee}.chart[data-v-da293f9a]{height:500px;width:100%} |
@@ -1,2 +1,2 @@ | |||||
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="favicon.ico"><title>myapp</title><link href="css/app.ac328da6.css" rel="preload" as="style"><link href="css/chunk-vendors.e8860705.css" rel="preload" as="style"><link href="js/app.c7691be8.js" rel="preload" as="script"><link href="js/chunk-vendors.a45910c3.js" rel="preload" as="script"><link href="css/chunk-vendors.e8860705.css" rel="stylesheet"><link href="css/app.ac328da6.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but myapp doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script>window.serverUrl = window.location.origin + "%(servicePrefix)"; | |||||
window.pollingInterval = "%(pollingInterval)";</script><script src="js/chunk-vendors.a45910c3.js"></script><script src="js/app.c7691be8.js"></script></body></html> | |||||
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="favicon.ico"><title>myapp</title><link href="css/app.4fd93b4b.css" rel="preload" as="style"><link href="css/chunk-vendors.e8860705.css" rel="preload" as="style"><link href="js/app.0d8d9e81.js" rel="preload" as="script"><link href="js/chunk-vendors.a45910c3.js" rel="preload" as="script"><link href="css/chunk-vendors.e8860705.css" rel="stylesheet"><link href="css/app.4fd93b4b.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but myapp doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script>window.serverUrl = window.location.origin + "%(servicePrefix)"; | |||||
window.pollingInterval = "%(pollingInterval)";</script><script src="js/chunk-vendors.a45910c3.js"></script><script src="js/app.0d8d9e81.js"></script></body></html> |
@@ -0,0 +1,12 @@ | |||||
let baseURL = ""; | |||||
switch (process.env.NODE_ENV) { | |||||
case 'development': | |||||
baseURL = 'http://localhost:5000'; | |||||
break | |||||
default: | |||||
baseURL = window.serverUrl; | |||||
break | |||||
} | |||||
export default baseURL; |
@@ -1,7 +1,7 @@ | |||||
import Vue from 'vue' | import Vue from 'vue' | ||||
import App from './App.vue' | import App from './App.vue' | ||||
import router from './router' | import router from './router' | ||||
import baseURL from './global' | |||||
import { BootstrapVue, IconsPlugin } from 'bootstrap-vue' | import { BootstrapVue, IconsPlugin } from 'bootstrap-vue' | ||||
import VueJsonPretty from 'vue-json-pretty'; | import VueJsonPretty from 'vue-json-pretty'; | ||||
import 'vue-json-pretty/lib/styles.css'; | import 'vue-json-pretty/lib/styles.css'; | ||||
@@ -10,7 +10,7 @@ import 'bootstrap-vue/dist/bootstrap-vue.css' | |||||
import store from '@/store/store.js' | import store from '@/store/store.js' | ||||
import axios from "axios"; | import axios from "axios"; | ||||
axios.defaults.baseURL = window.serverUrl; | |||||
axios.defaults.baseURL = baseURL; | |||||
axios.defaults.withCredentials = true | axios.defaults.withCredentials = true | ||||
axios.defaults.headers.post['Content-Type'] = 'application/json'; | axios.defaults.headers.post['Content-Type'] = 'application/json'; | ||||
axios.interceptors.request.use( | axios.interceptors.request.use( | ||||
@@ -4,6 +4,7 @@ import Home from '../pages/Home.vue' | |||||
Vue.use(VueRouter) | Vue.use(VueRouter) | ||||
const routes = [ | const routes = [ | ||||
{ | { | ||||
path: '/', | path: '/', | ||||
@@ -46,4 +47,4 @@ const router = new VueRouter({ | |||||
routes | routes | ||||
}) | }) | ||||
export default router | |||||
export default router; |