Skip to content

Commit

Permalink
- CHG: Updated Vue CLI to 5.0.4.
Browse files Browse the repository at this point in the history
- CHG: Made required changes to make it build again.
- ADD: Added bootswatch theme to align appearance with Germinate.
  • Loading branch information
sebastian-raubach committed Apr 28, 2022
1 parent f4fc209 commit b19ab5a
Show file tree
Hide file tree
Showing 23 changed files with 7,781 additions and 10,218 deletions.
8 changes: 5 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ module.exports = {
env: {
node: true
},
'extends': [
extends: [
'plugin:vue/essential',
'@vue/standard'
],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'vue/no-mutating-props': 'off',
'vue/multi-word-component-names': 0
},
parserOptions: {
parser: 'babel-eslint'
parser: '@babel/eslint-parser'
}
}
8 changes: 5 additions & 3 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
module.exports = {
presets: [
['@vue/app',
{
useBuiltIns: 'entry'
// '@vue/cli-plugin-babel/preset',
[
'@babel/preset-env', {
'useBuiltIns': 'usage',
'corejs': 3
}
]
]
Expand Down
17,599 changes: 7,576 additions & 10,023 deletions package-lock.json

Large diffs are not rendered by default.

52 changes: 29 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@
"version": "4.2.1",
"description": "",
"author": "Sebastian Raubach",
"homepage": "https://ics.hutton.ac.uk/get-germinate",
"copyright": "Copyright 2019 The James Hutton Institute",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/germinateplatform/gatekeeper-vue.git"
},
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
Expand All @@ -20,27 +13,33 @@
"axios": "^0.26.1",
"bootstrap": "^4.6.1",
"bootstrap-vue": "^2.22.0",
"core-js": "~2.6.5",
"vue": "~2.6.10",
"bootswatch": "^4.6.1",
"core-js": "^3.8.3",
"vue": "^2.6.14",
"vue-flag-icon": "~1.0.6",
"vue-i18n": "^8.27.1",
"vue-material-design-icons": "~3.2.0",
"vue-router": "~3.0.6",
"vuex": "~3.1.1",
"vuex-persistedstate": "~2.5.4",
"vue-router": "^3.5.1",
"vuex": "^3.6.2",
"vuex-persistedstate": "^4.1.0",
"zxcvbn": "~4.4.2"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.11",
"@vue/cli-plugin-eslint": "~4.5.11",
"@vue/cli-service": "~4.5.11",
"@vue/eslint-config-standard": "~4.0.0",
"babel-eslint": "~10.0.1",
"eslint": "~7.19.0",
"eslint-plugin-vue": "~7.5.0",
"node-sass": "~4.14.1",
"sass-loader": "~7.1.0",
"vue-template-compiler": "~2.6.10"
"@babel/core": "^7.12.16",
"@babel/eslint-parser": "^7.12.16",
"@vue/cli-plugin-babel": "^5.0.4",
"@vue/cli-plugin-eslint": "^5.0.4",
"@vue/cli-service": "^5.0.4",
"@vue/eslint-config-standard": "^6.1.0",
"eslint": "^7.32.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.1.0",
"eslint-plugin-vue": "^8.0.3",
"path-browserify": "^1.0.1",
"sass": "^1.32.7",
"sass-loader": "^12.0.0",
"vue-template-compiler": "^2.6.14"
},
"eslintConfig": {
"root": true,
Expand All @@ -64,5 +63,12 @@
"browserslist": [
"> 1%",
"last 2 versions"
]
],
"copyright": "Copyright 2019 The James Hutton Institute",
"homepage": "https://ics.hutton.ac.uk/get-germinate",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/germinateplatform/gatekeeper-vue.git"
}
}
83 changes: 60 additions & 23 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
<b-navbar-nav class="ml-auto mr-2">
<b-nav-item :to="token ? '/about' : '/gk/about'">{{ $t('navbarActionAbout') }}</b-nav-item>
<b-nav-item-dropdown text="Lang" right>
<template slot="button-content"><TranslateIcon class="form-icon" /></template>
<template slot="button-content"><MdiIcon :path="mdiTranslate" /></template>
<b-dropdown-item v-for="language in languages" :key="language.locale" @click="onLocaleChanged(language)"><flag :squared="false" :iso="language.flag" class="flag-icon" /> {{ language.name }}</b-dropdown-item>
</b-nav-item-dropdown>
<b-nav-item to="/" @click="signOut" :title="$t('navbarActionSignOut')" v-if="token">
<LogoutVariantIcon class="form-icon" :title="$t('navbarActionSignOut')" />
<MdiIcon :path="mdiLogoutVariant" />
</b-nav-item>
</b-navbar-nav>
</b-navbar>
Expand Down Expand Up @@ -40,15 +40,18 @@
</template>

