From 1d46ecebd18f5ccc8fc072577cf44c3a4c4705bc Mon Sep 17 00:00:00 2001 From: Montana Date: Tue, 9 Apr 2019 11:18:04 -0400 Subject: [PATCH] Add environments-table component --- atst/routes/portfolios/applications.py | 2 +- .../tables/application_environments.js | 34 +++++++++++ js/index.js | 2 + .../fragments/applications/environments.html | 59 +++++++++---------- 4 files changed, 64 insertions(+), 33 deletions(-) create mode 100644 js/components/tables/application_environments.js diff --git a/atst/routes/portfolios/applications.py b/atst/routes/portfolios/applications.py index b5a20407..20603b3c 100644 --- a/atst/routes/portfolios/applications.py +++ b/atst/routes/portfolios/applications.py @@ -73,7 +73,7 @@ def edit_application(portfolio_id, application_id): portfolio=portfolio, application=application, form=form, - environments_obj=environments_obj + environments_obj=environments_obj, ) diff --git a/js/components/tables/application_environments.js b/js/components/tables/application_environments.js new file mode 100644 index 00000000..c91e63a2 --- /dev/null +++ b/js/components/tables/application_environments.js @@ -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, + } + ), + }) + }, + }, +} diff --git a/js/index.js b/js/index.js index 0a419224..dee29320 100644 --- a/js/index.js +++ b/js/index.js @@ -25,6 +25,7 @@ import Modal from './mixins/modal' import selector from './components/selector' import BudgetChart from './components/charts/budget_chart' import SpendTable from './components/tables/spend_table' +import EnvironmentsTable from './components/tables/application_environments' import TaskOrderList from './components/tables/task_order_list.js' import MembersList from './components/members_list' import LocalDatetime from './components/local_datetime' @@ -56,6 +57,7 @@ const app = new Vue({ selector, BudgetChart, SpendTable, + EnvironmentsTable, TaskOrderList, MembersList, LocalDatetime, diff --git a/templates/fragments/applications/environments.html b/templates/fragments/applications/environments.html index 8e07f618..3eec6645 100644 --- a/templates/fragments/applications/environments.html +++ b/templates/fragments/applications/environments.html @@ -13,44 +13,39 @@ -
+ - - - - + + - - {% for environment in application.environments %} - - - - - - - - {% endfor %} + + + + + + +
{{ "portfolios.applications.environments.name" | translate }}{{ "portfolios.applications.environments.members" | translate }}
{{ "portfolios.applications.environments.name" | translate }}{{ "portfolios.applications.environments.members" | translate }}
-
- User Name here -
-
+
+ +
+
-
+