git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C33158
--- /dev/null
+.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);
+}
+
+
+
+
+
--- /dev/null
+'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 '<button type="button" class="toastjs-btn toastjs-btn--custom">' + customButton.text + '</button>';
+ });
+ customButtons = customButtons.join('');
+ }
+
+ this.toastEl.innerHTML = '\n <p>' + this.options.message + '</p>\n <button type="button" class="toastjs-btn toastjs-btn--close">Close</button>\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
--- /dev/null
+"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'<button type="button" class="toastjs-btn toastjs-btn--custom">'+t.text+"</button>"}),t=t.join("")),this.toastEl.innerHTML="\n <p>"+this.options.message+'</p>\n <button type="button" class="toastjs-btn toastjs-btn--close">Close</button>\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
-<?xml version="1.0" encoding="UTF-8"?>\r
-\r
<?init class="user.jobengine.zk.util.AuthInitiator"?>\r
-<!DOCTYPE xml>\r
-<zk xmlns:w="http://www.zkoss.org/2005/zk/client">\r
+<zk>\r
<style src="/css/archivum.css" />\r
<zscript><![CDATA[\r
// Chrome F5 bug workaround (miscalculates 100% width on second refresh)\r
--- /dev/null
+<zk xmlns:ca="client/attribute">\r
+ <style src="/css/toast.css" />\r
+ <script src="/js/toast.min.js" />\r
+ <script>\r
+ function showToast(m) {\r
+ var toast = new Toast({message: m, type: 'danger' });\r
+ setTimeout(function(){ toast._close(); }, 3000);\r
+ }\r
+ </script>\r
+ <vlayout height="100%" viewModel="@id('jlm') @init('user.jobengine.zk.model.JobEditorModel')">\r
+ <toolbar>\r
+ <toolbarbutton label="Futtatás" iconSclass="z-icon-play" onClick="@command('execute')" disabled="${not sessionScope.userPrincipal.admin}" autodisable="self" />\r
+ </toolbar>\r
+ <borderlayout vflex="true">\r
+ <center border="none" vflex="true">\r
+ <listbox vflex="true" model="@load(jlm.jobs)" selectedItem="@bind(jlm.selectedJob)">\r
+ <listhead>\r
+ <listheader hflex="1" label="Név" align="left" />\r
+ </listhead>\r
+\r
+ <template name="model">\r
+ <!-- Ez nagyon veszelyes, furan kezeli a zkoss, problemakat okozhat !!! -->\r
+ <!-- <listitem onDoubleClick="@command('execute')"> -->\r
+ <listitem>\r
+ <listcell label="@load(empty each.name ? each.template : each.name)" />\r
+ </listitem>\r
+ </template>\r
+ </listbox>\r
+ </center>\r
+ <east size="60%" flex="true" splittable="true" collapsible="true">\r
+ <tabbox id="pagesTab" vflex="true" hflex="true" orient="top">\r
+ <tabs visible="true">\r
+ <tab id="tab0" label="Paraméterek" selected="true" />\r
+ <tab id="tab1" label="Részletek" />\r
+ <tab id="tab2" label="Ábra" />\r
+ </tabs>\r
+ <tabpanels>\r
+ <tabpanel>\r
+ <borderlayout>\r
+ <north size="50%" splittable="true">\r
+ <grid visible="@bind(not empty jlm.selectedJob)" sizedByContent="false" span="true" vflex="true"\r
+ style="border: none; background: #e3e3e3 !important;" oddRowSclass="listbox-odd-style" \r
+ sclass="listbox-normal-style"\r
+ emptyMessage="A részletek megtekintéséhez jelöljön ki egy folyamatot.">\r
+ <columns>\r
+ <column hflex="min"/>\r
+ <column hflex="true"/>\r
+ </columns>\r
+ <rows>\r
+ <row>\r
+ <label value="Name"/>\r
+ <label value="@bind(jlm.selectedJob.name)"/>\r
+ </row>\r
+ <row>\r
+ <label value="Template"/>\r
+ <label value="@bind(jlm.selectedJob.template)"/>\r
+ </row>\r
+ <row>\r
+ <label value="Active"/>\r
+ <label value="@bind(empty jlm.selectedJob.active ? false : jlm.selectedJob.active)"/>\r
+ </row>\r
+ <row>\r
+ <label value="Execute immediate"/>\r
+ <label value="@bind(empty jlm.selectedJob.executeimmediate ? false : jlm.selectedJob.executeimmediate)"/>\r
+ </row>\r
+ <row>\r
+ <label value="Cron expression"/>\r
+ <label value="@bind(jlm.selectedJob.cronexpression)"/>\r
+ </row>\r
+ <row>\r
+ <label value="Next execution"/>\r
+ <label value="@bind(jlm.selectedJob.nextTime)"/>\r
+ </row>\r
+ </rows>\r
+ </grid>\r
+\r
+ </north>\r
+ <center border="none" flex="true">\r
+ <grid model="@load(jlm.selectedJob.parameters)" style="border: none; background: #e3e3e3 !important;"\r
+ oddRowSclass="listbox-odd-style" sclass="listbox-normal-style">\r
+ <columns sizable="true">\r
+ <column label="Name" hflex="1"/>\r
+ <column label="Value" hflex="3"/>\r
+ <column label="Type" hflex="1"/>\r
+ </columns>\r
+ <rows>\r
+ <template name="model">\r
+ <row>\r
+ <label value="@load(each.name)"/>\r
+ <label value="@load(each.value)"/>\r
+ <label value="@load(each.type)"/>\r
+ </row>\r
+ </template>\r
+ </rows>\r
+ </grid>\r
+ </center>\r
+ </borderlayout>\r
+ </tabpanel>\r
+ <tabpanel>\r
+ <label height="100%" ca:data-syntax-highlight="true" multiline="true" pre="true" \r
+ value="@bind(jlm.selectedJob['xml'])" />\r
+ </tabpanel>\r
+ <tabpanel>\r
+ <include src="pages/processVisualizer.zul" />\r
+ </tabpanel>\r
+ </tabpanels>\r
+ </tabbox>\r
+ </east>\r
+ </borderlayout>\r
+<!-- <div hflex="true" vflex="min" align="center"> -->\r
+<!-- <button id="reloadButton" label="Frissítés" onClick="@command('reload')" /> -->\r
+<!-- <button id="closeButton" label="Mégsem" onClick="@command('close')" /> -->\r
+<!-- <button id="executeButton" label="Futtatás" onClick="@command('execute')" /> -->\r
+<!-- </div> -->\r
+ </vlayout>\r
+</zk>\r
<?xml version="1.0" encoding="UTF-8"?>\r
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c" ?>\r
<?init class="user.jobengine.zk.util.AdminAuthInitiator"?>\r
-<?page id="joblist"?>\r
-<!DOCTYPE xml>\r
-\r
<zk xmlns:w="http://www.zkoss.org/2005/zk/client" xmlns:ca="client/attribute" xmlns:x="xhtml">\r
- <style src="css/joblist.css" />\r
+ <style src="/css/joblist.css" />\r
\r
<!-- csak igy jo a list sebessege -->\r
<custom-attributes org.zkoss.zul.listbox.rod="true" />\r
<toolbarbutton label="Feladat leállítása" iconSclass="z-icon-times-circle" onClick="@command('cancelSelectedJobs')" \r
disabled="@load(jlm.updatePriorityDisabled)" autodisable="self"/>\r
<separator orient="vertical"/>\r
- <toolbarbutton label="Futtatás" iconSclass="z-icon-play" onClick="@command('executeJob')" \r
- disabled="${not sessionScope.userPrincipal.admin}" autodisable="self" />\r
+<!-- <toolbarbutton label="Futtatás" iconSclass="z-icon-play" onClick="@command('executeJob')" -->\r
+<!-- disabled="${not sessionScope.userPrincipal.admin}" autodisable="self" /> -->\r
<toolbarbutton label="Összes megszakítása" iconSclass="z-icon-stop" onClick="@command('cancelAllJobs')" \r
disabled="${not sessionScope.userPrincipal.admin}" autodisable="self" />\r
\r
--- /dev/null
+<?page id="jobs"?>\r
+<zk xmlns:w="http://www.zkoss.org/2005/zk/client" xmlns:ca="client/attribute" xmlns:x="xhtml">\r
+ <style src="css/joblist.css" />\r
+\r
+ <tabbox id="pagesTab" vflex="true" hflex="true" orient="top">\r
+ <tabs visible="true">\r
+ <tab id="tab0" label="Futó folyamatok" selected="true" />\r
+ <tab id="tab1" label="Folyamat szerkesztő" />\r
+ </tabs>\r
+ <tabpanels>\r
+ <tabpanel>\r
+ <include src="/pages/joblist.zul" />\r
+ </tabpanel>\r
+ <tabpanel>\r
+ <include src="/pages/jobeditor.zul" />\r
+ </tabpanel>\r
+ </tabpanels>\r
+ </tabbox>\r
+\r
+</zk>
\ No newline at end of file
<!DOCTYPE xml>\r
\r
<zk xmlns:ca="client/attribute">\r
- <window id="resultWin" title="Folyamat futtatása" sizable="true" width="70%" height="70%" border="normal"\r
- viewModel="@id('jlm') @init('user.jobengine.zk.model.JobSelectorModel')" forward="onCancel=closeButton.onClick">\r
- <vlayout height="100%">\r
- <borderlayout vflex="true">\r
- <center border="none" vflex="true">\r
- <listbox vflex="true" model="@load(jlm.jobs)" selectedItem="@bind(jlm.selectedJob)">\r
- <listhead>\r
- <listheader hflex="1" label="Név" align="left" />\r
- </listhead>\r
-\r
- <template name="model">\r
-<!-- Ez nagyon veszelyes, furan kezeli a zkoss, problemakat okozhat !!! -->\r
-<!-- <listitem onDoubleClick="@command('execute')"> -->\r
- <listitem>\r
- <listcell label="@load(empty each.name ? each.template : each.name)" />\r
- </listitem>\r
- </template>\r
- </listbox>\r
- </center>\r
- <east size="60%" flex="true" splittable="true" collapsible="true">\r
- <tabbox id="pagesTab" vflex="true" hflex="true" orient="top">\r
- <tabs visible="true">\r
- <tab id="tab0" label="Paraméterek" selected="true" />\r
- <tab id="tab1" label="Részletek" />\r
- <tab id="tab2" label="Ábra" />\r
- </tabs>\r
- <tabpanels>\r
- <tabpanel>\r
- <borderlayout>\r
- <north size="50%" splittable="true">\r
- <grid visible="@bind(not empty jlm.selectedJob)" sizedByContent="false" span="true" vflex="true"\r
- style="border: none; background: #e3e3e3 !important;" oddRowSclass="listbox-odd-style" \r
- sclass="listbox-normal-style"\r
- emptyMessage="A részletek megtekintéséhez jelöljön ki egy folyamatot.">\r
- <columns>\r
- <column hflex="min"/>\r
- <column hflex="true"/>\r
- </columns>\r
- <rows>\r
- <row>\r
- <label value="Name"/>\r
- <label value="@bind(jlm.selectedJob.name)"/>\r
- </row>\r
- <row>\r
- <label value="Template"/>\r
- <label value="@bind(jlm.selectedJob.template)"/>\r
- </row>\r
- <row>\r
- <label value="Active"/>\r
- <label value="@bind(empty jlm.selectedJob.active ? false : jlm.selectedJob.active)"/>\r
- </row>\r
- <row>\r
- <label value="Execute immediate"/>\r
- <label value="@bind(empty jlm.selectedJob.executeimmediate ? false : jlm.selectedJob.executeimmediate)"/>\r
- </row>\r
- <row>\r
- <label value="Cron expression"/>\r
- <label value="@bind(jlm.selectedJob.cronexpression)"/>\r
- </row>\r
- <row>\r
- <label value="Next execution"/>\r
- <label value="@bind(jlm.selectedJob.nextTime)"/>\r
- </row>\r
- </rows>\r
- </grid>\r
-\r
- </north>\r
- <center border="none" flex="true">\r
- <grid model="@load(jlm.selectedJob.parameters)" style="border: none; background: #e3e3e3 !important;"\r
- oddRowSclass="listbox-odd-style" sclass="listbox-normal-style">\r
- <columns sizable="true">\r
- <column label="Name" hflex="1"/>\r
- <column label="Value" hflex="3"/>\r
- <column label="Type" hflex="1"/>\r
- </columns>\r
- <rows>\r
- <template name="model">\r
- <row>\r
- <label value="@load(each.name)"/>\r
- <label value="@load(each.value)"/>\r
- <label value="@load(each.type)"/>\r
- </row>\r
- </template>\r
- </rows>\r
- </grid>\r
- </center>\r
- </borderlayout>\r
- </tabpanel>\r
- <tabpanel>\r
- <label height="100%" ca:data-syntax-highlight="true" multiline="true" pre="true" \r
- value="@bind(jlm.selectedJob['xml'])" />\r
- </tabpanel>\r
- <tabpanel>\r
- <include src="pages/processVisualizer.zul" />\r
- </tabpanel>\r
- </tabpanels>\r
- </tabbox>\r
- </east>\r
- </borderlayout>\r
- <div hflex="true" vflex="min" align="center">\r
- <!-- <button id="reloadButton" label="Frissítés" onClick="@command('reload')" /> -->\r
- <button id="closeButton" label="Mégsem" onClick="@command('close')" />\r
- <button id="executeButton" label="Futtatás" onClick="@command('execute')" />\r
- </div>\r
- </vlayout>\r
+ <window id="resultWin" title="Folyamat futtatása" sizable="true" width="70%" height="70%" border="normal" forward="onCancel=closeButton.onClick">\r
+ <include src="/pages/jobeditor.zul" />\r
</window>\r
</zk>\r
public class IndexModel extends BaseModel {\r
private static final Logger logger = LogManager.getLogger();\r
private String page;\r
- private Map<String, Object> pathMap = ListUtils.asMap("/", "searchitems", "jobs", "joblist", "missingmaterials",\r
+ private Map<String, Object> pathMap = ListUtils.asMap("/", "searchitems", "jobs", "jobs", "missingmaterials",\r
"missingmaterials", "newshistory", "newshistory", "edithistory", "edithistory", "statistics", "statistics",\r
"maestro", "maestro", "pwdgen", "pwdgen");\r
\r
import org.zkoss.zk.ui.Executions;\r
import org.zkoss.zk.ui.select.Selectors;\r
import org.zkoss.zk.ui.select.annotation.Wire;\r
+import org.zkoss.zk.ui.util.Clients;\r
import org.zkoss.zul.ListModelList;\r
import org.zkoss.zul.Messagebox;\r
import org.zkoss.zul.Window;\r
\r
import com.ibm.nosql.json.api.BasicDBObject;\r
\r
+import user.jobengine.gui.ComponentBinder;\r
import user.jobengine.server.IJobEngine;\r
+import user.jobengine.server.IJobRuntime;\r
import user.jobengine.server.scheduler.ScheduledJob;\r
import user.jobengine.server.scheduler.SchedulerService;\r
\r
-public class JobSelectorModel extends BaseModel {\r
+public class JobEditorModel extends BaseModel {\r
private static final String XML = "xml";\r
private static final String NEXT_TIME = "nextTime";\r
private static final String TEMPLATE = "template";\r
\r
@Command\r
public void close() {\r
- resultWin.detach();\r
+ if (resultWin != null)\r
+ resultWin.detach();\r
}\r
\r
@Command\r
\r
ScheduledJob scheduledJob = jobEngine.getScheduledJob(template);\r
\r
- // ScheduledJob scheduledJob =\r
- // jobEngine.getJobEngineConfiguration().createScheduledJob(selectedJob,\r
- // jobEngine);\r
try {\r
- scheduledJob.doManualJob();\r
+ IJobRuntime runtime = scheduledJob.doManualJob();\r
+ toast(runtime);\r
} catch (Exception e) {\r
Messagebox.show(e.getMessage());\r
}\r
close();\r
}\r
\r
+ private void toast(IJobRuntime runtime) {\r
+ Clients.evalJavaScript(\r
+ String.format("showToast('<b>%s</b> elindítva.</br>ID %d')", runtime.getName(), runtime.getId()));\r
+ }\r
+\r
public ListModelList<BasicDBObject> getJobs() {\r
return jobs;\r
}\r
\r
@Init\r
public void init() {\r
- this.jobEngine = (IJobEngine) Executions.getCurrent().getArg().get("jobEngine");\r
+ jobEngine = (IJobEngine) Executions.getCurrent().getArg().get("jobEngine");\r
+ if (jobEngine == null)\r
+ jobEngine = ComponentBinder.getJobEngine();\r
\r
initJobList();\r
}\r
jobList.clear();\r
Map<Long, IJobRuntime> jobMap = jobEngine.getJobs();\r
for (int i = 0; i < jobMap.size(); i++) {\r
- if (currentUser.equals(jobMap.get(i).getOwner())) {\r
- jobList.add(i, jobMap.get(i));\r
+ IJobRuntime runtime = jobMap.get(i);\r
+\r
+ if (runtime == null)\r
+ continue;\r
+\r
+ if (currentUser.equals(runtime.getOwner())) {\r
+ jobList.add(i, runtime);\r
}\r
}\r
}\r