Added comments and minor refactoring
This commit is contained in:
@@ -6,7 +6,7 @@ class AssetRowsSource extends AttractRowsSourceBase {
|
|||||||
super(projectId, 'attract_asset', AssetRow);
|
super(projectId, 'attract_asset', AssetRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
thenFetchObjects() {
|
thenGetRowObjects() {
|
||||||
return attract.api.thenGetProjectAssets(this.projectId)
|
return attract.api.thenGetProjectAssets(this.projectId)
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
let assets = result._items;
|
let assets = result._items;
|
||||||
|
@@ -1,5 +1,9 @@
|
|||||||
let RowObjectsSourceBase = pillar.vuecomponents.table.rows.RowObjectsSourceBase;
|
let RowObjectsSourceBase = pillar.vuecomponents.table.rows.RowObjectsSourceBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base for all attract tables. Listens to events on create/delete events and keeps the the source up to date
|
||||||
|
* accordingly.
|
||||||
|
*/
|
||||||
class AttractRowsSourceBase extends RowObjectsSourceBase {
|
class AttractRowsSourceBase extends RowObjectsSourceBase {
|
||||||
constructor(projectId, node_type, rowClass) {
|
constructor(projectId, node_type, rowClass) {
|
||||||
super(projectId);
|
super(projectId);
|
||||||
|
@@ -21,6 +21,7 @@ export class TaskEventListener {
|
|||||||
|
|
||||||
onTaskCreated(event) {
|
onTaskCreated(event) {
|
||||||
let task = new TaskRow(event.detail);
|
let task = new TaskRow(event.detail);
|
||||||
|
task.thenInit();
|
||||||
this.registerEventListeners(task);
|
this.registerEventListeners(task);
|
||||||
this.rowObject.tasks = this.rowObject.tasks.concat(task);
|
this.rowObject.tasks = this.rowObject.tasks.concat(task);
|
||||||
}
|
}
|
||||||
|
@@ -2,6 +2,9 @@ const TEMPLATE =`
|
|||||||
<div class="attract-box item-details-empty">Select Something</div>
|
<div class="attract-box item-details-empty">Select Something</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For when nothing is selected in the table
|
||||||
|
*/
|
||||||
let Empty = Vue.component('attract-editor-empty', {
|
let Empty = Vue.component('attract-editor-empty', {
|
||||||
template: TEMPLATE,
|
template: TEMPLATE,
|
||||||
});
|
});
|
||||||
|
@@ -4,6 +4,9 @@ const TEMPLATE =`
|
|||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For when objects of different node_type is selected.
|
||||||
|
*/
|
||||||
let MultipleTypes = Vue.component('attract-editor-multiple-types', {
|
let MultipleTypes = Vue.component('attract-editor-multiple-types', {
|
||||||
template: TEMPLATE,
|
template: TEMPLATE,
|
||||||
});
|
});
|
||||||
|
@@ -51,11 +51,6 @@ Vue.component('attract-detailed-view', {
|
|||||||
isActivitiesOutdated: true
|
isActivitiesOutdated: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
isActivitiesOutdated: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
computed: {
|
||||||
headerText() {
|
headerText() {
|
||||||
switch(this.items.length) {
|
switch(this.items.length) {
|
||||||
@@ -111,4 +106,3 @@ Vue.component('attract-detailed-view', {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -6,10 +6,13 @@ const TEMPLATE =`
|
|||||||
/>
|
/>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draws a chain icon. If property is inconclusive it becomes a broken chain.
|
||||||
|
*/
|
||||||
Vue.component('attract-property-conslusive-mark', {
|
Vue.component('attract-property-conslusive-mark', {
|
||||||
template: TEMPLATE,
|
template: TEMPLATE,
|
||||||
props: {
|
props: {
|
||||||
prop: Object,
|
prop: Object, // MultiProperty
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
classes() {
|
classes() {
|
||||||
|
@@ -47,4 +47,5 @@ Vue.component('attract-date-picker', {
|
|||||||
this.picker.setDate(this.value);
|
this.picker.setDate(this.value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
}
|
||||||
|
);
|
||||||
|
@@ -2,6 +2,9 @@ import {MultiEditEngine} from './MultiEditEngine'
|
|||||||
let UnitOfWorkTracker = pillar.vuecomponents.mixins.UnitOfWorkTracker;
|
let UnitOfWorkTracker = pillar.vuecomponents.mixins.UnitOfWorkTracker;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Properties to be edited and/or read using the multi editor engine.
|
||||||
|
*/
|
||||||
const BaseProps = Object.freeze({
|
const BaseProps = Object.freeze({
|
||||||
NAME: 'name',
|
NAME: 'name',
|
||||||
DESCRIPTION: 'description',
|
DESCRIPTION: 'description',
|
||||||
@@ -15,10 +18,16 @@ for (const key in BaseProps) {
|
|||||||
ALL_BASE_PROPERTIES.push(BaseProps[key]);
|
ALL_BASE_PROPERTIES.push(BaseProps[key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The base implementation of node editor.
|
||||||
|
* Extend to fit your needs.
|
||||||
|
* @emits objects-are-edited(isEdited) When the user starts editing the objects.
|
||||||
|
*/
|
||||||
let EditorBase = Vue.component('attract-editor-Base', {
|
let EditorBase = Vue.component('attract-editor-Base', {
|
||||||
mixins: [UnitOfWorkTracker],
|
mixins: [UnitOfWorkTracker],
|
||||||
props: {
|
props: {
|
||||||
items: Array,
|
items: Array, // Array of objects to be edited.
|
||||||
project: Object,
|
project: Object,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@@ -29,7 +38,7 @@ let EditorBase = Vue.component('attract-editor-Base', {
|
|||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
items() {
|
items() {
|
||||||
this.multiEditEngine = this.createEditorEngine(ALL_BASE_PROPERTIES);
|
this.multiEditEngine = this.createEditorEngine(ALL_BASE_PROPERTIES); // MultiEditEngine
|
||||||
},
|
},
|
||||||
statusPropEdited(isEdited) {
|
statusPropEdited(isEdited) {
|
||||||
if(isEdited && this.items.length === 1) {
|
if(isEdited && this.items.length === 1) {
|
||||||
@@ -98,15 +107,16 @@ let EditorBase = Vue.component('attract-editor-Base', {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
/**
|
||||||
|
* @param {MultiProperty} prop
|
||||||
|
* @returns {Object} Css classes for property
|
||||||
|
*/
|
||||||
classesForProperty(prop) {
|
classesForProperty(prop) {
|
||||||
return {
|
return {
|
||||||
'inconclusive': !prop.isConclusive(),
|
'inconclusive': !prop.isConclusive(),
|
||||||
'edited': prop.isEdited(),
|
'edited': prop.isEdited(),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
conclusiveIcon(prop) {
|
|
||||||
return prop.isConclusive() ? 'pi-link' : 'pi-unlink';
|
|
||||||
},
|
|
||||||
createEditorEngine(props) {
|
createEditorEngine(props) {
|
||||||
return new MultiEditEngine(this.items, ...props);
|
return new MultiEditEngine(this.items, ...props);
|
||||||
},
|
},
|
||||||
|
@@ -6,6 +6,9 @@ const TEMPLATE = `
|
|||||||
type="text"
|
type="text"
|
||||||
rows="2"/>
|
rows="2"/>
|
||||||
`;
|
`;
|
||||||
|
/**
|
||||||
|
* Wrapper around regular textarea to make it grow in length as you type.
|
||||||
|
*/
|
||||||
Vue.component('attract-editor-text-area', {
|
Vue.component('attract-editor-text-area', {
|
||||||
template: TEMPLATE,
|
template: TEMPLATE,
|
||||||
props: {
|
props: {
|
||||||
|
@@ -6,7 +6,7 @@ class ShotRowsSource extends AttractRowsSourceBase {
|
|||||||
super(projectId, 'attract_asset', ShotRow);
|
super(projectId, 'attract_asset', ShotRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
thenFetchObjects() {
|
thenGetRowObjects() {
|
||||||
return attract.api.thenGetProjectShots(this.projectId)
|
return attract.api.thenGetProjectShots(this.projectId)
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
let shots = result._items;
|
let shots = result._items;
|
||||||
|
@@ -6,7 +6,7 @@ class TaskRowsSource extends AttractRowsSourceBase {
|
|||||||
super(projectId, 'attract_task', TaskRow);
|
super(projectId, 'attract_task', TaskRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
thenFetchObjects() {
|
thenGetRowObjects() {
|
||||||
return attract.api.thenGetProjectTasks(this.projectId)
|
return attract.api.thenGetProjectTasks(this.projectId)
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
let tasks = result._items;
|
let tasks = result._items;
|
||||||
|
Reference in New Issue
Block a user