Skip to content
Snippets Groups Projects
Commit 9b7a6049 authored by Eugen Ciur's avatar Eugen Ciur
Browse files

enable commander panel refresh after drag and drop

parent b93218d3
No related branches found
No related tags found
No related merge requests found
......@@ -48,7 +48,14 @@ export default class CommanderComponent extends Component {
this.ws_nodes_move.addHandler(this.wsNodesMoveHandler, this);
}
wsNodesMoveHandler() {
wsNodesMoveHandler(message) {
if (message.type === 'nodesmove.tasksucceeded') {
if (this.args.node.id == message.source_parent['id']) {
this._substract_nodes(message.nodes.map(node => node.id));
} else if (this.args.node.id == message.target_parent['id']) {
this._add_nodes(message.nodes.map(node => node.id));
}
}
}
messageHandler(message) {
......@@ -76,6 +83,50 @@ export default class CommanderComponent extends Component {
} // end of switch
}
_substract_nodes(node_ids) {
let that = this, doc;
node_ids.forEach(node_id => {
// maybe document ?
doc = that.store.peekRecord('document', node_id);
if (doc) {
that._substract_node(doc);
}
// maybe folder ?
doc = that.store.peekRecord('folder', node_id);
if (doc) {
that._substract_node(doc);
}
});
}
_substract_node(doc) {
this.deleted_records.push(doc);
this.__deleted_record = doc;
}
_add_nodes(node_ids) {
let that = this, doc;
node_ids.forEach(node_id => {
// maybe document ?
doc = that.store.peekRecord('document', node_id);
if (doc) {
that._add_node(doc);
}
// maybe folder ?
doc = that.store.peekRecord('folder', node_id);
if (doc) {
that._add_node(doc);
}
});
}
_add_node(doc) {
this.new_records.push(doc);
this.__new_record = doc;
}
@action
openNewFolderModal() {
this.show_new_folder_modal = true;
......
......@@ -79,8 +79,9 @@ export default class ViewerComponent extends Component {
{ reload: true }
).then((doc) => {
last_version = doc.last_version;
that._document_versions.push(last_version);
that.__document_versions__ = last_version;
//that._document_versions.push(last_version);
//that.__document_versions__ = last_version;
page_adapter.loadImages(last_version.pages, 'image/svg+xml').then(
(pages) => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment