Add environments-table component
This commit is contained in:
34
js/components/tables/application_environments.js
Normal file
34
js/components/tables/application_environments.js
Normal file
@@ -0,0 +1,34 @@
|
||||
import { set } from 'vue/dist/vue'
|
||||
|
||||
export default {
|
||||
name: 'environments-table',
|
||||
|
||||
props: {
|
||||
environments: Object,
|
||||
},
|
||||
|
||||
data: function() {
|
||||
return {
|
||||
environmentsState: this.environments,
|
||||
}
|
||||
},
|
||||
|
||||
created: function() {
|
||||
Object.keys(this.environments).forEach(environment => {
|
||||
set(this.environmentsState[environment], 'isVisible', false)
|
||||
})
|
||||
},
|
||||
|
||||
methods: {
|
||||
toggle: function(e, environmentName) {
|
||||
this.environmentsState = Object.assign(this.environmentsState, {
|
||||
[environmentName]: Object.assign(
|
||||
this.environmentsState[environmentName],
|
||||
{
|
||||
isVisible: !this.environmentsState[environmentName].isVisible,
|
||||
}
|
||||
),
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
Reference in New Issue
Block a user