Skip to content

Commit af943f4

Browse files
SW-724 drop upload either in working area or in design lib directly 3 (mrbeam#1423)
* SW-724 remove spinner if loading bar reaches 100% * SW-724 do not add file to WA and show notification if file already exists in WA * SW-724 code restructure
1 parent ab6843f commit af943f4

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

octoprint_mrbeam/static/js/mother_viewmodel.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ $(function () {
340340
for (let mutation of mutationsList) {
341341
if (OctoPrint.coreui.selectedTab === "#workingarea") {
342342
let width = $(mutation.target).inlineStyle("width");
343-
if (width === "0%") {
343+
if (width === "0%" || width === "100%") {
344344
$("body").removeClass("activitySpinnerActive");
345345
} else {
346346
$("body").addClass("activitySpinnerActive");
@@ -376,7 +376,17 @@ $(function () {
376376
}
377377

378378
if (file) {
379-
self.workingArea.placeUpload(file);
379+
const fileAlreadyPlaced = (element) => element.path === path;
380+
if(!self.workingArea.placedDesigns().some(fileAlreadyPlaced)){
381+
self.workingArea.placeUpload(file);
382+
} else {
383+
new PNotify({
384+
title: gettext("File uploaded but not added to the Working Area"),
385+
text: gettext("The file you uploaded was not added to the working area because another file with the same name already exists."),
386+
type: "warn",
387+
hide: false
388+
});
389+
}
380390
} else {
381391
console.warn(
382392
"Unable to place upload on the workingArea. FilesViewmodel was not updated yet."

0 commit comments

Comments
 (0)