diff --git a/src/scripts/js/es6/common/vuecomponents/App.js b/src/scripts/js/es6/common/vuecomponents/App.js
index 550b74d..dd060c2 100644
--- a/src/scripts/js/es6/common/vuecomponents/App.js
+++ b/src/scripts/js/es6/common/vuecomponents/App.js
@@ -13,8 +13,10 @@ const TEMPLATE =`
:project="project"
:selectedIds="selectedIds"
:canChangeSelectionCB="canChangeSelectionCB"
+ :componentState="initialTableState"
@selectItemsChanged="onSelectItemsChanged"
@isInitialized="onTableInitialized"
+ @componentStateChanged="onTableStateChanged"
/>
@@ -41,6 +41,18 @@ let AssetsTable = Vue.component('attract-assets-table', {
return {
columnFactory: new AssetColumnFactory(this.project),
rowsSource: new AssetRowsSource(this.project._id),
+ rowFilterConfig: {validStatuses: this.getValidStatuses()}
+ }
+ },
+ methods: {
+ getValidStatuses() {
+ for (const it of this.project.node_types) {
+ if(it.name === 'attract_asset'){
+ return it.dyn_schema.status.allowed;
+ }
+ }
+ console.warn('Did not find allowed statuses for node type attract_shot');
+ return [];
}
},
components: {
diff --git a/src/scripts/js/es6/common/vuecomponents/attracttable/filter/RowFilter.js b/src/scripts/js/es6/common/vuecomponents/attracttable/filter/RowFilter.js
deleted file mode 100644
index eeeb095..0000000
--- a/src/scripts/js/es6/common/vuecomponents/attracttable/filter/RowFilter.js
+++ /dev/null
@@ -1,98 +0,0 @@
-let RowFilterBase = pillar.vuecomponents.table.filter.RowFilter;
-const TEMPLATE =`
-
-`;
-
-let RowFilter = {
- extends: RowFilterBase,
- template: TEMPLATE,
- props: {
- rowObjects: Array
- },
- data() {
- return {
- showAssetStatus: {
- todo: true,
- in_progress: true,
- on_hold: true,
- approved: true,
- cbb: true,
- final: true,
- review: true,
- },
- }
- },
- computed: {
- nameQueryLoweCase() {
- return this.nameQuery.toLowerCase();
- },
- visibleRowObjects() {
- return this.rowObjects.filter((row) => {
- if (!this.hasShowStatus(row)) return false;
- return this.filterByName(row);
- });
- }
- },
- methods: {
- hasShowStatus(rowObject) {
- let status = rowObject.getProperties().status;
- return !(this.showAssetStatus[status] === false); // To handle invalid statuses
- },
- },
-};
-
-export { RowFilter }
diff --git a/src/scripts/js/es6/common/vuecomponents/attracttable/rows/AttractRowBase.js b/src/scripts/js/es6/common/vuecomponents/attracttable/rows/AttractRowBase.js
index ce45608..6deca7a 100644
--- a/src/scripts/js/es6/common/vuecomponents/attracttable/rows/AttractRowBase.js
+++ b/src/scripts/js/es6/common/vuecomponents/attracttable/rows/AttractRowBase.js
@@ -9,6 +9,10 @@ class AttractRowBase extends RowBase {
onRowUpdated(event) {
this.underlyingObject = event.detail;
}
+
+ getStatus() {
+ return this.underlyingObject.properties.status;
+ }
}
export { AttractRowBase }
diff --git a/src/scripts/js/es6/common/vuecomponents/attracttable/rows/filter/RowFilter.js b/src/scripts/js/es6/common/vuecomponents/attracttable/rows/filter/RowFilter.js
new file mode 100644
index 0000000..60b66ce
--- /dev/null
+++ b/src/scripts/js/es6/common/vuecomponents/attracttable/rows/filter/RowFilter.js
@@ -0,0 +1,68 @@
+let NameFilter = pillar.vuecomponents.table.rows.filter.NameFilter;
+let StatusFilter = pillar.vuecomponents.table.rows.filter.StatusFilter;
+
+const TEMPLATE =`
+
+
+
+
+`;
+
+let RowFilter = {
+ template: TEMPLATE,
+ props: {
+ rowObjects: Array,
+ componentState: Object,
+ config: Object
+ },
+ data() {
+ return {
+ availableStatuses: this.config.validStatuses,
+ nameFilteredRowObjects: [],
+ nameFilterState: (this.componentState || {}).nameFilter,
+ statusFilterState: (this.componentState || {}).statusFilter,
+ }
+ },
+ methods: {
+ onNameFiltered(visibleRowObjects) {
+ this.nameFilteredRowObjects = visibleRowObjects;
+ },
+ onNameFilterStateChanged(stateObj) {
+ this.nameFilterState = stateObj;
+ },
+ onStatusFilterStateChanged(stateObj) {
+ this.statusFilterState = stateObj;
+ }
+ },
+ computed: {
+ currentComponentState() {
+ return {
+ nameFilter: this.nameFilterState,
+ statusFilter: this.statusFilterState,
+ };
+ }
+ },
+ watch: {
+ currentComponentState(newValue) {
+ this.$emit('componentStateChanged', newValue);
+ }
+ },
+ components: {
+ 'name-filter': NameFilter,
+ 'status-filter': StatusFilter
+ }
+};
+
+export { RowFilter }
+
diff --git a/src/scripts/js/es6/common/vuecomponents/shotstable/Table.js b/src/scripts/js/es6/common/vuecomponents/shotstable/Table.js
index 7c3f94d..6f6bcd0 100644
--- a/src/scripts/js/es6/common/vuecomponents/shotstable/Table.js
+++ b/src/scripts/js/es6/common/vuecomponents/shotstable/Table.js
@@ -1,7 +1,7 @@
let PillarTable = pillar.vuecomponents.table.PillarTable;
import {ShotsColumnFactory} from './columns/ShotsColumnFactory'
import {ShotRowsSource} from './rows/ShotRowsSource'
-import {RowFilter} from '../attracttable/filter/RowFilter'
+import {RowFilter} from '../attracttable/rows/filter/RowFilter'
let ShotsTable = Vue.component('attract-shots-table', {
extends: PillarTable,
@@ -12,6 +12,18 @@ let ShotsTable = Vue.component('attract-shots-table', {
return {
columnFactory: new ShotsColumnFactory(this.project),
rowsSource: new ShotRowsSource(this.project._id),
+ rowFilterConfig: {validStatuses: this.getValidStatuses()}
+ }
+ },
+ methods: {
+ getValidStatuses() {
+ for (const it of this.project.node_types) {
+ if(it.name === 'attract_shot'){
+ return it.dyn_schema.status.allowed;
+ }
+ }
+ console.warn('Did not find allowed statuses for node type attract_shot');
+ return [];
}
},
components: {
diff --git a/src/scripts/js/es6/common/vuecomponents/taskstable/Table.js b/src/scripts/js/es6/common/vuecomponents/taskstable/Table.js
index 269d81f..a937b44 100644
--- a/src/scripts/js/es6/common/vuecomponents/taskstable/Table.js
+++ b/src/scripts/js/es6/common/vuecomponents/taskstable/Table.js
@@ -1,7 +1,7 @@
let PillarTable = pillar.vuecomponents.table.PillarTable;
import {TasksColumnFactory} from './columns/TasksColumnFactory'
import {TaskRowsSource} from './rows/TaskRowsSource'
-import {RowFilter} from '../attracttable/filter/RowFilter'
+import {RowFilter} from '../attracttable/rows/filter/RowFilter'
const TEMPLATE =`
@@ -41,6 +41,18 @@ let TasksTable = Vue.component('attract-tasks-table', {
return {
columnFactory: new TasksColumnFactory(this.project),
rowsSource: new TaskRowsSource(this.project._id),
+ rowFilterConfig: {validStatuses: this.getValidStatuses()}
+ }
+ },
+ methods: {
+ getValidStatuses() {
+ for (const it of this.project.node_types) {
+ if(it.name === 'attract_task'){
+ return it.dyn_schema.status.allowed;
+ }
+ }
+ console.warn('Did not find allowed statuses for node type attract_task');
+ return [];
}
},
components: {