From 2461d6ac1c5ecc9785728f60fceec834433f147e Mon Sep 17 00:00:00 2001 From: "vasary.daniel" Date: Wed, 13 Apr 2022 21:57:16 +0000 Subject: [PATCH] job view redesign git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C33158 --- server/user.mediacube.gui/css/toast.css | 73 +++++++++++ server/user.mediacube.gui/js/toast.js | 113 +++++++++++++++++ server/user.mediacube.gui/js/toast.min.js | 1 + server/user.mediacube.gui/pages/index.zul | 5 +- server/user.mediacube.gui/pages/jobeditor.zul | 116 ++++++++++++++++++ server/user.mediacube.gui/pages/joblist.zul | 9 +- server/user.mediacube.gui/pages/jobs.zul | 20 +++ .../user.mediacube.gui/pages/jobselector.zul | 107 +--------------- .../user/jobengine/zk/model/IndexModel.java | 2 +- ...SelectorModel.java => JobEditorModel.java} | 23 ++-- .../zk/model/MaestroJobListModel.java | 9 +- 11 files changed, 353 insertions(+), 125 deletions(-) create mode 100644 server/user.mediacube.gui/css/toast.css create mode 100644 server/user.mediacube.gui/js/toast.js create mode 100644 server/user.mediacube.gui/js/toast.min.js create mode 100644 server/user.mediacube.gui/pages/jobeditor.zul create mode 100644 server/user.mediacube.gui/pages/jobs.zul rename server/user.mediacube.gui/src/user/jobengine/zk/model/{JobSelectorModel.java => JobEditorModel.java} (83%) diff --git a/server/user.mediacube.gui/css/toast.css b/server/user.mediacube.gui/css/toast.css new file mode 100644 index 00000000..79d65808 --- /dev/null +++ b/server/user.mediacube.gui/css/toast.css @@ -0,0 +1,73 @@ +.toastjs-container { + position: absolute; /* Fallback */ + position: fixed; + top: 200px; + left: 30px; + width: calc(100% - 60px); + max-width: 400px; + + transform: translateX(-150%); + transition: transform 0.3s; + + z-index: 100; /* */ +} + +.toastjs-container[aria-hidden="false"] { + transform: translateX(0%); +} + +.toastjs { + background: #fff; + padding: 10px 15px 0; /* No bottom padding because the buttons have a margin-bottom */ + border-left-style: solid; + border-left-width: 5px; + border-radius: 4px; + box-shadow: 0 2px 5px 0 rgba(0,0,0,0.2); +} + +.toastjs.default { + border-left-color: #AAAAAA; +} + +.toastjs.success { + border-left-color: #2ECC40; +} +.toastjs.warning { + border-left-color: #FF851B; +} +.toastjs.danger { + border-left-color: #FF4136; +} + + +.toastjs-btn { + background: rgb(240,240,240); + padding: 5px 10px; + border: 0; + border-radius: 4px; + + font-family: 'Source Sans Pro', sans-serif; + font-size: 14px; + + display: inline-block; + margin-right: 10px; + margin-bottom: 10px; + cursor: pointer; +} + +.toastjs-btn--custom { + background: rgb(50,50,50); + color: #fff; +} + + +.toastjs-btn:hover, +.toastjs-btn:focus { + outline: none; + box-shadow: 0 2px 5px 0 rgba(0,0,0,0.2); +} + + + + + diff --git a/server/user.mediacube.gui/js/toast.js b/server/user.mediacube.gui/js/toast.js new file mode 100644 index 00000000..3b54a6b2 --- /dev/null +++ b/server/user.mediacube.gui/js/toast.js @@ -0,0 +1,113 @@ +'use strict'; + +function Toast(options) { + + if (!options.message) { + throw new Error('Toast.js - You need to set a message to display'); + return; + } + + this.options = options; + this.options.type = options.type || 'default'; + + this.toastContainerEl = document.querySelector('.toastjs-container'); + this.toastEl = document.querySelector('.toastjs'); + + this._init(); +} + +Toast.prototype._createElements = function () { + var _this = this; + + return new Promise(function (resolve, reject) { + + _this.toastContainerEl = document.createElement('div'); + _this.toastContainerEl.classList.add('toastjs-container'); + _this.toastContainerEl.setAttribute('role', 'alert'); + _this.toastContainerEl.setAttribute('aria-hidden', true); + + _this.toastEl = document.createElement('div'); + _this.toastEl.classList.add('toastjs'); + + _this.toastContainerEl.appendChild(_this.toastEl); + document.body.appendChild(_this.toastContainerEl); + + setTimeout(function () { + return resolve(); + }, 500); + }); +}; + +Toast.prototype._addEventListeners = function () { + var _this2 = this; + + document.querySelector('.toastjs-btn--close').addEventListener('click', function () { + _this2._close(); + }); + + if (this.options.customButtons) { + var customButtonsElArray = Array.prototype.slice.call(document.querySelectorAll('.toastjs-btn--custom')); + customButtonsElArray.map(function (el, index) { + el.addEventListener('click', function (event) { + return _this2.options.customButtons[index].onClick(event); + }); + }); + } +}; + +Toast.prototype._close = function () { + var _this3 = this; + + return new Promise(function (resolve, reject) { + _this3.toastContainerEl.setAttribute('aria-hidden', true); + setTimeout(function () { + + _this3.toastEl.innerHTML = ''; + _this3.toastEl.classList.remove('default', 'success', 'warning', 'danger'); + + if (_this3.focusedElBeforeOpen) { + _this3.focusedElBeforeOpen.focus(); + } + + resolve(); + }, 1000); + }); +}; + +Toast.prototype._open = function () { + + this.toastEl.classList.add(this.options.type); + this.toastContainerEl.setAttribute('aria-hidden', false); + + var customButtons = ''; + if (this.options.customButtons) { + customButtons = this.options.customButtons.map(function (customButton, index) { + return ''; + }); + customButtons = customButtons.join(''); + } + + this.toastEl.innerHTML = '\n

' + this.options.message + '

\n \n ' + customButtons + '\n '; + + this.focusedElBeforeOpen = document.activeElement; + document.querySelector('.toastjs-btn--close').focus(); +}; + +Toast.prototype._init = function () { + var _this4 = this; + + Promise.resolve().then(function () { + if (_this4.toastContainerEl) { + return Promise.resolve(); + } + return _this4._createElements(); + }).then(function () { + if (_this4.toastContainerEl.getAttribute('aria-hidden') == 'false') { + return _this4._close(); + } + return Promise.resolve(); + }).then(function () { + _this4._open(); + _this4._addEventListeners(); + }); +}; \ No newline at end of file diff --git a/server/user.mediacube.gui/js/toast.min.js b/server/user.mediacube.gui/js/toast.min.js new file mode 100644 index 00000000..1a0413ca --- /dev/null +++ b/server/user.mediacube.gui/js/toast.min.js @@ -0,0 +1 @@ +"use strict";function Toast(t){if(!t.message)throw new Error("Toast.js - You need to set a message to display");this.options=t,this.options.type=t.type||"default",this.toastContainerEl=document.querySelector(".toastjs-container"),this.toastEl=document.querySelector(".toastjs"),this._init()}Toast.prototype._createElements=function(){var t=this;return new Promise(function(e,o){t.toastContainerEl=document.createElement("div"),t.toastContainerEl.classList.add("toastjs-container"),t.toastContainerEl.setAttribute("role","alert"),t.toastContainerEl.setAttribute("aria-hidden",!0),t.toastEl=document.createElement("div"),t.toastEl.classList.add("toastjs"),t.toastContainerEl.appendChild(t.toastEl),document.body.appendChild(t.toastContainerEl),setTimeout(function(){return e()},500)})},Toast.prototype._addEventListeners=function(){var t=this;if(document.querySelector(".toastjs-btn--close").addEventListener("click",function(){t._close()}),this.options.customButtons){var e=Array.prototype.slice.call(document.querySelectorAll(".toastjs-btn--custom"));e.map(function(e,o){e.addEventListener("click",function(e){return t.options.customButtons[o].onClick(e)})})}},Toast.prototype._close=function(){var t=this;return new Promise(function(e,o){t.toastContainerEl.setAttribute("aria-hidden",!0),setTimeout(function(){t.toastEl.innerHTML="",t.toastEl.classList.remove("default","success","warning","danger"),t.focusedElBeforeOpen&&t.focusedElBeforeOpen.focus(),e()},1e3)})},Toast.prototype._open=function(){this.toastEl.classList.add(this.options.type),this.toastContainerEl.setAttribute("aria-hidden",!1);var t="";this.options.customButtons&&(t=this.options.customButtons.map(function(t,e){return'"}),t=t.join("")),this.toastEl.innerHTML="\n

"+this.options.message+'

\n \n '+t+"\n ",this.focusedElBeforeOpen=document.activeElement,document.querySelector(".toastjs-btn--close").focus()},Toast.prototype._init=function(){var t=this;Promise.resolve().then(function(){return t.toastContainerEl?Promise.resolve():t._createElements()}).then(function(){return"false"==t.toastContainerEl.getAttribute("aria-hidden")?t._close():Promise.resolve()}).then(function(){t._open(),t._addEventListeners()})}; \ No newline at end of file diff --git a/server/user.mediacube.gui/pages/index.zul b/server/user.mediacube.gui/pages/index.zul index 3b74039d..1df319a4 100644 --- a/server/user.mediacube.gui/pages/index.zul +++ b/server/user.mediacube.gui/pages/index.zul @@ -1,8 +1,5 @@ - - - - +