<script>
import LogoutVariantIcon from 'vue-material-design-icons/LogoutVariant'
import TranslateIcon from 'vue-material-design-icons/Translate'
import MdiIcon from '@/components/MdiIcon'
import { mapState } from 'vuex'
import { EventBus } from './event-bus.js'
import { mdiLogoutVariant, mdiTranslate } from '@mdi/js'
export default {
name: 'app',
data: function () {
return {
mdiLogoutVariant,
mdiTranslate,
languages: [{
locale: 'en_GB',
flag: 'gb',
Expand All @@ -67,32 +70,28 @@ export default {
])
},
components: {
LogoutVariantIcon,
TranslateIcon
MdiIcon
},
methods: {
onLocaleChanged: function (language) {
this.$i18n.locale = language.locale
this.$store.dispatch('ON_LOCALE_CHANGED', language.locale)
},
signOut: function () {
var vm = this
var user = {
const user = {
email: this.token.username,
password: this.token.token
}
this.apiDeleteToken(user, function (result) {
console.log(result)
this.apiDeleteToken(user, result => {
// If it's successful, delete token, then redirect
vm.$store.dispatch('ON_TOKEN_CHANGED', null)
vm.$router.push('/gk/login')
this.$store.dispatch('ON_TOKEN_CHANGED', null)
this.$router.push('/gk/login')
}, {
codes: [],
callback: function () {
callback: () => {
// If they're wrong, remove
vm.$store.dispatch('ON_TOKEN_CHANGED', null)
this.$store.dispatch('ON_TOKEN_CHANGED', null)
}
})
},
Expand All @@ -108,22 +107,60 @@ export default {
EventBus.$off('show-loading', this.toggleLoading)
},
mounted: function () {
var vm = this
EventBus.$on('show-loading', this.toggleLoading)
if (this.locale) {
this.$i18n.locale = this.languages.map(function (l) {
return l.locale
}).filter(function (l) {
return vm.locale === l
})
this.$i18n.locale = this.languages.map(l => l.locale).filter(l => this.locale === l)
}
}
}
</script>

<style>
<style lang="scss">
$font-size-base: 1rem;
$primary: #23a1d7;
$dark: #36363b;
$secondary: #bdc3c7;
$success: #27ae60;
$info: #3498db;
$warning: #f39c12;
$danger: #e74c3c;
$indigo: #6610f2;
$purple: #6f42c1;
$pink: #e83e8c;
$red: #dc3545;
$orange: #fd7e14;
$yellow: #ffc107;
$green: #28a745;
$teal: #20c997;
$cyan: #17a2b8;
$headings-font-weight: 400;
$badge-font-size: 85%;
$small-font-size: 70%;
$container-max-widths: (
sm: 540px,
md: 720px,
lg: 960px,
xl: 1140px,
xxl: 1400px
);
$grid-breakpoints: (
xs: 0,
sm: 576px,
md: 768px,
lg: 992px,
xl: 1200px,
xxl: 1500px
);
@import '~bootswatch/dist/cosmo/variables';
@import '~bootstrap/scss/bootstrap';
@import '~bootstrap-vue/src/index.scss';
@import '~bootswatch/dist/cosmo/bootswatch';
@import '@/assets/css/custom.scss';
#app {
flex: 1 0 auto;
min-height: calc(100vh - 37px);
Expand Down
3 changes: 0 additions & 3 deletions src/assets/css/custom.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
@import "../../../node_modules/bootstrap/scss/bootstrap.scss";
@import "../../../node_modules/bootstrap-vue/dist/bootstrap-vue.css";

body {
font-size: .875rem;
}
Expand Down
4 changes: 2 additions & 2 deletions src/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import store from './store/store'

export default {
loggedIn () {
var token = store.getters.token
const token = store.getters.token
return token && this.tokenStillValid()
},
tokenStillValid () {
var token = store.getters.token
const token = store.getters.token
if (token) {
return new Date().getTime() - token.createdOn <= token.lifetime
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/components/UserRequestTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export default {
this.$nextTick(() => this.$refs.feedbackModal.show())
} else {
EventBus.$emit('show-loading', true)
var decision = {
const decision = {
requestId: this.currentRow.id,
decision: 'REJECT',
feedback: this.rejectionReason
Expand All @@ -188,7 +188,7 @@ export default {
},
onApprove: function (row) {
EventBus.$emit('show-loading', true)
var decision = {
const decision = {
requestId: row.id,
decision: 'APPROVE'
}
Expand Down
14 changes: 5 additions & 9 deletions src/components/modal/AddDatabaseModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,7 @@ export default {
},
methods: {
show () {
var vm = this
this.$nextTick(function () {
vm.$refs.addDatabaseModal.show()
})
this.$nextTick(() => this.$refs.addDatabaseModal.show())
},
onAddDatabaseClicked: function (event) {
event.preventDefault()
Expand All @@ -66,11 +63,10 @@ export default {
}
// Send the new database to the server
var vm = this
this.apiPostDatabase(this.database, function (result) {
vm.$refs.addDatabaseModal.hide()
vm.$emit('databases-updated')
vm.resetDatabase()
this.apiPostDatabase(this.database, result => {
this.$refs.addDatabaseModal.hide()
this.$emit('databases-updated')
this.resetDatabase()
EventBus.$emit('stats-count-changed')
})
},
Expand Down
12 changes: 4 additions & 8 deletions src/components/modal/AddInstitutionModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ export default {
},
methods: {
show () {
var vm = this
this.$nextTick(function () {
vm.$refs.addInstitutionModal.show()
})
this.$nextTick(() => this.$refs.addInstitutionModal.show())
},
onAddInstitutionClicked: function (event) {
event.preventDefault()
Expand All @@ -56,10 +53,9 @@ export default {
}
// Send the new institution to the server
var vm = this
this.apiPostInstitution(this.institution, function (result) {
vm.$refs.addInstitutionModal.hide()
vm.$emit('institutions-updated')
this.apiPostInstitution(this.institution, result => {
this.$refs.addInstitutionModal.hide()
this.$emit('institutions-updated')
})
}
}
Expand Down
9 changes: 3 additions & 6 deletions src/components/modal/AddUserModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,11 @@ export default {
},
methods: {
show () {
var vm = this
this.$nextTick(function () {
vm.$refs.addUserModal.show()
})
this.$nextTick(() => this.$refs.addUserModal.show())
},
updateInstitutions: function () {
this.apiGetInstitutions(result => {
var mapped = result.data.map(i => {
const mapped = result.data.map(i => {
return {
value: i.id,
text: i.name
Expand All @@ -104,7 +101,7 @@ export default {
this.checkForm()
},
checkForm: function () {
var result = true
let result = true
result = result && this.$refs.password.valid()
result = result && this.user.fullName
result = result && this.user.institutionId
Expand Down
4 changes: 2 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import mixin from './mixins/mixin.js'
import api from './mixins/api.js'
import { i18n } from './plugins/i18n.js'
import FlagIcon from 'vue-flag-icon'
let axiosDefaults = require('axios/lib/defaults')
const axiosDefaults = require('axios/lib/defaults')

Vue.mixin(mixin)
Vue.mixin(api)
Vue.use(FlagIcon)
Vue.use(BootstrapVue)

// Set base URL
var baseUrl = './api/'
let baseUrl = './api/'

if (process.env.VUE_APP_BASE_URL) {
baseUrl = process.env.VUE_APP_BASE_URL
Expand Down
Loading

0 comments on commit b19ab5a

Please sign in to comment.