diff --git a/assets/diagram-js-code-editor.css b/assets/diagram-js-code-editor.css index 7978844..122eb59 100644 --- a/assets/diagram-js-code-editor.css +++ b/assets/diagram-js-code-editor.css @@ -25,92 +25,178 @@ .toolbar { display: none; width: 50%; - height: 35px; list-style-type: none; padding: 0; } .djs-editor.open .toolbar { - display: block; - text-align: left; - line-height: 35px; -} - -.toolbar { - width: 100%; - float: left; - margin: 0; - padding: 0; - background-color: #f2f2f2; - border-bottom: 1px solid #ccc; - border-top: 1px solid #ccc; -} -.toolbar > div { - float: left; - display: block; - border-right: 1px solid #ccc; - padding: 0px 15px; -} + display: block; + text-align: left; + line-height: 35px; + } -.toolbar div { - text-decoration: none; - font-weight: bold; - color: #069; -} + .toolbar { + width: 100%; + float: left; + margin: 0; + padding: 0; + background-color: #f2f2f2; + border-bottom: 1px solid #ccc; + border-top: 1px solid #ccc; + position: relative; + z-index: 1; + text-decoration: none; + font-weight: bold; + color: #069; + } -.toolbar div:hover { - color: #c00; - background-color: #fff; -} + /* Pure CSS DropDown Multilabil DropDown Menu */ -.toolbar div.active { - background-color: rgb(201, 205, 248); -} + nav { + display: block; + width: 100%; + } -.dropdown .trigger { - border: none; - padding: 0px; -} + nav ul { + padding: 0; + margin: 0; + list-style: none; + } -.dropdown { - position: relative; -} + nav ul li { + position: relative; + } -.dropdown .dropdown-content { - display: none; - position: absolute; - background-color: #f2f2f2 !important; - z-index: 1; -} + nav ul a { + text-decoration: none; + color: #000; + } -.dropdown:hover .dropdown-content { - display: block; -} + nav>ul>li { + float: left; + margin-right: 1px; + } -.dropdown-content .sub-trigger { - text-decoration: none; - padding: 0 0 0 15px; - border-bottom: 1px solid #ccc; - display: block; -} + nav>ul>li>a { + display: inline-block; + padding: 4px 10px 0; + height: 25px; + } -.description { - display: none; - color: #000 !important; - min-width: 250px; - background-color: #f2f2f2 !important; -} + nav>ul>li.submenu>a { + padding-right: 5px; + } -.dropdown-content .sub-trigger{ -position: relative; -} -.dropdown-content .sub-trigger:hover .description { - top: 0; - left: 100%; + nav>ul>li.submenu>.description { + padding-right: 5px; + } - position: absolute; - display: block; -} + nav>ul>li:hover { + background: #000; + } + + nav li.submenu { + padding-right: 22px; + } + + nav li.submenu:before { + content: "☞"; + display: block; + position: absolute; + /* top:4px; */ + right: 0; + color: #000; + width: 16px; + } + + nav ul ul { + position: absolute; + left: 0; + /* top:29px; */ + width: 180px; + filter: alpha(opacity="0"); + opacity: 0; + background: #666; + font-size: 12px; + border: 1px solid #000; + border-bottom: 0; + border-top: 0; + } + + .description { + display: none + } + + /* nav > ul > ul { + height: 200px; + } + + nav > ul > ul { + overflow: hidden; + overflow-y: scroll; + } */ + + nav ul ul li { + display: none; + } + + nav ul li.submenu:hover>ul>li { + display: block; + } + + nav ul li.submenu:hover { + color: #fff; + } + + nav ul li.submenu:hover>ul { + filter: alpha(opacity="100"); + opacity: 1; + } + + nav ul li.submenu:hover>ul ul { + filter: alpha(opacity="0"); + opacity: 0; + } + + nav ul li.submenu:hover>ul li.submenu:hover>ul { + filter: alpha(opacity="100"); + opacity: 1; + } + + nav ul li.submenu:hover>ul li.submenu:hover>ul>li { + display: block; + } + + nav ul ul li { + border-bottom: 1px solid #000; + background: #565656; + } + + nav ul ul li:first-child { + border-top: 1px solid #000; + } + + nav ul ul li a { + padding: 4px 10px; + display: block; + } + + nav ul ul li:hover { + background: #000; + } + + nav ul ul li:hover>a { + padding-left: 15px; + color: #fff; + } + + nav ul ul ul { + left: 180px; + top: 0; + margin-top: -1px; + } + + /* */ #run_btn { font-family: "Material Icons", sans-serif; @@ -120,7 +206,21 @@ position: relative; content: "build"; } + #run_btn.passing { + color: green; + } + + #run_btn.failing { + color: red; + } + + #run_btn.unknown { + color: rgba(207, 168, 10, 0.842); + } + .djs-editor .ide { + position: relative; + z-index: 0; display: none; width: 100%; min-width: 420px; @@ -160,5 +260,4 @@ position: relative; right: 0; padding: 6px; z-index: 1; - } - \ No newline at end of file + } \ No newline at end of file diff --git a/lib/Editor.js b/lib/Editor.js index 7d700d6..4069e62 100644 --- a/lib/Editor.js +++ b/lib/Editor.js @@ -34,10 +34,9 @@ export default function Editor( this._state = { isOpen: undefined, - isEnabled: undefined, }; - this._init(); + this.init(); this.toggle((config && config.open) || false); @@ -48,74 +47,61 @@ export default function Editor( self.toggle(); }); - domEvent.bind(this._run_btn, 'click', function (event) { + domEvent.bind(this.run_btn, 'click', function (event) { event.preventDefault(); event.stopPropagation(); self.validate(); }); - domEvent.bind(this._parent, 'wheel', function(event) { + domEvent.bind(this._parent, 'wheel', function (event) { // stop propagation and handle scroll differently event.preventDefault(); event.stopPropagation(); }); - + // Check that the currently selected bpmn task is a script task and enable or disable coding window appropriately eventBus.on('selection.changed', function (context) { if (self.isOpen()) { self.close(); } - if (context.newSelection && self._parent) { // ? Try and replace self._parent with self.isOpen() cause idk why it works yet + domClasses(self._parent).remove('enabled'); + if (context.newSelection.length > 0) { if (context.newSelection[0].type == "bpmn:ScriptTask") { domClasses(self._parent).add('enabled'); - self._state.isEnabled = true; return; } } - domClasses(self._parent).remove('enabled'); - self._state.isEnabled = false; - }); - - eventBus.on('editor.validate.response', function (response) { - if(response.type == "error"){ - } else { - if (response.passing){ - // Update Status - } - } - self._eventBus.fire("editor.toolbar.update"); }); + eventBus.on('editor.validate.response', function (response) { + if (response.passing) { + domClasses(self.run_btn).add('passing'); + domClasses(self.run_btn).remove('failing'); + domClasses(self.run_btn).remove('unknown'); + } else { + domClasses(self.run_btn).add('failing'); + domClasses(self.run_btn).remove('passing'); + domClasses(self.run_btn).remove('unknown'); + } + }); + + // Return a list of objects containing both the script name and description in plain text eventBus.on('editor.scripts.response', function (response) { - if(response.type == "error"){ - self.scripts = [{name:"No Scripts Available", description:"Contact your system administrator if this is abnormal"}]; + if (response.type == "error") { + self.scripts = [{ name: "No Scripts Available", description: "Contact your system administrator if this is abnormal" }]; } else { self.scripts = response.scripts; } - self._eventBus.fire("editor.toolbar.update"); - }); - eventBus.on('editor.objects.response', function (response) { - if(response.type == "error"){ - self.objects = [{name:"No Data Objects Available", description:"Contact your system administrator if this is abnormal"}]; - } else { - self.objects = response.objects; - } - self._eventBus.fire("editor.toolbar.update"); - }); - - eventBus.on('editor.toolbar.update', function () { - self._scripts_menu.innerHTML = ""; + self.scripts_menu.innerHTML = ""; self.scripts.forEach(element => - self._scripts_menu.innerHTML += `