summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorUdo Walter2019-02-28 06:06:37 +0100
committerUdo Walter2019-02-28 06:06:37 +0100
commit8816b80307379fccfd0e9d3d23315beaff52213b (patch)
treeb2a4efa6fc79a4e01467d5589ed37f4fa076da73 /webapp
parent[webapp/backends] Rework to the new DataTable (diff)
downloadbas-8816b80307379fccfd0e9d3d23315beaff52213b.tar.gz
bas-8816b80307379fccfd0e9d3d23315beaff52213b.tar.xz
bas-8816b80307379fccfd0e9d3d23315beaff52213b.zip
[webapp/groups] performance improvements
Diffstat (limited to 'webapp')
-rw-r--r--webapp/src/components/ConfiguratorModule.vue2
-rw-r--r--webapp/src/components/ConfiguratorModuleEntry.vue6
-rw-r--r--webapp/src/components/DataTable.vue6
-rw-r--r--webapp/src/components/GroupModule.vue3
-rw-r--r--webapp/src/components/RegistrationModule.vue2
-rw-r--r--webapp/src/components/RegistrationModuleEdit.vue3
-rw-r--r--webapp/src/main.js1
-rw-r--r--webapp/src/store/groups.js17
-rw-r--r--webapp/src/store/registration.js6
9 files changed, 26 insertions, 20 deletions
diff --git a/webapp/src/components/ConfiguratorModule.vue b/webapp/src/components/ConfiguratorModule.vue
index a5b92ce..edbe8f9 100644
--- a/webapp/src/components/ConfiguratorModule.vue
+++ b/webapp/src/components/ConfiguratorModule.vue
@@ -168,7 +168,7 @@ export default {
},
created () {
this.$store.dispatch('configurator/loadData')
- this.$store.dispatch('groups/loadLists')
+ this.$store.dispatch('groups/loadGroupList')
}
}
</script>
diff --git a/webapp/src/components/ConfiguratorModuleEntry.vue b/webapp/src/components/ConfiguratorModuleEntry.vue
index 3eeebc4..94bce00 100644
--- a/webapp/src/components/ConfiguratorModuleEntry.vue
+++ b/webapp/src/components/ConfiguratorModuleEntry.vue
@@ -74,8 +74,10 @@ export default {
let url = '/api/configurator/entries'
if (this.dialog.info.id !== undefined) url += '/' + this.dialog.info.id
await this.$http.post(url, {
- name: this.name,
- script: this.script
+ data: {
+ name: this.name,
+ script: this.script
+ }
})
this.$store.dispatch('configurator/loadData')
this.setDialog({ show: false })
diff --git a/webapp/src/components/DataTable.vue b/webapp/src/components/DataTable.vue
index eda7d63..bd97394 100644
--- a/webapp/src/components/DataTable.vue
+++ b/webapp/src/components/DataTable.vue
@@ -238,7 +238,7 @@ export default {
},
dataKeys () { return this.headers.map(x => x.key) },
rows () {
- return this.items.map(item => ({ data: item, selected: false, id: item.id }))
+ return Object.freeze(this.items.map(item => ({ data: item, selected: false, id: item.id })))
},
sortedRows () {
const rows = this.rows.slice(0)
@@ -247,7 +247,7 @@ export default {
if (direction === 'asc') rows.sort((a, b) => String(a.data[key]).localeCompare(String(b.data[key])))
if (direction === 'desc') rows.sort((b, a) => String(a.data[key]).localeCompare(String(b.data[key])))
}
- return rows
+ return Object.freeze(rows)
},
filterFunction () {
if (this.regex && this.caseSensitive) return (s, str) => s.text.regex.test(str)
@@ -427,7 +427,7 @@ export default {
// Skip filtering if all search strings are empty
if (this.search.every(s => s.text.raw === '') && !this.onlyShowSelected) {
- this.filteredRows = this.sortedRows
+ this.filteredRows = Object.freeze(this.sortedRows)
return
}
diff --git a/webapp/src/components/GroupModule.vue b/webapp/src/components/GroupModule.vue
index b772055..8a301e3 100644
--- a/webapp/src/components/GroupModule.vue
+++ b/webapp/src/components/GroupModule.vue
@@ -94,7 +94,7 @@ export default {
},
created () {
this.$store.dispatch('groups/loadConfigs')
- if (this.groupList.length === 0 || this.clientList.length === 0) this.$store.dispatch('groups/loadLists')
+ this.$store.dispatch('groups/loadLists')
if (this.tabChain.length === 0) this.$store.dispatch('groups/loadGroup', { id: 0, tabIndex: 0 })
if (this.$route.params.id !== '0') this.loadItem(this.$route.name, this.$route.params.id)
this.$router.replace({
@@ -111,7 +111,6 @@ export default {
break
}
}
- console.log(tabIndex)
if (tabIndex === undefined) this.loadItem(to.name, to.params.id)
else this.setActiveTab(tabIndex)
}
diff --git a/webapp/src/components/RegistrationModule.vue b/webapp/src/components/RegistrationModule.vue
index 4e66019..8448dd4 100644
--- a/webapp/src/components/RegistrationModule.vue
+++ b/webapp/src/components/RegistrationModule.vue
@@ -102,7 +102,7 @@ export default {
}
},
created () {
- this.$store.dispatch('registration/loadGroupList')
+ this.$store.dispatch('groups/loadGroupList')
this.$store.dispatch('registration/loadHooks')
}
}
diff --git a/webapp/src/components/RegistrationModuleEdit.vue b/webapp/src/components/RegistrationModuleEdit.vue
index 9709f86..040acec 100644
--- a/webapp/src/components/RegistrationModuleEdit.vue
+++ b/webapp/src/components/RegistrationModuleEdit.vue
@@ -77,7 +77,8 @@ export default {
}
},
computed: {
- ...mapState('registration', ['dialog', 'groupList']),
+ ...mapState('registration', ['dialog']),
+ ...mapState('groups', ['groupList']),
headers () {
return [
{ key: 'name', text: this.$t('name') }
diff --git a/webapp/src/main.js b/webapp/src/main.js
index 97f8a15..20dde73 100644
--- a/webapp/src/main.js
+++ b/webapp/src/main.js
@@ -18,6 +18,7 @@ import VueI18n from 'vue-i18n'
import i18nMessages from '@/config/i18n'
import '@/assets/styles.css'
+Vue.config.performance = true
Vue.config.productionTip = false
Vue.use(Vuex)
diff --git a/webapp/src/store/groups.js b/webapp/src/store/groups.js
index 0dea3e5..4b1ec5a 100644
--- a/webapp/src/store/groups.js
+++ b/webapp/src/store/groups.js
@@ -49,12 +49,20 @@ export default {
context.commit('setConfigList', result.data.map(x => ({ id: x.id, name: x.name || x.id })))
})
},
- loadLists (context) {
- Promise.all([axios.get('/api/groups'), axios.get('/api/clients')]).then(res => {
- context.commit('setGroupList', res[0].data)
- context.commit('setClientList', res[1].data)
+ loadGroupList (context) {
+ axios.get('/api/groups').then(response => {
+ context.commit('setGroupList', Object.freeze(response.data))
+ })
+ },
+ loadClientList (context) {
+ axios.get('/api/clients').then(response => {
+ context.commit('setClientList', Object.freeze(response.data))
})
},
+ loadLists (context) {
+ context.dispatch('loadGroupList')
+ context.dispatch('loadClientList')
+ },
loadGroup (context, { id, name, tabIndex, switchTab, reload, save, placeholderName }) {
if (!reload && context.state.tabChain.length > tabIndex && context.state.tabChain[tabIndex].id === id) {
if (switchTab) context.commit('setActiveTab', tabIndex)
@@ -70,6 +78,7 @@ export default {
axios.get('/api/groups/' + id + (showAll ? '?all' : '')).then(res => {
res.data.tabType = 'group'
res.data.tabShowAll = showAll
+ res.data.subgroups = Object.freeze(res.data.subgroups)
context.commit('setTab', { index: tabIndex, item: res.data })
}).catch(err => {
console.log(err)
diff --git a/webapp/src/store/registration.js b/webapp/src/store/registration.js
index 244d98e..e7fb6cb 100644
--- a/webapp/src/store/registration.js
+++ b/webapp/src/store/registration.js
@@ -4,7 +4,6 @@ export default {
namespaced: true,
state: {
hooks: [],
- groupList: [],
dialog: {
show: false,
type: null,
@@ -26,11 +25,6 @@ export default {
context.commit('setHooks', result.data)
})
},
- loadGroupList (context) {
- axios.get('/api/groups').then(result => {
- context.commit('setGroupList', result.data)
- })
- },
setHooks (context, hooks) {
axios.post('/api/registration/hookorder', { ids: hooks.map(x => x.id) }).then(result => {
context.commit('setHooks', hooks)