Attract multi edit: Edit multiple tasks/shots/assets at the same time
For the user: Ctrl + L-Mouse to select multiple tasks/shots/assets and then edit the nodes as before. When multiple items are selected a chain icon can be seen in editor next to the fields. If the chain is broken it indicates that the values are not the same on all the selected items. When a field has been edited it will be marked with a green background color. The items are saved one by one in parallel. This means that one item could fail to be saved, while the others get updated. For developers: The editor and activities has been ported to Vue. The table and has been updated to support multi select. MultiEditEngine is the core of the multi edit. It keeps track of what values differs and what has been edited.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
export { thenMarkdownToHtml } from './markdown'
|
||||
export { thenGetProject } from './projects'
|
||||
export { thenGetNodes } from './nodes'
|
||||
export { thenGetNodes, thenGetNode, thenGetNodeActivities, thenUpdateNode, thenDeleteNode } from './nodes'
|
||||
export { thenGetProjectUsers } from './users'
|
||||
|
@@ -3,7 +3,80 @@ function thenGetNodes(where, embedded={}, sort='') {
|
||||
let encodedEmbedded = encodeURIComponent(JSON.stringify(embedded));
|
||||
let encodedSort = encodeURIComponent(sort);
|
||||
|
||||
return $.get(`/api/nodes?where=${encodedWhere}&embedded=${encodedEmbedded}&sort=${encodedSort}`);
|
||||
return $.ajax({
|
||||
url: `/api/nodes?where=${encodedWhere}&embedded=${encodedEmbedded}&sort=${encodedSort}`,
|
||||
cache: false,
|
||||
});
|
||||
}
|
||||
|
||||
export { thenGetNodes }
|
||||
function thenGetNode(nodeId) {
|
||||
return $.ajax({
|
||||
url: `/api/nodes/${nodeId}`,
|
||||
cache: false,
|
||||
});
|
||||
}
|
||||
|
||||
function thenGetNodeActivities(nodeId, sort='[("_created", -1)]', max_results=20, page=1) {
|
||||
let encodedSort = encodeURIComponent(sort);
|
||||
return $.ajax({
|
||||
url: `/api/nodes/${nodeId}/activities?sort=${encodedSort}&max_results=${max_results}&page=${page}`,
|
||||
cache: false,
|
||||
});
|
||||
}
|
||||
|
||||
function thenUpdateNode(node) {
|
||||
let id = node['_id'];
|
||||
let etag = node['_etag'];
|
||||
|
||||
let nodeToSave = removePrivateKeys(node);
|
||||
let data = JSON.stringify(nodeToSave);
|
||||
return $.ajax({
|
||||
url: `/api/nodes/${id}`,
|
||||
type: 'PUT',
|
||||
data: data,
|
||||
dataType: 'json',
|
||||
contentType: 'application/json; charset=UTF-8',
|
||||
headers: {'If-Match': etag},
|
||||
}).then(updatedInfo => {
|
||||
return thenGetNode(updatedInfo['_id'])
|
||||
.then(node => {
|
||||
pillar.events.Nodes.triggerUpdated(node);
|
||||
return node;
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function thenDeleteNode(node) {
|
||||
let id = node['_id'];
|
||||
let etag = node['_etag'];
|
||||
|
||||
return $.ajax({
|
||||
url: `/api/nodes/${id}`,
|
||||
type: 'DELETE',
|
||||
headers: {'If-Match': etag},
|
||||
}).then(() => {
|
||||
pillar.events.Nodes.triggerDeleted(id);
|
||||
});
|
||||
}
|
||||
|
||||
function removePrivateKeys(doc) {
|
||||
function doRemove(d) {
|
||||
for (const key in d) {
|
||||
if (key.startsWith('_')) {
|
||||
delete d[key];
|
||||
continue;
|
||||
}
|
||||
let val = d[key];
|
||||
if(typeof val === 'object') {
|
||||
doRemove(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
let docCopy = JSON.parse(JSON.stringify(doc));
|
||||
doRemove(docCopy);
|
||||
delete docCopy['allowed_methods']
|
||||
|
||||
return docCopy;
|
||||
}
|
||||
|
||||
export { thenGetNodes, thenGetNode, thenGetNodeActivities, thenUpdateNode, thenDeleteNode }
|
||||
|
7
src/scripts/js/es6/common/api/users.js
Normal file
7
src/scripts/js/es6/common/api/users.js
Normal file
@@ -0,0 +1,7 @@
|
||||
function thenGetProjectUsers(projectId) {
|
||||
return $.ajax({
|
||||
url: `/api/p/users?project_id=${projectId}`,
|
||||
});
|
||||
}
|
||||
|
||||
export { thenGetProjectUsers }
|
Reference in New Issue
Block a user