ENTAXY-374 release 1.8.2

This commit is contained in:
2022-08-23 13:40:11 +03:00
parent b68642f81c
commit f495628c75
618 changed files with 61269 additions and 3202 deletions

View File

@ -3,7 +3,7 @@
<parent>
<groupId>ru.entaxy.esb.ui</groupId>
<artifactId>entaxy-hawtio</artifactId>
<version>1.8.1</version>
<version>1.8.2</version>
</parent>
<groupId>ru.entaxy.esb.ui.hawtio</groupId>
<artifactId>artemis-plugin-entaxy</artifactId>

View File

@ -163,7 +163,9 @@ var Artemis;
tabs.push(new Nav.HawtioTab(TAB_CONFIG.artemisAddresses.title, TAB_CONFIG.artemisAddresses.route));
tabs.push(new Nav.HawtioTab(TAB_CONFIG.artemisQueues.title, TAB_CONFIG.artemisQueues.route));
tabs.push(new Nav.HawtioTab(TAB_CONFIG.attributes.title, TAB_CONFIG.attributes.route));
tabs.push(new Nav.HawtioTab(TAB_CONFIG.operations.title, TAB_CONFIG.operations.route));
if (workspace.getSelectedMBeanName()) {
tabs.push(new Nav.HawtioTab(TAB_CONFIG.operations.title, TAB_CONFIG.operations.route));
}
tabs.push(new Nav.HawtioTab(TAB_CONFIG.chart.title, TAB_CONFIG.chart.route));
if (shouldShowCreateAddressTab()) {
tabs.push(new Nav.HawtioTab(TAB_CONFIG.createAddress.title, TAB_CONFIG.createAddress.route));
@ -222,11 +224,19 @@ var Artemis;
function hasInvokeRights(jolokia, mbean, operation) {
var response = jolokia.request({
type: 'exec',
mbean: 'hawtio:type=security,area=jmx,name=ArtemisJMXSecurity',
mbean: 'artemis:type=security,area=jmx,name=ArtemisJMXSecurity',
operation: 'canInvoke(java.lang.String, java.lang.String)',
arguments: [mbean, operation] },
Core.onSuccess(null));
if (response.error) {
response = jolokia.request({
type: 'exec',
mbean: 'hawtio:type=security,area=jmx,name=ArtemisJMXSecurity',
operation: 'canInvoke(java.lang.String, java.lang.String)',
arguments: [mbean, operation]
},
Core.onSuccess(null));
}
Artemis.log.debug(operation + "=" + response.value);
return response.value;
}

View File

@ -3,7 +3,7 @@
<parent>
<groupId>ru.entaxy.esb.ui</groupId>
<artifactId>entaxy-hawtio</artifactId>
<version>1.8.1</version>
<version>1.8.2</version>
</parent>
<groupId>ru.entaxy.esb.ui.hawtio</groupId>
<artifactId>entaxy-branding-plugin</artifactId>

View File

@ -19,7 +19,18 @@
*/
/* jmx tree icon */
.ru-entaxy-esb span.node-icon::before, .ru-entaxy-esb-context-folder span.node-icon::before {
/*.ru-entaxy-esb span.node-icon::before,*/
.node-entaxytree span.node-icon::before /* BUT this way icons aren't present in JMX */
/*.ru-entaxy-esb-0-0-0-0-folder span.node-icon::before,
.ru-entaxy-esb-platform-folder span.node-icon::before,
.ru-entaxy-esb-adapters-folder span.node-icon::before,
.ru-entaxy-esb-artemis-adapter-1-folder span.node-icon::before,
.ru-entaxy-esb-artemis-amqp-adapter-1-folder span.node-icon::before,
.ru-entaxy-esb-file-adapter-1-folder span.node-icon::before,
.ru-entaxy-esb-h2-adapter-1-4-199-folder span.node-icon::before,
.ru-entaxy-esb-postgresql-adapter-42-2-9-folder span.node-icon::before,
.ru-entaxy-esb-rabbitmq-amqp-adapter-1-folder span.node-icon::before*/
{
display: inline-block;
background: url(../img/entaxy.svg);
min-width: 16px;
@ -31,6 +42,86 @@
vertical-align: middle;
}
/*.ru-entaxy-esb-adapters-folder span.node-icon::before*/
/*.ru-entaxy-esb-artemis-adapter-1-folder span.node-icon::before
{
display: inline-block;
background: url(../img/artemis.png);
min-width: 16px;
min-height: 16px;
background-size: 16px 16px;
background-position: -1px center;
background-repeat: no-repeat;
content: "" !important;
vertical-align: middle;
}
.ru-entaxy-esb-artemis-amqp-adapter-1-folder span.node-icon::before
{
display: inline-block;
background: url(../img/activemq.png);
min-width: 16px;
min-height: 16px;
background-size: 16px 16px;
background-position: -1px center;
background-repeat: no-repeat;
content: "" !important;
vertical-align: middle;
}
.ru-entaxy-esb-file-adapter-1-folder span.node-icon::before
{
display: inline-block;
background: url(../img/jesus.jpg);
min-width: 16px;
min-height: 16px;
background-size: 16px 16px;
background-position: -1px center;
background-repeat: no-repeat;
content: "" !important;
vertical-align: middle;
}
.ru-entaxy-esb-h2-adapter-1-4-199-folder span.node-icon::before
{
display: inline-block;
background: url(../img/h2.png);
min-width: 16px;
min-height: 16px;
background-size: 16px 16px;
background-position: -1px center;
background-repeat: no-repeat;
content: "" !important;
vertical-align: middle;
}
.ru-entaxy-esb-postgresql-adapter-42-2-9-folder span.node-icon::before
{
display: inline-block;
background: url(../img/postgresql.png);
min-width: 16px;
min-height: 16px;
background-size: 16px 16px;
background-position: -1px center;
background-repeat: no-repeat;
content: "" !important;
vertical-align: middle;
}
.ru-entaxy-esb-rabbitmq-amqp-adapter-1-folder span.node-icon::before
{
display: inline-block;
background: url(../img/rabbitmq.svg);
min-width: 16px;
min-height: 16px;
background-size: 16px 16px;
background-position: -1px center;
background-repeat: no-repeat;
content: "" !important;
vertical-align: middle;
}
*/
/* fonts */
@ -131,6 +222,18 @@ svg text {
color: #B24E78;
}
.btn-add-modal {
font-size: 14px;
}
.btn-add-modal:focus {
outline: none;
}
.btn-add-modal:active:focus {
outline: none;
}
.pf-c-button.pf-m-primary {
background-color: #B24E78;
}
@ -165,7 +268,7 @@ svg text {
border-color: #B21054;
}
/*These change the row ina table when hovered over*/
/*These change the row in a table when hovered over*/
.table-hover>tbody>tr:hover {
background-color: #B24E78;
}
@ -212,6 +315,14 @@ tbody>tr:hover {
color: #fff!important;
}
/*.list-group.list-view-pf.list-view-pf-view {
margin-top: -30px;
}*/
.entaxy-result-table {
width: 300px;
}
/* This changes the color of the underline in the main left menuLeft hand menu tab underline*/
.pf-c-nav__list .pf-m-current.pf-c-nav__link::after, .pf-c-nav__list .pf-m-current>.pf-c-nav__link::after {
background-color: #B24E78;
@ -236,6 +347,103 @@ table.dataTable thead .sorting_asc, table.dataTable thead .sorting_desc {
position: relative;
}
/* CSSs for entaxy modal window are below */
.modal-xl {
width: 70%;
}
.modal-body-header {
height: 70px;
max-height: 70px;
margin-bottom: 15px;
padding-top: 5px;
padding-left: 15px;
padding-right: 15px;
border-bottom: 1px #f5f5f5 solid;
}
.entaxy-modal-container .modal-body {
height: calc(100vh - 300px);
max-height: calc(100vh - 300px);
padding: 0px;
}
.modal-list-container {
display: flex;
flex-direction: column;
}
.modal-list-toolbar-container {
flex: initial;
padding-left: 20px;
padding-right: 20px;
}
.modal-list-list-container {
min-height:200px;
overflow-y:auto;
flex:initial;
}
/* This changes the size of the list-view item */
/*.list-group-item*/
.modal-list-list-container .list-view-pf-main-info {
height: 30px;
padding-top: 10px;
padding-bottom: 10px;
}
.modal-group-fields-container {
height: 100%;
max-height: 100%;
display: flex;
flex-direction: row;
}
.modal-groups-list-container {
width: 335px;
}
.modal-group-fields-form-container {
overflow-y: auto;
flex: auto;
}
.modal-group-fields-form-container .form-group {
margin-left: 0px;
margin-right: 0px;
}
/*
.modal {
text-align: center;
padding: 0!important;
}
.modal::before {
content: '';
display: inline-block;
height: 100%;
vertical-align: middle;
margin-right: -4px;
}
.modal-dialog {
display: inline-block;
text-align: left;
vertical-align: middle;
}
*/
.modal-top-margin-override {
top: 40px;/*
transform: translateY(-50%) !important;
-webkit-transform: translateY(-50%) !important;
-moz-transform: translateY(-50%) !important;
-ms-transform: translateY(-50%) !important;
-o-transform: translateY(-50%) !important;*/
}
/*This is the original css from HawtIO 1,leaving as is as somemay be used*/
* {
font-family: "Open Sans";
@ -1349,6 +1557,10 @@ i.expandable-indicator.folder {
background-color: darkorange;
}
.toast-pf {
max-width: 50%;
}
.toast.toast-warning * {
color: black;
}
@ -1731,7 +1943,8 @@ a:hover {
.prefs > .row-fluid > .tabbable > .nav.nav-tabs > li {
margin-bottom: 0px;
margin-top: 0px; padding-left: 20px;
margin-top: 0px;
padding-left: 20px;
padding-right: 20px;
}

View File

@ -100,12 +100,13 @@ var Branding = (function (Branding) {
// !! that's absolutely awful !!
// but there's no other way to make those links open in new window
window.linkModifier = window.setInterval(function(){
if (document.readyState == "complete") {
var collection = document.getElementsByTagName("footer").item(0).getElementsByTagName("a");
for (var i=0; i<collection.length; i++)
collection.item(i).setAttribute("target", "_blank");
window.clearInterval(window.linkModifier);
window.linkModifier = window.setInterval(function() {
if (document.readyState == "complete" && document.getElementsByTagName("footer").item(0)) {
var collection = document.getElementsByTagName("footer").item(0).getElementsByTagName("a");
// collection.map(el => return el.item(0).setAttribute("target", "_blank"));
for (var i=0; i<collection.length; i++)
collection.item(i).setAttribute("target", "_blank");
window.clearInterval(window.linkModifier);
}
}, 500);

View File

@ -3,7 +3,7 @@
<parent>
<groupId>ru.entaxy.esb.ui</groupId>
<artifactId>entaxy-hawtio</artifactId>
<version>1.8.1</version>
<version>1.8.2</version>
</parent>
<groupId>ru.entaxy.esb.ui.hawtio</groupId>
<artifactId>entaxy-h2-plugin</artifactId>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>ru.entaxy.esb.ui</groupId>
<artifactId>entaxy-hawtio</artifactId>
<version>1.8.1</version>
<version>1.8.2</version>
</parent>
<groupId>ru.entaxy.esb.ui.hawtio</groupId>
<artifactId>entaxy-management-plugin</artifactId>

View File

@ -0,0 +1,238 @@
/*-
* ~~~~~~licensing~~~~~~
* entaxy-management-plugin
* ==========
* Copyright (C) 2020 - 2021 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('entaxyAddConnectorModal', {
bindings: {
modalInstance: '<',
resolve: '<'
},
template:
`
<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">Add Connector</h4>
</div>
<div class="modal-list-container" ng-show="$ctrl.step1">
<div class="modal-body" style="height:203px; max-height:203px">
<div class="col-md-auto">
<h2>Choose connector template</h2>
</div>
<hr class="col-md-auto">
<div class="col-md-12">
<pf-toolbar class="entaxy-template-toolbar" config="$ctrl.toolbarConfig"></pf-toolbar>
</div>
</div>
<div class="modal-body" style="height:300px; max-height:300px">
<pf-list-view class="entaxy-template-list" items="$ctrl.viewedTemplates" config="$ctrl.listConfig">
<div class="list-view-pf-description">
<div class="list-group-item-heading">
{{item.name}}
</div>
</div>
</pf-list-view>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" ng-click="$ctrl.next()"
ng-disabled="$ctrl.listConfig.selectedItems.length === 0">Next</button>
</div>
</div>
<form name="connectorForm" class="form-horizontal" ng-show="$ctrl.step2" ng-submit="$ctrl.saveConnector($ctrl.formFields)">
<div class="modal-body" style="height:503px; max-height:503px">
<div class="col-md-auto">
<h2>Fill in connector template parameters</h2>
</div>
<hr class="col-md-auto">
<div class="form-group" ng-repeat="formField in $ctrl.formFields">
<label class="col-sm-3 control-label" ng-class="{'required-pf': formField.isRequired}" for="{{formField.label}}">{{formField.label}}</label>
<div class="col-sm-8">
<input type="{{formField.type}}" id="{{formField.label}}" ng-class="{'form-control': formField.type !== 'checkbox'}"
ng-model="formField.value" ng-readonly="formField.isReadOnly">
<!--<span class="help-block">{{formField.helpText}}</span>-->
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" ng-click="$ctrl.back()">Back</button>
<button type="submit" class="btn btn-primary">Add</button>
</div>
</form>
`,
controller: EntaxyAddConnectorModalController
})
.name;
function EntaxyAddConnectorModalController(workspace) {
'ngInject';
var ctrl = this;
// ctrl.errors = null;
Entaxy.log.info('MODAL???');
ctrl.$onInit = function() {
Entaxy.log.info('MODAL!!!');
ctrl.connector = ctrl.resolve.connector ? ctrl.resolve.connector : null; // FIXME
ctrl.step1 = true;
ctrl.step2 = false;
// ctrl.formFields = ctrl.resolve.args.map(arg => {
// let formField = {
// label: arg.name,
// type: Entaxy.convertToHtmlInputType(arg.type)
// };
// return formField;
// });
// Entaxy.log.info('FORM FIELDS ' + JSON.stringify(ctrl.formFields));
let templates = Entaxy.getConnectorTemplates();
ctrl.templates = templates.map(template => { return { name: template }});
// Entaxy.log.info('TEMPLATES ' + JSON.stringify(templates));
// Entaxy.log.info('TEMPLATES ' + JSON.stringify(ctrl.templates));
ctrl.viewedTemplates = ctrl.templates;
ctrl.toolbarConfig.filterConfig.resultsCount = ctrl.viewedTemplates.length;
}
ctrl.toolbarConfig = {
filterConfig: {
fields: [
{
id: 'name',
title: 'Name',
placeholder: 'Filter by Name...',
filterType: 'text'
}
],
resultCount: ctrl.viewedTemplates ? ctrl.viewedTemplates.length : 0,
appliedFilters: [],
onFilterChange: filterChange
},
actionsConfig: {},
// isTableView: true
};
ctrl.listConfig = {
selectionMatchProp: 'name',
selectItems: true,
// selectedItems: [],
showSelectBox: false,
dlbClick: true,
onDblClick: function(item, event){
ctrl.listConfig.selectedItems.push(item);
ctrl.next();
}
}
function filterChange(filters) {
applyFilters(filters);
ctrl.toolbarConfig.filterConfig.resultsCount = ctrl.viewedTemplates.length;
};
function applyFilters(filters) {
ctrl.viewedTemplates = [];
if (filters && filters.length > 0) {
ctrl.templates.forEach(function (template) {
if (matchesFilters(template, filters)) {
ctrl.viewedTemplates.push(template);
}
});
} else {
ctrl.viewedTemplates = ctrl.templates;
}
};
function matchesFilters(item, filters) {
var matches = true;
filters.forEach(function(filter) {
if (!matchesFilter(item, filter)) {
matches = false;
return false;
}
});
return matches;
};
function matchesFilter(item, filter) {
var match = true;
if (filter.id === 'name') {
match = item.name.match(filter.value) !== null;
}
return match;
};
ctrl.next = function() {
ctrl.step1 = false;
ctrl.step2 = true;
Entaxy.log.info('Selected item ' + JSON.stringify(ctrl.listConfig.selectedItems));
if (!ctrl.formFields || ctrl.listConfig.selectedItems[0].name !== ctrl.formFields[0].value) {
ctrl.formFields = Entaxy.getConnectorTemplateParams(ctrl.listConfig.selectedItems[0].name); //ctrl.listConfig.selectedItems[0]
ctrl.formFields.unshift({
label: 'templateName',
type: 'java.lang.String',
helpText: null,
value: ctrl.listConfig.selectedItems[0].name,
isReadOnly: true
});
ctrl.formFields.forEach(formField => formField.type = Entaxy.convertToHtmlInputType(formField.type));
}
}
ctrl.back = function() {
ctrl.step1 = true;
ctrl.step2 = false;
// ctrl.formFields = null;
}
ctrl.cancel = function() {
Entaxy.log.info('QUIT MODAL');
ctrl.modalInstance.dismiss();
}
//
ctrl.saveConnector = function(connector) { // FIXME
Entaxy.log.info('SAVE CONNECTOR: ' + JSON.stringify(connector));
ctrl.errors = validateFields(connector); // FIXME
Entaxy.log.info('ERRORS ' + JSON.stringify(ctrl.errors));
if (Object.keys(ctrl.errors).length === 0) {
// TODO
let connectorArgs = {
connectorTemplateName: ctrl.formFields.shift().value,
connectorFields: ctrl.formFields.map(formField => { return { label: formField.label, value: formField.value }; })
};
ctrl.modalInstance.close(connectorArgs);
}
}
function validateFields(connector) {
Entaxy.log.info('VALIDATION START');
let errors = {};
Entaxy.log.info('VALIDATION END');
return errors;
}
}
EntaxyAddConnectorModalController.$inject = ['workspace'];
})(Entaxy || (Entaxy = {}));

View File

@ -0,0 +1,36 @@
/*-
* ~~~~~~licensing~~~~~~
* entaxy-management-plugin
* ==========
* Copyright (C) 2020 - 2021 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('entaxyConnections', {
bindings: {
pageTitle: '@'
},
template:
`
<h2>
{{$ctrl.pageTitle}}
</h2>
<entaxy-table item-name="Connection" folder-name="Коннекции" status-name="Status" object-name="name"></entaxy-table>
`
})
.name;
})(Entaxy || (Entaxy = {}));

View File

@ -0,0 +1,290 @@
/*-
* ~~~~~~licensing~~~~~~
* entaxy-management-plugin
* ==========
* Copyright (C) 2020 - 2021 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('entaxyConnectors', {
template:
`
<h2>
Connectors
</h2>
<pf-toolbar class="entaxy-connector-toolbar" config="$ctrl.toolbarConfig"></pf-toolbar>
<pf-table-view config="$ctrl.tableConfig"
columns="$ctrl.tableColumns"
action-buttons="$ctrl.tableActionButtons"
page-config="$ctrl.pageConfig"
items="$ctrl.viewedConnectors">
</pf-table-view>
`,
controller: EntaxyConnectorsController
})
.name;
function EntaxyConnectorsController(workspace, $uibModal, operationsService, jolokiaService) {
'ngInject';
var ctrl = this;
ctrl.workspace = workspace;
var entaxyJmxDomain = localStorage['entaxyJmxDomain'] || "ru.entaxy.esb";
let filterValues = Entaxy.getAllBundleStates();
ctrl.tableConfig = {
selectionMatchProp: 'name',
showCheckboxes: false
};
ctrl.toolbarConfig = {
filterConfig: {
fields: [
{
id: 'name',
title: 'Name',
placeholder: 'Filter by Name...',
filterType: 'text'
},
{
id: 'status',
title: 'Status',
placeholder: 'Filter by Status...',
filterType: 'select', // actually text has it rights to be
filterValues: filterValues
}
],
resultCount: ctrl.viewedConnectors ? ctrl.viewedConnectors.length : 0,
appliedFilters: [],
onFilterChange: filterChange
},
actionsConfig: {
primaryActions: [
{ name: 'Add connector', actionFn: () => ctrl.showAddConnectorModal() },
// { name: 'Show Modal', actionFn: () => ctrl.showModal() }
]
},
isTableView: true
};
ctrl.columnDefs = [
{ field: 'name', displayName: 'Connector Name' },
{ field: 'status', displayName: 'Status' }
];
ctrl.tableColumns = [
{ header: 'Connector Name', itemField: 'name' },
{ header: 'Status', itemField: 'status' }
];
ctrl.tableActionButtons = [
{ name: 'Start', title: 'Start Connector', actionFn: startConnector },
{ name: 'Stop', title: 'Stop Connector', actionFn: stopConnector },
// { name: 'Edit', title: 'Edit Connector', actionFn: editConnector },
{ name: 'Remove', title: 'Remove Connector', actionFn: removeConnector }
];
ctrl.pageConfig = {
pageNumber: 1,
pageSize: 10,
pageSizeIncrements: [5, 10, 20, 50, 100]
};
function filterChange(filters) {
applyFilters(filters);
ctrl.toolbarConfig.filterConfig.resultsCount = ctrl.viewedConnectors.length;
};
function applyFilters(filters) {
ctrl.viewedConnectors = [];
if (filters && filters.length > 0) {
ctrl.connectors.forEach(function (connector) {
if (matchesFilters(connector, filters)) {
ctrl.viewedConnectors.push(connector);
}
});
} else {
ctrl.viewedConnectors = ctrl.connectors;
}
};
function matchesFilters(item, filters) {
var matches = true;
filters.forEach(function(filter) {
if (!matchesFilter(item, filter)) {
matches = false;
return false;
}
});
return matches;
};
function matchesFilter(item, filter) {
var match = true;
if (filter.id === 'name') {
match = item.name.match(filter.value) !== null;
} else if (filter.id === 'status') {
match = item.status === filter.value;
}
return match;
};
ctrl.connectors = [];
ctrl.viewedConnectors = [];
ctrl.$onInit = function() {
populateTable();
}
function populateTable() {
ctrl.folderName = 'Коннекторы';
ctrl.statusName = 'BundleState';
let connectors = [];
let count = 0; // FIXME CRUTCH
let connectorsFolder = workspace.getSelectedMBean().get(ctrl.folderName);
if (connectorsFolder) {
connectorsFolder.children.forEach((child) => {
jolokiaService.getAttributes(child.objectName, [ctrl.statusName])
.then((response) => {
connectors.push({name: child.title, status: response[ctrl.statusName], mbeanName: child.objectName});
});
count++; // FIXME CRUTCH
});
ctrl.connectors = connectors;
ctrl.viewedConnectors = connectors;
ctrl.toolbarConfig.filterConfig.resultsCount = count; // FIXME CRUTCH
}
}
ctrl.showAddConnectorModal = function() {
$uibModal.open({
component: 'entaxyAddConnectorModal',
resolve: {
connector: null
},
size: 'lg',
backdrop: 'static'
})
.result.then(connectorArgs => {
addConnector(connectorArgs);
});
}
ctrl.templates = Entaxy.getConnectorTemplates();
ctrl.showModal = function() {
$uibModal.open({
component: 'entaxyModal',
resolve: {
modalTitle: () => 'Add Connector',
firstStepTitle: () => 'Choose connector template',
secondStepTitle: () => 'Fill in connector template parameters',
// profile: null,
// profileNames: () => ctrl.profiles.map(profile => profile.name),
// profileIds: () => ctrl.profiles.map(profile => profile.id)
templates: () => ctrl.templates.map(template => { return { name: template }})
},
size: 'lg',
backdrop: 'static'
})
.result.then(args => {
// addConnector(args);
});
}
function addConnector(connectorArgs) {
let args = [];
args.push(connectorArgs.connectorTemplateName);
let argParams = '{';
_.forEach(connectorArgs.connectorFields, (field) => {
argParams += '\"' + field.label + '\":\"' + field.value + '\",';
});
if (argParams.length > 1) {
argParams = argParams.substring(0, argParams.length - 1);
}
argParams += '}';
args.push(argParams);
let mbeanName = ctrl.workspace.getSelectedMBeanName();
operationsService.executeOperation(mbeanName, { name: 'addConnector' }, args)
.then(result => {
// // FIXME FIXME FIXME FIXME FIXME FIXME
setTimeout(() => populateTable(), 5000);
ctrl.viewedConnectors = ctrl.connectors;
ctrl.toolbarConfig.filterConfig.appliedFilters = [];
ctrl.toolbarConfig.filterConfig.resultsCount = ctrl.viewedConnectors.length;
Core.notification('success', result, 3000);
}).catch(error => {
Core.notification('danger', error, 5000);
});
}
function startConnector(action, connector) {
let mbeanName = workspace.getSelectedMBeanName();
operationsService.executeOperation(mbeanName, { name: 'startConnector' }, [ connector.name ])
.then(result => {
// FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME
setTimeout(() => populateTable(), 100);
Core.notification('success', result, 3000);
}).catch(error => {
Core.notification('danger', error, 5000);
});
}
function stopConnector(action, connector) {
let mbeanName = workspace.getSelectedMBeanName();
operationsService.executeOperation(mbeanName, { name: 'stopConnector' }, [ connector.name ])
.then(result => {
// FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME
setTimeout(() => populateTable(), 100);
Core.notification('success', result, 3000);
}).catch(error => {
Core.notification('danger', error, 5000);
});
}
function removeConnector(action, connector) {
let mbeanName = workspace.getSelectedMBeanName();
operationsService.executeOperation(mbeanName, { name: 'removeConnector' }, [ connector.name ])
.then(result => {
ctrl.connectors.splice(ctrl.connectors.indexOf(connector), 1);
ctrl.viewedConnectors = ctrl.connectors;
ctrl.toolbarConfig.filterConfig.appliedFilters = [];
ctrl.toolbarConfig.filterConfig.resultsCount = ctrl.viewedConnectors.length;
Core.notification('success', result, 3000);
}).catch(error => {
Core.notification('danger', error, 5000);
});
}
ctrl.dismissAlert = () => ctrl.alert = null;
}
EntaxyConnectorsController.$inject = ['workspace', '$uibModal', 'operationsService', 'jolokiaService'];
})(Entaxy || (Entaxy = {}));

View File

@ -0,0 +1,201 @@
/*-
* ~~~~~~licensing~~~~~~
* entaxy-management-plugin
* ==========
* Copyright (C) 2020 - 2021 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('entaxyModal', {
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 ng-if="$ctrl.step1">
<div class="modal-body-header">
<h2>{{$ctrl.firstStepTitle}}</h2>
</div>
<div class="modal-body">
<entaxy-modal-list items="$ctrl.templates" selected="$ctrl.selectedItem"
change-selection="$ctrl.changeSelection"></entaxy-modal-list>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" ng-click="$ctrl.next()"
ng-disabled="!$ctrl.selectedItem">Next</button>
</div>
</div>
<div ng-if="$ctrl.step2">
<div class="modal-body-header">
<h2>{{$ctrl.secondStepTitle}}</h2>
</div>
<div class="modal-body">
<entaxy-modal-group-fields groups="$ctrl.groups" fields="$ctrl.formFields"
errors="$ctrl.errors"></entaxy-modal-group-fields>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" ng-if="$ctrl.hasSteps" ng-click="$ctrl.back()">Back</button>
<button type="submit" class="btn btn-primary" ng-click="$ctrl.save($ctrl.formFields)">Add</button>
</div>
<div>
</div>
`,
controller: entaxyModalController
})
.name;
function entaxyModalController(workspace, operationsService) {
'ngInject';
var ctrl = this;
ctrl.$onInit = function() {
ctrl.modalTitle = ctrl.resolve.modalTitle ? ctrl.resolve.modalTitle : 'Modal'; // fixme do required
ctrl.firstStepTitle = ctrl.resolve.firstStepTitle ? ctrl.resolve.firstStepTitle : ctrl.modalTitle;
ctrl.secondStepTitle = ctrl.resolve.secondStepTitle ? ctrl.resolve.secondStepTitle : ctrl.modalTitle;
ctrl.templates = ctrl.resolve.templates ? ctrl.resolve.templates : null;
// fixme it was only if (ctrl.templates)
if (ctrl.templates && ctrl.templates.length !== 0) { // fixme or maybe if ctrl.templates.length === 1 and then factoryId = ctrl.templates[0]
if (ctrl.templates.length > 1) {
ctrl.step1 = true;
ctrl.step2 = false;
ctrl.hasSteps = true;
} else if (ctrl.templates.length === 1) {
ctrl.hasSteps = false;
ctrl.next();
}
} else {
ctrl.cancel('Templates are not found');
}
}
ctrl.next = function() {
// ctrl.step1 = false;
// ctrl.step2 = true;
// fixme this if perhaps is needed only if hasSteps is true
if (!ctrl.formFields || ctrl.selectedItem.name !== ctrl.formFields[0].value) {
ctrl.formFields = [];
ctrl.formFields.push({
label: 'factoryId',
type: 'java.lang.String',
helpText: null,
value: ctrl.hasSteps ? ctrl.selectedItem.name : ctrl.templates[0].name,
readOnly: true,
required: true,
group: 'general'
});
let mbeanName = ctrl.hasSteps ? ctrl.selectedItem.mbeanName : ctrl.templates[0].mbeanName;
operationsService.executeOperation(mbeanName, { name: 'getFields' }, [ 'init' ])
.then((response) => {
let groups = new Set();
groups.add('general');
_.forEach(JSON.parse(response), (field) => {
let formField = {
label: field.displayName ? field.displayName : field.name,
type: field.type,
description: field.description,
immutable: field.immutable,
required: field.required,
value: field.defaultValue,
conditional: field.conditional,
isRef: field.isRef,
isBackRef: field.isBackRef,
group: field.group ? field.group : 'general',
// tag: field.label
};
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 }; });
ctrl.step1 = false;
ctrl.step2 = true;
});
} else {
ctrl.step1 = false;
ctrl.step2 = true;
}
}
ctrl.back = function() {
ctrl.step1 = true;
ctrl.step2 = false;
}
ctrl.cancel = function(reason) {
ctrl.modalInstance.dismiss(reason);
}
ctrl.changeSelection = function(item) {
ctrl.selectedItem = item;
}
ctrl.save = function(item) {
// fixme maybe forEach here
ctrl.errors = validateFields(ctrl.formFields);
if (Object.keys(ctrl.errors).length === 0) {
let factoryIdName = ctrl.formFields.shift().value;
args = {
factoryId: ctrl.templates.find((template) => template.name === factoryIdName),
fields: ctrl.formFields.map(formField => { return { label: formField.label, value : (formField.nestedValue ? formField.nestedValue : formField.value) }; })
};
ctrl.modalInstance.close(args);
}
}
function validateFields(fields) {
let errors = {};
_.forEach(fields, (field) => {
if (field.required && !field.isBackRef) {
if (!field.value || (field.type !== 'checkbox' ? field.value.trim().length === 0 : false)) {
errors[field.label] = 'Please fill out this field';
}
}
});
return errors;
}
}
entaxyModalController.$inject = ['workspace', 'operationsService'];
})(Entaxy || (Entaxy = {}));

View File

@ -0,0 +1,81 @@
/*-
* ~~~~~~licensing~~~~~~
* entaxy-management-plugin
* ==========
* Copyright (C) 2020 - 2021 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('entaxyModalGroupFields', {
bindings: {
groups: '<',
fields: '<',
errors: '<'
},
template:
`
<div class="modal-group-fields-container">
<div class="modal-groups-list-container">
<entaxy-modal-list items="$ctrl.groups" selected="$ctrl.groups[0]"
change-selection="$ctrl.change" filter="$ctrl.matchesFilter"></entaxy-modal-list>
</div>
<div class="modal-group-fields-form-container">
<form name="connectorForm" class="form-horizontal">
<div class="form-group" ng-class="{'has-error': $ctrl.errors[formField.label]}"
ng-repeat="formField in $ctrl.viewedFormFields" ng-if="!formField.isBackRef">
<label class="col-sm-4 control-label" ng-class="{'required-pf': formField.required}" for="{{formField.label}}">{{formField.label}}</label>
<div class="col-sm-7">
<input type="{{formField.type}}" id="{{formField.label}}" ng-class="{'form-control': formField.type !== 'checkbox'}"
ng-model="formField.value" ng-readonly="formField.readOnly">
<span class="help-block" ng-show="$ctrl.errors[formField.label]">{{$ctrl.errors[formField.label]}}</span>
</div>
</div>
</form>
</div>
</div>
`,
controller: entaxyModalGroupFieldsController
})
.name;
function entaxyModalGroupFieldsController() {
var ctrl = this;
ctrl.change = function(group) {
ctrl.viewedFormFields = ctrl.fields.filter((formField) => formField.group === group.name);
}
ctrl.matchesFilter = function(group, filter) {
var match = false;
_.forEach(ctrl.fields.filter((formField) => formField.group === group.name), (field) => {
if (field.tag && field.tag.length !== 0) {
_.forEach(field.tag, (tag) => {
if (tag.match(filter.value) !== null) {
match = true;
return match;
}
});
}
});
return match;
};
}
})(Entaxy || (Entaxy = {}));

View File

@ -0,0 +1,135 @@
/*-
* ~~~~~~licensing~~~~~~
* entaxy-management-plugin
* ==========
* Copyright (C) 2020 - 2021 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('entaxyModalList', {
bindings: {
items: '<',
selected: '<',
changeSelection: '<',
filter: '<'
},
template:
`
<div class="modal-list-container">
<div class="modal-list-toolbar-container">
<pf-toolbar class="entaxy-toolbar" config="$ctrl.toolbarConfig"></pf-toolbar>
</div>
<div class="modal-list-list-container">
<pf-list-view class="entaxy-list" items="$ctrl.viewedItems" config="$ctrl.listConfig">
<div class="list-view-pf-description">
<div class="list-group-item-heading">
{{item.name}}
</div>
</div>
</pf-list-view>
</div>
</div>
`,
controller: entaxyModalListController
})
.name;
function entaxyModalListController() {
var ctrl = this;
ctrl.$onInit = function() {
ctrl.viewedItems = ctrl.items;
ctrl.toolbarConfig.filterConfig.resultsCount = ctrl.viewedItems.length;
// FIXME i don't like invoking of changeSelection somehow
if (ctrl.selected) {
ctrl.listConfig.selectedItems = [ ctrl.selected ];
changeSelection();
}
}
ctrl.toolbarConfig = {
filterConfig: {
fields: [
{
id: 'name',
title: 'Name',
placeholder: 'Filter by Name...',
filterType: 'text'
}
],
appliedFilters: [],
onFilterChange: filterChange
},
actionsConfig: {}
};
function filterChange(filters) {
applyFilters(filters);
ctrl.toolbarConfig.filterConfig.resultsCount = ctrl.viewedItems.length;
};
function applyFilters(filters) {
ctrl.viewedItems = [];
if (filters && filters.length > 0) {
ctrl.items.forEach(function (item) {
if (matchesFilters(item, filters)) {
ctrl.viewedItems.push(item);
}
});
} else {
ctrl.viewedItems = ctrl.items;
}
};
function matchesFilters(item, filters) {
var matches = true;
filters.forEach(function(filter) {
if (!matchesFilter(item, filter)) {
matches = false;
return matches;
}
});
return matches;
};
function matchesFilter(item, filter) {
if (ctrl.filter) {
return ctrl.filter(item, filter);
} else {
var match = true;
if (filter.id === 'name') {
match = item.name.match(filter.value) !== null;
}
return match;
}
};
ctrl.listConfig = {
selectionMatchProp: 'name',
selectItems: true,
showSelectBox: false,
onSelectionChange: changeSelection
}
function changeSelection() {
ctrl.changeSelection(ctrl.listConfig.selectedItems[0]);
}
}
})(Entaxy || (Entaxy = {}));

View File

@ -20,20 +20,7 @@
var Entaxy;
(function (Entaxy) {
Entaxy.log.debug("loading navigation");
var TAB_CONFIG = {
attributes: {
title: 'Attributes',
route: '/entaxy/attributes'
},
operations: {
title: 'Operations',
route: '/entaxy/operations'
},
chart: {
title: 'Chart',
route: '/entaxy/charts'
}
};
Entaxy._module
.config(configureRoutes)
.component('entaxyNavigation', {
@ -43,7 +30,7 @@ var Entaxy;
.name;
Entaxy.log.debug("loaded navigation " + Entaxy.navigationModule);
function EntaxyNavigationController($scope, $location, workspace, localStorage, jolokia) {
function EntaxyNavigationController($scope, $location, workspace, localStorage, jolokia, $rootScope) {
'ngInject';
var ctrl = this;
this.$location = $location;
@ -73,22 +60,100 @@ var Entaxy;
.map(function (config) { return TAB_CONFIG[config].route; })
.filter(function (route) { return _.startsWith(route, '/entaxy'); });
if (enabledRoutes.length > 0) {
tabs.push(new Nav.HawtioTab(TAB_CONFIG.attributes.title, TAB_CONFIG.attributes.route));
tabs.push(new Nav.HawtioTab(TAB_CONFIG.operations.title, TAB_CONFIG.operations.route));
tabs.push(new Nav.HawtioTab(TAB_CONFIG.attributes.title, TAB_CONFIG.attributes.route));
if (workspace.getSelectedMBeanName()) {
if (shouldShowConnectionsTab()) {
tabs.unshift(new Nav.HawtioTab(TAB_CONFIG.connections.title, TAB_CONFIG.connections.route));
} else if (shouldShowProfilesTab()) {
tabs.unshift(new Nav.HawtioTab(TAB_CONFIG.profiles.title, TAB_CONFIG.profiles.route));
// todo smth like goto/$location.search ?
} else if (shouldShowConnectorsTab()) {
tabs.unshift(new Nav.HawtioTab(TAB_CONFIG.connectors.title, TAB_CONFIG.connectors.route));
} else {
let mbeanName = workspace.getSelectedMBeanName();
let parsedMbean = Core.parseMBean(mbeanName);
console.log(parsedMbean);
if (TAB_CONFIG[parsedMbean.attributes.category] &&
TAB_CONFIG[parsedMbean.attributes.category].check &&
TAB_CONFIG[parsedMbean.attributes.category].check(workspace)) {
tabs.unshift(
new Nav.HawtioTab(TAB_CONFIG[parsedMbean.attributes.category].title,
TAB_CONFIG[parsedMbean.attributes.category].route));
}
}
tabs.push(new Nav.HawtioTab(TAB_CONFIG.operations.title, TAB_CONFIG.operations.route));
}
tabs.push(new Nav.HawtioTab(TAB_CONFIG.chart.title, TAB_CONFIG.chart.route));
// tabs.push(new Nav.HawtioTab(TAB_CONFIG.test.title, TAB_CONFIG.test.route));
}
return tabs;
}
function shouldShowConnectionsTab() {
return workspace.hasDomainAndProperties(entaxyJmxDomain, {'category': 'connections'}) &&
workspace.getSelectedMBeanName().endsWith('category=connections');
}
function shouldShowProfilesTab() {
return workspace.hasDomainAndProperties(entaxyJmxDomain, {'category': 'profiles'}) &&
workspace.getSelectedMBeanName().endsWith('category=profiles');
}
function shouldShowConnectorsTab() {
let mbeanName = workspace.getSelectedMBeanName();
let parsedMbean = Core.parseMBean(mbeanName);
return workspace.hasDomainAndProperties(entaxyJmxDomain, {'category': 'profiles'}) &&
parsedMbean.attributes.profile &&
!parsedMbean.attributes.section;
}
// global event for entaxy extras
$rootScope.$emit('entaxyNavigationInited', $scope);
}
EntaxyNavigationController.$inject = ['$scope', '$location', 'workspace', 'localStorage', 'jolokia']
EntaxyNavigationController.$inject = ['$scope', '$location', 'workspace', 'localStorage', 'jolokia', '$rootScope']
function configureRoutes($routeProvider) {
$routeProvider.
when('/entaxy/attributes', { templateUrl: 'plugins/jmx/html/attributes/attributes.html' }).
when('/entaxy/operations', { template: '<operations></operations>' }).
when('/entaxy/charts', { templateUrl: 'plugins/jmx/html/charts.html' });
when('/entaxy/charts', { templateUrl: 'plugins/jmx/html/charts.html' }).
when('/entaxy/test', { template: '<entaxy-test></entaxy-test>' }).
when('/entaxy/connections', { template: '<entaxy-connections page-title="Connections"></entaxy-connections>' }).
when('/entaxy/profiles', { template: '<entaxy-profiles page-title="Profiles"></entaxy-profiles>' }).
when('/entaxy/connectors', { template: '<entaxy-connectors></entaxy-connectors>' });
}
configureRoutes.$inject = ['$routeProvider'];
})(Entaxy || (Entaxy = {}));
var TAB_CONFIG = {
attributes: {
title: 'Attributes',
route: '/entaxy/attributes'
},
operations: {
title: 'Operations',
route: '/entaxy/operations'
},
chart: {
title: 'Chart',
route: '/entaxy/charts'
},
test: {
title: 'Test',
route: '/entaxy/test'
},
connections: {
title: 'Connections',
route: '/entaxy/connections'
},
profiles: {
title: 'Profiles',
route: '/entaxy/profiles'
},
connectors: {
title: 'Connectors',
route: '/entaxy/connectors'
}
};

View File

@ -0,0 +1,39 @@
/*-
* ~~~~~~licensing~~~~~~
* entaxy-management-plugin
* ==========
* Copyright (C) 2020 - 2021 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('entaxyProfiles', {
bindings: {
pageTitle: '@'
},
template:
`
<h2>
{{$ctrl.pageTitle}}
</h2>
<entaxy-table item-name="Profile" folder-name="Профили"
status-name="BundleState" object-name="systemName"></entaxy-table>
`
})
.name;
})(Entaxy || (Entaxy = {}));

View File

@ -0,0 +1,311 @@
/*-
* ~~~~~~licensing~~~~~~
* entaxy-management-plugin
* ==========
* Copyright (C) 2020 - 2021 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('entaxyTable', {
bindings: {
itemName: '@',
folderName: '@',
statusName: '@',
objectName: '@'
},
template:
`
<pf-toolbar class="entaxy-toolbar" config="$ctrl.toolbarConfig"></pf-toolbar>
<pf-table-view config="$ctrl.tableConfig"
columns="$ctrl.tableColumns"
action-buttons="$ctrl.tableActionButtons"
page-config="$ctrl.pageConfig"
items="$ctrl.viewedItems">
</pf-table-view>
`,
controller: EntaxyTableController
})
.name;
function EntaxyTableController(workspace, $location, $uibModal, operationsService, jolokiaService) {
'ngInject';
var ctrl = this;
ctrl.workspace = workspace;
var entaxyJmxDomain = localStorage['entaxyJmxDomain'] || "ru.entaxy.esb";
let filterValues = Entaxy.getAllBundleStates();
ctrl.tableConfig = {
selectionMatchProp: 'name',
showCheckboxes: false
};
ctrl.toolbarConfig = {
filterConfig: {
fields: [
{
id: 'name',
title: 'Name',
placeholder: 'Filter by Name...',
filterType: 'text'
},
{
id: 'status',
title: 'Status',
placeholder: 'Filter by Status...',
filterType: 'select',
filterValues: filterValues
}
],
// resultsCount: ctrl.viewedItems ? ctrl.viewedItems.length : 0,
// totalCount: ctrl.items ? ctrl.items.length : 0,
appliedFilters: [],
onFilterChange: filterChange
},
// actionsConfig: {
// primaryActions: [
// { name: 'Add ' + ctrl.itemName, actionFn: () => ctrl.showModal() }
// ]
// },
isTableView: true
};
ctrl.columnDefs = [
{ field: 'name', displayName: 'Name' },
{ field: 'status', displayName: 'Status' }
];
ctrl.tableColumns = [
{ header: 'Name', itemField: 'name' },
{ header: 'Status', itemField: 'status' }
];
// ctrl.tableActionButtons = [
// { name: 'Start', title: 'Start ' + ctrl.itemName, actionFn: startItem },
// { name: 'Stop', title: 'Stop ' + ctrl.itemName, actionFn: stopItem },
//// { name: 'Edit', title: 'Edit ' + ctrl.itemName, actionFn: editItem },
// { name: 'Uninstall', title: 'Uninstall ' + ctrl.itemName, actionFn: uninstallItem }
// ];
ctrl.pageConfig = {
pageNumber: 1,
pageSize: 10,
pageSizeIncrements: [5, 10, 20, 50, 100]
};
function filterChange(filters) {
applyFilters(filters);
ctrl.toolbarConfig.filterConfig.resultsCount = ctrl.viewedItems.length;
};
function applyFilters(filters) {
ctrl.viewedItems = [];
if (filters && filters.length > 0) {
ctrl.items.forEach(function (item) {
if (matchesFilters(item, filters)) {
ctrl.viewedItems.push(item);
}
});
} else {
ctrl.viewedItems = ctrl.items;
}
};
function matchesFilters(item, filters) {
var matches = true;
filters.forEach(function(filter) {
if (!matchesFilter(item, filter)) {
matches = false;
return false;
}
});
return matches;
};
function matchesFilter(item, filter) {
var match = true;
if (filter.id === 'name') {
match = item.name.match(filter.value) !== null;
} else if (filter.id === 'status') {
match = item.status === filter.value;
}
return match;
};
ctrl.items = [];
ctrl.viewedItems = [];
ctrl.$onInit = function() {
populateTable();
ctrl.toolbarConfig.actionsConfig = {
primaryActions: [
{ name: 'Add ' + ctrl.itemName, actionFn: () => ctrl.showModal() }
]
};
ctrl.tableActionButtons = [
{ name: 'Start', title: 'Start ' + ctrl.itemName, actionFn: startItem },
{ name: 'Stop', title: 'Stop ' + ctrl.itemName, actionFn: stopItem },
// { name: 'Edit', title: 'Edit ' + ctrl.itemName, actionFn: editItem },
{ name: 'Uninstall', title: 'Uninstall ' + ctrl.itemName, actionFn: uninstallItem }
];
}
function populateTable() {
let items = [];
let count = 0; // FIXME if you can
let children = workspace.tree.findDescendant(child => child.title === ctrl.folderName).children;
if (children) {
children.forEach((child) => {
jolokiaService.getAttributes(child.objectName, [ctrl.statusName])
.then((response) => {
items.push({name: child.title, status: response[ctrl.statusName], mbeanName: child.objectName});
});
count++; // FIXME
});
ctrl.items = items;
ctrl.viewedItems = items;
ctrl.toolbarConfig.filterConfig.resultsCount = count; // FIXME
}
}
ctrl.showModal = function() {
let templates = workspace.tree.findDescendant(child => child.title === 'entaxy.runtime.' + ctrl.itemName.toLowerCase())
.children.map((child) => {
let template = {
name: child.title,
mbeanName: child.objectName
};
return template;
});
$uibModal.open({
component: 'entaxyModal',
resolve: {
modalTitle: () => 'Add ' + ctrl.itemName,
templates: () => templates
},
size: 'xl',
backdrop: 'static'
})
.result.then(args => {
addItem(args)
});
}
function addItem(args) {
let objectId = args.fields.find((field) => field.label === 'objectId').value;
let fields;
if (objectId) {
fields = args.fields.filter((field) => field.label !== 'objectId');
}
let mbeanName = args.factoryId.mbeanName;
let properties = fields.reduce((obj, cur) => ({ ...obj, [cur.label] : cur.value }), {});
operationsService.executeOperation(mbeanName, { name: 'createObject' }, [ objectId, 'public', properties ] )
.then(result => {
setTimeout(() => populateTable(), 200);
let tableHtml = `<table class="entaxy-result-table">`;
tableHtml +=
`
<tr>
<th>Step</th>
<th>Step name</th>
<th>Step result</th>
</tr>
`;
_.forEach(JSON.parse(result), (step) => {
let iconName = step['Step result'] === 'OK' ? 'ok' : 'error-circle-o';
tableHtml += `<tr><td>` + step['Step'] + `</td><td>` + step['Step name'] + `</td>`;
tableHtml += `<td><span class="pficon pficon-${iconName}"></span></td></tr>`;
});
tableHtml += `</table>`;
Entaxy.notification('success', tableHtml, 8000);
changeLocation(properties[ctrl.objectName]);
}).catch(error => {
Core.notification('danger', error, 5000);
});
}
function changeLocation(itemName) {
let currentLocation = $location.search();
$location.search('nid', currentLocation.nid + '-' + itemName); // FIXME FIXME FIXME
}
function startItem(action, item) {
let mbeanName = workspace.getSelectedMBeanName();
operationsService.executeOperation(mbeanName, { name: 'start' + ctrl.itemName }, [ item.name ])
.then(result => {
// FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME
setTimeout(() => populateTable(), 100);
Core.notification('success', result, 3000);
}).catch(error => {
Core.notification('danger', error, 5000);
});
}
function stopItem(action, item) {
let mbeanName = workspace.getSelectedMBeanName();
operationsService.executeOperation(mbeanName, { name: 'stop' + ctrl.itemName }, [ item.name ])
.then(result => {
// FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME
// jolokiaService.getAttribute(item.mbeanName, 'BundleState')
// .then((response) => item.status = response);
setTimeout(() => populateTable(), 100);
Core.notification('success', result, 3000);
}).catch(error => {
Core.notification('danger', error, 5000);
});
}
function uninstallItem(action, item) {
let mbeanName = workspace.getSelectedMBeanName();
operationsService.executeOperation(mbeanName, { name: 'uninstall' + ctrl.itemName }, [ item.name ])
.then(result => {
ctrl.items.splice(ctrl.items.indexOf(item), 1);
ctrl.viewedItems = ctrl.items;
ctrl.toolbarConfig.filterConfig.appliedFilters = [];
ctrl.toolbarConfig.filterConfig.resultsCount = ctrl.viewedItems.length;
Core.notification('success', result, 3000);
}).catch(error => {
Core.notification('danger', error, 5000);
});
}
ctrl.dismissAlert = () => ctrl.alert = null;
}
EntaxyTableController.$inject = ['workspace', '$location', '$uibModal', 'operationsService', 'jolokiaService'];
})(Entaxy || (Entaxy = {}));

View File

@ -152,7 +152,7 @@ var Entaxy;
var _this = this;
var children = [];
var tree = this.workspace.tree;
Entaxy.log.debug("tree= "+tree);
Entaxy.log.debug("tree = " + tree);
if (tree) {
var domainName = entaxyJmxDomain;
var folder = tree.get(domainName);
@ -161,7 +161,7 @@ var Entaxy;
children = folder.children;
}
angular.forEach(children, function(child) {
Entaxy.log.debug("child=" + child.text + " " + child.id);
Entaxy.log.debug("child = " + child.text + " " + child.id);
});
var treeElement = $("#entaxytree");
this.removeTree();

View File

@ -0,0 +1,94 @@
/*-
* ~~~~~~licensing~~~~~~
* entaxy-management-plugin
* ==========
* Copyright (C) 2020 - 2021 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) {
function convertToHtmlInputType(javaType) {
if (!javaType || javaType.startsWith('entaxy.runtime')) {
// fixme maybe
return javaType;
}
switch (javaType) {
case 'boolean':
case 'Boolean':
case 'java.lang.Boolean':
return 'checkbox';
case 'int':
case 'long':
case 'java.lang.Integer':
case 'java.lang.Long':
return 'number';
default:
return 'text';
}
}
Entaxy.convertToHtmlInputType = convertToHtmlInputType;
function notification(type, message, duration) {
let visibleToastElem = null;
let timeoutId;
let toastHtml = `
<div class="toast-pf alert alert-${type} alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">
<span class="pficon pficon-close"></span>
</button>
<span class="pficon pficon-${resolveToastIcon(type)}"></span>
${message}
</div>
`;
let toastFrag = document.createRange().createContextualFragment(toastHtml);
let toastElem = toastFrag.querySelector('div');
let bodyElem = document.querySelector('body');
// if toast element is in the DOM
if (visibleToastElem && visibleToastElem.parentNode) {
clearTimeout(timeoutId);
bodyElem.removeChild(visibleToastElem);
}
visibleToastElem = bodyElem.appendChild(toastElem);
if (duration || (type === 'success' || type === 'info')) {
timeoutId = window.setTimeout(() => {
if (toastElem.parentNode) {
bodyElem.removeChild(toastElem);
}
}, duration || 8000);
}
}
Entaxy.notification = notification;
function resolveToastIcon(type) {
switch (type) {
case 'success':
return 'ok';
case 'warning':
return 'warning-triangle-o';
case 'danger':
return 'error-circle-o';
default:
return 'info';
}
}
})(Entaxy || (Entaxy = {}));

View File

@ -0,0 +1,152 @@
/*-
* ~~~~~~licensing~~~~~~
* entaxy-management-plugin
* ==========
* Copyright (C) 2020 - 2021 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) {
function getAllBundleStates() {
return JSON.parse('["Active", "Installed", "Resolved", "Starting", "Stopping", "Uninstalled"]');
}
Entaxy.getAllBundleStates = getAllBundleStates;
function getConnectorTemplates() {
return JSON.parse('["uniform-service-active-in-connector", "uniform-service-passive-in-connector", "uniform-service-active-out-connector", "uniform-service-passive-out-connector", "odata-in-connector", "sql-out-connector"]');
}
Entaxy.getConnectorTemplates = getConnectorTemplates;
function getConnectorTemplateParams(templateName) {
let json = JSON.parse(connectorTemplateParams);
return json[templateName];
}
Entaxy.getConnectorTemplateParams = getConnectorTemplateParams;
let connectorTemplateParams = '{"uniform-service-active-in-connector":[' +
'{' +
'"label":"period",' +
'"type":"java.lang.String",' +
'"helpText":null,' +
'"value":"1m"' +
'},' +
'{' +
'"label":"username",' +
'"type":"java.lang.String",' +
'"helpText":null,' +
'"value":"admin"' +
'},' +
'{' +
'"label":"password",' +
'"type":"java.lang.String",' +
'"helpText":null,' +
'"value":""' +
'},' +
'{' +
'"label":"endpointUrl",' +
'"type":"java.lang.String",' +
'"helpText":null,' +
'"value":""' +
'},' +
'{' +
'"label":"connectionTimeout",' +
'"type":"int",' +
'"helpText":null,' +
'"value":3000' +
'},' +
'{' +
'"label":"connectionMaxThreads",' +
'"type":"int",' +
'"helpText":null,' +
'"value":1' +
'}' +
'],' +
'"uniform-service-active-out-connector":[' +
'{' +
'"label":"username",' +
'"type":"java.lang.String",' +
'"helpText":null,' +
'"value":"admin"' +
'},' +
'{' +
'"label":"password",' +
'"type":"java.lang.String",' +
'"helpText":null,' +
'"value":""' +
'},' +
'{' +
'"label":"endpointUrl",' +
'"type":"java.lang.String",' +
'"helpText":null,' +
'"value":""' +
'},' +
'{' +
'"label":"connectionTimeout",' +
'"type":"int",' +
'"helpText":null,' +
'"value":3000' +
'},' +
'{' +
'"label":"connectionMaxThreads",' +
'"type":"int",' +
'"helpText":null,' +
'"value":1' +
'}' +
'],' +
'"uniform-service-passive-in-connector":[],' +
'"uniform-service-passive-out-connector":[],' +
'"odata-in-connector":[],' +
'"sql-out-connector":[' +
'{' +
'"label":"serverName",' +
'"type":"java.lang.String",' +
'"helpText":null,' +
'"value":""' +
'},' +
'{' +
'"label":"portNumber",' +
'"type":"java.lang.Integer",' +
'"helpText":null,' +
'"value":5432' +
'},' +
'{' +
'"label":"databaseName",' +
'"type":"java.lang.String",' +
'"helpText":null,' +
'"value":""' +
'},' +
'{' +
'"label":"user",' +
'"type":"java.lang.String",' +
'"helpText":null,' +
'"value":""' +
'},' +
'{' +
'"label":"password",' +
'"type":"java.lang.String",' +
'"helpText":null,' +
'"value":""' +
'},' +
'{' +
'"label":"dataSourceClass",' +
'"type":"java.lang.String",' +
'"helpText":null,' +
'"value":"org.postgresql.ds.PGSimpleDataSource"' +
'}' +
']' +
'}';
})(Entaxy || (Entaxy = {}));

View File

@ -58,7 +58,7 @@ var Entaxy = (function (Entaxy) {
})
.run(configurePlugin);
function configurePlugin(mainNavService, workspace, helpRegistry, preferencesRegistry, localStorage, preLogoutTasks, documentBase, $templateCache) {
function configurePlugin(mainNavService, workspace, helpRegistry, preferencesRegistry, localStorage, preLogoutTasks, documentBase, $templateCache, $rootScope) {
var entaxyJmxDomain = localStorage['entaxyJmxDomain'] || "ru.entaxy.esb";
mainNavService.addItem({
title: 'Entaxy',
@ -67,6 +67,34 @@ var Entaxy = (function (Entaxy) {
isValid: function () { return workspace.treeContainsDomainAndProperties(entaxyJmxDomain); }
});
function mBeansTreeLocalization(children) {
if (children && children.length >0) {
for (var i=0; i<children.length; i++) {
let c = children[i];
if (L10N.hasOwnProperty(c.title)) {
c.title = L10N[c.title];
}
if (c.children && c.children.length > 0) {
mBeansTreeLocalization(c.children);
}
}
}
}
// global event for entaxy extras
$rootScope.$emit('entaxyWorkspacePreparing', workspace);
workspace.addNamedTreePostProcessor('localize', (tree) => {
if (tree) {
let domain = tree.get(entaxyJmxDomain);
if (domain) {
console.log('domain ');
console.log(domain.children);
mBeansTreeLocalization(domain.children);
}
}
});
// clean up local storage upon logout
/* preLogoutTasks.addTask('CleanupArtemisCredentials', function () {
Artemis.log.debug("Clean up Artemis credentials in local storage");
@ -74,7 +102,7 @@ var Entaxy = (function (Entaxy) {
localStorage.removeItem('artemisPassword');
}); */
}
configurePlugin.$inject = ['mainNavService', 'workspace', 'helpRegistry', 'preferencesRegistry', 'localStorage', 'preLogoutTasks', 'documentBase', '$templateCache'];
configurePlugin.$inject = ['mainNavService', 'workspace', 'helpRegistry', 'preferencesRegistry', 'localStorage', 'preLogoutTasks', 'documentBase', '$templateCache','$rootScope'];
return Entaxy;
@ -83,3 +111,14 @@ var Entaxy = (function (Entaxy) {
// tell the Hawtio plugin loader about our plugin so it can be
// bootstrapped with the rest of AngularJS
hawtioPluginLoader.addModule(Entaxy.pluginName);
var L10N = {
platform: 'Платформа',
adapters: 'Адаптеры',
factories: 'Фабрики',
runtime:'Состояние',
connections:'Коннекции',
profiles:'Профили',
connectors:'Коннекторы',
routes:'Маршруты'
};

View File

@ -0,0 +1,77 @@
/*-
* ~~~~~~licensing~~~~~~
* entaxy-management-plugin
* ==========
* Copyright (C) 2020 - 2022 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('entaxyConnectorsService', ['jolokia', 'jolokiaService', '$q',
function(jolokia, jolokiaService, $q) {
return {
getConnectors: function (profileName) {
return getConnectors(profileName);
}
};
// let mbeanName = ctrl.workspace.getSelectedMBeanName();
//
// let parsedMbean = Core.parseMBean(mbeanName);
// let profileName = parsedMbean.attributes.profile;
//
// entaxyConnectorsService.getConnectors(profileName).then(connectors => {
// ctrl.connectors = connectors;
// ctrl.viewedConnectors = connectors;
// ctrl.toolbarConfig.filterConfig.resultsCount = connectors.length;
// });
function getConnectors(profileName) {
var entaxyJmxDomain = localStorage['entaxyJmxDomain'] || "ru.entaxy.esb";
return $q((resolve, reject) => {
jolokia.list(entaxyJmxDomain,
Core.onSuccess((response) => {
let connectors = [];
let promises = [];
let entaxyDomain = response;
angular.forEach(entaxyDomain, function (mbean, mbeanNameWithoutDomain) {
let mbeanName = entaxyJmxDomain + ':' + mbeanNameWithoutDomain;
let parsedMbean = Core.parseMBean(mbeanName);
if (parsedMbean.attributes.connector && parsedMbean.attributes.profile === profileName) {
let connectorName = parsedMbean.attributes.connector;
let promise = jolokiaService.getAttribute(mbeanName, 'BundleState');
promise.then((response) =>
connectors.push({name: connectorName, status: response, mbeanName: mbeanName}));
promises.push(promise);
}
});
$q.all(promises).then(() => resolve(connectors));
},
{
error: (response) => Entaxy.log.info('ERROR ' + JSON.stringify(response))
})
);
});
}
}
])
})(Entaxy || (Entaxy = {}));

View File

@ -0,0 +1,142 @@
/*-
* ~~~~~~licensing~~~~~~
* entaxy-management-plugin
* ==========
* Copyright (C) 2020 - 2021 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('firstStepModalTest', {
bindings: {
templates: '<',
selected: '<',
changeSelection: '<',
filter: '<'
},
template:
`
<div style="height: 473px; max-height: 473px; display: flex; flex-direction: column;">
<div class="modal-body-filter-header" style="flex: auto; padding-left: 20px; padding-right: 20px;">
<!--div class="col-md-12"-->
<pf-toolbar class="entaxy-template-toolbar" config="$ctrl.toolbarConfig"></pf-toolbar>
<!--/div-->
</div>
<div class="modal-list-list-container" style="height:385px; max-height:385px; min-height:200px; overflow-y:auto; flex:initial;">
<pf-list-view class="entaxy-template-list" items="$ctrl.viewedTemplates" config="$ctrl.listConfig">
<div class="list-view-pf-description">
<div class="list-group-item-heading">
{{item.name}}
</div>
</div>
</pf-list-view>
</div>
</div>
`,
controller: firstStepModalTestController
})
.name;
function firstStepModalTestController() {
'ngInject';
var ctrl = this;
ctrl.$onInit = function() {
ctrl.viewedTemplates = ctrl.templates;
ctrl.toolbarConfig.filterConfig.resultsCount = ctrl.viewedTemplates.length;
Entaxy.log.info('SELECTED ' + JSON.stringify(ctrl.selected));
// FIXME i don't like invoking of changeSelection somehow
if (ctrl.selected) {
ctrl.listConfig.selectedItems = [ ctrl.selected ];
changeSelection();
}
}
ctrl.toolbarConfig = {
filterConfig: {
fields: [
{
id: 'name',
title: 'Name',
placeholder: 'Filter by Name...',
filterType: 'text'
}
],
appliedFilters: [],
onFilterChange: filterChange
},
actionsConfig: {}
};
function filterChange(filters) {
applyFilters(filters);
ctrl.toolbarConfig.filterConfig.resultsCount = ctrl.viewedTemplates.length;
};
function applyFilters(filters) {
ctrl.viewedTemplates = [];
if (filters && filters.length > 0) {
ctrl.templates.forEach(function (template) {
if (matchesFilters(template, filters)) {
ctrl.viewedTemplates.push(template);
}
});
} else {
ctrl.viewedTemplates = ctrl.templates;
}
};
function matchesFilters(item, filters) {
var matches = true;
filters.forEach(function(filter) {
if (!matchesFilter(item, filter)) {
matches = false;
return matches;
}
});
return matches;
};
function matchesFilter(item, filter) {
if (ctrl.filter) {
return ctrl.filter(item, filter);
} else {
var match = true;
if (filter.id === 'name') {
match = item.name.match(filter.value) !== null;
}
return match;
}
};
ctrl.listConfig = {
selectionMatchProp: 'name',
selectItems: true,
// selectedItems: [ { name: 'test' } ], // ctrl.selected ? [ ctrl.selected ] : [],
showSelectBox: false,
onSelectionChange: changeSelection
}
function changeSelection() {
ctrl.changeSelection(ctrl.listConfig.selectedItems[0]);
}
}
firstStepModalTestController.$inject = [];
})(Entaxy || (Entaxy = {}));

View File

@ -0,0 +1,50 @@
/*-
* ~~~~~~licensing~~~~~~
* entaxy-management-plugin
* ==========
* Copyright (C) 2020 - 2022 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('restService', ['$q', '$http',
function($q, $http) {
return {
post: function (url, data) {
return post(url, data);
}
};
function post(url, data) {
var deferred = $q.defer();
$http({
method: 'POST',
url: url,
data: data,
transformRequest: angular.identity,
headers: {'Content-Type': undefined}
}).then(function(response) {
deferred.resolve(response);
}, function(response) {
deferred.reject(response);
}).catch(function(fallback) {
Entaxy.log.error(fallback);
});
return deferred.promise;
};
}
]);
})(Entaxy || (Entaxy = {}));

View File

@ -0,0 +1,99 @@
/*-
* ~~~~~~licensing~~~~~~
* entaxy-management-plugin
* ==========
* Copyright (C) 2020 - 2021 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('secondStepModalTest', {
bindings: {
groups: '<',
fields: '<',
errors: '<'
},
template:
`
<div class="col-md-4" style="margin-left:-20px;">
<first-step-modal-test templates="$ctrl.groups" selected="$ctrl.groups[0]"
change-selection="$ctrl.change" filter="$ctrl.matchesFilter"></first-step-modal-test>
</div>
<div class="modal-body-form-container col-md-8">
<form name="connectorForm" class="form-horizontal">
<div class="form-group" ng-repeat="formField in $ctrl.viewedFormFields">
<label class="col-sm-3 control-label" ng-class="{'required-pf': formField.required}" for="{{formField.label}}">{{formField.label}}</label>
<div class="col-sm-7">
<input type="{{formField.type}}" id="{{formField.label}}" ng-class="{'form-control': formField.type !== 'checkbox'}"
ng-model="formField.value" ng-readonly="formField.readOnly">
<!--<span class="help-block">{{formField.helpText}}</span>-->
</div>
<div>
<button type="button" class="btn btn-link btn-add-modal" ng-click="$ctrl.addModal(formField)"
ng-if="formField.hasAddButton && !formField.nestedValue">
<span class="pficon pficon-add-circle-o"></span>
</button>
<button type="button" class="btn btn-link btn-add-modal" ng-click="$ctrl.deleteNestedValue(formField)"
ng-if="formField.hasAddButton && formField.nestedValue">
<!--<span class="pficon pficon-error-circle-o"></span>-->
<span class="pficon pficon-delete"></span>
</button>
</div>
</div>
</form>
</div>
`,
controller: secondStepModalTestController
})
.name;
function secondStepModalTestController() {
'ngInject';
var ctrl = this;
ctrl.$onInit = function() {
}
ctrl.change = function(group) {
ctrl.viewedFormFields = ctrl.fields.filter((formField) => formField.group === group.name);
}
ctrl.matchesFilter = function(group, filter) {
var match = false;
_.forEach(ctrl.fields.filter((formField) => formField.group === group.name), (field) => {
if (field.tag && field.tag.length !== 0) {
_.forEach(field.tag, (tag) => {
if (tag.match(filter.value) !== null) {
match = true;
return match;
}
});
}
});
// if (filter.id === 'name') {
// match = item.name.match(filter.value) !== null;
// }
return match;
};
}
secondStepModalTestController.$inject = [];
})(Entaxy || (Entaxy = {}));

View File

@ -0,0 +1,192 @@
/*-
* ~~~~~~licensing~~~~~~
* entaxy-management-plugin
* ==========
* Copyright (C) 2020 - 2021 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("selectNgFiles", function() {
return {
require: "ngModel",
link: function postLink(scope,elem,attrs,ngModel) {
elem.on("change", function(e) {
var files = elem[0].files;
ngModel.$setViewValue(files);
})
}
}
})
.component('entaxyTest', {
template:
`<h2>Test</h2>
<div>
<div style="margin-bottom:10px">
<p>Test of a modal window with capability of invoking extra modals</p>
<button type="button" class="btn btn-default" ng-click="$ctrl.showModal()">
Show Modal
</button>
<hr>
</div>
<div style="margin-bottom:10px">
<p>Test of a modal window, keep it for filter in second step</p>
<button type="button" class="btn btn-default" ng-click="$ctrl.showModal2()">
Show Modal
</button>
<hr>
</div>
<div style="margin-bottom:10px">
<p>Test of posting a file to the REST API with getting its id in response</p>
<form name="testForm" class="form-horizontal" ng-submit="$ctrl.testRest()">
<div class="form-group" ng-repeat="formField in $ctrl.fileFormFields">
<label class="col-sm-1 control-label" ng-class="{'required-pf': formField.isRequired}" for="{{formField.label}}">{{formField.label}}</label>
<div class="col-sm-7">
<input type="{{formField.type}}" id="{{formField.label}}" ng-class="{'form-control': formField.type !== 'checkbox'}"
ng-model="formField.value" ng-readonly="formField.isReadOnly">
</div>
</div>
<div class="form-group">
<label class="col-sm-1 control-label">file</label>
<div class="col-sm-7">
<input type="file" select-ng-files ng-model="$ctrl.files"></input>
</div>
</div>
<button type="submit" class="btn btn-default"
ng-disabled="!$ctrl.files">Confirm</button>
</form>
</div>
<hr>
<div ng-repeat="file in $ctrl.files" style="margin-bottom:10px">
<p>File name: {{file.name}}</p>
</div>
<div ng-if="$ctrl.res" style="margin-bottom:10px">
<p>File id: {{$ctrl.res}}</p>
</div>
<div ng-if="$ctrl.req" style="margin-bottom:10px">
<p>Request: {{$ctrl.req}}</p>
</div>
<div ng-if="$ctrl.fields" style="margin-bottom:10px">
<hr>
<p>Fields: {{$ctrl.fields}}</p>
</div>
</div>
`,
controller: EntaxyTestController
})
.name;
function EntaxyTestController(workspace, $uibModal, $q, jolokia, restService, operationsService) {
'ngInject';
var ctrl = this;
ctrl.fileFormFields = [];
for (var i = 0; i < 2; i++) {
ctrl.fileFormFields.push({
label: 'field' + i,
value: '',
type: Entaxy.convertToHtmlInputType('String')
});
}
ctrl.count = 5;
ctrl.callback = function(amount) {
ctrl.count += amount;
}
ctrl.testRest = function () {
let file = ctrl.files[0];
var fd = new FormData();
fd.append('file', file);
restService.post('/cxf/fileUpload/post', fd)
.then((response) => {
ctrl.res = response.data;
ctrl.req = ctrl.fileFormFields.map(formField => { return { label: formField.label, value: formField.value }; });
ctrl.req.push({ label: 'fileId', value: ctrl.res});
})
.catch((error) => Core.notification('danger', error, 5000));
}
ctrl.options = [{ name: 'first option' }, { name: 'second option' }, { name: 'third option' }];
function updateFormFields() {
ctrl.formFields = [];
ctrl.formFields.push({
label: 'field0',
value: '',
type: Entaxy.convertToHtmlInputType('entaxy.runtime.profile'),
hasAddButton: true
});
for (var i = 1; i < 5; i++) {
ctrl.formFields.push({
label: 'field' + i,
value: '',
type: Entaxy.convertToHtmlInputType('entaxy.runtime.profile')
});
}
}
ctrl.showModal = function() {
updateFormFields();
$uibModal.open({
component: 'testModal',
resolve: {
templates: () => [ { name: 'testParent' } ],
formFields: () => ctrl.formFields
},
size: 'lg',
backdrop: 'static'
})
.result.then(args => {
ctrl.fields = args;
});
}
ctrl.showModal2 = function() {
$uibModal.open({
component: 'testModal2',
resolve: {
templates: () => [ { name: 'test' } ]
},
size: 'xl',
backdrop: 'static'
})
.result.then(args => {
ctrl.res = args;
});
}
ctrl.prepareFile = function() {
Entaxy.log.info('FILE ' + JSON.stringify(ctrl.files[0]));
let file = ctrl.files[0];
let data = ctrl.files[0];
var fd = new FormData();
fd.append('file', file);
restService.post('/cxf/fileUpload/post', fd)
.then((response) => ctrl.res = response.data);
}
}
EntaxyTestController.$inject = ['workspace', '$uibModal', '$q', 'jolokia', 'restService', 'operationsService'];
})(Entaxy || (Entaxy = {}));

View File

@ -0,0 +1,303 @@
/*-
* ~~~~~~licensing~~~~~~
* entaxy-management-plugin
* ==========
* Copyright (C) 2020 - 2021 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('testModal', {
bindings: {
modalInstance: '<',
resolve: '<'
},
template:
`
<div style="vertical-align: middle">
<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-list-container" ng-if="$ctrl.step1">
<div class="modal-body" style="height:203px; max-height:203px">
<div class="col-md-auto">
<h2>{{$ctrl.firstStepTitle}}</h2>
</div>
<hr class="col-md-auto">
<div class="col-md-12">
<pf-toolbar class="entaxy-template-toolbar" config="$ctrl.toolbarConfig"></pf-toolbar>
</div>
</div>
<div class="modal-body" style="height:300px; max-height:300px">
<pf-list-view class="entaxy-template-list" items="$ctrl.viewedTemplates" config="$ctrl.listConfig">
<div class="list-view-pf-description">
<div class="list-group-item-heading">
{{item.name}}
</div>
</div>
</pf-list-view>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" ng-click="$ctrl.next()"
ng-disabled="$ctrl.listConfig.selectedItems.length === 0">Next</button>
</div>
</div>
<form name="connectorForm" class="form-horizontal" ng-if="$ctrl.step2" ng-submit="$ctrl.save($ctrl.formFields)">
<div class="modal-body" style="height:115px; max-height:115px">
<div class="col-md-auto">
<h2>{{$ctrl.secondStepTitle}}</h2>
</div>
<hr class="col-md-auto">
</div>
<div class="modal-body" style="height:388px; max-height:388px">
<div class="form-group" ng-repeat="formField in $ctrl.formFields">
<label class="col-sm-3 control-label" ng-class="{'required-pf': formField.isRequired}" for="{{formField.label}}">{{formField.label}}</label>
<div class="col-sm-7">
<input type="{{formField.type}}" id="{{formField.label}}" ng-class="{'form-control': formField.type !== 'checkbox'}"
ng-model="formField.value" ng-readonly="formField.isReadOnly">
<!--<span class="help-block">{{formField.helpText}}</span>-->
</div>
<div>
<button type="button" class="btn btn-link btn-add-modal" ng-click="$ctrl.addModal(formField)"
ng-if="formField.hasAddButton && !formField.nestedValue">
<span class="pficon pficon-add-circle-o"></span>
</button>
<button type="button" class="btn btn-link btn-add-modal" ng-click="$ctrl.deleteNestedValue(formField)"
ng-if="formField.hasAddButton && formField.nestedValue">
<!--<span class="pficon pficon-error-circle-o"></span>-->
<span class="pficon pficon-delete"></span>
</button>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" ng-if="$ctrl.hasSteps" ng-click="$ctrl.back()">Back</button>
<button type="submit" class="btn btn-primary">Add</button>
</div>
</form>
</div>
`,
controller: testModalController
})
.name;
function testModalController(workspace, $uibModal) {
'ngInject';
var ctrl = this;
Entaxy.log.info('MODAL???');
ctrl.$onInit = function() {
Entaxy.log.info('MODAL!!!');
ctrl.modalTitle = ctrl.resolve.modalTitle ? ctrl.resolve.modalTitle : 'Test Modal'; // fixme do required
ctrl.firstStepTitle = ctrl.resolve.firstStepTitle ? ctrl.resolve.firstStepTitle : ctrl.modalTitle;
ctrl.secondStepTitle = ctrl.resolve.secondStepTitle ? ctrl.resolve.secondStepTitle : ctrl.modalTitle;
ctrl.templates = ctrl.resolve.templates ? ctrl.resolve.templates : null;
if (ctrl.templates && ctrl.templates.length !== 0) {
if (ctrl.templates.length > 1) {
ctrl.step1 = true;
ctrl.step2 = false;
ctrl.hasSteps = true;
ctrl.viewedTemplates = ctrl.templates;
ctrl.toolbarConfig.filterConfig.resultsCount = ctrl.viewedTemplates.length;
} else if (ctrl.templates.length === 1) {
ctrl.step1 = false;
ctrl.step2 = true;
ctrl.hasSteps = false;
ctrl.formFields = ctrl.resolve.formFields ? ctrl.resolve.formFields : null; // fixme
ctrl.formFields.unshift({
label: 'factoryId',
type: 'java.lang.String',
helpText: null,
value: ctrl.templates[0].name,
isReadOnly: true
});
}
} else {
ctrl.cancel('Templates are not found');
}
}
ctrl.toolbarConfig = {
filterConfig: {
fields: [
{
id: 'name',
title: 'Name',
placeholder: 'Filter by Name...',
filterType: 'text'
}
],
resultCount: ctrl.viewedTemplates ? ctrl.viewedTemplates.length : 0,
appliedFilters: [],
onFilterChange: filterChange
},
actionsConfig: {},
};
ctrl.listConfig = {
selectionMatchProp: 'name',
selectItems: true,
showSelectBox: false
}
function filterChange(filters) {
applyFilters(filters);
ctrl.toolbarConfig.filterConfig.resultsCount = ctrl.viewedTemplates.length;
};
function applyFilters(filters) {
ctrl.viewedTemplates = [];
if (filters && filters.length > 0) {
ctrl.templates.forEach(function (template) {
if (matchesFilters(template, filters)) {
ctrl.viewedTemplates.push(template);
}
});
} else {
ctrl.viewedTemplates = ctrl.templates;
}
};
function matchesFilters(item, filters) {
var matches = true;
filters.forEach(function(filter) {
if (!matchesFilter(item, filter)) {
matches = false;
return false;
}
});
return matches;
};
function matchesFilter(item, filter) {
var match = true;
if (filter.id === 'name') {
match = item.name.match(filter.value) !== null;
}
return match;
};
ctrl.next = function() {
ctrl.step1 = false;
ctrl.step2 = true;
if (!ctrl.formFields || ctrl.listConfig.selectedItems[0].name !== ctrl.formFields[0].value) {
ctrl.formFields = Entaxy.getConnectorTemplateParams(ctrl.listConfig.selectedItems[0].name); // todo mb set values to null through map
ctrl.formFields.unshift({
label: 'factoryId',
type: 'java.lang.String',
helpText: null,
value: ctrl.listConfig.selectedItems[0].name,
isReadOnly: true
});
ctrl.formFields.forEach(formField => formField.type = Entaxy.convertToHtmlInputType(formField.type));
}
}
ctrl.back = function() {
ctrl.step1 = true;
ctrl.step2 = false;
}
ctrl.cancel = function(reason) {
ctrl.modalInstance.dismiss(reason);
}
function getChildModalFormFields(formField) {
// todo somehow use current formField to get childFormFields from server
let newFormFields = [];
for (var i = 0; i < 3; i++) {
newFormFields.push({
label: 'field' + i,
value: '',
type: Entaxy.convertToHtmlInputType('entaxy.runtime.profile')
});
}
newFormFields.push({
label: 'field3',
value: '',
type: Entaxy.convertToHtmlInputType('entaxy.runtime.profile'),
hasAddButton: true
});
return newFormFields;
}
ctrl.addModal = function(formField) {
let newFormFields = getChildModalFormFields();
$uibModal.open({
component: 'testModal',
resolve: {
modalTitle: () => 'Test Child Modal',
templates: () => [ { name: 'testChild' } ],
formFields: () => newFormFields
},
size: 'lg',
backdrop: 'static',
windowTopClass: 'modal-top-margin-override'
})
.result.then(args => {
_.forEach(args.fields, (field) => {
if (field.label === 'field0') { // fixme it may be id or name
formField.value = field.value;
}
});
formField.nestedValue = args;
});
}
ctrl.deleteNestedValue = function(formField) {
formField.nestedValue = null;
formField.value = null;
}
ctrl.save = function(item) {
ctrl.errors = validateFields(item);
if (Object.keys(ctrl.errors).length === 0) {
let factoryIdName = ctrl.formFields.shift().value;
let args = {
factoryId: ctrl.templates.find((template) => template.name === factoryIdName),
fields: ctrl.formFields.map(formField => { return { label: formField.label, value: (formField.nestedValue ? formField.nestedValue : formField.value) }; })
};
ctrl.modalInstance.close(args);
}
}
function validateFields(item) {
let errors = {};
// todo validation
return errors;
}
}
testModalController.$inject = ['workspace', '$uibModal'];
})(Entaxy || (Entaxy = {}));

View File

@ -0,0 +1,244 @@
/*-
* ~~~~~~licensing~~~~~~
* entaxy-management-plugin
* ==========
* Copyright (C) 2020 - 2021 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('testModal2', {
bindings: {
modalInstance: '<',
resolve: '<'
},
template:
`
<div style="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 ng-if="$ctrl.step1">
<div class="modal-body-header" style="height:70px; max-height:70px; margin-bottom:15px; padding-top: 5px; padding-left: 15px; padding-right: 15px; border-bottom: 1px #f5f5f5 solid;">
<h2>{{$ctrl.firstStepTitle}}</h2>
</div>
<div class="entaxy-modal-body" style="max-height: calc(100vh - 200px); overflow-y: auto; padding: 0px">
<first-step-modal-test templates="$ctrl.templates" selected="$ctrl.selectedItem" change-selection="$ctrl.changeSelection"></first-step-modal-test>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" ng-click="$ctrl.next()"
ng-disabled="!$ctrl.selectedItem">Next</button>
</div>
</div>
<div ng-if="$ctrl.step2">
<div class="modal-body-header" style="height:70px; max-height:70px; margin-bottom:15px; padding-top: 5px; padding-left: 15px; padding-right: 15px; border-bottom: 1px #f5f5f5 solid;">
<h2>{{$ctrl.secondStepTitle}}</h2>
</div>
<div class="entaxy-modal-body" style="max-height: calc(100vh - 200px); overflow-y: auto; padding: 0px">
<second-step-modal-test groups="$ctrl.groups" fields="$ctrl.formFields" errors="$ctrl.errors"></second-step-modal-test>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" ng-if="$ctrl.hasSteps" ng-click="$ctrl.back()">Back</button>
<button type="submit" class="btn btn-primary" ng-click="$ctrl.save($ctrl.formFields)">Add</button>
</div>
<div>
</div>
`,
controller: testModal2Controller
})
.name;
function testModal2Controller(workspace, $uibModal) {
'ngInject';
var ctrl = this;
ctrl.groups = [ { name: 'group1' }, { name: 'group2' }, {name: 'group3'} ];
ctrl.$onInit = function() {
ctrl.modalTitle = ctrl.resolve.modalTitle ? ctrl.resolve.modalTitle : 'Test Modal'; // fixme do required
ctrl.firstStepTitle = ctrl.resolve.firstStepTitle ? ctrl.resolve.firstStepTitle : ctrl.modalTitle;
ctrl.secondStepTitle = ctrl.resolve.secondStepTitle ? ctrl.resolve.secondStepTitle : ctrl.modalTitle;
ctrl.templates = ctrl.resolve.templates ? ctrl.resolve.templates : null;
for (let i = 0; i < 10; i++) {
ctrl.templates.push({ name : 'template' + i });
}
if (ctrl.templates && ctrl.templates.length !== 0) {
if (ctrl.templates.length > 1) {
ctrl.step1 = true;
ctrl.step2 = false;
ctrl.hasSteps = true;
} else if (ctrl.templates.length === 1) {
ctrl.hasSteps = false;
ctrl.next();
}
} else {
ctrl.cancel('Templates are not found');
}
}
function getFields() {
// todo get formFields from server
for (let i = 0; i < 2; i++) {
ctrl.formFields.push({
label: 'field' + i,
type: 'java.lang.String',
value: 'gr1',
group: 'group1'
});
}
ctrl.formFields.push({
label: 'field2',
type: 'java.lang.String',
value: 'gr1',
group: 'group1',
tag: ['group1', 'group3']
});
for (let i = 3; i < 5; i++) {
ctrl.formFields.push({
label: 'field' + i,
type: 'java.lang.String',
value: 'gr2',
group: 'group2'
});
}
ctrl.formFields.push({
label: 'field5',
type: 'java.lang.String',
value: 'gr3',
group: 'group3',
tag: ['group1', 'group3']
});
}
ctrl.next = function() {
ctrl.step1 = false;
ctrl.step2 = true;
if (!ctrl.formFields || ctrl.selectedItem.name !== ctrl.formFields[0].value) {
ctrl.formFields = [];
ctrl.formFields.push({
label: 'factoryId',
type: 'java.lang.String',
value: ctrl.hasSteps ? ctrl.selectedItem.name : ctrl.templates[0].name,
readOnly: true,
required: true
});
getFields();
ctrl.formFields.forEach(formField => formField.type = Entaxy.convertToHtmlInputType(formField.type));
}
}
ctrl.back = function() {
ctrl.step1 = true;
ctrl.step2 = false;
}
ctrl.cancel = function(reason) {
ctrl.modalInstance.dismiss(reason);
}
ctrl.changeSelection = function(item) {
ctrl.selectedItem = item;
}
// function getChildModalFormFields(formField) {
// // todo somehow use current formField to get childFormFields from server
//
// let newFormFields = [];
// for (var i = 0; i < 3; i++) {
// newFormFields.push({
// label: 'field' + i,
// value: '',
// type: Entaxy.convertToHtmlInputType('entaxy.runtime.profile')
// });
// }
// newFormFields.push({
// label: 'field3',
// value: '',
// type: Entaxy.convertToHtmlInputType('entaxy.runtime.profile'),
// hasAddButton: true
// });
// return newFormFields;
// }
//
// ctrl.addModal = function(formField) {
//
// let newFormFields = getChildModalFormFields();
//
// $uibModal.open({
// component: 'testModal2',
// resolve: {
// modalTitle: () => 'Test Child Modal',
// templates: () => [ { name: 'testChild' } ],
// formFields: () => newFormFields
// },
// size: 'lg',
// backdrop: 'static',
// windowTopClass: 'modal-top-margin-override'
// })
// .result.then(args => {
// _.forEach(args.fields, (field) => {
// if (field.label === 'field0') {
// formField.value = field.value;
// }
// });
// formField.nestedValue = args;
// });
// }
//
// ctrl.deleteNestedValue = function(formField) {
// formField.nestedValue = null;
// formField.value = null;
// }
ctrl.save = function(item) {
ctrl.errors = validateFields(item);
if (Object.keys(ctrl.errors).length === 0) {
let factoryIdName = ctrl.formFields.shift().value;
let args = {
factoryId: ctrl.templates.find((template) => template.name === factoryIdName),
fields: ctrl.formFields.map(formField => { return { label: formField.label, value: (formField.nestedValue ? formField.nestedValue : formField.value) }; })
};
ctrl.modalInstance.close(args);
}
}
function validateFields(item) {
let errors = {};
// todo validation
return errors;
}
}
testModal2Controller.$inject = ['workspace', '$uibModal'];
})(Entaxy || (Entaxy = {}));

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ru.entaxy.esb</groupId>
<artifactId>ui</artifactId>
<version>1.8.1</version>
<version>1.8.2</version>
</parent>
<groupId>ru.entaxy.esb.ui</groupId>
<artifactId>entaxy-hawtio</artifactId>
@ -13,7 +13,6 @@
<description>ENTAXY :: UI :: HAWTIO</description>
<properties>
<hawtio.version>2.14.1</hawtio.version>
<entaxy.underlying.version>${project.version}</entaxy.underlying.version>
</properties>
@ -44,7 +43,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.2</version>
</plugin>
</plugins>
</pluginManagement>

View File

@ -29,6 +29,7 @@
<feature name="${project.artifactId}" version="${project.version}" start-level="90">
<feature prerequisite="true">war</feature>
<feature prerequisite="true" version="${hawtio.version}">hawtio</feature>
<bundle>mvn:ru.entaxy.esb.system.management.file.upload/file-upload/${project.version}</bundle>
<bundle>webbundle:mvn:ru.entaxy.esb.ui.hawtio/entaxy-branding-plugin/${project.version}/war</bundle>
<bundle>webbundle:mvn:ru.entaxy.esb.ui.hawtio/entaxy-management-plugin/${project.version}/war</bundle>
<bundle>webbundle:mvn:ru.entaxy.esb.ui.hawtio/entaxy-h2-plugin/${project.version}/war</bundle>