diff --git a/src/scripts/js/es6/common/vuecomponents/App.js b/src/scripts/js/es6/common/vuecomponents/App.js index d69e61d..550b74d 100644 --- a/src/scripts/js/es6/common/vuecomponents/App.js +++ b/src/scripts/js/es6/common/vuecomponents/App.js @@ -10,7 +10,7 @@ const TEMPLATE =`
it.name); }, tableComponentName() { + if(!this.project) return ''; switch (this.contextType) { case 'assets': return AssetsTable.options.name; case 'tasks': return TasksTable.options.name; diff --git a/src/scripts/js/es6/common/vuecomponents/assetstable/Table.js b/src/scripts/js/es6/common/vuecomponents/assetstable/Table.js index 5847e10..f035459 100644 --- a/src/scripts/js/es6/common/vuecomponents/assetstable/Table.js +++ b/src/scripts/js/es6/common/vuecomponents/assetstable/Table.js @@ -34,8 +34,15 @@ let TableActions = { let AssetsTable = Vue.component('attract-assets-table', { extends: PillarTable, - columnFactory: AssetColumnFactory, - rowsSource: AssetRowsSource, + props: { + project: Object + }, + data() { + return { + columnFactory: new AssetColumnFactory(this.project), + rowsSource: new AssetRowsSource(this.project._id), + } + }, components: { 'pillar-table-actions': TableActions, 'pillar-table-row-filter': RowFilter, diff --git a/src/scripts/js/es6/common/vuecomponents/assetstable/columns/AssetColumnFactory.js b/src/scripts/js/es6/common/vuecomponents/assetstable/columns/AssetColumnFactory.js index e614187..31fe84a 100644 --- a/src/scripts/js/es6/common/vuecomponents/assetstable/columns/AssetColumnFactory.js +++ b/src/scripts/js/es6/common/vuecomponents/assetstable/columns/AssetColumnFactory.js @@ -6,18 +6,22 @@ let ColumnFactoryBase = pillar.vuecomponents.table.columns.ColumnFactoryBase; class AssetColumnFactory extends ColumnFactoryBase{ - thenGetColumns() { - return this.thenGetProject() - .then((project) => { - let taskTypes = project.extension_props.attract.task_types.attract_asset; - let taskColumns = taskTypes.map((tType) => { - return new TaskColumn(tType, 'asset-task'); - }) + constructor(project) { + super(); + this.project = project; + } - return [new Status(), new RowObject()] - .concat(taskColumns) - .concat([new NextTaskDueDate(),]); + thenGetColumns() { + let taskTypes = this.project.extension_props.attract.task_types.attract_asset; + let taskColumns = taskTypes.map((tType) => { + return new TaskColumn(tType, 'asset-task'); }) + + return Promise.resolve( + [new Status(), new RowObject()] + .concat(taskColumns) + .concat([new NextTaskDueDate(),]) + ); } } diff --git a/src/scripts/js/es6/common/vuecomponents/attracttable/rows/AttractRowsSourceBase.js b/src/scripts/js/es6/common/vuecomponents/attracttable/rows/AttractRowsSourceBase.js index 9970050..de1d842 100644 --- a/src/scripts/js/es6/common/vuecomponents/attracttable/rows/AttractRowsSourceBase.js +++ b/src/scripts/js/es6/common/vuecomponents/attracttable/rows/AttractRowsSourceBase.js @@ -6,7 +6,8 @@ let RowObjectsSourceBase = pillar.vuecomponents.table.rows.RowObjectsSourceBase; */ class AttractRowsSourceBase extends RowObjectsSourceBase { constructor(projectId, node_type, rowClass) { - super(projectId); + super(); + this.projectId = projectId; this.node_type = node_type; this.rowClass = rowClass; } diff --git a/src/scripts/js/es6/common/vuecomponents/shotstable/Table.js b/src/scripts/js/es6/common/vuecomponents/shotstable/Table.js index 9e346e1..7c3f94d 100644 --- a/src/scripts/js/es6/common/vuecomponents/shotstable/Table.js +++ b/src/scripts/js/es6/common/vuecomponents/shotstable/Table.js @@ -5,8 +5,15 @@ import {RowFilter} from '../attracttable/filter/RowFilter' let ShotsTable = Vue.component('attract-shots-table', { extends: PillarTable, - columnFactory: ShotsColumnFactory, - rowsSource: ShotRowsSource, + props: { + project: Object + }, + data() { + return { + columnFactory: new ShotsColumnFactory(this.project), + rowsSource: new ShotRowsSource(this.project._id), + } + }, components: { 'pillar-table-row-filter': RowFilter, }, diff --git a/src/scripts/js/es6/common/vuecomponents/shotstable/columns/ShotsColumnFactory.js b/src/scripts/js/es6/common/vuecomponents/shotstable/columns/ShotsColumnFactory.js index 7098523..72dad98 100644 --- a/src/scripts/js/es6/common/vuecomponents/shotstable/columns/ShotsColumnFactory.js +++ b/src/scripts/js/es6/common/vuecomponents/shotstable/columns/ShotsColumnFactory.js @@ -7,18 +7,22 @@ let ColumnFactoryBase = pillar.vuecomponents.table.columns.ColumnFactoryBase; class ShotsColumnFactory extends ColumnFactoryBase{ + constructor(project) { + super(); + this.project = project; + } + thenGetColumns() { - return this.thenGetProject() - .then((project) => { - let taskTypes = project.extension_props.attract.task_types.attract_shot; + let taskTypes = this.project.extension_props.attract.task_types.attract_shot; let taskColumns = taskTypes.map((tType) => { return new TaskColumn(tType, 'shot-task'); }) - return [new Status(), new Picture(), new RowObject()] + return Promise.resolve( + [new Status(), new Picture(), new RowObject()] .concat(taskColumns) - .concat([new NextTaskDueDate(),]); - }) + .concat([new NextTaskDueDate(),]) + ); } } diff --git a/src/scripts/js/es6/common/vuecomponents/taskstable/Table.js b/src/scripts/js/es6/common/vuecomponents/taskstable/Table.js index c2bb20e..269d81f 100644 --- a/src/scripts/js/es6/common/vuecomponents/taskstable/Table.js +++ b/src/scripts/js/es6/common/vuecomponents/taskstable/Table.js @@ -34,8 +34,15 @@ let TableActions = { let TasksTable = Vue.component('attract-tasks-table', { extends: PillarTable, - columnFactory: TasksColumnFactory, - rowsSource: TaskRowsSource, + props: { + project: Object + }, + data() { + return { + columnFactory: new TasksColumnFactory(this.project), + rowsSource: new TaskRowsSource(this.project._id), + } + }, components: { 'pillar-table-actions': TableActions, 'pillar-table-row-filter': RowFilter, diff --git a/src/scripts/js/es6/common/vuecomponents/taskstable/columns/TasksColumnFactory.js b/src/scripts/js/es6/common/vuecomponents/taskstable/columns/TasksColumnFactory.js index a9717a0..cbfc052 100644 --- a/src/scripts/js/es6/common/vuecomponents/taskstable/columns/TasksColumnFactory.js +++ b/src/scripts/js/es6/common/vuecomponents/taskstable/columns/TasksColumnFactory.js @@ -10,17 +10,14 @@ let ColumnFactoryBase = pillar.vuecomponents.table.columns.ColumnFactoryBase; class TasksColumnFactory extends ColumnFactoryBase{ thenGetColumns() { - return this.thenGetProject() - .then((project) => { - return [ - new Status(), - new ParentName(), - new RowObject(), - new ShortCode(), - new TaskType(), - new TaskDueDate(), - ]; - }) + return Promise.resolve([ + new Status(), + new ParentName(), + new RowObject(), + new ShortCode(), + new TaskType(), + new TaskDueDate(), + ]); } }