Add environments-table component
This commit is contained in:
parent
7c484f6a90
commit
1d46ecebd1
@ -73,7 +73,7 @@ def edit_application(portfolio_id, application_id):
|
|||||||
portfolio=portfolio,
|
portfolio=portfolio,
|
||||||
application=application,
|
application=application,
|
||||||
form=form,
|
form=form,
|
||||||
environments_obj=environments_obj
|
environments_obj=environments_obj,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
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,
|
||||||
|
}
|
||||||
|
),
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
@ -25,6 +25,7 @@ import Modal from './mixins/modal'
|
|||||||
import selector from './components/selector'
|
import selector from './components/selector'
|
||||||
import BudgetChart from './components/charts/budget_chart'
|
import BudgetChart from './components/charts/budget_chart'
|
||||||
import SpendTable from './components/tables/spend_table'
|
import SpendTable from './components/tables/spend_table'
|
||||||
|
import EnvironmentsTable from './components/tables/application_environments'
|
||||||
import TaskOrderList from './components/tables/task_order_list.js'
|
import TaskOrderList from './components/tables/task_order_list.js'
|
||||||
import MembersList from './components/members_list'
|
import MembersList from './components/members_list'
|
||||||
import LocalDatetime from './components/local_datetime'
|
import LocalDatetime from './components/local_datetime'
|
||||||
@ -56,6 +57,7 @@ const app = new Vue({
|
|||||||
selector,
|
selector,
|
||||||
BudgetChart,
|
BudgetChart,
|
||||||
SpendTable,
|
SpendTable,
|
||||||
|
EnvironmentsTable,
|
||||||
TaskOrderList,
|
TaskOrderList,
|
||||||
MembersList,
|
MembersList,
|
||||||
LocalDatetime,
|
LocalDatetime,
|
||||||
|
@ -13,44 +13,39 @@
|
|||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div>
|
<environments-table
|
||||||
|
v-cloak
|
||||||
|
v-bind:environments='{{ environments_obj }}'
|
||||||
|
inline-template>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<th scope='col'>{{ "portfolios.applications.environments.name" | translate }}</th>
|
||||||
<td>{{ "portfolios.applications.environments.name" | translate }}</td>
|
<th scope='col' class='table-cell--align-right'>{{ "portfolios.applications.environments.members" | translate }}</th>
|
||||||
<td>{{ "portfolios.applications.environments.members" | translate }}</td>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody v-for='(members_list, name) in environments' class='spend-table__portfolio'>
|
||||||
{% for environment in application.environments %}
|
<tr>
|
||||||
<tr is='toggler' v-cloak>
|
<th scope='rowgroup' v-on:click="toggle($event, name)" v-html='name'></th>
|
||||||
<template slot-scope='props'>
|
|
||||||
|
|
||||||
<th v-on:click="props.toggle">{{ environment.name }}</th>
|
<template v-if="environmentsState[name].isVisible">
|
||||||
|
<span v-on:click="toggle($event, name)" class='icon-link icon-link--large spend-table__application__toggler'>
|
||||||
<template v-if="props.isVisible">
|
<td>Hide Members(<span v-html='members_list.length'></span>){{ Icon('caret_up') }}</td>
|
||||||
<span v-on:click="props.toggle" class='icon-link toggle-link'>
|
</template>
|
||||||
<td>Hide Members({{ environment.num_users }}){{ Icon('caret_up') }}</td>
|
<template v-else>
|
||||||
</template>
|
<span v-on:click="toggle($event, name)" class='icon-link icon-link--large spend-table__application__toggler'>
|
||||||
<template v-else>
|
<td>Show Members(<span v-html='members_list.length'></span>){{ Icon('caret_down') }}</td>
|
||||||
<span v-on:click="props.toggle" class='icon-link toggle-link'>
|
</template>
|
||||||
<td>Show Members({{ environment.num_users }}){{ Icon('caret_down') }}</td>
|
</tr>
|
||||||
</template>
|
|
||||||
|
|
||||||
</template>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr >
|
|
||||||
<td class='accordian__item application-list-item__environment'>
|
|
||||||
<div class='application-list-item__environment__name'>
|
|
||||||
<span>User Name here</span>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
|
<tr scope='rowgroup' v-for='member in members_list' v-show='environmentsState[name].isVisible' class='spend-table__application__env'>
|
||||||
|
<td class='accordian__item application-list-item__environment table-cell--expand'>
|
||||||
|
<div class='application-list-item__environment__name'>
|
||||||
|
<span v-html='member'></span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</environments-table>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user