1
0
mirror of https://gitlab.com/bramw/baserow.git synced 2024-11-21 23:37:55 +00:00
bramw_baserow/web-frontend/modules/core/mixins/application.js
2024-07-25 17:05:43 +00:00

40 lines
1.0 KiB
JavaScript

import { notifyIf } from '@baserow/modules/core/utils/error'
export default {
methods: {
setLoading(application, value) {
this.$store.dispatch('application/setItemLoading', {
application,
value,
})
},
getApplicationContextComponent(application) {
return this.$registry
.get('application', application.type)
.getApplicationContextComponent()
},
getApplicationTypeName(application) {
return this.$registry.get('application', application.type).getName()
},
handleRenameApplication() {
this.$refs.rename.edit()
},
async renameApplication(application, event) {
this.setLoading(application, true)
try {
await this.$store.dispatch('application/update', {
application,
values: {
name: event.value,
},
})
} catch (error) {
this.$refs.rename.set(event.oldValue)
notifyIf(error, 'application')
}
this.setLoading(application, false)
},
},
}