ENTAXY-480 release version 1.8.3

This commit is contained in:
2023-08-03 04:45:45 +03:00
parent 5844a2e5cf
commit 3cc15f7459
236 changed files with 21106 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 759 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 990 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 754 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 929 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 877 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 712 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 823 B

View File

@ -0,0 +1,452 @@
/*-
* ~~~~~~licensing~~~~~~
* entaxy-management-plugin
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ~~~~~~/licensing~~~~~~
*/
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";
var HINT_ELEMENT_CLASS = "CodeMirror-hint";
var ACTIVE_HINT_ELEMENT_CLASS = "CodeMirror-hint-active";
// This is the old interface, kept around for now to stay
// backwards-compatible.
CodeMirror.showHint = function(cm, getHints, options) {
if (!getHints) return cm.showHint(options);
if (options && options.async) getHints.async = true;
var newOpts = {hint: getHints};
if (options) for (var prop in options) newOpts[prop] = options[prop];
return cm.showHint(newOpts);
};
CodeMirror.defineExtension("showHint", function(options) {
options = parseOptions(this, this.getCursor("start"), options);
var selections = this.listSelections()
if (selections.length > 1) return;
// By default, don't allow completion when something is selected.
// A hint function can have a `supportsSelection` property to
// indicate that it can handle selections.
if (this.somethingSelected()) {
if (!options.hint.supportsSelection) return;
// Don't try with cross-line selections
for (var i = 0; i < selections.length; i++)
if (selections[i].head.line != selections[i].anchor.line) return;
}
if (this.state.completionActive) this.state.completionActive.close();
var completion = this.state.completionActive = new Completion(this, options);
if (!completion.options.hint) return;
CodeMirror.signal(this, "startCompletion", this);
completion.update(true);
});
function Completion(cm, options) {
this.cm = cm;
this.options = options;
this.widget = null;
this.debounce = 0;
this.tick = 0;
this.startPos = this.cm.getCursor("start");
this.startLen = this.cm.getLine(this.startPos.line).length - this.cm.getSelection().length;
var self = this;
cm.on("cursorActivity", this.activityFunc = function() { self.cursorActivity(); });
}
var requestAnimationFrame = window.requestAnimationFrame || function(fn) {
return setTimeout(fn, 1000/60);
};
var cancelAnimationFrame = window.cancelAnimationFrame || clearTimeout;
Completion.prototype = {
close: function() {
if (!this.active()) return;
this.cm.state.completionActive = null;
this.tick = null;
this.cm.off("cursorActivity", this.activityFunc);
if (this.widget && this.data) CodeMirror.signal(this.data, "close");
if (this.widget) this.widget.close();
CodeMirror.signal(this.cm, "endCompletion", this.cm);
},
active: function() {
return this.cm.state.completionActive == this;
},
pick: function(data, i) {
var completion = data.list[i];
if (completion.hint) completion.hint(this.cm, data, completion);
else this.cm.replaceRange(getText(completion), completion.from || data.from,
completion.to || data.to, "complete");
CodeMirror.signal(data, "pick", completion);
this.close();
},
cursorActivity: function() {
if (this.debounce) {
cancelAnimationFrame(this.debounce);
this.debounce = 0;
}
var pos = this.cm.getCursor(), line = this.cm.getLine(pos.line);
if (pos.line != this.startPos.line || line.length - pos.ch != this.startLen - this.startPos.ch ||
pos.ch < this.startPos.ch || this.cm.somethingSelected() ||
(pos.ch && this.options.closeCharacters.test(line.charAt(pos.ch - 1)))) {
this.close();
} else {
var self = this;
this.debounce = requestAnimationFrame(function() {self.update();});
if (this.widget) this.widget.disable();
}
},
update: function(first) {
if (this.tick == null) return
var self = this, myTick = ++this.tick
fetchHints(this.options.hint, this.cm, this.options, function(data) {
if (self.tick == myTick) self.finishUpdate(data, first)
})
},
finishUpdate: function(data, first) {
if (this.data) CodeMirror.signal(this.data, "update");
var picked = (this.widget && this.widget.picked) || (first && this.options.completeSingle);
if (this.widget) this.widget.close();
this.data = data;
if (data && data.list.length) {
if (picked && data.list.length == 1) {
this.pick(data, 0);
} else {
this.widget = new Widget(this, data);
CodeMirror.signal(data, "shown");
}
}
}
};
function parseOptions(cm, pos, options) {
var editor = cm.options.hintOptions;
var out = {};
for (var prop in defaultOptions) out[prop] = defaultOptions[prop];
if (editor) for (var prop in editor)
if (editor[prop] !== undefined) out[prop] = editor[prop];
if (options) for (var prop in options)
if (options[prop] !== undefined) out[prop] = options[prop];
if (out.hint.resolve) out.hint = out.hint.resolve(cm, pos)
return out;
}
function getText(completion) {
if (typeof completion == "string") return completion;
else return completion.text;
}
function buildKeyMap(completion, handle) {
var baseMap = {
Up: function() {handle.moveFocus(-1);},
Down: function() {handle.moveFocus(1);},
PageUp: function() {handle.moveFocus(-handle.menuSize() + 1, true);},
PageDown: function() {handle.moveFocus(handle.menuSize() - 1, true);},
Home: function() {handle.setFocus(0);},
End: function() {handle.setFocus(handle.length - 1);},
Enter: handle.pick,
Tab: handle.pick,
Esc: handle.close
};
var custom = completion.options.customKeys;
var ourMap = custom ? {} : baseMap;
function addBinding(key, val) {
var bound;
if (typeof val != "string")
bound = function(cm) { return val(cm, handle); };
// This mechanism is deprecated
else if (baseMap.hasOwnProperty(val))
bound = baseMap[val];
else
bound = val;
ourMap[key] = bound;
}
if (custom)
for (var key in custom) if (custom.hasOwnProperty(key))
addBinding(key, custom[key]);
var extra = completion.options.extraKeys;
if (extra)
for (var key in extra) if (extra.hasOwnProperty(key))
addBinding(key, extra[key]);
return ourMap;
}
function getHintElement(hintsElement, el) {
while (el && el != hintsElement) {
if (el.nodeName.toUpperCase() === "LI" && el.parentNode == hintsElement) return el;
el = el.parentNode;
}
}
function Widget(completion, data) {
this.completion = completion;
this.data = data;
this.picked = false;
var widget = this, cm = completion.cm;
var hints = this.hints = document.createElement("ul");
hints.className = "CodeMirror-hints";
this.selectedHint = data.selectedHint || 0;
var completions = data.list;
for (var i = 0; i < completions.length; ++i) {
var elt = hints.appendChild(document.createElement("li")), cur = completions[i];
var className = HINT_ELEMENT_CLASS + (i != this.selectedHint ? "" : " " + ACTIVE_HINT_ELEMENT_CLASS);
if (cur.className != null) className = cur.className + " " + className;
elt.className = className;
if (cur.render) cur.render(elt, data, cur);
else elt.appendChild(document.createTextNode(cur.displayText || getText(cur)));
elt.hintId = i;
}
var pos = cm.cursorCoords(completion.options.alignWithWord ? data.from : null);
var left = pos.left, top = pos.bottom, below = true;
hints.style.left = left + "px";
hints.style.top = top + "px";
// If we're at the edge of the screen, then we want the menu to appear on the left of the cursor.
var winW = window.innerWidth || Math.max(document.body.offsetWidth, document.documentElement.offsetWidth);
var winH = window.innerHeight || Math.max(document.body.offsetHeight, document.documentElement.offsetHeight);
(completion.options.container || document.body).appendChild(hints);
var box = hints.getBoundingClientRect(), overlapY = box.bottom - winH;
var scrolls = hints.scrollHeight > hints.clientHeight + 1
var startScroll = cm.getScrollInfo();
if (overlapY > 0) {
var height = box.bottom - box.top, curTop = pos.top - (pos.bottom - box.top);
if (curTop - height > 0) { // Fits above cursor
hints.style.top = (top = pos.top - height) + "px";
below = false;
} else if (height > winH) {
hints.style.height = (winH - 5) + "px";
hints.style.top = (top = pos.bottom - box.top) + "px";
var cursor = cm.getCursor();
if (data.from.ch != cursor.ch) {
pos = cm.cursorCoords(cursor);
hints.style.left = (left = pos.left) + "px";
box = hints.getBoundingClientRect();
}
}
}
var overlapX = box.right - winW;
if (overlapX > 0) {
if (box.right - box.left > winW) {
hints.style.width = (winW - 5) + "px";
overlapX -= (box.right - box.left) - winW;
}
hints.style.left = (left = pos.left - overlapX) + "px";
}
if (scrolls) for (var node = hints.firstChild; node; node = node.nextSibling)
node.style.paddingRight = cm.display.nativeBarWidth + "px"
cm.addKeyMap(this.keyMap = buildKeyMap(completion, {
moveFocus: function(n, avoidWrap) { widget.changeActive(widget.selectedHint + n, avoidWrap); },
setFocus: function(n) { widget.changeActive(n); },
menuSize: function() { return widget.screenAmount(); },
length: completions.length,
close: function() { completion.close(); },
pick: function() { widget.pick(); },
data: data
}));
if (completion.options.closeOnUnfocus) {
var closingOnBlur;
cm.on("blur", this.onBlur = function() { closingOnBlur = setTimeout(function() { completion.close(); }, 100); });
cm.on("focus", this.onFocus = function() { clearTimeout(closingOnBlur); });
}
cm.on("scroll", this.onScroll = function() {
var curScroll = cm.getScrollInfo(), editor = cm.getWrapperElement().getBoundingClientRect();
var newTop = top + startScroll.top - curScroll.top;
var point = newTop - (window.pageYOffset || (document.documentElement || document.body).scrollTop);
if (!below) point += hints.offsetHeight;
if (point <= editor.top || point >= editor.bottom) return completion.close();
hints.style.top = newTop + "px";
hints.style.left = (left + startScroll.left - curScroll.left) + "px";
});
CodeMirror.on(hints, "dblclick", function(e) {
var t = getHintElement(hints, e.target || e.srcElement);
if (t && t.hintId != null) {widget.changeActive(t.hintId); widget.pick();}
});
CodeMirror.on(hints, "click", function(e) {
var t = getHintElement(hints, e.target || e.srcElement);
if (t && t.hintId != null) {
widget.changeActive(t.hintId);
if (completion.options.completeOnSingleClick) widget.pick();
}
});
CodeMirror.on(hints, "mousedown", function() {
setTimeout(function(){cm.focus();}, 20);
});
CodeMirror.signal(data, "select", completions[this.selectedHint], hints.childNodes[this.selectedHint]);
return true;
}
Widget.prototype = {
close: function() {
if (this.completion.widget != this) return;
this.completion.widget = null;
this.hints.parentNode.removeChild(this.hints);
this.completion.cm.removeKeyMap(this.keyMap);
var cm = this.completion.cm;
if (this.completion.options.closeOnUnfocus) {
cm.off("blur", this.onBlur);
cm.off("focus", this.onFocus);
}
cm.off("scroll", this.onScroll);
},
disable: function() {
this.completion.cm.removeKeyMap(this.keyMap);
var widget = this;
this.keyMap = {Enter: function() { widget.picked = true; }};
this.completion.cm.addKeyMap(this.keyMap);
},
pick: function() {
this.completion.pick(this.data, this.selectedHint);
},
changeActive: function(i, avoidWrap) {
if (i >= this.data.list.length)
i = avoidWrap ? this.data.list.length - 1 : 0;
else if (i < 0)
i = avoidWrap ? 0 : this.data.list.length - 1;
if (this.selectedHint == i) return;
var node = this.hints.childNodes[this.selectedHint];
node.className = node.className.replace(" " + ACTIVE_HINT_ELEMENT_CLASS, "");
node = this.hints.childNodes[this.selectedHint = i];
node.className += " " + ACTIVE_HINT_ELEMENT_CLASS;
if (node.offsetTop < this.hints.scrollTop)
this.hints.scrollTop = node.offsetTop - 3;
else if (node.offsetTop + node.offsetHeight > this.hints.scrollTop + this.hints.clientHeight)
this.hints.scrollTop = node.offsetTop + node.offsetHeight - this.hints.clientHeight + 3;
CodeMirror.signal(this.data, "select", this.data.list[this.selectedHint], node);
},
screenAmount: function() {
return Math.floor(this.hints.clientHeight / this.hints.firstChild.offsetHeight) || 1;
}
};
function applicableHelpers(cm, helpers) {
if (!cm.somethingSelected()) return helpers
var result = []
for (var i = 0; i < helpers.length; i++)
if (helpers[i].supportsSelection) result.push(helpers[i])
return result
}
function fetchHints(hint, cm, options, callback) {
if (hint.async) {
hint(cm, callback, options)
} else {
var result = hint(cm, options)
if (result && result.then) result.then(callback)
else callback(result)
}
}
function resolveAutoHints(cm, pos) {
var helpers = cm.getHelpers(pos, "hint"), words
if (helpers.length) {
var resolved = function(cm, callback, options) {
var app = applicableHelpers(cm, helpers);
function run(i) {
if (i == app.length) return callback(null)
fetchHints(app[i], cm, options, function(result) {
if (result && result.list.length > 0) callback(result)
else run(i + 1)
})
}
run(0)
}
resolved.async = true
resolved.supportsSelection = true
return resolved
} else if (words = cm.getHelper(cm.getCursor(), "hintWords")) {
return function(cm) { return CodeMirror.hint.fromList(cm, {words: words}) }
} else if (CodeMirror.hint.anyword) {
return function(cm, options) { return CodeMirror.hint.anyword(cm, options) }
} else {
return function() {}
}
}
CodeMirror.registerHelper("hint", "auto", {
resolve: resolveAutoHints
});
CodeMirror.registerHelper("hint", "fromList", function(cm, options) {
var cur = cm.getCursor(), token = cm.getTokenAt(cur);
var to = CodeMirror.Pos(cur.line, token.end);
if (token.string && /\w/.test(token.string[token.string.length - 1])) {
var term = token.string, from = CodeMirror.Pos(cur.line, token.start);
} else {
var term = "", from = to;
}
var found = [];
for (var i = 0; i < options.words.length; i++) {
var word = options.words[i];
if (word.slice(0, term.length) == term)
found.push(word);
}
if (found.length) return {list: found, from: from, to: to};
});
CodeMirror.commands.autocomplete = CodeMirror.showHint;
var defaultOptions = {
hint: CodeMirror.hint.auto,
completeSingle: true,
alignWithWord: true,
closeCharacters: /[\s()\[\]{};:>,]/,
closeOnUnfocus: true,
completeOnSingleClick: true,
container: null,
customKeys: null,
extraKeys: null
};
CodeMirror.defineOption("hintOptions", null);
});

