From f68ab291842e433285a90c8d80faa476a605c3a7 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Tue, 23 Nov 2021 11:07:07 +0100 Subject: [PATCH] fix(ui): error messages from exception --- public/dist/scripts/app-all.js | 4 ++-- public/dist/scripts/app.js | 4 ++-- public/scripts/views/service.js | 8 +++++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/public/dist/scripts/app-all.js b/public/dist/scripts/app-all.js index 936f665b9e..643d4f1954 100644 --- a/public/dist/scripts/app-all.js +++ b/public/dist/scripts/app-all.js @@ -3080,7 +3080,7 @@ newHistory[project]=history;} let currentSnapshot={...current};for(let index=.1;index<=1;index+=.05){let currentTransition={...currentSnapshot};for(const project in current){if(project in newHistory){let base=newHistory[project][bars-2].value;let cur=currentSnapshot[project];let offset=(cur-base)*index;currentTransition[project]=base+Math.floor(offset);}} realtime.setCurrent(currentTransition);await sleep(250);} realtime.setHistory(newHistory);}});window.formValidation=(form,fields)=>{const elements=form.elements;const actionHandler=(action,attribute)=>{switch(action){case"disable":elements[attribute].setAttribute("disabled",true);elements[attribute].dispatchEvent(new Event('change'));break;case"enable":elements[attribute].removeAttribute("disabled");elements[attribute].dispatchEvent(new Event('change'));break;case"unvalue":elements[attribute].value="";break;case"check":elements[attribute].value="true";break;case"uncheck":elements[attribute].value="false";break;}};for(const field in fields){for(const attribute in fields[field]){const attr=fields[field][attribute];if(Array.isArray(attr)){attr.forEach(action=>{if(elements[field].value==="true"){actionHandler(action,attribute);}})}else{const condition=attr.if.some(c=>{return elements[c].value==="true";});if(condition){for(const thenAction in attr.then){attr.then[thenAction].forEach(action=>{actionHandler(action,thenAction);});}}else{for(const elseAction in attr.else){attr.else[elseAction].forEach(action=>{actionHandler(action,elseAction);});}}}}} -form.addEventListener("reset",()=>{for(const key in fields){if(Object.hasOwnProperty.call(fields,key)){const element=form.elements[key];element.setAttribute('value','');element.removeAttribute("disabled");element.dispatchEvent(new Event('change'));}}});};(function(window){"use strict";window.ls.container.set('alerts',function(window){return{list:[],ids:0,counter:0,max:5,add:function(message,time){var scope=this;message.id=scope.ids++;message.remove=function(){scope.remove(message.id);};scope.counter++;scope.list.unshift(message);if(scope.counter>scope.max){scope.list.pop();scope.counter--;} +form.addEventListener("reset",()=>{for(const key in fields){if(Object.hasOwnProperty.call(fields,key)){const element=form.elements[key];element.setAttribute("value","");element.removeAttribute("disabled");element.dispatchEvent(new Event("change"));}}});};(function(window){"use strict";window.ls.container.set('alerts',function(window){return{list:[],ids:0,counter:0,max:5,add:function(message,time){var scope=this;message.id=scope.ids++;message.remove=function(){scope.remove(message.id);};scope.counter++;scope.list.unshift(message);if(scope.counter>scope.max){scope.list.pop();scope.counter--;} if(time>0){window.setTimeout(function(message){return function(){scope.remove(message.id)}}(message),time);} return message.id;},remove:function(id){let scope=this;for(let index=0;index{const elements=form.elements;const actionHandler=(action,attribute)=>{switch(action){case"disable":elements[attribute].setAttribute("disabled",true);elements[attribute].dispatchEvent(new Event('change'));break;case"enable":elements[attribute].removeAttribute("disabled");elements[attribute].dispatchEvent(new Event('change'));break;case"unvalue":elements[attribute].value="";break;case"check":elements[attribute].value="true";break;case"uncheck":elements[attribute].value="false";break;}};for(const field in fields){for(const attribute in fields[field]){const attr=fields[field][attribute];if(Array.isArray(attr)){attr.forEach(action=>{if(elements[field].value==="true"){actionHandler(action,attribute);}})}else{const condition=attr.if.some(c=>{return elements[c].value==="true";});if(condition){for(const thenAction in attr.then){attr.then[thenAction].forEach(action=>{actionHandler(action,thenAction);});}}else{for(const elseAction in attr.else){attr.else[elseAction].forEach(action=>{actionHandler(action,elseAction);});}}}}} -form.addEventListener("reset",()=>{for(const key in fields){if(Object.hasOwnProperty.call(fields,key)){const element=form.elements[key];element.setAttribute('value','');element.removeAttribute("disabled");element.dispatchEvent(new Event('change'));}}});};(function(window){"use strict";window.ls.container.set('alerts',function(window){return{list:[],ids:0,counter:0,max:5,add:function(message,time){var scope=this;message.id=scope.ids++;message.remove=function(){scope.remove(message.id);};scope.counter++;scope.list.unshift(message);if(scope.counter>scope.max){scope.list.pop();scope.counter--;} +form.addEventListener("reset",()=>{for(const key in fields){if(Object.hasOwnProperty.call(fields,key)){const element=form.elements[key];element.setAttribute("value","");element.removeAttribute("disabled");element.dispatchEvent(new Event("change"));}}});};(function(window){"use strict";window.ls.container.set('alerts',function(window){return{list:[],ids:0,counter:0,max:5,add:function(message,time){var scope=this;message.id=scope.ids++;message.remove=function(){scope.remove(message.id);};scope.counter++;scope.list.unshift(message);if(scope.counter>scope.max){scope.list.pop();scope.counter--;} if(time>0){window.setTimeout(function(message){return function(){scope.remove(message.id)}}(message),time);} return message.id;},remove:function(id){let scope=this;for(let index=0;index