fixed errors VC
This commit is contained in:
parent
6c6403336f
commit
3124e09c12
|
@ -1,5 +1,5 @@
|
|||
// TODO: Add Artica ST header.
|
||||
/* globals jQuery, VisualConsole, AsyncTaskManager, confirmDialog */
|
||||
/* globals jQuery, VisualConsole, AsyncTaskManager */
|
||||
|
||||
/*
|
||||
* *********************
|
||||
|
@ -460,54 +460,50 @@ function createVisualConsole(
|
|||
var aux = item;
|
||||
var id = item.props.id;
|
||||
|
||||
confirmDialog({
|
||||
title: "Delete",
|
||||
message: "Are you sure?",
|
||||
onAccept: function() {
|
||||
item.remove();
|
||||
item.remove();
|
||||
|
||||
var taskId = "visual-console-item-update-" + id;
|
||||
var taskId = "visual-console-item-update-" + id;
|
||||
|
||||
asyncTaskManager
|
||||
.add(taskId, function(done) {
|
||||
var abortable = removeVisualConsoleItem(
|
||||
baseUrl,
|
||||
visualConsole.props.id,
|
||||
id,
|
||||
function(error, data) {
|
||||
if (error || !data) {
|
||||
console.log(
|
||||
"[ERROR]",
|
||||
"[VISUAL-CONSOLE-CLIENT]",
|
||||
"[API]",
|
||||
error ? error.message : "Invalid response"
|
||||
);
|
||||
asyncTaskManager
|
||||
.add(taskId, function(done) {
|
||||
var abortable = removeVisualConsoleItem(
|
||||
baseUrl,
|
||||
visualConsole.props.id,
|
||||
id,
|
||||
function(error, data) {
|
||||
if (error || !data) {
|
||||
console.log(
|
||||
"[ERROR]",
|
||||
"[VISUAL-CONSOLE-CLIENT]",
|
||||
"[API]",
|
||||
error ? error.message : "Invalid response"
|
||||
);
|
||||
|
||||
// Add the item to the list.
|
||||
var itemRetrieved = aux.props;
|
||||
itemRetrieved["receivedAt"] = new Date();
|
||||
var newItem = visualConsole.addElement(itemRetrieved);
|
||||
newItem.setMeta({ editMode: true });
|
||||
}
|
||||
// Add the item to the list.
|
||||
var itemRetrieved = aux.props;
|
||||
itemRetrieved["receivedAt"] = new Date();
|
||||
var newItem = visualConsole.addElement(itemRetrieved);
|
||||
newItem.setMeta({ editMode: true });
|
||||
}
|
||||
|
||||
done();
|
||||
}
|
||||
);
|
||||
done();
|
||||
}
|
||||
);
|
||||
|
||||
return {
|
||||
cancel: function() {
|
||||
abortable.abort();
|
||||
}
|
||||
};
|
||||
})
|
||||
.init();
|
||||
}
|
||||
});
|
||||
return {
|
||||
cancel: function() {
|
||||
abortable.abort();
|
||||
}
|
||||
};
|
||||
})
|
||||
.init();
|
||||
},
|
||||
copyItem: function(item) {
|
||||
var id = item.props.id;
|
||||
item.setMeta({ isSelected: false, isUpdating: true });
|
||||
|
||||
visualConsole.unSelectItem(id);
|
||||
|
||||
var taskId = "visual-console-item-update-" + id;
|
||||
|
||||
// Persist the new position.
|
||||
|
@ -569,6 +565,7 @@ function createVisualConsole(
|
|||
|
||||
var newItem = visualConsole.addElement(itemRetrieved);
|
||||
newItem.setMeta({ editMode: true, isSelected: true });
|
||||
visualConsole.selectItem(newItem.props.id);
|
||||
|
||||
done();
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -516,9 +516,15 @@ ui_require_css_file('form');
|
|||
});
|
||||
|
||||
$('#button-button_delete').click(function (event){
|
||||
visualConsoleManager.visualConsole.elements.forEach(item => {
|
||||
if (item.meta.isSelected === true) {
|
||||
visualConsoleManager.deleteItem(item);
|
||||
confirmDialog({
|
||||
title: "<?php echo __('Delete'); ?>",
|
||||
message: "<?php echo __('Are you sure'); ?>"+"?",
|
||||
onAccept: function() {
|
||||
visualConsoleManager.visualConsole.elements.forEach(item => {
|
||||
if (item.meta.isSelected === true) {
|
||||
visualConsoleManager.deleteItem(item);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -257,7 +257,7 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
|
|||
// This function will only run the 2nd arg function after the time
|
||||
// of the first arg have passed after its last execution.
|
||||
private debouncedMovementSave = debounce(
|
||||
300, // ms.
|
||||
100, // ms.
|
||||
(x: Position["x"], y: Position["y"]) => {
|
||||
// Update the metadata information.
|
||||
// Don't use the .meta property cause we don't need DOM updates.
|
||||
|
@ -338,7 +338,7 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
|
|||
// This function will only run the 2nd arg function after the time
|
||||
// of the first arg have passed after its last execution.
|
||||
private debouncedResizementSave = debounce(
|
||||
300, // ms.
|
||||
100, // ms.
|
||||
(width: Size["width"], height: Size["height"]) => {
|
||||
// Update the metadata information.
|
||||
// Don't use the .meta property cause we don't need DOM updates.
|
||||
|
|
|
@ -96,7 +96,7 @@ export default class Line extends Item<LineProps> {
|
|||
// This function will only run the 2nd arg function after the time
|
||||
// of the first arg have passed after its last execution.
|
||||
private debouncedStartPositionMovementSave = debounce(
|
||||
500, // ms.
|
||||
100, // ms.
|
||||
(x: Position["x"], y: Position["y"]) => {
|
||||
this.isMoving = false;
|
||||
const startPosition = { x, y };
|
||||
|
@ -154,7 +154,7 @@ export default class Line extends Item<LineProps> {
|
|||
// This function will only run the 2nd arg function after the time
|
||||
// of the first arg have passed after its last execution.
|
||||
private debouncedEndPositionMovementSave = debounce(
|
||||
500, // ms.
|
||||
100, // ms.
|
||||
(x: Position["x"], y: Position["y"]) => {
|
||||
this.isMoving = false;
|
||||
const endPosition = { x, y };
|
||||
|
|
Loading…
Reference in New Issue