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