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