diff --git a/.env.development b/.env.development index 0b3ce09f7ae4f7705ac86dcc68a31214f6267fb3..7edf1aed286e4a208cbdd694fac1d305cd253977 100644 --- a/.env.development +++ b/.env.development @@ -1,8 +1,18 @@ -VUE_APP_TITLE = My App -VUE_APP_OIDC_CLIENT_ID = 078036 VUE_APP_API_STEERING = http://127.0.0.1:8000/api/v1/ VUE_APP_API_STEERING_SHOWS = http://127.0.0.1:8000/api/v1/shows/ +VUE_APP_OIDC_CLIENT_ID = 078036 VUE_APP_API_STEERING_OIDC_URI = http://localhost:8000/openid -VUE_APP_API_STEERING_OIDC_REDIRECT_URI = http://localhost:8080/static/oidc_callback.html -VUE_APP_API_STEERING_OIDC_REDIRECT_URI_SILENT = http://localhost:8080/static/oidc_callback_silentRenew.html +VUE_APP_API_STEERING_OIDC_EXPIRE_NOTIFICATION = 120 +VUE_APP_API_STEERING_OIDC_REDIRECT_URI = http://localhost:8080/oidc_callback.html +VUE_APP_API_STEERING_OIDC_REDIRECT_URI_SILENT = http://localhost:8080/oidc_callback_silentRenew.html VUE_APP_API_STEERING_OIDC_REDIRECT_URI_POSTLOGOUT = http://localhost:8080 + + +# Dashboard UI defaults +# ===================== + +# How many timeslots should be shown by default? (has to be a string) +VUE_APP_TIMESLOT_FILTER_DEFAULT_NUMSLOTS = 10 + +# For how many days from now should timeslots be fetched by default? (has to be an int) +VUE_APP_TIMESLOT_FILTER_DEFAULT_DAYS = 60 diff --git a/README.md b/README.md index f93ac1e16a8874d114ac6816f5858cd6a6731c19..b4db2cc3b2a3b869770262d27fb5075c394719fc 100644 --- a/README.md +++ b/README.md @@ -32,17 +32,15 @@ For customizing the whole vue cli development environment, see [Configuration Re ## Configuration -All global configuration settings of the dashboard application can be set in the corresponding `config/*.env.js` files. You can use different settings of a `dev`elopment, a `prod`uction and a `test` environment. So for a productive environment you will have to set all values in `config/prod.env.js`. In then `config/dev.env.js` you can overwrite only those value that differ from those in the production setting. +All global configuration settings of the dashboard application can be set in the corresponding `.env.*` files. You can use different settings for a `development` and a `production` environment. So for a productive environment you will have to set all values in `.env.production`. For development use `.env.development`. For more infos on environment variables, also for test and staging modes, see [Vue CLI 3: Environment Variables and Modes](https://cli.vuejs.org/guide/mode-and-env.html) -All values are provided with comments in the `config/prod.env.js`, so you can just take a look there. Here are some important notes on what to set and what to not forget. +All needed values are provided with comments in the `.env.production` file, so you can just take a look there and create your copy for the development environment. There are some important notes on what to set and what to not forget. Also be aware that these settings become environment variables once compiled by _Vue.js_, so hot reload does not work, when you change them. You have to compile the app again for changes to take effect. -Most likely the only values that you will have to set in the `dev.env.js` file different from the `prod.env.js` file are those containing links. Also be aware that these settings become environment variables once compiled by _Vue.js_. Therefore an integer is represented as `'23'` while a string is represented as `'"23"'` in the config file. Sometimes this is important. - -For the _OpenID Connect_ settings it is very important to use exactly the same redirect URIs as defined in you OIDC client settings in the _aura/steering_ module. So `API_STEERING_OIDC_REDIRECT_URI` and `API_STEERING_OIDC_REDIRECT_URI_SILENT` should ideally be a copy-paste from there. This can be a nasty debug issue if you don't get the login to work. For example we once had the issue that while the _steering_ used `http://localhost:8080/static/oidc_callback.html` as the parameter for the REDIRECT_URI, the dashboard had configured `http://127.0.0.1:8080/static/oidc_callback.html`. You would expect that this resolves to the same location, but even if `localhost` resolves to `127.0.0.1`, the _OIDC provider_ in the _steering_ module does a string comparison of what it receives from the client and what it has configured. +For the _OpenID Connect_ settings it is very important to use exactly the same redirect URIs as defined in you OIDC client settings in the _aura/steering_ module. So `VUE_APP_API_STEERING_OIDC_REDIRECT_URI` and `VUE_APP_API_STEERING_OIDC_REDIRECT_URI_SILENT` should ideally be a copy-paste from there. This can be a nasty debug issue if you don't get the login to work. For example we once had the issue that while the _steering_ used `http://localhost:8080/oidc_callback.html` as the parameter for the REDIRECT_URI, the dashboard had configured `http://127.0.0.1:8080/oidc_callback.html`. You would expect that this resolves to the same location, but even if `localhost` resolves to `127.0.0.1`, the _OIDC provider_ in the _steering_ module does a string comparison of what it receives from the client and what it has configured. ## Configuration of the steering backend -For the dashboard to run in a dev mode you only need the `npm install` and `npm run dev` commands. To access show data in the show manager you also have to have the [steering/pv module](https://gitlab.servus.at/autoradio/pv) running somewhere. There you need to add the following lines to the `pv/local_settings.py`, in order to allow CORS requests from you dashboard: +For the dashboard to run in a dev mode you only need the `npm install` and `npm run dev` commands. To access show data in the show manager you also have to have the [steering/pv module](https://gitlab.servus.at/autoradio/pv) running somewhere. There you need to add the following lines to the `pv/local_settings.py`, in order to allow CORS requests from your dashboard: ``` CORS_ALLOW_CREDENTIALS = True @@ -51,12 +49,12 @@ CORS_ORIGIN_WHITELIST = ( ) ``` -This assumes of course that you have the dashboard running on its standard localhost port 8080. If you want to change this to e.g. port `9090`, add a line `PORT: 9090,` to the `module.exports` in `config/dev.env.js` file of the dashboard package. +This assumes of course that you have the dashboard running on its standard localhost port 8080. If you want to change this to e.g. port `9090`, add a line `PORT: 9090,` to the `.env.development` file of the dashboard package. ## Detailed infos on build environment -This project is built with [Vue.js 2](https://vuejs.org). Take a look at their [Guide](https://vuejs.org/v2/guide/) or the [API docs](https://vuejs.org/v2/api/) to find out more about the core framework. As template we are using the _webpack template_. For a detailed explanation on how things work with this, check out the [webpack guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader). +This project is built with [Vue.js 2](https://vuejs.org). Take a look at their [Guide](https://vuejs.org/v2/guide/) or the [API docs](https://vuejs.org/v2/api/) to find out more about the core framework. As template we are using the _webpack template_. For a detailed explanation on how things work with this, check out the [webpack guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader). For the whole einvornment setup we started out with Vue CLI 2 but now work with [Vue CLI 3](https://cli.vuejs.org). Webpack also comes with code linting, using [ESLint](https://eslint.org/), which makes our code consistent, functional and less error-prone. For infos on how the routes work, take a look at the [vue-router](http://router.vuejs.org/). diff --git a/package.json b/package.json index 0f922e6ed24f97ed48ec47f7122d1056355514e4..9dc3c1bb754c105053f9951e1cedd080857e0156 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "@vue/cli-plugin-eslint": "^3.4.0", "@vue/cli-service": "^3.4.0", "babel-eslint": "^10.0.1", + "copy-webpack-plugin": "^4.6.0", "eslint": "^5.8.0", "eslint-plugin-vue": "^5.0.0", "vue-template-compiler": "^2.5.21" diff --git a/public/oidc_callback.html b/public/oidc_callback.html index 5dffd805605139369bbe0b5cd5d1f29f4a049843..db3b3c19341aa08b46dd24b5cbc579ee8f8e329e 100644 --- a/public/oidc_callback.html +++ b/public/oidc_callback.html @@ -7,7 +7,7 @@ </head> <body> - <script src="oidc-client.js"></script> + <script src="js/oidc-client.min.js"></script> <script> var mgr = new Oidc.UserManager({userStore: new Oidc.WebStorageStateStore()}) mgr.signinRedirectCallback().then(function (user) { diff --git a/public/oidc_callback_popupRenew.html b/public/oidc_callback_popupRenew.html index 13ea7585f59463276586cec767e17893a202e892..157c5aa5b5eee38b597c75aa92b2aba58f5d1a09 100644 --- a/public/oidc_callback_popupRenew.html +++ b/public/oidc_callback_popupRenew.html @@ -7,7 +7,7 @@ </head> <body> - <script src="oidc-client.js"></script> + <script src="js/oidc-client.min.js"></script> <script> var mgr = new Oidc.UserManager() mgr.signinPopupCallback() diff --git a/public/oidc_callback_silentRenew.html b/public/oidc_callback_silentRenew.html index fc08326ebaa1c0ac67c09b732205b3bce0ee503b..547318a8623055f6d1b063f749462329016bb9ae 100644 --- a/public/oidc_callback_silentRenew.html +++ b/public/oidc_callback_silentRenew.html @@ -7,7 +7,7 @@ </head> <body> - <script src="oidc-client.js"></script> + <script src="js/oidc-client.min.js"></script> <script> var mgr = new Oidc.UserManager() mgr.signinSilentCallback() diff --git a/src/App.vue b/src/App.vue index 3e2fe6076464822abda15d32573c0f28cefdf014..77473293cf0421e0f83d563cdfbcd0288a2e8512 100644 --- a/src/App.vue +++ b/src/App.vue @@ -50,8 +50,8 @@ export default { // the client id has to be a string, therefore we add the + '' client_id: process.env.VUE_APP_OIDC_CLIENT_ID, redirect_uri: process.env.VUE_APP_API_STEERING_OIDC_REDIRECT_URI, - silent_redirect_uri: 'http://localhost:8080/static/oidc_callback_silentRenew.html', - popup_redirect_uri: 'http://localhost:8080/static/oidc_callback_popupRenew.html', + silent_redirect_uri: 'http://localhost:8080/oidc_callback_silentRenew.html', + popup_redirect_uri: 'http://localhost:8080/oidc_callback_popupRenew.html', accessTokenExpiringNotificationTime: process.env.VUE_APP_API_STEERING_OIDC_EXPIRE_NOTIFICATION, response_type: 'id_token token', scope: 'openid profile email', diff --git a/src/components/ShowManager.vue b/src/components/ShowManager.vue index d00069cfeb2f78568ea03af6a571a348e3e0221a..645d817a8353b3395536fcc17b7d84efadb11e15 100644 --- a/src/components/ShowManager.vue +++ b/src/components/ShowManager.vue @@ -131,9 +131,9 @@ <b-col lg="6"> <p> <!-- TODO: discuss: should this be visible to show owners or only to administrators? --> - <!-- TODO: fetch name for predecessor_id from steering api --> + <!-- TODO: fetch name for predecessor from steering api --> <b-badge variant="light">Predecessor:</b-badge> - <span v-if="shows[currentShow].predecessor_id === null"><small><i>This show has no predecessor show.</i></small></span> + <span v-if="shows[currentShow].predecessor === null"><small><i>This show has no predecessor show.</i></small></span> <span v-else>{{ predecessorName }}</span> <img src="../assets/16x16/emblem-system.png" alt="edit" v-on:click="$refs.appModalShow.showPredecessor()" /> </p> @@ -309,7 +309,7 @@ export default { computed: { predecessorName: function () { for (var i in this.shows) { - if (this.shows[i].id === this.shows[this.currentShow].predecessor_id) { + if (this.shows[i].id === this.shows[this.currentShow].predecessor) { return this.shows[i].name } } diff --git a/src/components/ShowManagerModalShow.vue b/src/components/ShowManagerModalShow.vue index c9c8721362b258562f94a6e2285a91475eb2d989..0e4eeaa7c97eae528644a284100a2c80c79e97c5 100644 --- a/src/components/ShowManagerModalShow.vue +++ b/src/components/ShowManagerModalShow.vue @@ -396,21 +396,25 @@ export default { } }, savePredecessor (event) { - if (this.id !== this.show.predecessor_id) { + if (this.id !== this.show.predecessor) { event.preventDefault() +<<<<<<< HEAD this.backupid = this.show.predecessor_id this.show.predecessor_id = this.id console.log(this.show.predecessor_id) axios.put(process.env.VUE_APP_API_STEERING_SHOWS + this.show.id + '/', this.show, { +======= + this.backupid = this.show.predecessor + this.show.predecessor = this.id + console.log(this.show.predecessor) + axios.put(process.env.API_STEERING_SHOWS + this.show.id + '/', this.show, { +>>>>>>> 3888ff92fbc548600ff336cd605a9e1087a603d9 withCredentials: true, headers: { 'Authorization': 'Bearer ' + this.$parent.$parent.user.access_token } }).then(response => { - // this.$parent.shows[this.$parent.currentShow].predecessor_id = this.show.predecessor_id - console.log('saved ' + this.show.predecessor_id) - console.log(response) this.$refs.modalShowPredecessor.hide() }).catch(error => { - this.show.predecessor_id = this.backupid + this.show.predecessor = this.backupid console.log('Error:') console.log(error) alert('Error: could not save the new show information') @@ -555,7 +559,7 @@ export default { this.$refs.modalShowCBAid.show() }, showPredecessor () { - this.id = this.show.predecessor_id + this.id = this.show.predecessor this.$refs.modalShowPredecessor.show() }, showType () { diff --git a/vue.config.js b/vue.config.js new file mode 100644 index 0000000000000000000000000000000000000000..b79668d098436b91a103511376de26045dbbf587 --- /dev/null +++ b/vue.config.js @@ -0,0 +1,11 @@ +const CopyWebpackPlugin = require('copy-webpack-plugin') + +module.exports = { + configureWebpack: { + plugins: [ + new CopyWebpackPlugin([ + { from: 'node_modules/oidc-client/dist/oidc-client.min.js', to: 'js' } + ]) + ] + } +}