View File

@ -0,0 +1,130 @@
/*-
* ~~~~~~licensing~~~~~~
* entaxy-management-plugin
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ~~~~~~/licensing~~~~~~
*/
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";
var Pos = CodeMirror.Pos;
function getHints(cm, options) {
var tags = options && options.schemaInfo;
var quote = (options && options.quoteChar) || '"';
if (!tags) return;
var cur = cm.getCursor(), token = cm.getTokenAt(cur);
if (token.end > cur.ch) {
token.end = cur.ch;
token.string = token.string.slice(0, cur.ch - token.start);
}
var inner = CodeMirror.innerMode(cm.getMode(), token.state);
if (inner.mode.name != "xml") return;
var result = [], replaceToken = false, prefix;
var tag = /\btag\b/.test(token.type) && !/>$/.test(token.string);
var tagName = tag && /^\w/.test(token.string), tagStart;
if (tagName) {
var before = cm.getLine(cur.line).slice(Math.max(0, token.start - 2), token.start);
var tagType = /<\/$/.test(before) ? "close" : /<$/.test(before) ? "open" : null;
if (tagType) tagStart = token.start - (tagType == "close" ? 2 : 1);
} else if (tag && token.string == "<") {
tagType = "open";
} else if (tag && token.string == "</") {
tagType = "close";
}
if (!tag && !inner.state.tagName || tagType) {
if (tagName)
prefix = token.string;
replaceToken = tagType;
var cx = inner.state.context, curTag = cx && tags[cx.tagName];
var childList = cx ? curTag && curTag.children : tags["!top"];
if (childList && tagType != "close") {
for (var i = 0; i < childList.length; ++i) if (!prefix || childList[i].lastIndexOf(prefix, 0) == 0)
result.push("<" + childList[i]);
} else if (tagType != "close") {
for (var name in tags)
if (tags.hasOwnProperty(name) && name != "!top" && name != "!attrs" && (!prefix || name.lastIndexOf(prefix, 0) == 0))
result.push("<" + name);
}
if (cx && (!prefix || tagType == "close" && cx.tagName.lastIndexOf(prefix, 0) == 0))
result.push("</" + cx.tagName + ">");
} else {
// Attribute completion
var curTag = tags[inner.state.tagName], attrs = curTag && curTag.attrs;
var globalAttrs = tags["!attrs"];
if (!attrs && !globalAttrs) return;
if (!attrs) {
attrs = globalAttrs;
} else if (globalAttrs) { // Combine tag-local and global attributes
var set = {};
for (var nm in globalAttrs) if (globalAttrs.hasOwnProperty(nm)) set[nm] = globalAttrs[nm];
for (var nm in attrs) if (attrs.hasOwnProperty(nm)) set[nm] = attrs[nm];
attrs = set;
}
if (token.type == "string" || token.string == "=") { // A value
var before = cm.getRange(Pos(cur.line, Math.max(0, cur.ch - 60)),
Pos(cur.line, token.type == "string" ? token.start : token.end));
var atName = before.match(/([^\s\u00a0=<>\"\']+)=$/), atValues;
if (!atName || !attrs.hasOwnProperty(atName[1]) || !(atValues = attrs[atName[1]])) return;
if (typeof atValues == 'function') atValues = atValues.call(this, cm); // Functions can be used to supply values for autocomplete widget
if (token.type == "string") {
prefix = token.string;
var n = 0;
if (/['"]/.test(token.string.charAt(0))) {
quote = token.string.charAt(0);
prefix = token.string.slice(1);
n++;
}
var len = token.string.length;
if (/['"]/.test(token.string.charAt(len - 1))) {
quote = token.string.charAt(len - 1);
prefix = token.string.substr(n, len - 2);
}
replaceToken = true;
}
for (var i = 0; i < atValues.length; ++i) if (!prefix || atValues[i].lastIndexOf(prefix, 0) == 0)
result.push(quote + atValues[i] + quote);
} else { // An attribute name
if (token.type == "attribute") {
prefix = token.string;
replaceToken = true;
}
for (var attr in attrs) if (attrs.hasOwnProperty(attr) && (!prefix || attr.lastIndexOf(prefix, 0) == 0))
result.push(attr);
}
}
return {
list: result,
from: replaceToken ? Pos(cur.line, tagStart == null ? token.start : tagStart) : cur,
to: replaceToken ? Pos(cur.line, token.end) : cur
};
}
CodeMirror.registerHelper("hint", "xml", getHints);
});

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,48 @@
/*-
* ~~~~~~licensing~~~~~~
* entaxy-management-plugin
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ~~~~~~/licensing~~~~~~
*/
var Entaxy;
(function (Entaxy) {
Entaxy._module
.directive('modalDialog', function(){
return {
restrict: 'AC',
link: function($scope, element) {
var draggableStr = "draggableModal";
var header = $(".modal-header", element);
header.on('mousedown', (mouseDownEvent) => {
var modalDialog = element;
var offset = header.offset();
modalDialog.addClass(draggableStr).parents().on('mousemove', (mouseMoveEvent) => {
$("." + draggableStr, modalDialog.parents()).offset({
top: mouseMoveEvent.pageY - (mouseDownEvent.pageY - offset.top),
left: mouseMoveEvent.pageX - (mouseDownEvent.pageX - offset.left)
});
}).on('mouseup', () => {
modalDialog.removeClass(draggableStr);
});
});
}
}
})
.name;
})(Entaxy || (Entaxy = {}));

View File

@ -0,0 +1,77 @@
/*-
* ~~~~~~licensing~~~~~~
* entaxy-management-plugin
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ~~~~~~/licensing~~~~~~
*/
var Entaxy;
(function (Entaxy) {
Entaxy._module
.component('entaxyModalListWithDescription', {
bindings: {
items: '<',
selectedItem: '<',
changeSelection: '<'
},
template:
`
<div class="modal-list-with-description-container">
<div class="modal-list-with-description-list-container">
<entaxy-modal-list items="$ctrl.items" selected="$ctrl.selectedItem" change-selection="$ctrl.changeSelection"
enable-dbl-click="true" filter="$ctrl.matchesFilter"></entaxy-modal-list>
</div>
<div class="modal-description-container">
<div class="modal-description-title">
{{$ctrl.title}}
</div>
<div class="modal-description-body">
<div ng-if="$ctrl.selectedItem.description">
{{$ctrl.selectedItem.description}}
</div>
<div ng-if="!$ctrl.selectedItem.description">
There is no selected factory.
</div>
</div>
</div>
</div>
`,
controller: entaxyModalListWithDescriptionController
})
.name;
function entaxyModalListWithDescriptionController() {
var ctrl = this;
ctrl.$onInit = function() {
ctrl.title = 'Factory Description:';
}
ctrl.matchesFilter = function(factory, filter) {
var match = false;
if (factory.displayName.toLowerCase().match(filter.value.toLowerCase()) !== null ||
factory.name.toLowerCase().match(filter.value.toLowerCase()) !== null ||
(factory.label && factory.label.toLowerCase().match(filter.value.toLowerCase()) !== null)) {
match = true;
return match;
}
return match;
};
}
})(Entaxy || (Entaxy = {}));

View File

@ -0,0 +1,148 @@
/*-
* ~~~~~~licensing~~~~~~
* entaxy-management-plugin
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ~~~~~~/licensing~~~~~~
*/
var Entaxy;
(function (Entaxy) {
Entaxy._module
.component('entaxyProperties', {
template:
`
<h2>
{{$ctrl.title}}
</h2>
<div class="properties-container">
<entaxy-modal-group-fields groups="$ctrl.groups" fields="$ctrl.formFields"
errors="$ctrl.errors" mode="$ctrl.mode" ng-if="$ctrl.groups && $ctrl.formFields"></entaxy-modal-group-fields>
</div>
<button type="submit" class="btn btn-primary" ng-click="$ctrl.save($ctrl.formFields)">{{$ctrl.submitBtnTitle}}</button>
`,
controller: entaxyPropertiesController
})
.name;
function entaxyPropertiesController(workspace, operationsService, entaxyService) {
'ngInject';
var ctrl = this;
ctrl.$onInit = function() {
ctrl.itemName = 'Profile';
ctrl.mode = Entaxy.MODAL_MODES.EDIT;
let selectedMbean = workspace.getSelectedMBean();
ctrl.title = 'Properties of ' + selectedMbean.title;
ctrl.submitBtnTitle = Entaxy.getButtonTitleByMode(ctrl.mode);
let profilesMbean = workspace.tree.findDescendant(child => child.objectName ? child.objectName.endsWith('category=profiles') : false);
let mbeanName = profilesMbean.objectName;
operationsService
.executeOperation(mbeanName, { name: 'get' + ctrl.itemName + 'Config' }, [ selectedMbean.title ])
.then(result => {
ctrl.itemInfo = JSON.parse(result);
let properties = Object.entries(ctrl.itemInfo.properties);
ctrl.properties = properties.map(property => { return { name: property[0], value: property[1] }; });
let factory = workspace.tree.findDescendant(child => child.title === ctrl.itemInfo.factoryId);
ctrl.factories = [{ name: factory.title, mbeanName: factory.objectName }];
makeFormFieldsAndGroups();
}).catch(error => {
Core.notification('danger', error, 5000);
Entaxy.log.error(error);
});
}
function makeFormFieldsAndGroups() {
ctrl.formFields = [];
ctrl.formFields.push({
label: 'Factory Id',
name: 'factoryId',
type: 'java.lang.String',
helpText: null,
value: ctrl.factories[0].name,
readOnly: true,
required: true,
group: 'general'
});
let mbeanName = ctrl.factories[0].mbeanName;
operationsService.executeOperation(mbeanName, { name: 'getFields' }, [ 'init' ])
.then((response) => {
let groups = new Set();
groups.add('general');
_.forEach(JSON.parse(response), (field) => {
let formField = entaxyService.makeFormField(field, ctrl.itemInfo['objectId'], ctrl.properties, ctrl.mode);
ctrl.formFields.push(formField);
groups.add(formField.group);
});
ctrl.formFields.forEach(formField => formField.type = Entaxy.convertToHtmlInputType(formField.type));
ctrl.groups = Array.from(groups).map((group) => { return { name: group, displayName: group }; });
});
}
ctrl.save = function(fieldsOrigin) {
let fields = JSON.parse(JSON.stringify(fieldsOrigin));
entaxyService.validateFields(fields, ctrl.factories[0], ctrl.itemName)
.then(errors => {
ctrl.errors = errors;
if (Object.keys(ctrl.errors).length === 0) {
let args = entaxyService.getArguments(fields, ctrl.factories);
update(args);
}
});
}
function update(args) {
let objectId = args.fields.find((field) => field.name === 'objectId').value;
let fields = objectId ? args.fields.filter((field) => field.name !== 'objectId') : args.fields;
let mbeanName = args.factoryId.mbeanName;
let properties = fields.reduce((obj, cur) => ({ ...obj, [cur.name] : cur.value }), {});
let instructions = {"@LIFECYCLE":["general"]};
operationsService.executeOperation(mbeanName, { name: 'createObjectByInstructions' }, [ objectId, 'public', instructions, properties ] )
.then(result => {
let tableHtml = Entaxy.createTableFromResponse(result);
Entaxy.notification('success', tableHtml, 10000);
}).catch(error => {
Core.notification('danger', error, 5000);
Entaxy.log.error(error);
});
}
}
entaxyPropertiesController.$inject = ['workspace', 'operationsService', 'entaxyService'];
})(Entaxy || (Entaxy = {}));

View File

@ -0,0 +1,193 @@
/*-
* ~~~~~~licensing~~~~~~
* entaxy-management-plugin
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ~~~~~~/licensing~~~~~~
*/
var Entaxy;
(function (Entaxy) {
// fixme this component works only for connections now
Entaxy._module
.component('entaxySelect', {
bindings: {
type: '<',
filter: '<',
model: '=',
updateParentFn: '<',
options: '='
},
template:
`
<div class="custom-select">
<button type="button" class="btn-select form-control dropdown-toggle" id="filter" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{$ctrl.selectedOption.name}}
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li ng-repeat="option in $ctrl.options" id="option.name" ng-click="$ctrl.changeSelection(option)">{{ option.name }}</li>
<li id="addItem" class="dropdown-option-new" ng-click="$ctrl.addConnection()"><span class="pficon pficon-add-circle-o"></span>New private connection...</li>
</ul>
</div>
`,
controller: entaxySelectController
})
.name;
function entaxySelectController(workspace, jolokiaService, $q, $uibModal) {
'ngInject';
var ctrl = this;
ctrl.$onInit = function() {
if (ctrl.type === 'entaxy.runtime.connection') {
if (!ctrl.options) {
let promises = [];
let filteredConnections = [];
let connectionsFolder = workspace.tree.findDescendant(child => (child.objectName && child.objectName.endsWith('category=connections')));
if (connectionsFolder) {
if (ctrl.filter) {
connectionsFolder.children.forEach((child) => {
promises.push(
jolokiaService.getAttribute(child.objectName, 'Label')
.then((label) => {
if (label.indexOf(ctrl.filter) > -1) {
filteredConnections.push({ name: child.title, mbeanName: connectionsFolder.objectName });
}
})
);
});
} else {
filteredConnections = connectionsFolder.children ? connectionsFolder.children.map(child => { name: child.title }) : [];
}
}
$q.all(promises).then(() => {
if (filteredConnections && filteredConnections.length > 0) {
ctrl.options = filteredConnections.sort(Entaxy.compareBy('name'));
ctrl.changeSelection(filteredConnections[0]);
} else {
Core.notification('danger', 'There are no suitable connections', 5000);
// todo close the modal
}
});
} else {
ctrl.selectedOption = ctrl.options.find((option) => option.name === ctrl.model || option.value === ctrl.model);
}
}
}
ctrl.changeSelection = function (option) {
let previousOption = ctrl.selectedOption;
ctrl.selectedOption = option;
ctrl.model = option.value ? option.value : option.name;
if (ctrl.type === 'entaxy.runtime.connection') {
if (previousOption) {
Core.notification('warning', 'Changing connection field value may lead to changes in other fields of the current connector. ' +
'Please, make sure to revise all fields before accepting.', 10000);
}
ctrl.updateParentFn(previousOption, option, 'Connection');
}
}
ctrl.addConnection = function () {
ctrl.showModal();
}
ctrl.showModal = function() {
let factories = [];
let promises = [];
let factoryFolder = workspace.tree.findDescendant(child => child.title === ctrl.type);
if (factoryFolder && factoryFolder.children) {
factoryFolder.children.forEach((child) => {
promises.push(jolokiaService.getAttributes(child.objectName, ['Abstract', 'DisplayName', 'Label', 'Description', 'Deprecated'])
.then((result) => {
let label = result['Label'];
if (!result['Abstract']) {
if (!ctrl.filter || (ctrl.filter && label && label.indexOf(ctrl.filter) > -1)) {
factories.push({
name: child.title,
displayName: result['DisplayName'] ? result['DisplayName'] : child.title,
label: result['Label'],
mbeanName: child.objectName,
description: result['Description'] ? result['Description'] : 'There is no description for this factory.',
additionalInfo: result['Deprecated'] ? ['[DEPRECATED]'] : undefined
});
}
}
}));
});
$uibModal.open({
component: 'entaxyModal',
resolve: {
mode: () => Entaxy.MODAL_MODES.ADD,
itemType: () => 'Connection',
factories: $q.all(promises).then(() => factories)
},
size: 'xl',
backdrop: 'static',
windowTopClass: 'modal-top-margin-override'
})
.result.then(args => {
addItem(args);
},
reason => {
if (reason) {
Core.notification('danger', reason, 5000);
}
});
}
}
function addItem(args) {
let factoryId = args.factoryId.name;
let objectId = args.fields.find((field) => field.name === 'objectId').value;
let fields = objectId ? args.fields.filter((field) => field.name !== 'objectId') : args.fields;
let properties = fields.reduce((obj, cur) => ({ ...obj, [cur.name] : cur.value }), {});
let newObjectProperties = {
factoryId: factoryId,
objectId: objectId,
scope: 'private',
properties: properties
};
let newObjectOption = {
name: objectId ? objectId : 'private-connection',
value: newObjectProperties
};
ctrl.options.push(newObjectOption);
ctrl.changeSelection(newObjectOption);
}
}
entaxySelectController.$inject = ['workspace', 'jolokiaService', '$q', '$uibModal'];
})(Entaxy || (Entaxy = {}));

View File

@ -0,0 +1,58 @@
/*-
* ~~~~~~licensing~~~~~~
* entaxy-management-plugin
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ~~~~~~/licensing~~~~~~
*/
var Entaxy;
(function (Entaxy) {
Entaxy._module
.component('entaxySelectFromEnum', {
bindings: {
values: '<',
isEmptyIncluded: '<',
model: '='
},
template:
`
<select class="form-control" ng-options="option.name for option in $ctrl.options" ng-model="$ctrl.selectedOption"
ng-change="$ctrl.changeSelection()">
`,
controller: entaxySelectFromEnumController
})
.name;
function entaxySelectFromEnumController() {
let ctrl = this;
let emptyValue = { name: '--Empty value--' };
ctrl.$onInit = function() {
ctrl.options = ctrl.values.map(value => { return { name: value } });
ctrl.options.unshift(emptyValue);
ctrl.selectedOption = ctrl.model ? ctrl.options.find((option) => option.name === ctrl.model) : ctrl.options[0];
ctrl.changeSelection();
}
ctrl.changeSelection = function () {
ctrl.model = (ctrl.selectedOption === emptyValue) ? undefined : ctrl.selectedOption.name;
}
}
})(Entaxy || (Entaxy = {}));

View File

@ -0,0 +1,107 @@
/*-
* ~~~~~~licensing~~~~~~
* entaxy-management-plugin
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ~~~~~~/licensing~~~~~~
*/
var Entaxy;
(function (Entaxy) {
Entaxy._module
.component('entaxySource', {
template:
`
<div class="route-source-header-container">
<h2>
Source
</h2>
<span class="route-source-error-message" ng-if="$ctrl.errorMessage">*{{$ctrl.errorMessage}}</span>
</div>
<div ng-if="$ctrl.isContentPresent">
<div class="xml-route-source-container">
<div hawtio-editor="xml" mode="'xml'" output-editor="xmlEditor"></div>
</div>
<button type="submit" class="btn btn-primary" ng-click="$ctrl.save()">Save changes</button>
</div>
<div ng-if="$ctrl.isContentPresent === false">There is no viewable content.</div>
`,
controller: entaxySourceController
})
.name;
function entaxySourceController(workspace, operationsService, $scope) {
'ngInject';
let ctrl = this;
ctrl.$onInit = function() {
let mbeanName = workspace.getSelectedMBeanName();
operationsService
.executeOperation(mbeanName, { name: 'doGetRouteConfig' }, [])
.then(result => {
let info = JSON.parse(result);
let xml = info.properties.routeContent;
if (xml) {
ctrl.isContentPresent = true;
ctrl.objectId = info.objectId;
ctrl.factoryId = info.factoryId;
ctrl.scope = info.scope;
ctrl.systemName = info.properties.systemName;
$scope.xml = atob(xml);
} else {
ctrl.isContentPresent = false;
}
}).catch(error => {
Core.notification('danger', error, 5000);
Entaxy.log.error(error);
});
}
ctrl.save = function() {
if ($scope.xml.trim().length !== 0) {
ctrl.errorMessage = '';
let factoryFolder = workspace.tree.findDescendant(child => child.title === ctrl.factoryId);
let mbeanName = factoryFolder.objectName
let properties = { systemName: ctrl.systemName, routeContent: btoa($scope.xml) };
let instructions = {"@LIFECYCLE":["general"]};
operationsService.executeOperation(mbeanName, { name: 'createObjectByInstructions' }, [ ctrl.objectId, ctrl.scope, instructions, properties ] )
.then(result => {
let tableHtml = Entaxy.createTableFromResponse(result);
Entaxy.notification('success', tableHtml, 10000);
}).catch(error => {
Core.notification('danger', error, 5000);
Entaxy.log.error(error);
});
} else {
ctrl.errorMessage = 'Value cannot be empty';
}
};
setTimeout(function() {
$scope.xmlEditor.options.extraKeys = Entaxy.getExtraKeys();
$scope.xmlEditor.options.hintOptions = Entaxy.getHintOptionsForRouteXml();
}, 100);
}
entaxySourceController.$inject = ['workspace', 'operationsService', '$scope'];
})(Entaxy || (Entaxy = {}));

View File

@ -0,0 +1,60 @@
/*-
* ~~~~~~licensing~~~~~~
* entaxy-management-plugin
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ~~~~~~/licensing~~~~~~
*/
var Entaxy;
(function (Entaxy) {
Entaxy._module
.component('entaxyXml', {
bindings: {
ngModel: '=',
mode: '<'
},
template:
`
<button class="entaxy-xml-form" ng-click="$ctrl.openEditor()">{{$ctrl.mode}}</button>
`,
controller: entaxyXmlController
})
.name;
function entaxyXmlController(workspace, $uibModal) {
'ngInject';
var ctrl = this;
ctrl.openEditor = function() {
$uibModal.open({
component: 'xmlModal',
resolve: {
xml: () => ctrl.ngModel,
mode: () => ctrl.mode
},
size: 'xl',
backdrop: 'static',
windowTopClass: 'modal-top-margin-override'
})
.result.then(xml => {
ctrl.ngModel = xml;
});
}
}
entaxyXmlController.$inject = ['workspace', '$uibModal'];
})(Entaxy || (Entaxy = {}));

View File

@ -0,0 +1,82 @@
/*-
* ~~~~~~licensing~~~~~~
* entaxy-management-plugin
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ~~~~~~/licensing~~~~~~
*/
var Entaxy;
(function (Entaxy) {
Entaxy._module.component('xmlModal', {
bindings: {
modalInstance: '<',
resolve: '<'
},
template:
`
<div class="entaxy-modal-container">
<div class="modal-header">
<button type="button" class="close" aria-label="Close" ng-click="$ctrl.cancel()">
<span class="pficon pficon-close" aria-hidden="true"></span>
</button>
<h4 class="modal-title">{{$ctrl.modalTitle}}</h4>
</div>
<div class="modal-body-without-header">
<div class="xml-editor-container">
<div hawtio-editor="xml" mode="'xml'" output-editor="xmlEditor"></div>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary" ng-click="$ctrl.save($ctrl.formFields)">{{$ctrl.btnTitle}}</button>
</div>
</div>
`,
controller: xmlModalController
})
.name;
function xmlModalController(workspace, $uibModal, $scope) {
'ngInject';
let ctrl = this;
ctrl.$onInit = function() {
ctrl.mode = ctrl.resolve.mode;
ctrl.modalTitle = ctrl.mode + ' XML';
ctrl.btnTitle = Entaxy.getButtonTitleByMode(ctrl.mode);
$scope.xml = ctrl.resolve.xml;
}
ctrl.cancel = function(reason) {
ctrl.modalInstance.dismiss(reason);
}
ctrl.save = function() {
ctrl.modalInstance.close($scope.xml);
}
setTimeout(function() {
if (ctrl.mode === Entaxy.MODAL_MODES.VIEW) {
$scope.xmlEditor.options.readOnly = true;
} else {
$scope.xmlEditor.options.extraKeys = Entaxy.getExtraKeys();
$scope.xmlEditor.options.hintOptions = Entaxy.getHintOptionsForRouteXml();
}
}, 100);
}
xmlModalController.$inject = ['workspace', '$uibModal', '$scope'];
})(Entaxy || (Entaxy = {}));

View File

@ -0,0 +1,301 @@
/*-
* ~~~~~~licensing~~~~~~
* entaxy-management-plugin
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ~~~~~~/licensing~~~~~~
*/
var Entaxy;
(function (Entaxy) {
Entaxy._module.factory('entaxyService', ['$q', 'workspace', 'jolokia', 'jolokiaService', 'operationsService',
function($q, workspace, jolokia, jolokiaService, operationsService) {
return {
makeFormField: function (field, objectId, properties, mode) {
return makeFormField(field, objectId, properties, mode);
},
getArguments: function (fields, factories) {
return getArguments(fields, factories);
},
validateFields: function (fields, selectedFactory, itemType) {
return validateFields(fields, selectedFactory, itemType);
}
};
function makeFormField(field, objectId, properties, mode) {
let formField;
if (mode !== Entaxy.MODAL_MODES.ADD) {
if (field.name === 'objectId') {
field.value = objectId;
}
let suitableProperty = properties.find(property => property.name === field.name);
if (suitableProperty) {
if (field.type.startsWith('entaxy.runtime.')) {
field.type = 'string';
}
if (field.defaultValue && field.defaultValue['@RESOURCE'] && field.defaultValue['@RESOURCE'].format === 'base64') {
suitableProperty.value = atob(suitableProperty.value);
}
field.value = suitableProperty.value;
}
if (!field.isHidden && field.defaultValue !== undefined && field.value === undefined) {
field.displayName = field.displayName ? ('* ' + field.displayName) : ('* ' + field.name);
}
if (field['@FACADE'] && field['@FACADE'].useFacade) {
field.type = field['@FACADE'].type;
field.value = field['@FACADE'].value;
field.defaultValue = undefined;
field.immutable = true;
}
formField = {
label: field.displayName ? field.displayName : field.name,
name: field.name,
type: field.type,
description: field.description,
value: field.value ? field.value : field.defaultValue,
isRef: field.isRef,
isBackRef: field.isBackRef,
isHidden: field.isHidden,
group: field.group ? field.group : 'general',
tag: field.label,
readOnly: mode === Entaxy.MODAL_MODES.VIEW ? true : field.immutable,
required: mode === Entaxy.MODAL_MODES.EDIT ? field.required : undefined,
typeInfo: mode === Entaxy.MODAL_MODES.EDIT ? field['@TYPEINFO'] : undefined,
isFromResource: field.defaultValue && field.defaultValue['@RESOURCE'],
defaultValue: field.defaultValue,
isInternal: field['@INTERNAL']
};
} else {
if (field.defaultValue) {
if (JSON.stringify(field.defaultValue).indexOf('@CALCULATED') > -1) {
field.isCalculated = true;
field.placeholder = 'has calculated default value';
} else if (field.defaultValue['@RESOURCE']) {
field.isFromResource = true;
}
}
formField = {
label: field.displayName ? field.displayName : field.name,
name: field.name,
type: field.type,
typeInfo: field['@TYPEINFO'],
description: field.description,
required: field.required,
value: (field.isCalculated || field.isFromResource) ? undefined : field.defaultValue,
defaultValue: field.defaultValue,
conditional: field.conditional,
isRef: field.isRef,
isBackRef: field.isBackRef,
group: field.group ? field.group : 'general',
isHidden: field.isHidden,
filter: field.filter ? field.filter.label : undefined,
placeholder: field.placeholder,
isCalculated: field.isCalculated,
isFromResource: field.isFromResource,
tag: field.label,
uniquenessCheckedProperties: field['@UNIQUE'] ? field['@UNIQUE'].filterProperties : undefined
};
if (formField.isFromResource) {
let resourcePromise = getResource(formField.defaultValue['@RESOURCE']);
if (resourcePromise) {
resourcePromise
.then((response) => { formField.value = response; })
.catch((error) => Entaxy.log.error(error));
} else {
Core.notification('danger', 'Resource service is not found', 5000);
}
}
if (formField.name === '__entaxyContainerId') {
let selectedMbean = workspace.getSelectedMBean();
jolokiaService.getAttribute(selectedMbean.objectName, 'RuntimeType')
.then((runtimeType) => {
if (runtimeType && runtimeType.startsWith('entaxy.runtime.')) {
formField.value = selectedMbean.title;
}
})
.catch((error) => Entaxy.log.error('There is no runtime type'));
}
}
return formField;
}
function getResource(resourceInfo) {
let resource = workspace.tree.findDescendant(child => {
let childObjectName = child.objectName;
if (childObjectName && childObjectName.endsWith('category=resource')) {
return child;
}
});
if (resource) {
return operationsService.executeOperation(
resource.objectName,
{ name: 'getResource' },
[ resourceInfo.provider + ':' + resourceInfo.location ]
);
}
}
function getArguments(fields, factories) {
let factoryIdName = fields.shift().value;
return args = {
factoryId: factories.find((factory) => factory.name === factoryIdName),
fields: fields.map(field => {
if (field.isFromResource && field.defaultValue['@RESOURCE'].format === 'base64') {
field.value = btoa(field.value);
}
if (field.isInternal) {
field.defaultValue = undefined;
field.value = undefined;
}
return {
name: field.name,
value: (field.defaultValue !== undefined && field.defaultValue === field.value) ? undefined : field.value
};
})
};
}
function validateFields(fields, selectedFactory, itemType) {
let errors = {};
_.forEach(fields, (field) => {
if (field.required && !field.isBackRef && !field.isHidden && !field.isCalculated) {
if (field.value === undefined || (typeof field.value === 'string' ? field.value.trim().length === 0 : false)) {
errors[field.name] = 'Please fill out this field';
}
if ((field.name === 'objectId' || field.name === 'systemName') && !errors[field.name]) {
if (field.value.trim().length < 3) {
errors[field.name] = 'Value must contain at least 3 characters';
}
}
}
if (field.uniquenessCheckedProperties && !errors[field.name]) {
errors[field.name] = checkUniqueness(field.name, field.value, field.uniquenessCheckedProperties, fields, selectedFactory, itemType);
}
});
let deferred = $q.defer();
if (Object.keys(errors).length !== 0) {
let errorArrayWithPromises = [];
Object.keys(errors).forEach(key => {
if (typeof errors[key] !== 'string') {
errorArrayWithPromises.push({ name: key, promise: errors[key] });
}
});
if (errorArrayWithPromises.length !== 0) {
$q.all(errorArrayWithPromises.map(obj => { return obj.promise; }))
.then(result => {
for (let i = 0; i < errorArrayWithPromises.length; i++) {
if (result[i]) {
errors[errorArrayWithPromises[i].name] = result[i];
} else {
delete errors[errorArrayWithPromises[i].name];
}
}
deferred.resolve(errors);
});
} else {
deferred.resolve(errors);
}
} else {
deferred.resolve(errors);
}
return deferred.promise;
}
function checkUniqueness(fieldName, fieldValue, properties, fields, selectedFactory, itemType) {
let message = 'Value must be unique';
let isInvalid = false;
let promises = [];
properties.unshift(fieldName);
properties = properties.map(property => {
return Entaxy.capitalize(property);
});
properties.unshift('RuntimeType');
let selectedMbean = workspace.getSelectedMBean();
if (selectedMbean && selectedMbean.isFolder) {
let children = Entaxy.getChildrenRecursive(selectedMbean);
let childrenMbeanNames = children
.map(child => { return child.objectName; })
.filter(child => child !== null);
childrenMbeanNames.forEach(mbeanName => {
promises.push(jolokiaService.getAttributes(mbeanName, properties)
.then((response) => {
if (response[properties[0]] === 'entaxy.runtime.' + itemType.toLowerCase()
&& fieldValue === response[properties[1]]) {
for (let i = 2; i < properties.length; i++) {
let checkedField = fields.find(field => field.name === Entaxy.uncapitalize(properties[i]));
if (checkedField) {
if (checkedField.value === response[properties[i]]) {
isInvalid = true;
}
} else {
return jolokiaService.getAttribute(selectedFactory.mbeanName, 'TypeInfo')
.then((typeInfo) => {
let typeInfoDesiredValue = typeInfo[Entaxy.uncapitalize(properties[i])];
if (typeInfoDesiredValue === response[properties[i]]) {
isInvalid = true;
}
});
}
}
}
}));
});
}
return $q.all(promises).then(() => isInvalid ? message : '');
}
}
])
})(Entaxy || (Entaxy = {}));

View File

@ -0,0 +1,102 @@
/*-
* ~~~~~~licensing~~~~~~
* entaxy-management-plugin
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ~~~~~~/licensing~~~~~~
*/
var Entaxy;
(function (Entaxy) {
Entaxy._module
.run(AddHeaderTools);
function AddHeaderTools(HawtioExtension, $location, $http, $interval) {
'ngInject';
let baseLocation = getBaseLocation();
let path = '/system/health';
let format = '?format=json';
HawtioExtension.add('context-selector', $scope => {
let div = document.createElement('div');
div.className = 'health-checks-status';
div.appendChild(document.createTextNode('Health checks status:'));
return div;
});
HawtioExtension.add('context-selector', $scope => {
let ref = document.createElement('a');
ref.setAttribute('href', baseLocation + path);
ref.setAttribute('target', '_blank');
let span = document.createElement('span');
changeSpanClassname();
ref.appendChild(span);
let updateStatus;
$scope.startUpdate = function() {
if (angular.isDefined(updateStatus)) return;
updateStatus = $interval(changeSpanClassname, 15000);
}
$scope.startUpdate();
$scope.stopUpdate = function() {
if (angular.isDefined(updateStatus)) {
$interval.cancel(updateStatus);
updateStatus = undefined;
}
}
$scope.$on('$destroy', function() {
$scope.stopUpdate();
});
function changeSpanClassname() {
$http.get(baseLocation + path + format).then(
(response) => {
let status = response.data.overallResult;
if (status === 'OK') {
span.className = 'health-checks pficon pficon-ok';
} else if (status === 'WARN') {
span.className = 'health-checks pficon pficon-warning-triangle-o';
} else {
span.className = 'health-checks pficon pficon-error-circle-o';
}
},
(error) => {
Entaxy.log.error('Unable to get health checks status');
}
);
}
return ref;
});
function getBaseLocation() {
let port = $location.port();
return $location.protocol() + '://' + $location.host() + (port ? (':' + port) : '');
}
}
AddHeaderTools.$inject = ['HawtioExtension', '$location', '$http', '$interval'];
})(Entaxy || (Entaxy = {}));

View File

@ -0,0 +1,74 @@
/*-
* ~~~~~~licensing~~~~~~
* entaxy-management-plugin
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ~~~~~~/licensing~~~~~~
*/
var Entaxy;
(function (Entaxy) {
let CodeMirror = window.CodeMirror;
function completeAfter(cm, pred) {
var cur = cm.getCursor();
if (!pred || pred()) setTimeout(function() {
if (!cm.state.completionActive) {
cm.showHint({completeSingle: false});
}
}, 100);
return CodeMirror.Pass;
}
function completeIfAfterLt(cm) {
return completeAfter(cm, function() {
var cur = cm.getCursor();
return cm.getRange(CodeMirror.Pos(cur.line, cur.ch - 1), cur) == "<";
});
}
function completeIfInTag(cm) {
return completeAfter(cm, function() {
var tok = cm.getTokenAt(cm.getCursor());
if (tok.type == "string" && (!/['"]/.test(tok.string.charAt(tok.string.length - 1)) || tok.string.length == 1)) {
return false;
}
var inner = CodeMirror.innerMode(cm.getMode(), tok.state).state;
return inner.tagName;
});
}
let extraKeys = {
"'<'": completeAfter,
"' '": completeIfInTag,
"'='": completeIfInTag,
"':'": completeIfInTag,
"Ctrl-Space": "autocomplete"
};
function getHintOptionsForRouteXml() {
let tags = Entaxy.getCamelBlueprintTags();
let hintOptions = { schemaInfo: tags };
return hintOptions;
}
Entaxy.getHintOptionsForRouteXml = getHintOptionsForRouteXml;
function getExtraKeys() {
return extraKeys;
}
Entaxy.getExtraKeys = getExtraKeys;
})(Entaxy || (Entaxy = {}));

View File

@ -0,0 +1,5 @@
<!-- -->
<configfile finalname="scripts/entaxy-hawtio.install" override="true">
mvn:ru.entaxy.esb.ui/entaxy-hawtio/1.8.3/install/entaxy-hawtio
</configfile>
<!-- -->

View File

@ -0,0 +1,5 @@
<!-- -->
<configfile finalname="scripts/entaxy-ui.install" override="true">
mvn:ru.entaxy.esb/ui/1.8.3/install/entaxy-ui
</configfile>
<!-- -->