ENTAXY-248 release 1.8.1

This commit is contained in:
2022-02-28 15:20:38 +03:00
parent 4d274c4fcc
commit c826adf1db
1958 changed files with 195926 additions and 10280 deletions

View File

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
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.

View File

@ -0,0 +1,233 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>ru.entaxy.esb.ui</groupId>
<artifactId>entaxy-hawtio</artifactId>
<version>1.8.1</version>
</parent>
<groupId>ru.entaxy.esb.ui.hawtio</groupId>
<artifactId>artemis-plugin-entaxy</artifactId>
<packaging>war</packaging>
<name>ENTAXY :: UI :: HAWTIO :: ARTEMIS PLUGIN</name>
<description>ENTAXY :: UI :: HAWTIO :: ARTEMIS PLUGIN</description>
<properties>
<activemq.basedir>${project.basedir}/../..</activemq.basedir>
<!-- filtered plugin properties, we don't define plugin-scripts here
as we build that dynamically using maven-antrun-plugin below. -->
<!-- plugin-context is what context this plugin will handle requests on
in the application server -->
<plugin-context>/artemis-plugin</plugin-context>
<!-- plugin-name is the name of our plugin, affects the name used for
the plugin's mbean -->
<plugin-name>artemis-plugin</plugin-name>
<!-- plugin-domain is currently unused, we just define it to an empty
string -->
<plugin-domain />
<!-- this lets this plugin deploy nicely into karaf, these get used
for the ImportPackage directive for maven-bundle-plugin -->
<bundle.osgi.import.pkg>
javax.servlet,
*;resolution:=optional
</bundle.osgi.import.pkg>
<webapp-dir>${project.artifactId}-${project.version}</webapp-dir>
<webapp-outdir>${basedir}/target/${webapp-dir}</webapp-outdir>
<schema-outdir>${basedir}/src/main/webapp/lib</schema-outdir>
<appjs-outfile>${webapp-outdir}/app/app.js</appjs-outfile>
<!--
<angular.version>1.7.9</angular.version>
-->
</properties>
<dependencies>
<dependency>
<groupId>io.hawt</groupId>
<artifactId>hawtio-plugin-mbean</artifactId>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- dependency>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_core</artifactId>
</dependency -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
</dependencies>
<build>
<!-- we want to ensure src/main/resources/WEB-INF/web.xml is being filtered
so that it picks up all of our javascript files -->
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
<plugins>
<!-- We use maven-antrun-plugin to build up a list of
javascript files for our plugin mbean, this means
it needs to run before the maven-resources-plugin
copies and filters the web.xml, since for this
example we use contextParam settings to configure
our plugin mbean -->
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>${maven-antrun-plugin.version}</version>
<executions>
<execution>
<!-- we run this early in the build process before
maven-resources-plugin is run. We're exporting the
plugin-scripts property from here, so we need to
use maven-antrun-plugin 1.6 or up -->
<id>generate-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<echo>Building plugin javascript file list</echo>
<!-- javascript-files will contain all of the javascript in
our project -->
<fileset id="javascript-files" dir="${basedir}/src/main/webapp">
<include name="**/*.js" />
</fileset>
<!-- we need to strip out the top level path which is
our source directory and be sure to change the directory
separators to forward slashes -->
<pathconvert pathsep="," dirsep="/" property="plugin-scripts" refid="javascript-files">
<map from="${basedir}/src/main/webapp/" to="" />
</pathconvert>
<echo>Files: ${plugin-scripts}</echo>
</target>
<!-- this exports plugin-scripts to the maven build, without
this line ${plugin-scripts} in the web.xml file won't be
replaced -->
<exportAntProperties>true</exportAntProperties>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<!-- version>${maven-resources-plugin-version}</version -->
<executions>
<execution>
<!-- defining this maven plugin in the same phase as the
maven-antrun-plugin but *after* we've configured the
maven-antrun-plugin ensures we filter resources *after*
we've discovered the plugin .js files. -->
<id>copy-resources</id>
<phase>generate-sources</phase>
<goals>
<goal>resources</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- maven-bundle-plugin config, needed to make this war
deployable in karaf, defines the context that this bundle
should handle requests on -->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
<configuration>
<manifestLocation>${webapp-outdir}/META-INF</manifestLocation>
<supportedProjectTypes>
<supportedProjectType>jar</supportedProjectType>
<supportedProjectType>bundle</supportedProjectType>
<supportedProjectType>war</supportedProjectType>
</supportedProjectTypes>
<instructions>
<Webapp-Context>${plugin-context}</Webapp-Context>
<Web-ContextPath>${plugin-context}</Web-ContextPath>
<Embed-Directory>WEB-INF/lib</Embed-Directory>
<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
<!-- Export-Package>${osgi.export}</Export-Package>
<Import-Package>${osgi.import}</Import-Package>
<DynamicImport-Package>${osgi.dynamic}</DynamicImport-Package>
<Private-Package>${osgi.private.pkg}</Private-Package -->
<Bundle-ClassPath>.,WEB-INF/classes</Bundle-ClassPath>
<Bundle-Name>${project.name}</Bundle-Name>
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
<Implementation-Title>Entaxy</Implementation-Title>
<Implementation-Version>${project.version}</Implementation-Version>
</instructions>
</configuration>
</plugin>
<!-- We define the maven-war-plugin here and make sure it uses
the manifest file generated by the maven-bundle-plugin. We
also ensure it picks up our filtered web.xml and not the one
in src/main/resources -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<outputFileNameMapping>@{artifactId}@-@{baseVersion}@@{dashClassifier?}@.@{extension}@</outputFileNameMapping>
<packagingExcludes>**/classes/OSGI-INF/**</packagingExcludes>
<failOnMissingWebXml>false</failOnMissingWebXml>
<archive>
<manifestFile>${webapp-outdir}/META-INF/MANIFEST.MF</manifestFile>
</archive>
<webResources>
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
<includes>
<include>**/*.*</include>
</includes>
<excludes>
<exclude>log4j.properties</exclude>
</excludes>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,90 @@
/*-
* ~~~~~~licensing~~~~~~
* artemis-plugin-entaxy
* ==========
* 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~~~~~~
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
package org.apache.activemq.hawtio.plugin;
import io.hawt.web.plugin.HawtioPlugin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
/**
* The Plugin Context Listener used to load in the plugin
**/
public class PluginContextListener implements ServletContextListener {
private static final Logger LOG = LoggerFactory.getLogger(PluginContextListener.class);
HawtioPlugin plugin = null;
@Override
public void contextInitialized(ServletContextEvent servletContextEvent) {
ServletContext context = servletContextEvent.getServletContext();
plugin = new HawtioPlugin();
plugin.setContext(context.getContextPath());
plugin.setName(context.getInitParameter("plugin-name"));
plugin.setScripts(context.getInitParameter("plugin-scripts"));
plugin.setDomain(null);
try {
plugin.init();
} catch (Exception e) {
throw createServletException(e);
}
LOG.info("Initialized {} plugin", plugin.getName());
}
@Override
public void contextDestroyed(ServletContextEvent servletContextEvent) {
try {
plugin.destroy();
} catch (Exception e) {
throw createServletException(e);
}
LOG.info("Destroyed {} plugin", plugin.getName());
}
protected RuntimeException createServletException(Exception e) {
return new RuntimeException(e);
}
}

View File

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~~~~~~licensing~~~~~~
artemis-plugin-entaxy
==========
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~~~~~~
-->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
-->
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<description>An Artemis Plugin</description>
<display-name>An Artemis plugin</display-name>
<context-param>
<description>Plugin's path on the server</description>
<param-name>plugin-context</param-name>
<param-value>${plugin-context}</param-value>
</context-param>
<context-param>
<description>Plugin's path on the server</description>
<param-name>plugin-name</param-name>
<param-value>${project.artifactId}</param-value>
</context-param>
<context-param>
<description>Plugin's path on the server</description>
<param-name>plugin-domain</param-name>
<param-value>${plugin-domain}</param-value>
</context-param>
<context-param>
<description>Plugin's path on the server</description>
<param-name>plugin-scripts</param-name>
<param-value>${plugin-scripts}</param-value>
</context-param>
<context-param>
<description>Disable listing of directories and files</description>
<param-name>org.eclipse.jetty.servlet.Default.dirAllowed</param-name>
<param-value>false</param-value>
</context-param>
<listener>
<listener-class>org.apache.activemq.hawtio.plugin.PluginContextListener</listener-class>
</listener>
</web-app>

View File

@ -0,0 +1,42 @@
###
# ~~~~~~licensing~~~~~~
# artemis-plugin-entaxy
# ==========
# 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~~~~~~
###
## ---------------------------------------------------------------------------
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements. See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You 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.
## ---------------------------------------------------------------------------
log4j.rootLogger=INFO, console
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%-5p | %t | %m%n

View File

@ -0,0 +1,47 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
Architecture
-->
<!DOCTYPE html>
<!--
~~~~~~licensing~~~~~~
artemis-plugin-entaxy
==========
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~~~~~~
-->
<html>
<head>
<meta charset="utf-8"/>
<title>Artemis plugin</title>
</head>
<body>
<h1>Hawtio :: Artemis plugin</h1>
</body>
</html>

View File

@ -0,0 +1,19 @@
### Artemis
Click [Artemis](#/jmx/attributes?tab=artemis) in the top navigation bar to see the Artemis specific plugin. (The Artemis tab won't appear if there is no broker in this JVM). The Artemis plugin works very much the same as the JMX plugin however with a focus on interacting with an Artemis broker.
The tree view on the left-hand side shows the top level JMX tree of each broker instance running in the JVM. Expanding the tree will show the various MBeans registered by Artemis that you can inspect via the **Attributes** tab.
#### Creating a new Address
To create a new address simply click on the broker or the address folder in the jmx tree and click on the create tab.
Once you have created an address you should be able to **Send** to it by clicking on it in the jmx tree and clicking on the send tab.
#### Creating a new Queue
To create a new queue click on the address you want to bind the queue to and click on the create tab.
Once you have created a queue you should be able to **Send** a message to it or **Browse** it or view the **Attributes** or **Charts**. Simply click on the queue in th ejmx tree and click on the appropriate tab.
You can also see a graphical view of all brokers, addresses, queues and their consumers using the **Diagram** tab.

View File

@ -0,0 +1,93 @@
<!--
~~~~~~licensing~~~~~~
artemis-plugin-entaxy
==========
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~~~~~~
-->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
Architecture
-->
<form class="form-horizontal artemis-preferences-form" ng-controller="Artemis.PreferencesController">
<div class="form-group">
<label class="col-md-2 control-label" for="artemisUserName">
Artemis user name
<span class="pficon pficon-info" data-toggle="tooltip" data-placement="top" title="The user name to be used when connecting to the broker"></span>
</label>
<div class="col-md-6">
<input id="artemisUserName" type="text" class="form-control" ng-model="artemisUserName"/>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label" for="artemisPassword">
Artemis password
<span class="pficon pficon-info" data-toggle="tooltip" data-placement="top" title="The user name to be used when connecting to the broker"></span>
</label>
<div class="col-md-6">
<input id="artemisPassword" type="password" class="form-control" ng-model="artemisPassword"/>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label" for="artemisDLQ">
Dead-letter address regex
<span class="pficon pficon-info" data-toggle="tooltip" data-placement="top" title="A regular expression to match one or more dead-letter addresses"></span>
</label>
<div class="col-md-6">
<input type="text" id="artemisDLQ" ng-model="artemisDLQ">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label" for="artemisExpiryQueue">
Expiry address regex
<span class="pficon pficon-info" data-toggle="tooltip" data-placement="top" title="A regular expression to match one or more expiry addresses"></span>
</label>
<div class="col-md-6">
<input type="text" id="artemisExpiryQueue" ng-model="artemisExpiryQueue">
</div>
</div>
<!-- <div class="form-group">
<label class="col-md-2 control-label" for="artemisBrowseBytesMessages">
Display message body as
<span class="pficon pficon-info" data-toggle="tooltip" data-placement="top" title="Browsing byte messages should display the message body as"></span>
</label>
<div class="col-md-6">
<select id="artemisBrowseBytesMessages"
ng-model="artemisBrowseBytesMessages"
ng-options="key for (key, value) in messageBodyDisplayOptions"
ng-selected="artemisBrowseBytesMessages === value">
</select>
</div>
</div>-->
</form>

View File

@ -0,0 +1,39 @@
<!--
~~~~~~licensing~~~~~~
artemis-plugin-entaxy
==========
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~~~~~~
-->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
Architecture
-->
<div class="tree-nav-sidebar-content">
<div id="artemistree" class="treeview-pf-hover treeview-pf-select"></div>
</div>

View File

@ -0,0 +1,60 @@
<!--
~~~~~~licensing~~~~~~
artemis-plugin-entaxy
==========
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~~~~~~
-->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
Architecture
-->
<div class="tree-nav-sidebar-header">
<form role="form" class="search-pf has-button">
<div class="form-group has-clear">
<div class="search-pf-input-group">
<label for="input-search" class="sr-only">Search Tree:</label>
<input id="input-search" type="search" class="form-control" placeholder="Search tree:"
ng-model="$ctrl.filter">
<button type="button" class="clear" aria-hidden="true"
ng-hide="$ctrl.filter.length === 0"
ng-click="$ctrl.filter = ''">
<span class="pficon pficon-close"></span>
</button>
</div>
</div>
<div class="form-group tree-nav-buttons">
<span class="badge" ng-class="{positive: $ctrl.result.length > 0}"
ng-show="$ctrl.filter.length > 0">
{{$ctrl.result.length}}
</span>
<i class="fa fa-plus-square-o" title="Expand All" ng-click="$ctrl.expandAll()"></i>
<i class="fa fa-minus-square-o" title="Collapse All" ng-click="$ctrl.contractAll()"></i>
</div>
</form>
</div>

View File

@ -0,0 +1,58 @@
/*-
* ~~~~~~licensing~~~~~~
* artemis-plugin-entaxy
* ==========
* 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~~~~~~
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
var Artemis;
(function (Artemis) {
function artemisJmxDomain() {
return localStorage['artemisJmxDomain'] || "org.apache.activemq.artemis";
}
Artemis.artemisJmxDomain = artemisJmxDomain;;
function ownUnescape(name) {
//simple return unescape(name); does not work for this :(
return name.replace(/\\\\/g, "\\").replace(/\\\*/g, "*").replace(/\\\?/g, "?");
};
Artemis.ownUnescape = ownUnescape;
function getBrokerMBean(workspace, jolokia) {
var mbean = null;
var selection = workspace.selection;
var folderNames = selection.folderNames;
mbean = "" + folderNames[0] + ":broker=\"" + folderNames[1] + "\"";
return mbean;
}
Artemis.getBrokerMBean = getBrokerMBean;
})(Artemis || (Artemis = {}));

View File

@ -0,0 +1,101 @@
/*-
* ~~~~~~licensing~~~~~~
* artemis-plugin-entaxy
* ==========
* 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~~~~~~
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/**
* The main entry point for the Simple module
*/
var Artemis = (function (Artemis) {
/**
* The name of this plugin
*/
Artemis.pluginName = 'artemis-plugin';
/**
* This plugin's logger instance
*/
Artemis.log = Logger.get('artemis-plugin');
/**
* The top level path of this plugin on the server
*/
Artemis.contextPath = "/artemis-plugin/";
Artemis.log.info("loading artemis plugin")
Artemis._module = angular.module(Artemis.pluginName, [
'angularResizable'
])
.component('artemis', {
template:
`<div class="tree-nav-layout">
<div class="sidebar-pf sidebar-pf-left" resizable r-directions="['right']">
<artemis-tree-header></artemis-tree-header>
<artemis-tree></artemis-tree>
</div>
<div class="tree-nav-main">
<jmx-header></jmx-header>
<artemis-navigation></artemis-navigation>
<div class="contents" ng-view></div>
</div>
</div>
`
})
.run(configurePlugin);
function configurePlugin(mainNavService, workspace, helpRegistry, preferencesRegistry, localStorage, preLogoutTasks, documentBase, $templateCache) {
var artemisJmxDomain = localStorage['artemisJmxDomain'] || "org.apache.activemq.artemis";
mainNavService.addItem({
title: 'Artemis',
basePath: '/artemis',
template: '<artemis></artemis>',
isValid: function () { return workspace.treeContainsDomainAndProperties(artemisJmxDomain); }
});
// clean up local storage upon logout
preLogoutTasks.addTask('CleanupArtemisCredentials', function () {
Artemis.log.debug("Clean up Artemis credentials in local storage");
localStorage.removeItem('artemisUserName');
localStorage.removeItem('artemisPassword');
});
}
configurePlugin.$inject = ['mainNavService', 'workspace', 'helpRegistry', 'preferencesRegistry', 'localStorage', 'preLogoutTasks', 'documentBase', '$templateCache'];
return Artemis;
})(Artemis || {});
// tell the Hawtio plugin loader about our plugin so it can be
// bootstrapped with the rest of AngularJS
hawtioPluginLoader.addModule(Artemis.pluginName);

View File

@ -0,0 +1,175 @@
/*-
* ~~~~~~licensing~~~~~~
* artemis-plugin-entaxy
* ==========
* 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~~~~~~
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/// <reference path="tree.component.ts"/>
var Artemis;
(function (Artemis) {
Artemis.log.debug("loading address send message");
Artemis._module.component('artemisAddressSendMessage', {
template:
`<h1>Send Message
<button type="button" class="btn btn-link jvm-title-popover"
uib-popover-template="'send-message-instructions.html'" popover-placement="bottom-left"
popover-title="Instructions" popover-trigger="'outsideClick'">
<span class="pficon pficon-help"></span>
</button>
</h1>
<div class="alert alert-warning" ng-show="$ctrl.message.noCredentials">
<span class="pficon pficon-warning-triangle-o"></span>
<strong>No credentials set for endpoint!</strong>
Please set your username and password in the
<a href="#" class="alert-link" ng-click="$ctrl.message.openPrefs()">Preferences</a> page.
</div>
<div class="row artemis-message-configuration">
<div class="col-sm-12">
<form>
<div class="form-group">
<label>Durable </label>
<input id="durable" type="checkbox" ng-model="$ctrl.message.durable" value="true">
<button type="button" class="btn btn-link jvm-title-popover"
uib-popover-template="'durable-info.html'" popover-placement="bottom-left"
popover-title="Durable" popover-trigger="'mouseenter'">
<span class="pficon pficon-info"></span>
</button>
</div>
<div class="form-group">
<label>Create Message ID </label>
<input id="messageID" type="checkbox" ng-model="$ctrl.message.messageID" value="true">
<button type="button" class="btn btn-link jvm-title-popover"
uib-popover-template="'message-id-info.html'" popover-placement="bottom-left"
popover-title="Message ID" popover-trigger="'mouseenter'">
<span class="pficon pficon-info"></span>
</button>
</div>
</form>
</div>
</div>
<h3>Headers</h3>
<div class="form-group" ng-if="$ctrl.message.headers.length > 0">
<table class="scr-component-references-table table">
<tbody>
<tr class="input-group" ng-repeat="header in $ctrl.message.headers">
<td><input type="text" class="form-control" ng-model="header.name" placeholder="Name" autocomplete="off" id="name"></td>
<td><input type="text" class="form-control" ng-model="header.value" placeholder="Value" autocomplete="off" id="value"></td>
<td><div class="input-group-prepend">
<button type="button" class="btn btn-default" title="Delete" ng-click="$ctrl.message.removeHeader(header)">
<span class="pficon pficon-delete"></span>
</button>
</div></td>
</tr>
</tbody>
</table>
</div>
<p>
<button type="button" class="btn btn-primary artemis-add-message-button" ng-click="$ctrl.message.addHeader()">Add Header</button>
</p>
<h3>Body</h3>
<form>
<div class="form-group">
<div hawtio-editor="$ctrl.message.message" mode="codeMirrorOptions.mode.name"></div>
</div>
<div class="form-group">
<select class="form-control artemis-send-message-format" ng-model="codeMirrorOptions.mode.name">
<option value="javascript">JSON</option>
<option value="xml">XML</option>
</select>
<button class="btn btn-default" ng-click="$ctrl.message.formatMessage()"
title="Automatically pretty prints the message so its easier to read">Format
</button>
</div>
</form>
<p>
<button type="button" class="btn btn-primary artemis-send-message-button" ng-click="$ctrl.message.sendMessage($ctrl.message.durable, $ctrl.message.messageID)">Send message</button>
</p>
<script type="text/ng-template" id="send-message-instructions.html">
<div>
<p>
This page allows you to send a message to the chosen address. The message will be of type <code>text</code>
message and it will be possible to add headers to the message. The sending of the message will be authenticated
using the username and password set ion <code>preferences</code>, if this is not set then these will
be null.
</p>
</div>
</script>
<script type="text/ng-template" id="message-id-info.html">
<div>
<p>
The Message ID is an automatically generated UUID that is set on the Message by the broker before it is routed.
If using a JMS client this would be the JMS Message ID on the JMS Message, this typically would not get
set for non JMS clients. Historically and on some other tabs this is also referred to as the User ID.
</p>
</div>
</script>
<script type="text/ng-template" id="durable-info.html">
<div>
<p>
If durable the message will be marked persistent and written to the brokers journal if the destination queue is durable.
</p>
</div>
</script>
`,
controller: AddressSendMessageController
})
.name;
Artemis.log.debug("loaded queue " + Artemis.createQueueModule);
function AddressSendMessageController($route, $scope, $element, $timeout, workspace, jolokia, localStorage, $location, artemisMessage, messageCreator) {
Core.initPreferenceScope($scope, localStorage, {
'durable': {
'value': true,
'converter': Core.parseBooleanValue
},
'messageID': {
'value': true,
'converter': Core.parseBooleanValue
}
});
var ctrl = this;
ctrl.messageCreator = messageCreator;
ctrl.message = ctrl.messageCreator.createNewMessage($scope, $location, $route, localStorage, artemisMessage, workspace, $element, $timeout, jolokia);
}
AddressSendMessageController.$inject = ['$route', '$scope', '$element', '$timeout', 'workspace', 'jolokia', 'localStorage', '$location', 'artemisMessage', 'messageCreator'];
})(Artemis || (Artemis = {}));

View File

@ -0,0 +1,272 @@
/*-
* ~~~~~~licensing~~~~~~
* artemis-plugin-entaxy
* ==========
* 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~~~~~~
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
var Artemis;
(function (Artemis) {
//Artemis.log.debug("loading addresses");
Artemis._module.component('artemisAddresses', {
template:
`<h1>Browse Addresses
<button type="button" class="btn btn-link jvm-title-popover"
uib-popover-template="'addresses-instructions.html'" popover-placement="bottom-left"
popover-title="Instructions" popover-trigger="'outsideClick'">
<span class="pficon pficon-help"></span>
</button>
</h1>
<div ng-include="'plugin/artemistoolbar.html'"></div>
<pf-table-view config="$ctrl.tableConfig"
dt-options="$ctrl.dtOptions"
columns="$ctrl.tableColumns"
action-buttons="$ctrl.tableActionButtons"
items="$ctrl.addresses">
</pf-table-view>
<div ng-include="'plugin/artemispagination.html'"></div>
<script type="text/ng-template" id="addresses-instructions.html">
<div>
<p>
This page allows you to browse all address on the broker. These can be narrowed down
by specifying a filter and also sorted using the sort function in the toolbar. To execute a query
click on the <span class="fa fa-search"></span> button.
</p>
<p>
You can also navigate directly to the JMX attributes and operations tabs by using the <code>attributes</code>
and <code>operations</code> button under the <code>Actions</code> column.You can navigate to the
addresses queues by clicking on the <code>Queue Count</code> field.
</p>
<p>
Note that each page is loaded in from the broker when navigating to a new page or when a query is executed.
</p>
</div>
</script>
`,
controller: AddressesController
})
.name;
function AddressesController($scope, workspace, jolokia, localStorage, artemisMessage, $location, $timeout, $filter, $sanitize, pagination, artemisAddress) {
var ctrl = this;
ctrl.pagination = pagination;
ctrl.pagination.reset();
var mbean = Artemis.getBrokerMBean(workspace, jolokia);
ctrl.allAddresses = [];
ctrl.addresses = [];
ctrl.workspace = workspace;
ctrl.refreshed = false;
ctrl.dtOptions = {
// turn of ordering as we do it ourselves
ordering: false,
columns: [
{name: "ID", visible: true},
{name: "Name", visible: true},
{name: "Routing Types", visible: true},
{name: "Queue Count", visible: true}
]
};
Artemis.log.debug('sessionStorage: addressColumnDefs =', localStorage.getItem('addressColumnDefs'));
if (localStorage.getItem('addressColumnDefs')) {
loadedDefs = JSON.parse(localStorage.getItem('addressColumnDefs'));
//sanity check to make sure columns havent been added
if(loadedDefs.length === ctrl.dtOptions.columns.length) {
ctrl.dtOptions.columns = loadedDefs;
}
}
ctrl.updateColumns = function () {
var attributes = [];
ctrl.dtOptions.columns.forEach(function (column) {
attributes.push({name: column.name, visible: column.visible});
});
Artemis.log.debug("saving columns " + JSON.stringify(attributes));
localStorage.setItem('addressColumnDefs', JSON.stringify(attributes));
}
ctrl.filter = {
fieldOptions: [
{id: 'id', name: 'ID'},
{id: 'name', name: 'Name'},
{id: 'routingTypes', name: 'Routing Types'},
{id: 'queueCount', name: 'Queue Count'}
],
operationOptions: [
{id: 'EQUALS', name: 'Equals'},
{id: 'CONTAINS', name: 'Contains'},
{id: 'NOT_CONTAINS', name: 'Does Not Contain'},
{id: 'GREATER_THAN', name: 'Greater Than'},
{id: 'LESS_THAN', name: 'Less Than'}
],
sortOptions: [
{id: 'asc', name: 'ascending'},
{id: 'desc', name: 'descending'}
],
values: {
field: "",
operation: "",
value: "",
sortOrder: "asc",
sortColumn: "id"
},
text: {
fieldText: "Filter Field..",
operationText: "Operation..",
sortOrderText: "ascending",
sortByText: "ID"
}
};
ctrl.tableActionButtons = [
{
name: 'attributes',
title: 'Navigate to attributes',
actionFn: navigateToAddressAtts
},
{
name: 'operations',
title: 'navigate to operations',
actionFn: navigateToAddressOps
}
];
ctrl.tableConfig = {
selectionMatchProp: 'id',
showCheckboxes: false
};
ctrl.tableColumns = [
{ header: 'ID', itemField: 'id' },
{ header: 'Name', itemField: 'name' },
{ header: 'Routing Types', itemField: 'routingTypes' },
{ header: 'Queue Count', itemField: 'queueCount' , templateFn: function(value, item) { return '<a href="#" onclick="selectQueues(' + item.idx + ')">' + $sanitize(value) + '</a>' }}
];
ctrl.refresh = function () {
ctrl.refreshed = true;
ctrl.pagination.load();
};
ctrl.reset = function () {
ctrl.filter.values.field = "";
ctrl.filter.values.operation = "";
ctrl.filter.values.value = "";
ctrl.filter.sortOrder = "asc";
ctrl.filter.sortColumn = "id";
ctrl.refreshed = true;
artemisAddress.address = null;
ctrl.pagination.load();
};
if (artemisAddress.address) {
Artemis.log.debug("navigating to address = " + artemisAddress.address.address);
ctrl.filter.values.field = ctrl.filter.fieldOptions[1].id;
ctrl.filter.values.operation = ctrl.filter.operationOptions[0].id;
ctrl.filter.values.value = artemisAddress.address.address;
artemisAddress.address = null;
}
selectQueues = function (idx) {
var address = ctrl.addresses[idx].name;
Artemis.log.debug("navigating to queues:" + address)
artemisAddress.address = { address: address };
$location.path("artemis/artemisQueues");
};
function navigateToAddressAtts(action, item) {
$location.path("artemis/attributes").search({"tab": "artemis", "nid": getAddressNid(item.name, $location)});
};
function navigateToAddressOps(action, item) {
$location.path("artemis/operations").search({"tab": "artemis", "nid": getAddressNid(item.name, $location)});
};
function getAddressNid(address, $location) {
var rootNID = getRootNid($location);
var targetNID = rootNID + "addresses-" + address;
Artemis.log.debug("targetNID=" + targetNID);
return targetNID;
}
function getRootNid($location) {
var currentNid = $location.search()['nid'];
Artemis.log.debug("current nid=" + currentNid);
var firstDash = currentNid.indexOf('-');
var secondDash = currentNid.indexOf('-', firstDash + 1);
var thirdDash = currentNid.indexOf('-', secondDash + 1);
if (thirdDash < 0) {
return currentNid + "-";
}
var rootNID = currentNid.substring(0, thirdDash + 1);
return rootNID;
}
ctrl.loadOperation = function () {
if (mbean) {
var method = 'listAddresses(java.lang.String, int, int)';
var addressFilter = {
field: ctrl.filter.values.field,
operation: ctrl.filter.values.operation,
value: ctrl.filter.values.value,
sortOrder: ctrl.filter.values.sortOrder,
sortColumn: ctrl.filter.values.sortColumn
};
if (ctrl.refreshed == true) {
ctrl.pagination.reset();
ctrl.refreshed = false;
}
jolokia.request({ type: 'exec', mbean: mbean, operation: method, arguments: [JSON.stringify(addressFilter), ctrl.pagination.pageNumber, ctrl.pagination.pageSize] }, Core.onSuccess(populateTable, { error: onError }));
}
};
ctrl.pagination.setOperation(ctrl.loadOperation);
function onError(response) {
Core.notification("error", "could not invoke list sessions" + response.error);
$scope.workspace.selectParentNode();
};
function populateTable(response) {
var data = JSON.parse(response.value);
ctrl.addresses = [];
angular.forEach(data["data"], function (value, idx) {
value.idx = idx;
ctrl.addresses.push(value);
});
ctrl.pagination.page(data["count"]);
allAddresses = ctrl.addresses;
ctrl.addresses = allAddresses;
Core.$apply($scope);
}
ctrl.pagination.load();
}
AddressesController.$inject = ['$scope', 'workspace', 'jolokia', 'localStorage', 'artemisMessage', '$location', '$timeout', '$filter', '$sanitize', 'pagination', 'artemisAddress'];
})(Artemis || (Artemis = {}));

View File

@ -0,0 +1,295 @@
/*-
* ~~~~~~licensing~~~~~~
* artemis-plugin-entaxy
* ==========
* 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~~~~~~
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
var Artemis;
(function (Artemis) {
Artemis.log.debug("loading connections");
Artemis._module.component('artemisConnections', {
template:
`
<h1>Browse Connections
<button type="button" class="btn btn-link jvm-title-popover"
uib-popover-template="'connections-instructions.html'" popover-placement="bottom-left"
popover-title="Instructions" popover-trigger="'outsideClick'">
<span class="pficon pficon-help"></span>
</button>
</h1>
<div ng-include="'plugin/artemistoolbar.html'"></div>
<pf-table-view config="$ctrl.tableConfig"
dt-options="$ctrl.dtOptions"
columns="$ctrl.tableColumns"
action-buttons="$ctrl.tableActionButtons"
items="$ctrl.connections">
</pf-table-view>
<div ng-include="'plugin/artemispagination.html'"></div>
<div hawtio-confirm-dialog="$ctrl.closeDialog" title="Close Connection?"
ok-button-text="Close"
cancel-button-text="Cancel"
on-ok="$ctrl.closeConnection()">
<div class="dialog-body">
<p class="alert alert-warning">
<span class="pficon pficon-warning-triangle-o"></span>
You are about to close the selected connection: {{$ctrl.connectionToDelete}}
<p>Are you sure you want to continue.</p>
</p>
</div>
</div>
<script type="text/ng-template" id="connections-instructions.html">
<div>
<p>
This page allows you to browse all connections currently connected to the broker, including client, cluster
and bridge connections. These can be narrowed down by specifying a filter and also sorted using the sort
function in the toolbar. To execute a query click on the <span class="fa fa-search"></span> button.
</p>
<p>
Connections can be closed by using the <code>close</code> button under the <code>Actions</code> column and you can
navigate to the connections sessions open by clicking on the <code>Session Count</code> field.
</p>
<p>
Note that each page is loaded in from the broker when navigating to a new page or when a query is executed.
</p>
</div>
</script>
`,
controller: ConnectionsController
})
.name;
function ConnectionsController($scope, workspace, jolokia, localStorage, artemisMessage, $location, $timeout, $filter, $sanitize, pagination, artemisConnection, artemisSession) {
var ctrl = this;
ctrl.pagination = pagination;
ctrl.pagination.reset();
var mbean = Artemis.getBrokerMBean(workspace, jolokia);
ctrl.allConnections = [];
ctrl.connections = [];
ctrl.pageNumber = 1;
ctrl.workspace = workspace;
ctrl.refreshed = false;
ctrl.connectionToDelete = '';
ctrl.closeDialog = false;
ctrl.dtOptions = {
// turn of ordering as we do it ourselves
ordering: false,
columns: [
{name: "ID", visible: true},
{name: "Client ID", visible: true},
{name: "Users", visible: true},
{name: "Protocol", visible: true},
{name: "Session Count", visible: true},
{name: "Remote Address", visible: true},
{name: "Local Address", visible: true},
{name: "Session ID", visible: true},
{name: "Creation Time", visible: true}
]
};
Artemis.log.debug('localStorage: connectionsColumnDefs =', localStorage.getItem('connectionsColumnDefs'));
if (localStorage.getItem('connectionsColumnDefs')) {
loadedDefs = JSON.parse(localStorage.getItem('connectionsColumnDefs'));
//sanity check to make sure columns havent been added
if(loadedDefs.length === ctrl.dtOptions.columns.length) {
ctrl.dtOptions.columns = loadedDefs;
}
Artemis.log.debug('loaded' + ctrl.dtOptions.columns);
}
ctrl.updateColumns = function () {
var attributes = [];
ctrl.dtOptions.columns.forEach(function (column) {
attributes.push({name: column.name, visible: column.visible});
});
Artemis.log.debug("saving columns " + JSON.stringify(attributes));
localStorage.setItem('connectionsColumnDefs', JSON.stringify(attributes));
}
ctrl.filter = {
fieldOptions: [
{id: 'connectionID', name: 'ID'},
{id: 'clientID', name: 'Client ID'},
{id: 'users', name: 'Users'},
{id: 'protocol', name: 'Protocol'},
{id: 'sessionCount', name: 'Session Count'},
{id: 'remoteAddress', name: 'Remote Address'},
{id: 'localAddress', name: 'Local Address'},
{id: 'sessionID', name: 'Session ID'}
],
operationOptions: [
{id: 'EQUALS', name: 'Equals'},
{id: 'CONTAINS', name: 'Contains'},
{id: 'NOT_CONTAINS', name: 'Does Not Contain'},
{id: 'GREATER_THAN', name: 'Greater Than'},
{id: 'LESS_THAN', name: 'Less Than'}
],
sortOptions: [
{id: 'asc', name: 'ascending'},
{id: 'desc', name: 'descending'}
],
values: {
field: "",
operation: "",
value: "",
sortOrder: "asc",
sortColumn: "connectionID"
},
text: {
fieldText: "Filter Field..",
operationText: "Operation..",
sortOrderText: "ascending",
sortByText: "ID"
}
};
ctrl.tableActionButtons = [
{
name: 'Close',
title: 'Close the Connection',
actionFn: openCloseDialog
}
];
ctrl.tableConfig = {
selectionMatchProp: 'connectionID',
showCheckboxes: false
};
ctrl.tableColumns = [
{ header: 'ID', itemField: 'connectionID' },
{ header: 'Client ID', itemField: 'clientID' },
{ header: 'Users', itemField: 'users' },
{ header: 'protocol', itemField: 'protocol' },
{ header: 'Session Count', itemField: 'sessionCount', templateFn: function(value, item) { return '<a href="#" onclick="selectSessions(' + item.idx + ')">' + $sanitize(value) + '</a>' }},
{ header: 'Remote Address', itemField: 'remoteAddress' },
{ header: 'Local Address', itemField: 'localAddress' },
{ header: 'Creation Time', itemField: 'creationTime' }
];
selectSessions = function (idx) {
var connection = ctrl.connections[idx].connectionID;
Artemis.log.debug("navigating to connection:" + connection)
artemisConnection.connection = { connectionID: connection };
$location.path("artemis/artemisSessions");
};
if (artemisSession.session) {
Artemis.log.debug("navigating to session = " + artemisSession.session.connectionID);
ctrl.filter.values.field = ctrl.filter.fieldOptions[0].id;
ctrl.filter.values.operation = ctrl.filter.operationOptions[0].id;
ctrl.filter.values.value = artemisSession.session.connectionID;
artemisSession.session = null;
}
ctrl.refresh = function () {
ctrl.refreshed = true;
ctrl.pagination.load();
};
ctrl.reset = function () {
ctrl.filter.values.field = "";
ctrl.filter.values.operation = "";
ctrl.filter.values.value = "";
ctrl.filter.sortOrder = "asc";
ctrl.filter.sortColumn = "connectionID";
ctrl.filter.text.fieldText = "Filter Field..";
ctrl.filter.text.operationText = "Operation..";
ctrl.filter.text.sortOrderText = "ascending";
ctrl.filter.text.sortByText = "ID";
ctrl.refreshed = true;
artemisSession.session = null;
ctrl.pagination.load();
};
ctrl.loadOperation = function () {
if (mbean) {
var method = 'listConnections(java.lang.String, int, int)';
var connectionsFilter = {
field: ctrl.filter.values.field,
operation: ctrl.filter.values.operation,
value: ctrl.filter.values.value,
sortOrder: ctrl.filter.values.sortOrder,
sortColumn: ctrl.filter.values.sortColumn
};
if (ctrl.refreshed == true) {
ctrl.pagination.reset();
ctrl.refreshed = false;
}
Artemis.log.info(JSON.stringify(connectionsFilter));
jolokia.request({ type: 'exec', mbean: mbean, operation: method, arguments: [JSON.stringify(connectionsFilter), ctrl.pagination.pageNumber, ctrl.pagination.pageSize] }, Core.onSuccess(populateTable, { error: onError }));
}
};
function openCloseDialog(action, item) {
ctrl.connectionToDelete = item.connectionID;
ctrl.closeDialog = true;
}
ctrl.closeConnection = function () {
Artemis.log.debug("closing connection: " + ctrl.connectionToDelete);
if (mbean) {
jolokia.request({ type: 'exec',
mbean: mbean,
operation: 'closeConnectionWithID(java.lang.String)',
arguments: [ctrl.connectionToDelete] },
Core.onSuccess(ctrl.pagination.load(), { error: function (response) {
Core.defaultJolokiaErrorHandler("Could not close connection: " + response);
}}));
}
};
pagination.setOperation(ctrl.loadOperation);
function onError(response) {
Core.notification("error", "could not invoke list connections" + response.error);
$scope.workspace.selectParentNode();
};
function populateTable(response) {
var data = JSON.parse(response.value);
ctrl.connections = [];
angular.forEach(data["data"], function (value, idx) {
value.idx = idx;
ctrl.connections.push(value);
});
ctrl.pagination.page(data["count"]);
allConnections = ctrl.connections;
ctrl.connections = allConnections;
Core.$apply($scope);
}
ctrl.pagination.load();
}
ConnectionsController.$inject = ['$scope', 'workspace', 'jolokia', 'localStorage', 'artemisMessage', '$location', '$timeout', '$filter', '$sanitize', 'pagination', 'artemisConnection', 'artemisSession'];
})(Artemis || (Artemis = {}));

View File

@ -0,0 +1,320 @@
/*-
* ~~~~~~licensing~~~~~~
* artemis-plugin-entaxy
* ==========
* 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~~~~~~
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
var Artemis;
(function (Artemis) {
Artemis._module.component('artemisConsumers', {
template:
`<h1>Browse Consumers
<button type="button" class="btn btn-link jvm-title-popover"
uib-popover-template="'consumers-instructions.html'" popover-placement="bottom-left"
popover-title="Instructions" popover-trigger="'outsideClick'">
<span class="pficon pficon-help"></span>
</button>
</h1>
<div ng-include="'plugin/artemistoolbar.html'"></div>
<pf-table-view config="$ctrl.tableConfig"
dt-options="$ctrl.dtOptions"
columns="$ctrl.tableColumns"
action-buttons="$ctrl.tableActionButtons"
items="$ctrl.consumers">
</pf-table-view>
<div ng-include="'plugin/artemispagination.html'"></div>
<div hawtio-confirm-dialog="$ctrl.closeDialog" title="Close Consumer?"
ok-button-text="Close"
cancel-button-text="Cancel"
on-ok="$ctrl.closeConsumer()">
<div class="dialog-body">
<p class="alert alert-warning">
<span class="pficon pficon-warning-triangle-o"></span>
You are about to close the selected consumer: {{$ctrl.consumerToDelete}}
<p>Are you sure you want to continue.</p>
</p>
</div>
</div>
<script type="text/ng-template" id="consumers-instructions.html">
<div>
<p>
This page allows you to browse all consumers currently open on the broker. These can be narrowed down
by specifying a filter and also sorted using the sort function in the toolbar. To execute a query
click on the <span class="fa fa-search"></span> button.
</p>
<p>
Consumers can be closed by using the <code>close</code> button under the <code>Actions</code> column and you can
navigate to the consumers session, address and queue by clicking on the appropriate field.
</p>
<p>
Note that each page is loaded in from the broker when navigating to a new page or when a query is executed.
</p>
</div>
</script>
`,
controller: ConsumersController
})
.name;
function ConsumersController($scope, workspace, jolokia, localStorage, artemisMessage, $location, $timeout, $filter, $sanitize, pagination, artemisConsumer, artemisQueue, artemisAddress, artemisSession) {
var ctrl = this;
ctrl.pagination = pagination;
ctrl.pagination.reset();
var mbean = Artemis.getBrokerMBean(workspace, jolokia);
ctrl.allConsumers = [];
ctrl.consumers = [];
ctrl.pageNumber = 1;
ctrl.workspace = workspace;
ctrl.refreshed = false;
ctrl.consumerToDeletesSession = '';
ctrl.consumerToDelete = '';
ctrl.closeDialog = false;
ctrl.dtOptions = {
// turn of ordering as we do it ourselves
ordering: false,
columns: [
{name: "ID", visible: true},
{name: "Session", visible: true},
{name: "Client ID", visible: true},
{name: "Protocol", visible: true},
{name: "Queue", visible: true},
{name: "Queue Type", visible: true},
{name: "Filter", visible: true},
{name: "Address", visible: true},
{name: "Remote Address", visible: true},
{name: "Local Address", visible: true},
{name: "Creation Time", visible: true}
]
};
Artemis.log.debug('localStorage: consumersColumnDefs =', localStorage.getItem('consumersColumnDefs'));
if (localStorage.getItem('consumersColumnDefs')) {
loadedDefs = JSON.parse(localStorage.getItem('consumersColumnDefs'));
//sanity check to make sure columns havent been added
if(loadedDefs.length === ctrl.dtOptions.columns.length) {
ctrl.dtOptions.columns = loadedDefs;
}
}
ctrl.updateColumns = function () {
var attributes = [];
ctrl.dtOptions.columns.forEach(function (column) {
attributes.push({name: column.name, visible: column.visible});
});
Artemis.log.debug("saving columns " + JSON.stringify(attributes));
localStorage.setItem('consumersColumnDefs', JSON.stringify(attributes));
}
ctrl.filter = {
fieldOptions: [
{id: 'id', name: 'ID'},
{id: 'session', name: 'Session'},
{id: 'clientID', name: 'Client ID'},
{id: 'user', name: 'User'},
{id: 'address', name: 'Address'},
{id: 'queue', name: 'Queue'},
{id: 'protocol', name: 'Protocol'},
{id: 'localAddress', name: 'Local Address'},
{id: 'remoteAddress', name: 'Remote Address'}
],
operationOptions: [
{id: 'EQUALS', name: 'Equals'},
{id: 'CONTAINS', name: 'Contains'},
{id: 'NOT_CONTAINS', name: 'Does Not Contain'},
{id: 'GREATER_THAN', name: 'Greater Than'},
{id: 'LESS_THAN', name: 'Less Than'}
],
sortOptions: [
{id: 'asc', name: 'ascending'},
{id: 'desc', name: 'descending'}
],
values: {
field: "",
operation: "",
value: "",
sortOrder: "asc",
sortColumn: "id"
},
text: {
fieldText: "Filter Field..",
operationText: "Operation..",
sortOrderText: "ascending",
sortByText: "ID"
}
};
ctrl.tableActionButtons = [
{
name: 'Close',
title: 'Close the Consumer',
actionFn: openCloseDialog
}
];
ctrl.tableConfig = {
selectionMatchProp: 'id',
showCheckboxes: false
};
ctrl.tableColumns = [
{ header: 'ID', itemField: 'id' },
{ header: 'Session', itemField: 'session' , templateFn: function(value, item) { return '<a href="#" onclick="selectSession(' + item.idx + ')">' + $sanitize(value) + '</a>' }},
{ header: 'Client ID', itemField: 'clientID' },
{ header: 'Protocol', itemField: 'protocol' },
{ header: 'Queue', itemField: 'queue', templateFn: function(value, item) { return '<a href="#" onclick="selectQueue(' + item.idx + ')">' + $sanitize(value) + '</a>' }},
{ header: 'Queue Type', itemField: 'queueType' },
{ header: 'Filter', itemField: 'filter' },
{ header: 'Address', itemField: 'address' , templateFn: function(value, item) { return '<a href="#" onclick="selectAddress(' + item.idx + ')">' + $sanitize(value) + '</a>' }},
{ header: 'Remote Address', itemField: 'remoteAddress' },
{ header: 'Local Address', itemField: 'localAddress' },
{ header: 'Creation Time', itemField: 'creationTime' }
];
ctrl.refresh = function () {
ctrl.refreshed = true;
ctrl.pagination.load();
};
ctrl.reset = function () {
ctrl.filter.values.field = "";
ctrl.filter.values.operation = "";
ctrl.filter.values.value = "";
ctrl.filter.sortOrder = "asc";
ctrl.filter.sortColumn = "id";
ctrl.filter.text.fieldText = "Filter Field..";
ctrl.filter.text.operationText = "Operation..";
ctrl.filter.text.sortOrderText = "ascending";
ctrl.filter.text.sortByText = "ID";
ctrl.refreshed = true;
artemisConsumer.consumer = null;
ctrl.pagination.load();
};
if (artemisConsumer.consumer) {
Artemis.log.debug("navigating to consumer = " + artemisConsumer.consumer.session);
ctrl.filter.values.field = ctrl.filter.fieldOptions[1].id;
ctrl.filter.values.operation = ctrl.filter.operationOptions[0].id;
ctrl.filter.values.value = artemisConsumer.consumer.session;
artemisConsumer.consumer = null;
}
if (artemisQueue.queue) {
Artemis.log.info("navigating to consumer = " + artemisQueue.queue.queue);
ctrl.filter.values.field = ctrl.filter.fieldOptions[5].id;
ctrl.filter.values.operation = ctrl.filter.operationOptions[0].id;
ctrl.filter.values.value = artemisQueue.queue.queue;
artemisQueue.queue = null;
}
selectQueue = function (idx) {
var queue = ctrl.consumers[idx].queue;
Artemis.log.debug("navigating to queue:" + queue)
artemisQueue.queue = { queue: queue };
$location.path("artemis/artemisQueues");
};
selectAddress = function (idx) {
var address = ctrl.consumers[idx].address;
Artemis.log.debug("navigating to address:" + address)
artemisAddress.address = { address: address };
$location.path("artemis/artemisAddresses");
};
selectSession = function (idx) {
var session = ctrl.consumers[idx].session;
Artemis.log.debug("navigating to session:" + session)
artemisSession.session = { session: session };
$location.path("artemis/artemisSessions");
};
function openCloseDialog(action, item) {
ctrl.consumerToDelete = item.id;
ctrl.consumerToDeletesSession = item.session;
ctrl.closeDialog = true;
}
ctrl.closeConsumer = function () {
Artemis.log.debug("closing session: " + ctrl.consumerToDelete);
if (mbean) {
jolokia.request({ type: 'exec',
mbean: mbean,
operation: 'closeConsumerWithID(java.lang.String,java.lang.String)',
arguments: [ctrl.consumerToDeletesSession, ctrl.consumerToDelete] },
Core.onSuccess(ctrl.pagination.load(), { error: function (response) {
Core.defaultJolokiaErrorHandler("Could not close session: " + response);
}}));
}
};
ctrl.loadOperation = function () {
if (mbean) {
var method = 'listConsumers(java.lang.String, int, int)';
var sessionsFilter = {
field: ctrl.filter.values.field,
operation: ctrl.filter.values.operation,
value: ctrl.filter.values.value,
sortOrder: ctrl.filter.values.sortOrder,
sortColumn: ctrl.filter.values.sortColumn
};
if (ctrl.refreshed == true) {
ctrl.pagination.reset();
ctrl.refreshed = false;
}
Artemis.log.info(JSON.stringify(sessionsFilter));
jolokia.request({ type: 'exec', mbean: mbean, operation: method, arguments: [JSON.stringify(sessionsFilter), ctrl.pagination.pageNumber, ctrl.pagination.pageSize] }, Core.onSuccess(populateTable, { error: onError }));
}
};
ctrl.pagination.setOperation(ctrl.loadOperation);
function onError(response) {
Core.notification("error", "could not invoke list sessions" + response.error);
$scope.workspace.selectParentNode();
};
function populateTable(response) {
var data = JSON.parse(response.value);
ctrl.consumers = [];
angular.forEach(data["data"], function (value, idx) {
value.idx = idx;
ctrl.consumers.push(value);
});
ctrl.pagination.page(data["count"]);
allConsumers = ctrl.consumers;
ctrl.consumers = allConsumers;
Core.$apply($scope);
}
ctrl.pagination.load();
}
ConsumersController.$inject = ['$scope', 'workspace', 'jolokia', 'localStorage', 'artemisMessage', '$location', '$timeout', '$filter', '$sanitize', 'pagination', 'artemisConsumer', 'artemisQueue', 'artemisAddress', 'artemisSession'];
})(Artemis || (Artemis = {}));

View File

@ -0,0 +1,158 @@
/*-
* ~~~~~~licensing~~~~~~
* artemis-plugin-entaxy
* ==========
* 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~~~~~~
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/// <reference path="tree.component.ts"/>
var Artemis;
(function (Artemis) {
Artemis._module.component('artemisCreateAddress', {
template:
`
<h1>Create Address
<button type="button" class="btn btn-link jvm-title-popover"
uib-popover-template="'create-address-instructions.html'" popover-placement="bottom-left"
popover-title="Instructions" popover-trigger="'outsideClick'">
<span class="pficon pficon-help"></span>
</button>
</h1>
<form class="form-horizontal">
<div class="form-group">
<label class="col-sm-2 control-label" for="name-markup">Address name</label>
<div class="col-sm-10">
<input id="name-markup" class="form-control" type="text" maxlength="300"
name="addressName" ng-model="$ctrl.addressName" placeholder="Address name"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Routing type</label>
<div class="col-sm-10">
<label class="checkbox">
<input type="radio" ng-model="$ctrl.routingType" value="Multicast"> Multicast
</label>
<label class="checkbox">
<input type="radio" ng-model="$ctrl.routingType" value="Anycast"> Anycast
</label>
<label class="checkbox">
<input type="radio" ng-model="$ctrl.routingType" value="Both"> Both
</label>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary"
ng-click="$ctrl.createAddress($ctrl.addressName, $ctrl.routingType)"
ng-disabled="!$ctrl.addressName">Create Address
</button>
</div>
</div>
<div hawtio-confirm-dialog="$ctrl.createDialog"
ok-button-text="Create"
cancel-button-text="Cancel"
on-ok="$ctrl.createAddress($ctrl.addressName, $ctrl.routingType)">
<div class="dialog-body">
<p>Address name <b>{{$ctrl.addressName}}</b> contains unrecommended characters: <code>:</code></p>
<p>This may cause unexpected problems. Are you really sure to create this {{$ctrl.uncapitalisedDestinationType()}}?</p>
</div>
</div>
</form>
<script type="text/ng-template" id="create-address-instructions.html">
<div>
<p>
This page allows you to create a new address on the broker, if you want the address to support JMS like
queues, i.e. point to point, then choose anycast. If you want your address to support JMS like topic
subscriptions, publish/subscribe, then choose multicast.
</p>
</div>
</script>
`,
controller: CreateAddressController
})
.name;
Artemis.log.debug("loaded address " + Artemis.addressModule);
function CreateAddressController($scope, workspace, jolokia, localStorage) {
Artemis.log.debug("loaded address controller");
var ctrl = this;
ctrl.addressName = "";
ctrl.routingType = "Anycast";
ctrl.workspace = workspace;
ctrl.message = "";
$scope.$watch('workspace.selection', function () {
workspace.moveIfViewInvalid();
});
function operationSuccess() {
ctrl.addressName = "";
ctrl.workspace.operationCounter += 1;
Core.$apply($scope);
Core.notification("success", $scope.message);
ctrl.workspace.loadTree();
}
function onError(response) {
Core.notification("error", "Could not create address: " + response.error);
}
ctrl.createAddress = function (name, routingType) {
Artemis.log.debug("creating " + routingType);
var mbean = Artemis.getBrokerMBean(workspace, jolokia);
if (mbean) {
if (routingType == "Multicast") {
$scope.message = "Created Multicast Address " + name;
Artemis.log.debug(ctrl.message);
jolokia.execute(mbean, "createAddress(java.lang.String,java.lang.String)", name, "MULTICAST", Core.onSuccess(operationSuccess, { error: onError }));
}
else if (routingType == "Anycast") {
$scope.message = "Created Anycast Address " + name;
Artemis.log.debug(ctrl.message);
jolokia.execute(mbean, "createAddress(java.lang.String,java.lang.String)", name, "ANYCAST", Core.onSuccess(operationSuccess, { error: onError }));
}
else {
$scope.message = "Created Anycast/Multicast Address " + name;
Artemis.log.debug(ctrl.message);
jolokia.execute(mbean, "createAddress(java.lang.String,java.lang.String)", name, "ANYCAST,MULTICAST", Core.onSuccess(operationSuccess, { error: onError }));
}
}
};
}
CreateAddressController.$inject = ['$scope', 'workspace', 'jolokia', 'localStorage'];
})(Artemis || (Artemis = {}));

View File

@ -0,0 +1,238 @@
/*-
* ~~~~~~licensing~~~~~~
* artemis-plugin-entaxy
* ==========
* 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~~~~~~
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/// <reference path="tree.component.ts"/>
var Artemis;
(function (Artemis) {
Artemis._module.component('artemisCreateQueue', {
template:
`
<h1>Create Queue
<button type="button" class="btn btn-link jvm-title-popover"
uib-popover-template="'create-queue-instructions.html'" popover-placement="bottom-left"
popover-title="Instructions" popover-trigger="'outsideClick'">
<span class="pficon pficon-help"></span>
</button>
</h1>
<form class="form-horizontal">
<div class="form-group">
<label class="col-sm-2 control-label" for="name-markup">Queue name</label>
<div class="col-sm-10">
<input id="name-markup" class="form-control" type="text" maxlength="300"
name="queueName" ng-model="$ctrl.queueName" placeholder="Queue name"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Routing type</label>
<div class="col-sm-10">
<label class="checkbox">
<input type="radio" ng-model="$ctrl.routingType" value="Anycast"> Anycast
</label>
<label class="checkbox">
<input type="radio" ng-model="$ctrl.routingType" value="Multicast"> Multicast
</label>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Durable</label>
<div class="col-sm-10">
<label class="checkbox">
<input type="checkbox" ng-model="$ctrl.durable">
</label>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="filter-markup">Filter</label>
<div class="col-sm-10">
<input id="filter-markup" class="form-control" type="text" maxlength="300"
name="filter" ng-model="$ctrl.filter" placeholder="Filter"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="maxConsumers-markup">Max consumers</label>
<div class="col-sm-10">
<input id="maxConsumers-markup" class="form-control" type="integer" maxlength="300"
name="filter" ng-model="$ctrl.maxConsumers" placeholder="Max consumers"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Purge when no consumers</label>
<div class="col-sm-10">
<label class="checkbox">
<input type="checkbox" ng-model="$ctrl.purgeWhenNoConsumers">
</label>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary"
ng-click="$ctrl.createQueue($ctrl.queueName, $ctrl.routingType, $ctrl.durable, $ctrl.filter, $ctrl.maxConsumers, $ctrl.purgeWhenNoConsumers)"
ng-disabled="!$ctrl.queueName">Create Queue
</button>
</div>
</div>
<div hawtio-confirm-dialog="$ctrl.createDialog"
ok-button-text="Create"
cancel-button-text="Cancel"
on-ok="$ctrl.createQueue($ctrl.queueName, $ctrl.routingType, $ctrl.durable, $ctrl.filter, $ctrl.maxConsumers, $ctrl.purgeWhenNoConsumers)">
<div class="dialog-body">
<p>Queue name <b>{{$ctrl.queueName}}</b> contains unrecommended characters: <code>:</code></p>
<p>This may cause unexpected problems. Are you really sure to create this {{$ctrl.uncapitalisedDestinationType()}}?</p>
</div>
</div>
</form>
<script type="text/ng-template" id="create-queue-instructions.html">
<div>
<p>
This page allows you to create a queue bound to the chosen address.
</p>
<p>
if you want the queue to support JMS like queues, i.e. point to point, then choose anycast. If you
want your address to support JMS like topic subscriptions, publish/subscribe, then choose multicast.
</p>
<p>
Selecting durable means that the queue will survive a restart of the broker.
</p>
<p>
Adding a filter expression will mean that only messages that match that filter will be routed to this queue:
see <a href="https://activemq.apache.org/components/artemis/documentation/latest/filter-expressions.html" target="_blank">Filter Expressions</a>
</p>
<p>
Max consumers will limit how many consumers can consume from a queue at any one time, -1 means no limit.
</p>
<p>
Purge on no consumers means the queue will not start receiving messages until a consumer is attached.
When the last consumer is detached from the queue. The queue is purged (its messages are removed)
and will not receive any more messages until a new consumer is attached.
</p>
</div>
</script>
`,
controller: CreateQueueController
})
.name;
Artemis.log.debug("loaded queue " + Artemis.createQueueModule);
function CreateQueueController($scope, workspace, jolokia, localStorage) {
Artemis.log.debug("loaded queue controller");
var ctrl = this;
Core.initPreferenceScope($scope, localStorage, {
'durable': {
'value': true,
'converter': Core.parseBooleanValue
},
'maxConsumers': {
'value': -1,
'converter': parseInt,
'formatter': parseInt
},
'purgeWhenNoConsumers': {
'value': false,
'converter': Core.parseBooleanValue
}
});
var artemisJmxDomain = localStorage['artemisJmxDomain'] || "org.apache.activemq.artemis";
ctrl.workspace = workspace;
ctrl.maxConsumers = -1;
ctrl.routingType = "Anycast";
ctrl.filter = "";
ctrl.purgeWhenNoConsumers = false;
ctrl.durable = true;
ctrl.queueName = '';
$scope.$watch('workspace.selection', function () {
workspace.moveIfViewInvalid();
});
function operationSuccess() {
ctrl.queueName = "";
ctrl.workspace.operationCounter += 1;
Core.$apply($scope);
Core.notification("success", $scope.message);
ctrl.workspace.loadTree();
}
function onError(response) {
Core.notification("error", "Could not create queue: " + response.error);
}
this.createQueue = function (queueName, routingType, durable, filter, maxConsumers, purgeWhenNoConsumers) {
var mbean = Artemis.getBrokerMBean(workspace, jolokia);
if (mbean) {
var selection = workspace.selection;
var entries = selection.entries;
var address = entries["address"];
if (address.charAt(0) === '"' && address.charAt(address.length -1) === '"')
{
address = address.substr(1,address.length -2);
}
address = unescape(address)
$scope.message = "Created queue " + queueName + " durable=" + durable + " filter=" + filter + " routing type=" + routingType + " max consumers=" + maxConsumers + " purge..=" + purgeWhenNoConsumers + " on address " + address;
if (routingType == "Multicast") {
Artemis.log.debug($scope.message);
jolokia.execute(mbean, "createQueue(java.lang.String,java.lang.String,java.lang.String,java.lang.String,boolean,int,boolean,boolean)", address, "MULTICAST", queueName, filter, durable, maxConsumers, purgeWhenNoConsumers, true, Core.onSuccess(operationSuccess, { error: onError }));
} else {
Artemis.log.debug($scope.message);
jolokia.execute(mbean, "createQueue(java.lang.String,java.lang.String,java.lang.String,java.lang.String,boolean,int,boolean,boolean)", address, "ANYCAST", queueName, filter, durable, maxConsumers, purgeWhenNoConsumers, true, Core.onSuccess(operationSuccess, { error: onError }));
}
}
};
// unescape name from JMX https://docs.oracle.com/en/java/javase/11/docs/api/java.management/javax/management/ObjectName.html#quote(java.lang.String)
function unescape(input) {
var result = input;
result = result.replace('\\"', '"');
result = result.replace("\\*", "*");
result = result.replace("\\?", "?");
result = result.replace("\\\\", "\\");
return result;
}
}
CreateQueueController.$inject = ['$scope', 'workspace', 'jolokia', 'localStorage'];
})(Artemis || (Artemis = {}));

View File

@ -0,0 +1,145 @@
/*-
* ~~~~~~licensing~~~~~~
* artemis-plugin-entaxy
* ==========
* 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~~~~~~
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/// <reference path="tree.component.ts"/>
var Artemis;
(function (Artemis) {
Artemis._module.component('artemisDeleteAddress', {
template:
`
<h1>Delete Address
<button type="button" class="btn btn-link jvm-title-popover"
uib-popover-template="'delete-address-instructions.html'" popover-placement="bottom-left"
popover-title="Instructions" popover-trigger="'outsideClick'">
<span class="pficon pficon-help"></span>
</button>
</h1>
<p>
<div class="alert alert-warning">
<span class="pficon pficon-warning-triangle-o"></span>
This operation cannot be undone. Please be careful!
</div>
</p>
<h2>Delete address</h2>
<p>Remove the address completely.</p>
<button type="submit" class="btn btn-danger" ng-click="$ctrl.deleteDialog = true">
Delete address
</button>
<div hawtio-confirm-dialog="$ctrl.deleteDialog"
title="Confirm delete address"
ok-button-text="Delete"
cancel-button-text="Cancel"
on-ok="$ctrl.deleteAddress()">
<div class="dialog-body">
<p>You are about to delete address <b>{{ $ctrl.selectedName() }}</b>.</p>
<p>This operation cannot be undone so please be careful.</p>
</div>
</div>
<script type="text/ng-template" id="delete-address-instructions.html">
<div>
<p>
This page allows you to delete the chosen address on the broker.
</p>
<p>
Note that this will only succeed if the address has no queues bound to it.
</p>
</div>
</script>
`,
controller: DeleteAddressController
})
.name;
Artemis.log.debug("loaded address " + Artemis.addressModule);
function DeleteAddressController($scope, workspace, jolokia, localStorage) {
var ctrl = this;
ctrl.workspace = workspace;
ctrl.deleteDialog = false;
$onInit = function () {
Artemis.log.debug("loaded address controller");
}
$scope.$watch('workspace.selection', function () {
workspace.moveIfViewInvalid();
});
function operationSuccess() {
// lets set the selection to the parent
workspace.removeAndSelectParentNode();
ctrl.workspace.operationCounter += 1;
Core.$apply($scope);
Core.notification("success", $scope.message);
ctrl.workspace.loadTree();
}
function onError(response) {
Core.notification("error", "Could not delete address: " + response.error);
}
ctrl.deleteAddress = function () {
var selection = workspace.selection;
var entries = selection.entries;
var mbean = Artemis.getBrokerMBean(workspace, jolokia);
Artemis.log.debug(mbean);
if (mbean) {
if (selection && jolokia && entries) {
var domain = selection.domain;
var name = entries["address"];
Artemis.log.debug("name = " + name)
name = Core.unescapeHTML(name);
if (name.charAt(0) === '"' && name.charAt(name.length -1) === '"')
{
name = name.substr(1,name.length -2);
}
name = Artemis.ownUnescape(name);
Artemis.log.debug(name);
var operation;
$scope.message = "Deleted address " + name;
jolokia.execute(mbean, "deleteAddress(java.lang.String)", name, Core.onSuccess(operationSuccess, { error: onError }));
}
}
};
ctrl.selectedName = function () {
var selection = ctrl.workspace.selection;
return selection ? _.unescape(selection.text) : null;
};
}
DeleteAddressController.$inject = ['$scope', 'workspace', 'jolokia', 'localStorage'];
})(Artemis || (Artemis = {}));

View File

@ -0,0 +1,191 @@
/*-
* ~~~~~~licensing~~~~~~
* artemis-plugin-entaxy
* ==========
* 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~~~~~~
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/// <reference path="tree.component.ts"/>
var Artemis;
(function (Artemis) {
Artemis._module.component('artemisDeleteQueue', {
template:
`<p>
<div class="alert alert-warning">
<span class="pficon pficon-warning-triangle-o"></span>
These operations cannot be undone. Please be careful!
</div>
</p>
<h2>Delete queue
<button type="button" class="btn btn-link jvm-title-popover"
uib-popover-template="'delete-queue-instructions.html'" popover-placement="bottom-left"
popover-title="Instructions" popover-trigger="'outsideClick'">
<span class="pficon pficon-help"></span>
</button>
</h2>
<p>Remove the queue completely.</p>
<button type="submit" class="btn btn-danger" ng-click="$ctrl.deleteDialog = true">
Delete Queue
</button>
<div hawtio-confirm-dialog="$ctrl.deleteDialog"
title="Confirm delete address"
ok-button-text="Delete"
cancel-button-text="Cancel"
on-ok="$ctrl.deleteQueue()">
<div class="dialog-body">
<p>You are about to delete queue <b>{{$ctrl.selectedName()}}</b>.</p>
<p>This operation cannot be undone so please be careful.</p>
</div>
</div>
<h2>Purge queue
<button type="button" class="btn btn-link jvm-title-popover"
uib-popover-template="'purge-queue-instructions.html'" popover-placement="bottom-left"
popover-title="Instructions" popover-trigger="'outsideClick'">
<span class="pficon pficon-help"></span>
</button>
</h2>
<p>Remove all messages from queue.</p>
<button type="submit" class="btn btn-danger" ng-click="$ctrl.purgeDialog = true">
Purge Queue
</button>
<div hawtio-confirm-dialog="$ctrl.purgeDialog"
title="Confirm purge address"
ok-button-text="Purge"
cancel-button-text="Cancel"
on-ok="$ctrl.purgeQueue()">
<div class="dialog-body">
<p>You are about to purge queue <b>{{$ctrl.selectedName()}}</b>.</p>
<p>This operation cannot be undone so please be careful.</p>
</div>
</div>
<script type="text/ng-template" id="delete-queue-instructions.html">
<div>
<p>
This will delete the queue and all of the messages it holds
</p>
</div>
</script>
<script type="text/ng-template" id="purge-queue-instructions.html">
<div>
<p>
This will delete all of the messages held within the queue but will not delete the queue
</p>
</div>
</script>
`,
controller: DeleteQueueController
})
.name;
Artemis.log.debug("loaded delete queue " + Artemis.createQueueModule);
function DeleteQueueController($scope, workspace, jolokia, localStorage) {
Artemis.log.debug("loaded queue controller");
var ctrl = this;
ctrl.workspace = workspace;
ctrl.deleteDialog = false;
ctrl.purgeDialog = false;
$scope.$watch('workspace.selection', function () {
ctrl.workspace.moveIfViewInvalid();
});
function operationSuccess() {
// lets set the selection to the parent
ctrl.workspace.removeAndSelectParentNode();
ctrl.workspace.operationCounter += 1;
Core.$apply($scope);
Core.notification("success", $scope.message);
ctrl.workspace.loadTree();
}
function onError(response) {
Core.notification("error", "Could not delete address: " + response.error);
}
function operationPurgeSuccess() {
// lets set the selection to the parent
/*$scope.workspace.operationCounter += 1;
Core.$apply($scope);*/
Core.notification("success", $scope.message);
}
function onPurgeError(response) {
Core.notification("error", "Could not purge address: " + response.error);
}
this.deleteQueue = function () {
var selection = ctrl.workspace.selection;
var entries = selection.entries;
var mbean = Artemis.getBrokerMBean(ctrl.workspace, jolokia);
Artemis.log.debug(mbean);
if (mbean) {
if (selection && jolokia && entries) {
var domain = selection.domain;
var name = entries["queue"];
Artemis.log.debug("name = " + name)
name = Core.unescapeHTML(name);
if (name.charAt(0) === '"' && name.charAt(name.length -1) === '"')
{
name = name.substr(1,name.length -2);
}
name = Artemis.ownUnescape(name);
Artemis.log.debug(name);
var operation;
$scope.message = "Deleted queue " + name;
jolokia.execute(mbean, "destroyQueue(java.lang.String)", name, Core.onSuccess(operationPurgeSuccess, { error: onError }));
}
}
};
this.purgeQueue = function () {
var selection = ctrl.workspace.selection;
var entries = selection.entries;
var mbean = selection.objectName;
if (selection && jolokia && entries) {
var name = entries["Destination"] || entries["destinationName"] || selection.title;
name = Core.unescapeHTML(name);
$scope.message = "Purged queue " + name;
jolokia.execute(mbean, "removeAllMessages()", Core.onSuccess(operationSuccess, { error: onPurgeError }));
}
};
ctrl.selectedName = function () {
var selection = ctrl.workspace.selection;
return selection ? _.unescape(selection.text) : null;
};
}
DeleteQueueController.$inject = ['$scope', 'workspace', 'jolokia', 'localStorage'];
})(Artemis || (Artemis = {}));

View File

@ -0,0 +1,529 @@
/*-
* ~~~~~~licensing~~~~~~
* artemis-plugin-entaxy
* ==========
* 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~~~~~~
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/// <reference path="tree.component.ts"/>
var Artemis;
(function (Artemis) {
Artemis._module.component('artemisBrokerDiagram', {
template:
`<div class="container-topology">
<h1>Broker Diagram
<button type="button" class="btn btn-link jvm-title-popover"
uib-popover-template="'diagram-instructions.html'" popover-placement="bottom-left"
popover-title="Instructions" popover-trigger="'outsideClick'">
<span class="pficon pficon-help"></span>
</button>
</h1>
<!-- Inhibit the context menu of pf-topology for the its items -->
<style type="text/css">pf-topology .popup { visibility: hidden; }</style>
<pf-topology items="$ctrl.data.items" relations="$ctrl.data.relations" kinds="$ctrl.kinds" icons="$ctrl.data.icons" nodes="$ctrl.nodes" item-selected="$ctrl.itemSelected(item)" search-text="searchText" show-labels="$ctrl.showLabels" tooltip-function="$ctrl.tooltip(node)" chart-rendered="$ctrl.chartRendered(vertices, added)">
<label style="margin-right: 1em">Show labels:
<input type="checkbox" ng-model="$ctrl.showLabels">
</label>
<label style="margin-right: 1em">Show addresses:
<input type="checkbox" ng-model="$ctrl.showAddresses">
</label>
<label style="margin-right: 1em">Show queues:
<input type="checkbox" ng-model="$ctrl.showQueues">
</label>
<label style="margin-right: 1em">Show internal addresses:
<input type="checkbox" ng-model="$ctrl.showInternalAddresses">
</label>
<label style="margin-right: 1em">Show internal queues:
<input type="checkbox" ng-model="$ctrl.showInternalQueues">
</label>
<label style="margin-right: 1em">Show Live Brokers:
<input type="checkbox" ng-model="$ctrl.showLiveBrokers">
</label>
<label style="margin-right: 1em">Show Backup Brokers:
<input type="checkbox" ng-model="$ctrl.showBackupBrokers">
</label>
<label style="margin-right: 1em">Show Connectors:
<input type="checkbox" ng-model="$ctrl.showConnectors">
</label>
<button type="submit" class="btn btn-primary"
ng-click="$ctrl.refresh()">Refresh
</button>
</div>
<div ng-show="$ctrl.showAttributes">
<pf-table-view
config="$ctrl.config"
columns="$ctrl.tableColumns"
items="$ctrl.attributes">
</div>
<script type="text/ng-template" id="diagram-instructions.html">
<div>
<p>
This page is a graphical representation of the cluster topology. It will show all the brokers in the cluster
as well as well as any Adresses and Queues on the broker the console is connected to.
</p>
<p>
It is possible to view the attributes of the addresses, queues and connected broker by left clicking
on each node.
</p>
</div>
</script>
`,
controller: BrokerDiagramController
})
.name;
function BrokerDiagramController($scope, workspace, jolokia, localStorage, artemisMessage, $location, $timeout, $filter) {
Artemis.log.debug("loaded browse " + Artemis.browseQueueModule);
var ctrl = this;
ctrl.index = 0;
ctrl.showLabels = false;
ctrl.showAddresses = true;
ctrl.showQueues = true;
ctrl.showInternalAddresses = false;
ctrl.showInternalQueues = false;
ctrl.showLiveBrokers = true;
ctrl.showBackupBrokers = true;
ctrl.showConnectors = true;
ctrl.hiddenRelations = [];
function updateAddressKind() {
if(ctrl.kinds.Address && !ctrl.showAddresses) {
delete ctrl.kinds.Address;
} else if (!ctrl.kinds.Address && ctrl.showAddresses) {
ctrl.kinds.Address = true;
}
}
$scope.$watch('$ctrl.showAddresses', function () {
updateAddressKind();
});
function updateQueueKind() {
if(ctrl.kinds.Queue && !ctrl.showQueues) {
delete ctrl.kinds.Queue;
} else if (!ctrl.kinds.Queue && ctrl.showQueues) {
ctrl.kinds.Queue = true;
}
}
$scope.$watch('$ctrl.showQueues', function () {
updateQueueKind();
});
function updateInternalAddressKind() {
if(ctrl.kinds.InternalAddress && !ctrl.showInternalAddresses) {
delete ctrl.kinds.InternalAddress;
} else if (!ctrl.kinds.InternalAddress && ctrl.showInternalAddresses) {
ctrl.kinds.InternalAddress = true;
}
}
$scope.$watch('$ctrl.showInternalAddresses', function () {
updateInternalAddressKind();
});
function updateInternalQueueKind() {
if(ctrl.kinds.InternalQueue && !ctrl.showInternalQueues) {
delete ctrl.kinds.InternalQueue;
} else if (!ctrl.kinds.InternalQueue && ctrl.showInternalQueues) {
ctrl.kinds.InternalQueue = true;
}
}
$scope.$watch('$ctrl.showInternalQueues', function () {
updateInternalQueueKind();
});
function updateLiveBrokerKind() {
if(ctrl.kinds.ThisBroker && !ctrl.showLiveBrokers) {
delete ctrl.kinds.ThisBroker;
} else if (!ctrl.kinds.ThisBroker && ctrl.showLiveBrokers) {
ctrl.kinds.ThisBroker = true;
}
if(ctrl.kinds.MasterBroker && !ctrl.showLiveBrokers) {
delete ctrl.kinds.MasterBroker;
} else if (!ctrl.kinds.MasterBroker && ctrl.showLiveBrokers) {
ctrl.kinds.MasterBroker = true;
}
}
$scope.$watch('$ctrl.showLiveBrokers', function () {
updateLiveBrokerKind();
});
function updateBackupBrokerKind() {
if(ctrl.kinds.SlaveBroker && !ctrl.showBackupBrokers) {
delete ctrl.kinds.SlaveBroker;
} else if (!ctrl.kinds.SlaveBroker && ctrl.showBackupBrokers) {
ctrl.kinds.SlaveBroker = true;
}
}
$scope.$watch('$ctrl.showBackupBrokers', function () {
updateBackupBrokerKind();
});
function updateConnectors() {
if(!ctrl.showConnectors) {
ctrl.data.relations = [];
} else {
ctrl.data.relations = ctrl.hiddenRelations;
}
}
$scope.$watch('$ctrl.showConnectors', function () {
updateConnectors();
});
ctrl.datasets = [];
//icons can be found at https://www.patternfly.org/v3/styles/icons/index.html
ctrl.serverIcon = "\ue90d";
Artemis.log.debug(ctrl.serverIcon);
ctrl.addressIcon = "";//\ue91a";
ctrl.queueIcon = "";//\ue90a";
ctrl.icons = {
"ThisBroker": {
"type": "glyph",
"icon": ctrl.serverIcon,
"background": "#456BD9",
"fontfamily": "PatternFlyIcons-webfont"
},
"MasterBroker": {
"type": "glyph",
"icon": ctrl.serverIcon,
"fontfamily": "PatternFlyIcons-webfont"
},
"SlaveBroker": {
"type": "glyph",
"icon": ctrl.serverIcon,
"fontfamily": "PatternFlyIcons-webfont"
},
"Address": {
"type": "glyph",
"icon": ctrl.addressIcon,
"fontfamily": "PatternFlyIcons-webfont"
},
"InternalAddress": {
"type": "glyph",
"icon": ctrl.addressIcon,
"fontfamily": "PatternFlyIcons-webfont"
},
"Queue": {
"type": "glyph",
"background": "#456BD9",
"icon": ctrl.queueIcon,
"fontfamily": "PatternFlyIcons-webfont"
},
"InternalQueue": {
"type": "glyph",
"background": "#456BD9",
"icon": ctrl.queueIcon,
"fontfamily": "PatternFlyIcons-webfont"
}
};
load();
ctrl.hiddenRelations = ctrl.relations;
function load() {
ctrl.items = {};
ctrl.relations = [];
ctrl.datasets.push({
"items": ctrl.items,
"relations": ctrl.relations,
"icons": ctrl.icons
});
Artemis.log.debug("index " + ctrl.index);
ctrl.data = ctrl.datasets[ctrl.index];
ctrl.data.url = "fooBar";
ctrl.kinds = {
"ThisBroker": true,
"MasterBroker": true,
"SlaveBroker": true,
"Address": true,
"Queue": true
};
ctrl.icons = ctrl.data.icons;
ctrl.nodes = {
"ThisBroker": {
"name": "ThisBroker",
"title": "hello",
"enabled": true,
"radius": 28,
"textX": 0,
"textY": 5,
"height": 30,
"width": 30,
"icon": ctrl.icons["ThisBroker"].icon,
"fontFamily": ctrl.icons["ThisBroker"].fontfamily
},
"MasterBroker": {
"name": "MasterBroker",
"enabled": true,
"radius": 28,
"textX": 0,
"textY": 5,
"height": 30,
"width": 30,
"icon": ctrl.icons["MasterBroker"].icon,
"fontFamily": ctrl.icons["MasterBroker"].fontfamily
},
"SlaveBroker": {
"name": "SlaveBroker",
"enabled": true,
"radius": 28,
"textX": 0,
"textY": 5,
"height": 30,
"icon": ctrl.icons["SlaveBroker"].icon,
"fontFamily": ctrl.icons["SlaveBroker"].fontfamily
},
"Address": {
"name": "Address",
"enabled": ctrl.showDestinations,
"radius": 16,
"textX": 0,
"textY": 5,
"height": 18,
"width": 18,
"icon": ctrl.icons["Address"].icon,
"fontFamily": ctrl.icons["Address"].fontfamily
},
"Queue": {
"name": "Queue",
"enabled": ctrl.showDestinations,
"radius": 16,
"textX": 0,
"textY": 5,
"height": 18,
"width": 18,
"icon": ctrl.icons["Queue"].icon,
"fontFamily": ctrl.icons["Queue"].fontfamily
}
};
ctrl.tableColumns = [
{ header: 'attribute', itemField: 'attribute' },
{ header: 'value', itemField: 'value' }
];
ctrl.attributes = [];
ctrl.config = {
selectionMatchProp: 'attribute',
showCheckboxes: false
};
ctrl.showAttributes = false;
updateAddressKind();
updateQueueKind();
updateInternalAddressKind();
updateInternalQueueKind();
updateLiveBrokerKind();
updateBackupBrokerKind();
updateConnectors();
loadThisBroker();
Core.$apply($scope);
}
ctrl.itemSelected = function(item) {
ctrl.showAttributes = false;
ctrl.attributes = [];
if (!item || !item.mbean) {
Core.$apply($scope);
return;
}
var atts = jolokia.request({ type: "read", mbean: item.mbean}, {method: "post"});
var val = atts.value;
if (val) {
angular.forEach(val, function (value, key) {
attribute = {
"attribute": key,
"value": value
}
ctrl.attributes.push(attribute);
});
}
ctrl.showAttributes = true;
Core.$apply($scope);
}
ctrl.tooltip = function (node) {
var status = [
'Name: ' + node.item.name,
'Type: ' + node.item.brokerKind
];
return status;
}
ctrl.chartRendered = function (vertices, added) {
// Inhibit the dblclick handler of pf-topology for the its items.
added.each(function (d) { d.url = "javascript:void(0)"; });
}
ctrl.refresh = function () {
ctrl.datasets = [];
load();
}
function loadThisBroker() {
var mBean = Artemis.getBrokerMBean(workspace, jolokia);
var atts = jolokia.request({ type: "read", mbean: mBean}, {method: "post"});
var val = atts.value;
var details = Core.parseMBean(mBean);
if (details) {
var properties = details['attributes'];
Artemis.log.debug("Got broker: " + mBean + " properties: " + angular.toJson(properties, true));
if (properties) {
var brokerAddress = properties["broker"] || "unknown";
var brokerName = artemisJmxDomain + ":broker=" + brokerAddress;
var backupRes = jolokia.request({ type: "read", mbean: mBean, attribute: "Backup"}, {method: "get"});
var isBackup = backupRes.value;
var nodeId = val["NodeID"];
var response = jolokia.request({ type: 'exec', mbean: mBean, operation: 'listNetworkTopology()' }, Core.onSuccess(null));
var responseValue = response.value;
var remoteBrokers = angular.fromJson(responseValue);
var thisBroker = remoteBrokers.find(broker => broker.nodeID == nodeId);
if(!thisBroker) {
if(isBackup) {
thisBroker = {
backup: "broker"
};
} else {
thisBroker = {
live: "broker"
};
}
}
if (thisBroker.live) {
ctrl.items[thisBroker.live] = {
"name": thisBroker.live,
"kind": "ThisBroker",
"brokerKind": "master",
"status": "broker",
"display_kind": "Server",
"mbean": mBean
}
}
if (thisBroker.backup) {
ctrl.items[thisBroker.backup] = {
"name": thisBroker.backup,
"kind": "SlaveBroker",
"brokerKind": "slave",
"status": "broker",
"display_kind": "Server"
};
if (thisBroker.live) {
ctrl.relations.push({
"source": thisBroker.live,
"target": thisBroker.backup
});
}
}
createAddresses(mBean, thisBroker.live)
}
angular.forEach(remoteBrokers, function (remoteBroker) {
if (nodeId != remoteBroker.nodeID) {
if (remoteBroker.live) {
ctrl.items[remoteBroker.live] = {
"name": remoteBroker.live,
"kind": "MasterBroker",
"brokerKind": "master",
"status": "broker",
"display_kind": "Server"
};
//if we arent a backup then connect to it as we are in the cluster
if(!isBackup) {}
ctrl.relations.push({
"source": thisBroker.live,
"target": remoteBroker.live
});
}
if (remoteBroker.backup) {
ctrl.items[remoteBroker.backup] = {
"name": remoteBroker.backup,
"kind": "SlaveBroker",
"brokerKind": "slave",
"status": "broker",
"display_kind": "Server"
};
ctrl.relations.push({
"source": remoteBroker.backup,
"target": remoteBroker.live
});
}
}
});
}
}
function createAddresses(brokerMBean, brokerId) {
jolokia.search(brokerMBean + ",component=addresses,*", Core.onSuccess(function (response) {
angular.forEach(response, function (objectName) {
var details = Core.parseMBean(objectName);
if (details) {
var properties = details['attributes'];
if (properties) {
if (!properties.subcomponent) {
Artemis.log.debug("Got Address: " + objectName + " properties: " + angular.toJson(properties, true));
addressKind = properties.address.startsWith("$", 1) || properties.address.startsWith("notif", 1) ? "InternalAddress" : "Address";
ctrl.items[properties.address] = {
"name": properties.address,
"kind": addressKind,
"brokerKind": "address",
"status": "Valid",
"display_kind": "Server",
"mbean": objectName
}
ctrl.relations.push({
"source": brokerId,
"target": properties.address
});
}
if (properties.queue) {
Artemis.log.debug("Got Queue: " + objectName + " properties: " + angular.toJson(properties, true));
queueKind = properties.queue.startsWith("$", 1) || properties.queue.startsWith("notif", 1) ? "InternalQueue" : "Queue";
ctrl.items["queue." + properties.queue] = {
"name": properties.queue,
"kind": queueKind,
"brokerKind": "queue",
"status": "Valid",
"display_kind": "Service",
"mbean": objectName
}
ctrl.relations.push({
"source": properties.address,
"target": "queue." + properties.queue
});
}
}
}
});
}));
}
}
BrokerDiagramController.$inject = ['$scope', 'workspace', 'jolokia', 'localStorage', 'artemisMessage', '$location', '$timeout', '$filter'];
})(Artemis || (Artemis = {}));

View File

@ -0,0 +1,70 @@
/*-
* ~~~~~~licensing~~~~~~
* artemis-plugin-entaxy
* ==========
* 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~~~~~~
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
var Artemis;
(function (Artemis) {
Artemis._module
.run(configureHelp)
.name;
function configureHelp(helpRegistry, $templateCache) {
var path = 'plugin/help.md';
helpRegistry.addUserDoc('artemis', path);
//this is indented to render correctly as it is markdown
$templateCache.put(path, `
### Artemis
Click [Artemis](#/jmx/attributes?tab=artemis) in the top navigation bar to see the Artemis specific plugin. (The Artemis tab won't appear if there is no broker in this JVM). The Artemis plugin works very much the same as the JMX plugin however with a focus on interacting with an Artemis broker.
The tree view on the left-hand side shows the top level JMX tree of each broker instance running in the JVM. Expanding the tree will show the various MBeans registered by Artemis that you can inspect via the **Attributes** tab.
#### Creating a new Address
To create a new address simply click on the broker or the address folder in the jmx tree and click on the create tab.
Once you have created an address you should be able to **Send** to it by clicking on it in the jmx tree and clicking on the send tab.
#### Creating a new Queue
To create a new queue click on the address you want to bind the queue to and click on the create tab.
Once you have created a queue you should be able to **Send** a message to it or **Browse** it or view the **Attributes** or **Charts**. Simply click on the queue in th ejmx tree and click on the appropriate tab.
You can also see a graphical view of all brokers, addresses, queues and their consumers using the **Diagram** tab.
`);
}
configureHelp.$inject = ['helpRegistry', '$templateCache'];
})(Artemis || (Artemis = {}));

View File

@ -0,0 +1,269 @@
/*-
* ~~~~~~licensing~~~~~~
* artemis-plugin-entaxy
* ==========
* 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~~~~~~
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/// <reference path="tree.component.ts"/>
var Artemis;
(function (Artemis) {
Artemis.log.debug("loading navigation");
var TAB_CONFIG = {
attributes: {
title: 'Attributes',
route: '/artemis/attributes'
},
operations: {
title: 'Operations',
route: '/artemis/operations'
},
chart: {
title: 'Chart',
route: '/artemis/charts'
},
createAddress: {
title: 'Create address',
route: '/artemis/artemisCreateAddress'
},
deleteAddress: {
title: 'Delete address',
route: '/artemis/artemisDeleteAddress'
},
createQueue: {
title: 'Create queue',
route: '/artemis/artemisCreateQueue'
},
deleteQueue: {
title: 'Delete queue',
route: '/artemis/artemisDeleteQueue'
},
sendMessage: {
title: 'Send message',
route: '/artemis/artemisSendMessage'
},
addressSendMessage: {
title: 'Send message',
route: '/artemis/artemisAddressSendMessage'
},
browseQueue: {
title: 'Browse queue',
route: '/artemis/artemisBrowseQueue'
},
brokerDiagram: {
title: 'Broker diagram',
route: '/artemis/artemisBrokerDiagram'
},
artemisStatus: {
title: 'Status',
route: '/artemis/artemisStatus'
},
artemisConnections: {
title: 'Connections',
route: '/artemis/artemisConnections'
},
artemisSessions: {
title: 'Sessions',
route: '/artemis/artemisSessions'
},
artemisConsumers: {
title: 'Consumers',
route: '/artemis/artemisConsumers'
},
artemisProducers: {
title: 'Producers',
route: '/artemis/artemisProducers'
},
artemisAddresses: {
title: 'Addresses',
route: '/artemis/artemisAddresses'
},
artemisQueues: {
title: 'Queues',
route: '/artemis/artemisQueues'
}
};
Artemis._module
.config(configureRoutes)
.component('artemisNavigation', {
template: `<hawtio-tabs tabs="$ctrl.tabs" on-change="$ctrl.goto(tab)"></hawtio-tabs>`,
controller: ArtemisNavigationController
})
.name;
Artemis.log.debug("loaded navigation " + Artemis.navigationModule);
function ArtemisNavigationController($scope, $location, workspace, localStorage, jolokia) {
'ngInject';
var ctrl = this;
this.$location = $location;
artemisJmxDomain = localStorage['artemisJmxDomain'] || "org.apache.activemq.artemis";
$scope.$on('jmxTreeClicked', function () {
ctrl.tabs = getTabs();
var tab = _.find(ctrl.tabs, { path: ctrl.$location.path() });
if (!tab) {
tab = ctrl.tabs[0];
}
ctrl.$location.path(tab.path);
});
ArtemisNavigationController.prototype.$onInit = function () {
this.tabs = getTabs();
};
ArtemisNavigationController.prototype.goto = function (tab) {
this.$location.path(tab.path);
};
ctrl.showCreateAddress = hasInvokeRights(jolokia, Artemis.getBrokerMBean(workspace, jolokia), 'createAddress');
ctrl.showDeleteAddress = hasInvokeRights(jolokia, Artemis.getBrokerMBean(workspace, jolokia), 'deleteAddress');
ctrl.showCreateQueue = hasInvokeRights(jolokia, Artemis.getBrokerMBean(workspace, jolokia), 'createQueue');
ctrl.showDeleteQueue = hasInvokeRights(jolokia, Artemis.getBrokerMBean(workspace, jolokia), 'destroyQueue');
function getTabs() {
var tabs = [];
var enabledRoutes = Object.keys(TAB_CONFIG)
.map(function (config) { return TAB_CONFIG[config].route; })
.filter(function (route) { return _.startsWith(route, '/artemis'); });
if (enabledRoutes.length > 0) {
tabs.push(new Nav.HawtioTab(TAB_CONFIG.artemisStatus.title, TAB_CONFIG.artemisStatus.route));
tabs.push(new Nav.HawtioTab(TAB_CONFIG.artemisConnections.title, TAB_CONFIG.artemisConnections.route));
tabs.push(new Nav.HawtioTab(TAB_CONFIG.artemisSessions.title, TAB_CONFIG.artemisSessions.route));
tabs.push(new Nav.HawtioTab(TAB_CONFIG.artemisConsumers.title, TAB_CONFIG.artemisConsumers.route));
tabs.push(new Nav.HawtioTab(TAB_CONFIG.artemisProducers.title, TAB_CONFIG.artemisProducers.route));
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));
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));
}
if (shouldShowDeleteAddressTab()) {
tabs.push(new Nav.HawtioTab(TAB_CONFIG.deleteAddress.title, TAB_CONFIG.deleteAddress.route));
}
if (shouldShowCreateQueueTab()) {
tabs.push(new Nav.HawtioTab(TAB_CONFIG.createQueue.title, TAB_CONFIG.createQueue.route));
}
if (shouldShowDeleteQueueTab()) {
tabs.push(new Nav.HawtioTab(TAB_CONFIG.deleteQueue.title, TAB_CONFIG.deleteQueue.route));
}
if (shouldShowSendMessageTab(workspace)) {
tabs.push(new Nav.HawtioTab(TAB_CONFIG.sendMessage.title, TAB_CONFIG.sendMessage.route));
}
if (shouldShowAddressSendMessageTab(workspace)) {
tabs.push(new Nav.HawtioTab(TAB_CONFIG.addressSendMessage.title, TAB_CONFIG.addressSendMessage.route));
}
if (shouldShowBrowseMessageTab(workspace)) {
tabs.push(new Nav.HawtioTab(TAB_CONFIG.browseQueue.title, TAB_CONFIG.browseQueue.route));
}
tabs.push(new Nav.HawtioTab(TAB_CONFIG.brokerDiagram.title, TAB_CONFIG.brokerDiagram.route));
}
return tabs;
}
function shouldShowCreateAddressTab() {
return workspace.selectionHasDomainAndLastFolderName(artemisJmxDomain, 'addresses') && ctrl.showCreateAddress;
}
function shouldShowDeleteAddressTab() {
return workspace.hasDomainAndProperties(artemisJmxDomain, {'component': 'addresses'}) && !workspace.hasDomainAndProperties(artemisJmxDomain, {'subcomponent': 'queues'}) && !workspace.hasDomainAndProperties(artemisJmxDomain, {'subcomponent': 'diverts'}) && ctrl.showDeleteAddress;
}
function shouldShowCreateQueueTab() {
return workspace.hasDomainAndProperties(artemisJmxDomain, {'component': 'addresses'}) && !workspace.hasDomainAndProperties(artemisJmxDomain, {'subcomponent': 'queues'}) && !workspace.hasDomainAndProperties(artemisJmxDomain, {'subcomponent': 'diverts'}) && ctrl.showCreateQueue;
}
function shouldShowDeleteQueueTab() {
return workspace.hasDomainAndProperties(artemisJmxDomain, {'subcomponent': 'queues'}) && ctrl.showDeleteQueue;
}
function shouldShowSendMessageTab(workspace) {
return workspace.hasDomainAndProperties(artemisJmxDomain, {'subcomponent': 'queues'}) && hasQueueinvokeRights(workspace, "sendMessage");
}
function shouldShowAddressSendMessageTab(workspace) {
return workspace.hasDomainAndProperties(artemisJmxDomain, {'component': 'addresses'}) && !workspace.hasDomainAndProperties(artemisJmxDomain, {'subcomponent': 'queues'}) && hasQueueinvokeRights(workspace, "sendMessage");
}
function shouldShowBrowseMessageTab(workspace) {
return workspace.hasDomainAndProperties(artemisJmxDomain, {'subcomponent': 'queues'}) && hasQueueinvokeRights(workspace, "browse") && hasQueueinvokeRights(workspace, "countMessages");
}
function hasInvokeRights(jolokia, mbean, operation) {
var 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;
}
function hasQueueinvokeRights(workspace, operation) {
var selection = workspace.selection;
if (!selection)
return false;
var mbean = selection.objectName;
if (!mbean)
return false;
return hasInvokeRights(jolokia, mbean, operation)
}
}
ArtemisNavigationController.$inject = ['$scope', '$location', 'workspace', 'localStorage', 'jolokia']
function configureRoutes($routeProvider) {
$routeProvider.
when('/artemis/attributes', { templateUrl: 'plugins/jmx/html/attributes/attributes.html' }).
when('/artemis/operations', { template: '<operations></operations>' }).
when('/artemis/charts', { templateUrl: 'plugins/jmx/html/charts.html' }).
when('/artemis/charts/edit', { templateUrl: 'plugins/jmx/html/chartEdit.html' }).
when('/artemis/artemisCreateAddress', { template: '<artemis-create-address></artemis-create-address>'}).
when('/artemis/artemisDeleteAddress', { template: '<artemis-delete-address></artemis-delete-address>'}).
when('/artemis/artemisCreateQueue', { template: '<artemis-create-queue></artemis-create-queue>'}).
when('/artemis/artemisDeleteQueue', { template: '<artemis-delete-queue></artemis-delete-queue>'}).
when('/artemis/artemisSendMessage', { template: '<artemis-send-message></artemis-send-message>'}).
when('/artemis/artemisAddressSendMessage', { template: '<artemis-address-send-message></artemis-address-send-message>'}).
when('/artemis/artemisBrowseQueue', { template: '<artemis-browse-queue></artemis-browse-queue>'}).
when('/artemis/artemisBrokerDiagram', { template: '<artemis-broker-diagram></artemis-broker-diagram>'}).
when('/artemis/artemisStatus', { template: '<artemis-status></artemis-status>'}).
when('/artemis/artemisConnections', { template: '<artemis-connections></artemis-connections>'}).
when('/artemis/artemisSessions', { template: '<artemis-sessions></artemis-sessions>'}).
when('/artemis/artemisConsumers', { template: '<artemis-consumers></artemis-consumers>'}).
when('/artemis/artemisProducers', { template: '<artemis-producers></artemis-producers>'}).
when('/artemis/artemisAddresses', { template: '<artemis-addresses></artemis-addresses>'}).
when('/artemis/artemisQueues', { template: '<artemis-queues></artemis-queues>'});
}
configureRoutes.$inject = ['$routeProvider'];
})(Artemis || (Artemis = {}));

View File

@ -0,0 +1,132 @@
/*-
* ~~~~~~licensing~~~~~~
* artemis-plugin-entaxy
* ==========
* 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~~~~~~
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
var Artemis;
(function (Artemis) {
Artemis._module
.controller("Artemis.PreferencesController", ["$scope", "localStorage", "userDetails", "$rootScope", function ($scope, localStorage, userDetails, $rootScope) {
Core.initPreferenceScope($scope, localStorage, {
'artemisUserName': {
'value': userDetails.username ? userDetails.username : ""
},
'artemisPassword': {
'value': userDetails.password ? userDetails.password : ""
},
'artemisDLQ': {
'value': "^DLQ$"
},
'artemisExpiryQueue': {
'value': "^ExpiryQueue$"
},
'ArtemisBrowseBytesMessages': {
'value': 99,
'post': function (newValue) {
$scope.$emit('ArtemisBrowseBytesMessages', newValue);
}
}
})}])
.run(configurePreferences)
.name;
function configurePreferences(preferencesRegistry, $templateCache, workspace) {
var path = 'plugin/preferences.html';
preferencesRegistry.addTab("Artemis", path, function () {
return workspace.treeContainsDomainAndProperties("org.apache.activemq.artemis");
});
$templateCache.put(path,
`<form class="form-horizontal artemis-preferences-form" ng-controller="Artemis.PreferencesController">
<div class="form-group">
<label class="col-md-2 control-label" for="artemisUserName">
Artemis user name
<span class="pficon pficon-info" data-toggle="tooltip" data-placement="top" title="The user name to be used when connecting to the broker"></span>
</label>
<div class="col-md-6">
<input id="artemisUserName" type="text" class="form-control" ng-model="artemisUserName"/>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label" for="artemisPassword">
Artemis password
<span class="pficon pficon-info" data-toggle="tooltip" data-placement="top" title="The user name to be used when connecting to the broker"></span>
</label>
<div class="col-md-6">
<input id="artemisPassword" type="password" class="form-control" ng-model="artemisPassword"/>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label" for="artemisDLQ">
Dead-letter address regex
<span class="pficon pficon-info" data-toggle="tooltip" data-placement="top" title="A regular expression to match one or more dead-letter addresses"></span>
</label>
<div class="col-md-6">
<input type="text" id="artemisDLQ" ng-model="artemisDLQ">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label" for="artemisExpiryQueue">
Expiry address regex
<span class="pficon pficon-info" data-toggle="tooltip" data-placement="top" title="A regular expression to match one or more expiry addresses"></span>
</label>
<div class="col-md-6">
<input type="text" id="artemisExpiryQueue" ng-model="artemisExpiryQueue">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label" for="Browse Byte Messages">
Browse Bytes Messages
<span class="pficon pficon-info" data-toggle="tooltip" data-placement="top" title="Browsing byte messages should display the message body as this"></span>
</label>
<div class="col-md-6">
<select id="ArtemisBrowseBytesMessages" class="form-control" ng-model="ArtemisBrowseBytesMessages">
<option value="99">Off</option>
<option value="16">Text</option>
<option value="8">Decimal</option>
<option value="4">Hex</option>
<option value="2">Decimal and Text</option>
<option value="1">Hex and Text</option>
</select>
</div>
</div>
</form>`
);
}
configurePreferences.$inject = ['preferencesRegistry', '$templateCache', 'workspace'];
})(Artemis || (Artemis = {}));

View File

@ -0,0 +1,251 @@
/*-
* ~~~~~~licensing~~~~~~
* artemis-plugin-entaxy
* ==========
* 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~~~~~~
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
var Artemis;
(function (Artemis) {
Artemis.log.debug("loading producers");
Artemis._module.component('artemisProducers', {
template:
`<h1>Browse Producers
<button type="button" class="btn btn-link jvm-title-popover"
uib-popover-template="'producers-instructions.html'" popover-placement="bottom-left"
popover-title="Instructions" popover-trigger="'outsideClick'">
<span class="pficon pficon-help"></span>
</button>
</h1>
<div ng-include="'plugin/artemistoolbar.html'"></div>
<pf-table-view config="$ctrl.tableConfig"
dt-options="$ctrl.dtOptions"
columns="$ctrl.tableColumns"
items="$ctrl.producers">
</pf-table-view>
<div ng-include="'plugin/artemispagination.html'"></div>
<script type="text/ng-template" id="producers-instructions.html">
<div>
<p>
This page allows you to browse all producers currently open on the broker. These can be narrowed down
by specifying a filter and also sorted using the sort function in the toolbar. To execute a query
click on the <span class="fa fa-search"></span> button.
</p>
<p>
You can navigate to the producers session by clicking on the <code>Session</code> field.
</p>
<p>
Note that each page is loaded in from the broker when navigating to a new page or when a query is executed.
</p>
</div>
</script>
`,
controller: ProducersController
})
.name;
function ProducersController($scope, workspace, jolokia, localStorage, artemisMessage, $location, $timeout, $filter, $sanitize, pagination, artemisProducer, artemisAddress, artemisSession) {
var ctrl = this;
ctrl.pagination = pagination;
ctrl.pagination.reset();
var mbean = Artemis.getBrokerMBean(workspace, jolokia);
ctrl.allProducers = [];
ctrl.producers = [];
ctrl.pageNumber = 1;
ctrl.workspace = workspace;
ctrl.refreshed = false;
ctrl.dtOptions = {
// turn of ordering as we do it ourselves
ordering: false,
columns: [
{name: "ID", visible: true},
{name: "Session", visible: true},
{name: "Client ID", visible: true},
{name: "Protocol", visible: true},
{name: "User", visible: true},
{name: "Address", visible: true},
{name: "Remote Address", visible: true},
{name: "Local Address", visible: true}
]
};
Artemis.log.debug('localStorage: producersColumnDefs =', localStorage.getItem('producersColumnDefs'));
if (localStorage.getItem('producersColumnDefs')) {
loadedDefs = JSON.parse(localStorage.getItem('producersColumnDefs'));
//sanity check to make sure columns havent been added
if(loadedDefs.length === ctrl.dtOptions.columns.length) {
ctrl.dtOptions.columns = loadedDefs;
}
}
ctrl.updateColumns = function () {
var attributes = [];
ctrl.dtOptions.columns.forEach(function (column) {
attributes.push({name: column.name, visible: column.visible});
});
Artemis.log.debug("saving columns " + JSON.stringify(attributes));
localStorage.setItem('producersColumnDefs', JSON.stringify(attributes));
}
ctrl.filter = {
fieldOptions: [
{id: 'id', name: 'ID'},
{id: 'session', name: 'Session'},
{id: 'clientID', name: 'Client ID'},
{id: 'user', name: 'User'},
{id: 'address', name: 'Address'},
{id: 'protocol', name: 'Protocol'},
{id: 'localAddress', name: 'Local Address'},
{id: 'remoteAddress', name: 'Remote Address'}
],
operationOptions: [
{id: 'EQUALS', name: 'Equals'},
{id: 'CONTAINS', name: 'Contains'}
],
sortOptions: [
{id: 'asc', name: 'ascending'},
{id: 'desc', name: 'descending'}
],
values: {
field: "",
operation: "",
value: "",
sortOrder: "asc",
sortColumn: "id"
},
text: {
fieldText: "Filter Field..",
operationText: "Operation..",
sortOrderText: "ascending",
sortByText: "ID"
}
};
ctrl.tableConfig = {
selectionMatchProp: 'id',
showCheckboxes: false
};
ctrl.tableColumns = [
{ header: 'ID', itemField: 'id' },
{ header: 'Session', itemField: 'session' , templateFn: function(value, item) { return '<a href="#" onclick="selectSession(' + item.idx + ')">' + $sanitize(value) + '</a>' }},
{ header: 'Client ID', itemField: 'clientID' },
{ header: 'Protocol', itemField: 'protocol' },
{ header: 'User', itemField: 'user' },
{ header: 'Address', itemField: 'address', templateFn: function(value, item) { return '<a href="#" onclick="selectAddress(' + item.idx + ')">' + $sanitize(value) + '</a>' }},
{ header: 'Remote Address', itemField: 'remoteAddress' },
{ header: 'Local Address', itemField: 'localAddress' }
];
ctrl.refresh = function () {
ctrl.refreshed = true;
ctrl.pagination.load();
};
ctrl.reset = function () {
ctrl.filter.values.field = "";
ctrl.filter.values.operation = "";
ctrl.filter.values.value = "";
ctrl.filter.sortOrder = "asc";
ctrl.filter.sortColumn = "id";
ctrl.filter.text.fieldText = "Filter Field..";
ctrl.filter.text.operationText = "Operation..";
ctrl.filter.text.sortOrderText = "ascending";
ctrl.filter.text.sortByText = "ID";
ctrl.refreshed = true;
artemisProducer.producer = null;
ctrl.pagination.load();
};
selectAddress = function (idx) {
var address = ctrl.producers[idx].address;
Artemis.log.debug("navigating to address:" + address)
artemisAddress.address = { address: address };
$location.path("artemis/artemisAddresses");
};
selectSession = function (idx) {
var session = ctrl.producers[idx].session;
Artemis.log.debug("navigating to session:" + session)
artemisSession.session = { session: session };
$location.path("artemis/artemisSessions");
};
if (artemisProducer.producer) {
Artemis.log.debug("navigating to producer = " + artemisProducer.producer.session);
ctrl.filter.values.field = ctrl.filter.fieldOptions[1].id;
ctrl.filter.values.operation = ctrl.filter.operationOptions[0].id;
ctrl.filter.values.value = artemisProducer.producer.session;
artemisProducer.producer = null;
}
ctrl.loadOperation = function () {
if (mbean) {
var method = 'listProducers(java.lang.String, int, int)';
var producerFilter = {
field: ctrl.filter.values.field,
operation: ctrl.filter.values.operation,
value: ctrl.filter.values.value,
sortOrder: ctrl.filter.values.sortOrder,
sortColumn: ctrl.filter.values.sortColumn
};
if (ctrl.refreshed == true) {
ctrl.pagination.reset();
ctrl.refreshed = false;
}
jolokia.request({ type: 'exec', mbean: mbean, operation: method, arguments: [JSON.stringify(producerFilter), ctrl.pagination.pageNumber, ctrl.pagination.pageSize] }, Core.onSuccess(populateTable, { error: onError }));
}
};
ctrl.pagination.setOperation(ctrl.loadOperation);
function onError(response) {
Core.notification("error", "could not invoke list sessions" + response.error);
$scope.workspace.selectParentNode();
};
function populateTable(response) {
var data = JSON.parse(response.value);
ctrl.producers = [];
angular.forEach(data["data"], function (value, idx) {
value.idx = idx;
ctrl.producers.push(value);
});
ctrl.pagination.page(data["count"]);
allProducers = ctrl.producers;
ctrl.producers = allProducers;
Core.$apply($scope);
}
ctrl.pagination.load();
}
ProducersController.$inject = ['$scope', 'workspace', 'jolokia', 'localStorage', 'artemisMessage', '$location', '$timeout', '$filter', '$sanitize', 'pagination', 'artemisProducer', 'artemisAddress', 'artemisSession'];
})(Artemis || (Artemis = {}));

View File

@ -0,0 +1,381 @@
/*-
* ~~~~~~licensing~~~~~~
* artemis-plugin-entaxy
* ==========
* 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~~~~~~
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
var Artemis;
(function (Artemis) {
//Artemis.log.debug("loading addresses");
Artemis._module.component('artemisQueues', {
template:
`<h1>Browse Queues
<button type="button" class="btn btn-link jvm-title-popover"
uib-popover-template="'queues-instructions.html'" popover-placement="bottom-left"
popover-title="Instructions" popover-trigger="'outsideClick'">
<span class="pficon pficon-help"></span>
</button>
</h1>
<div ng-include="'plugin/artemistoolbar.html'"></div>
<pf-table-view config="$ctrl.tableConfig"
dt-options="$ctrl.dtOptions"
columns="$ctrl.tableColumns"
action-buttons="$ctrl.tableActionButtons"
items="$ctrl.queues">
</pf-table-view>
<div ng-include="'plugin/artemispagination.html'"></div>
<script type="text/ng-template" id="queues-instructions.html">
<div>
<p>
This page allows you to browse all queues on the broker. These can be narrowed down
by specifying a filter and also sorted using the sort function in the toolbar. To execute a query
click on the <span class="fa fa-search"></span> button.
</p>
<p>
You can also navigate directly to the JMX attributes and operations tabs by using the <code>attributes</code>
and <code>operations</code> button under the <code>Actions</code> column.You can navigate to the
queues address by clicking on the <code>Address</code> field.
</p>
<p>
Note that each page is loaded in from the broker when navigating to a new page or when a query is executed.
</p>
</div>
</script>
`,
controller: QueuesController
})
.name;
function QueuesController($scope, workspace, jolokia, localStorage, artemisMessage, $location, $timeout, $filter, $sanitize, pagination, artemisQueue, artemisAddress) {
var ctrl = this;
ctrl.pagination = pagination;
ctrl.pagination.reset();
var mbean = Artemis.getBrokerMBean(workspace, jolokia);
ctrl.allAddresses = [];
ctrl.queues = [];
ctrl.workspace = workspace;
ctrl.refreshed = false;
ctrl.dtOptions = {
// turn of ordering as we do it ourselves
ordering: false,
columns: [
{name: "ID", visible: true},
{name: "name", visible: true},
{name: "Address", visible: true},
{name: "Routing Type", visible: true},
{name: "Filter", visible: true},
{name: "Durable", visible: true},
{name: "Max Consumers", visible: true},
{name: "Purge On No Consumers", visible: true},
{name: "Consumer Count", visible: true},
{name: "Rate", visible: true},
{name: "Message Count", visible: true},
{name: "Paused", visible: false},
{name: "Temporary", visible: false},
{name: "Auto Created", visible: false},
{name: "User", visible: false},
{name: "Total Messages Added", visible: false},
{name: "Total Messages Acked", visible: false},
{name: "Delivering Count", visible: false},
{name: "Messages Killed", visible: false},
{name: "Direct Deliver", visible: false},
{name: "Exclusive", visible: false},
{name: "Last Value", visible: false},
{name: "Last Value Key", visible: false},
{name: "Scheduled Count", visible: false},
{name: "Group Rebalance", visible: false},
{name: "Group Rebalance Pause Dispatch", visible: false},
{name: "Group Buckets", visible: false},
{name: "Group First Key", visible: false},
{name: "Queue Enabled", visible: false},
{name: "Ring Size", visible: false},
{name: "Consumers Before Dispatch", visible: false},
{name: "Delay Before Dispatch", visible: false}
]
};
Artemis.log.debug('localStorage: queuesColumnDefs =', localStorage.getItem('queuesColumnDefs'));
if (localStorage.getItem('queuesColumnDefs')) {
Artemis.log.info("loading columns " + localStorage.getItem('queuesColumnDefs'))
loadedDefs = JSON.parse(localStorage.getItem('queuesColumnDefs'));
//sanity check to make sure columns havent been added
if(loadedDefs.length === ctrl.dtOptions.columns.length) {
ctrl.dtOptions.columns = loadedDefs;
}
}
ctrl.updateColumns = function () {
var attributes = [];
ctrl.dtOptions.columns.forEach(function (column) {
attributes.push({name: column.name, visible: column.visible});
});
Artemis.log.debug("saving columns " + JSON.stringify(attributes));
localStorage.setItem('queuesColumnDefs', JSON.stringify(attributes));
}
ctrl.filter = {
fieldOptions: [
{id: 'id', name: 'ID'},
{id: 'name', name: 'Name'},
{id: 'consumerCount', name: 'Consumer Count'},
{id: 'address', name: 'Address'},
{id: 'filter', name: 'Filter'},
{id: 'maxConsumers', name: 'Max Consumers'},
{id: 'routingType', name: 'Routing Type'},
{id: 'purgeOnNoConsumers', name: 'Purge On No Consumers'},
{id: 'user', name: 'User'},
{id: 'messageCount', name: 'Message Count'},
{id: 'deliveringCount', name: 'Delivering Count'},
{id: 'paused', name: 'Paused'},
{id: 'temporary', name: 'Temporary'},
{id: 'autoCreated', name: 'Auto Created'},
{id: 'rate', name: 'Rate'}
],
operationOptions: [
{id: 'EQUALS', name: 'Equals'},
{id: 'CONTAINS', name: 'Contains'},
{id: 'NOT_CONTAINS', name: 'Does Not Contain'},
{id: 'GREATER_THAN', name: 'Greater Than'},
{id: 'LESS_THAN', name: 'Less Than'}
],
sortOptions: [
{id: 'asc', name: 'ascending'},
{id: 'desc', name: 'descending'}
],
values: {
field: "",
operation: "",
value: "",
sortOrder: "asc",
sortColumn: "id"
},
text: {
fieldText: "Filter Field..",
operationText: "Operation..",
sortOrderText: "ascending",
sortByText: "ID"
}
};
ctrl.tableActionButtons = [
{
name: 'attributes',
title: 'Navigate to attributes',
actionFn: navigateToQueuesAtts
},
{
name: 'operations',
title: 'navigate to operations',
actionFn: navigateToQueuesOps
}
];
ctrl.tableConfig = {
selectionMatchProp: 'id',
showCheckboxes: false
};
ctrl.tableColumns = [
{ header: 'ID', itemField: 'id' },
{ header: 'Name', itemField: 'name',
templateFn: function(value, item) { return '<a href="#" onclick="selectQueue(' + item.idx + ')">' + $sanitize(value) + '</a>' }
},
{ header: 'Address', itemField: 'address',
templateFn: function(value, item) { return '<a href="#" onclick="selectAddress(' + item.idx + ')">' + $sanitize(value) + '</a>' }
},
{ header: 'Routing Type', itemField: 'routingType'},
{ header: 'Filter', itemField: 'filter' },
{ header: 'Durable', itemField: 'durable' },
{ header: 'Max Consumers', itemField: 'maxConsumers' },
{ header: 'Purge On No Consumers', itemField: 'purgeOnNoConsumers' },
{ header: 'Consumer Count', itemField: 'consumerCount' ,
templateFn: function(value, item) { return '<a href="#" onclick="selectConsumers(' + item.idx + ')">' + $sanitize(value) + '</a>' }
},
{ header: 'Rate', itemField: 'rate' },
{ header: 'Message Count', itemField: 'messageCount',
templateFn: function(value, item) { return '<a href="#" onclick="browseQueue(' + item.idx + ')" title="Browse Messages">' + value + '</a>' }
},
{ header: 'Paused', itemField: 'paused' },
{ header: 'Temporary', itemField: 'temporary' },
{ header: 'Auto Created', itemField: 'autoCreated' },
{ header: 'User', itemField: 'user' },
{ header: 'Total Messages Added', itemField: 'messagesAdded' },
{ header: 'Total Messages Acked', itemField: 'messagesAcked' },
{ header: 'Delivering Count', itemField: 'deliveringCount' },
{ header: 'Messages Killed', itemField: 'messagesKilled' },
{ header: 'Direct Deliver', itemField: 'directDeliver' },
{ header: 'exclusive', itemField: 'exclusive' },
{ header: 'Last Value', itemField: 'lastValue' },
{ header: 'Last Value Key', itemField: 'lastValueKey' },
{ header: 'Scheduled Count', itemField: 'scheduledCount' },
{ header: 'Group Rebalance', itemField: 'groupRebalance' },
{ header: 'Group Rebalance Pause Dispatch', itemField: 'groupRebalancePauseDispatch' },
{ header: 'Group Buckets', itemField: 'groupBuckets' },
{ header: 'Group First Key', itemField: 'groupFirstKey' },
{ header: 'Enabled', itemField: 'enabled'},
{ header: 'Ring Size', itemField: 'ringSize'},
{ header: 'Consumers Before Dispatch', itemField: 'consumersBeforeDispatch'},
{ header: 'Delay Before Dispatch', itemField: 'delayBeforeDispatch'}
];
ctrl.refresh = function () {
ctrl.refreshed = true;
ctrl.pagination.load();
};
ctrl.reset = function () {
ctrl.filter.values.field = "";
ctrl.filter.values.operation = "";
ctrl.filter.values.value = "";
ctrl.filter.sortOrder = "asc";
ctrl.filter.sortColumn = "id";
ctrl.filter.text.fieldText = "Filter Field..";
ctrl.filter.text.operationText = "Operation..";
ctrl.filter.text.sortOrderText = "ascending";
ctrl.filter.text.sortByText = "ID";
ctrl.refreshed = true;
ctrl.pagination.load();
};
if (artemisQueue.queue) {
Artemis.log.debug("navigating to queue = " + artemisQueue.queue.queue);
ctrl.filter.values.field = ctrl.filter.fieldOptions[1].id;
ctrl.filter.values.operation = ctrl.filter.operationOptions[0].id;
ctrl.filter.values.value = artemisQueue.queue.queue;
artemisQueue.queue = null;
}
if (artemisAddress.address) {
Artemis.log.debug("navigating to address = " + artemisAddress.address.address);
ctrl.filter.values.field = ctrl.filter.fieldOptions[3].id;
ctrl.filter.values.operation = ctrl.filter.operationOptions[0].id;
ctrl.filter.values.value = artemisAddress.address.address;
artemisAddress.address = null;
}
function navigateToQueuesAtts(action, item) {
qnid = getQueuesNid(item, $location);
Artemis.log.info(qnid);
$location.path("artemis/attributes").search({"tab": "artemis", "nid": qnid });
};
function navigateToQueuesOps(action, item) {
$location.path("artemis/operations").search({"tab": "artemis", "nid": getQueuesNid(item, $location)});
};
selectAddress = function (idx) {
var item = ctrl.queues[idx]
Artemis.log.debug("navigating to address:" + item.address);
artemisAddress.address = { address: item.address };
$location.path("artemis/artemisAddresses").search({"tab": "artemis", "nid": getAddressesNid(item, $location)});
};
selectQueue = function (idx) {
var item = ctrl.queues[idx];
var nid = getQueuesNid(item, $location);
Artemis.log.debug("navigating to queue:" + nid);
artemisQueue.queue = { queue: item.name };
$location.path("artemis/artemisQueues").search({"tab": "artemis", "nid": nid});
};
selectConsumers = function (idx) {
var item = ctrl.queues[idx];
var nid = getQueuesNid(item, $location);
artemisQueue.queue = { queue: item.name };
$location.path("artemis/artemisConsumers").search({"tab": "artemis", "nid": nid});;
};
browseQueue = function (idx) {
var item = ctrl.queues[idx];
var nid = getQueuesNid(item, $location);
Artemis.log.debug("navigating to queue browser:" + nid);
$location.path("artemis/artemisBrowseQueue").search({"tab": "artemis", "nid": nid});
};
function getQueuesNid(item, $location) {
var rootNID = getRootNid($location);
var targetNID = rootNID + "addresses-" + item.address + "-queues-" + item.routingType.toLowerCase() + "-" + item.name;
Artemis.log.debug("targetNID=" + targetNID);
return targetNID;
}
function getAddressesNid(item, $location) {
var rootNID = getRootNid($location);
var targetNID = rootNID + "addresses-" + item.address;
Artemis.log.debug("targetNID=" + targetNID);
return targetNID;
}
function getRootNid($location) {
var mBean = Artemis.getBrokerMBean(workspace, jolokia);
var details = Core.parseMBean(mBean);
var properties = details['attributes'];
var brokerAddress = properties["broker"] || "unknown";
var artemisJmxDomain = localStorage['artemisJmxDomain'] || "org.apache.activemq.artemis";
//we have to remove the surrounding quotes
return "root-" + artemisJmxDomain + "-" + brokerAddress.replace(/^"|"$/g, '') + "-";
}
ctrl.loadOperation = function () {
if (mbean) {
var method = 'listQueues(java.lang.String, int, int)';
var queuesFilter = {
field: ctrl.filter.values.field,
operation: ctrl.filter.values.operation,
value: ctrl.filter.values.value,
sortOrder: ctrl.filter.values.sortOrder,
sortColumn: ctrl.filter.values.sortColumn
};
if (ctrl.refreshed == true) {
ctrl.pagination.reset();
ctrl.refreshed = false;
}
jolokia.request({ type: 'exec', mbean: mbean, operation: method, arguments: [JSON.stringify(queuesFilter), ctrl.pagination.pageNumber, ctrl.pagination.pageSize] }, Core.onSuccess(populateTable, { error: onError }));
}
};
ctrl.pagination.setOperation(ctrl.loadOperation);
function onError(response) {
Core.notification("error", "could not invoke list queues" + response.error);
$scope.workspace.selectParentNode();
};
function populateTable(response) {
var data = JSON.parse(response.value);
ctrl.queues = [];
angular.forEach(data["data"], function (value, idx) {
value.idx = idx;
ctrl.queues.push(value);
});
ctrl.pagination.page(data["count"]);
allQueues = ctrl.queues;
ctrl.queues = allQueues;
Core.$apply($scope);
}
ctrl.pagination.load();
}
QueuesController.$inject = ['$scope', 'workspace', 'jolokia', 'localStorage', 'artemisMessage', '$location', '$timeout', '$filter', '$sanitize', 'pagination', 'artemisQueue', 'artemisAddress'];
})(Artemis || (Artemis = {}));

View File

@ -0,0 +1,174 @@
/*-
* ~~~~~~licensing~~~~~~
* artemis-plugin-entaxy
* ==========
* 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~~~~~~
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/// <reference path="tree.component.ts"/>
var Artemis;
(function (Artemis) {
Artemis.log.debug("loading send message");
Artemis._module.component('artemisSendMessage', {
template:
`<h1>Send Message
<button type="button" class="btn btn-link jvm-title-popover"
uib-popover-template="'send-message-instructions.html'" popover-placement="bottom-left"
popover-title="Instructions" popover-trigger="'outsideClick'">
<span class="pficon pficon-help"></span>
</button>
</h1>
<div class="alert alert-warning" ng-show="$ctrl.message.noCredentials">
<span class="pficon pficon-warning-triangle-o"></span>
<strong>No credentials set for endpoint!</strong>
Please set your username and password in the
<a href="#" class="alert-link" ng-click="$ctrl.message.openPrefs()">Preferences</a> page.
</div>
<div class="row artemis-message-configuration">
<div class="col-sm-12">
<form>
<div class="form-group">
<label>Durable </label>
<input id="durable" type="checkbox" ng-model="$ctrl.message.durable" value="true">
<button type="button" class="btn btn-link jvm-title-popover"
uib-popover-template="'durable-info.html'" popover-placement="bottom-left"
popover-title="Durable" popover-trigger="'mouseenter'">
<span class="pficon pficon-info"></span>
</button>
</div>
<div class="form-group">
<label>Create Message ID </label>
<input id="messageID" type="checkbox" ng-model="$ctrl.message.messageID" value="true">
<button type="button" class="btn btn-link jvm-title-popover"
uib-popover-template="'message-id-info.html'" popover-placement="bottom-left"
popover-title="Message ID" popover-trigger="'mouseenter'">
<span class="pficon pficon-info"></span>
</button>
</div>
</form>
</div>
</div>
<h3>Headers</h3>
<div class="form-group" ng-if="$ctrl.message.headers.length > 0">
<table class="scr-component-references-table table">
<tbody>
<tr class="input-group" ng-repeat="header in $ctrl.message.headers">
<td><input type="text" class="form-control" ng-model="header.name" placeholder="Name" autocomplete="off" id="name"></td>
<td><input type="text" class="form-control" ng-model="header.value" placeholder="Value" autocomplete="off" id="value"></td>
<td><div class="input-group-prepend">
<button type="button" class="btn btn-default" title="Delete" ng-click="$ctrl.removeHeader(header)">
<span class="pficon pficon-delete"></span>
</button>
</div></td>
</tr>
</tbody>
</table>
</div>
<p>
<button type="button" class="btn btn-primary artemis-add-message-button" ng-click="$ctrl.message.addHeader()">Add Header</button>
</p>
<h3>Body</h3>
<form>
<div class="form-group">
<div hawtio-editor="$ctrl.message.message" mode="codeMirrorOptions.mode.name"></div>
</div>
<div class="form-group">
<select class="form-control artemis-send-message-format" ng-model="codeMirrorOptions.mode.name">
<option value="javascript">JSON</option>
<option value="xml">XML</option>
</select>
<button class="btn btn-default" ng-click="$ctrl.formatMessage()"
title="Automatically pretty prints the message so its easier to read">Format
</button>
</div>
</form>
<p>
<button type="button" class="btn btn-primary artemis-send-message-button" ng-click="$ctrl.message.sendMessage($ctrl.message.durable, $ctrl.message.messageID)">Send message</button>
</p>
<script type="text/ng-template" id="send-message-instructions.html">
<div>
<p>
This page allows you to send a message to the chosen queue. The message will be of type <code>text</code>
message and it will be possible to add headers to the message. The sending of the message will be authenticated
using the username and password set ion <code>preferences</code>, if this is not set then these will
be null.
</p>
</div>
</script>
<script type="text/ng-template" id="message-id-info.html">
<div>
<p>
The Message ID is an automatically generated UUID that is set on the Message by the broker before it is routed.
If using a JMS client this would be the JMS Message ID on the JMS Message, this typically would not get
set for non JMS clients. Historically and on some other tabs this is also referred to as the User ID.
</p>
</div>
</script>
<script type="text/ng-template" id="durable-info.html">
<div>
<p>
If durable the message will be marked persistent and written to the brokers journal if the destination queue is durable.
</p>
</div>
</script>
`,
controller: SendMessageController
})
.name;
Artemis.log.debug("loaded queue " + Artemis.createQueueModule);
function SendMessageController($route, $scope, $element, $timeout, workspace, jolokia, localStorage, $location, artemisMessage, messageCreator) {
Core.initPreferenceScope($scope, localStorage, {
'durable': {
'value': true,
'converter': Core.parseBooleanValue
},
'messageID': {
'value': true,
'converter': Core.parseBooleanValue
}
});
var ctrl = this;
ctrl.messageCreator = messageCreator;
ctrl.message = ctrl.messageCreator.createNewMessage($scope, $location, $route, localStorage, artemisMessage, workspace, $element, $timeout, jolokia);
}
SendMessageController.$inject = ['$route', '$scope', '$element', '$timeout', 'workspace', 'jolokia', 'localStorage', '$location', 'artemisMessage', 'messageCreator'];
})(Artemis || (Artemis = {}));

View File

@ -0,0 +1,309 @@
/*-
* ~~~~~~licensing~~~~~~
* artemis-plugin-entaxy
* ==========
* 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~~~~~~
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
var Artemis;
(function (Artemis) {
Artemis.log.debug("loading sessions");
Artemis._module.component('artemisSessions', {
template:
`<h1>Browse Sessions
<button type="button" class="btn btn-link jvm-title-popover"
uib-popover-template="'sessions-instructions.html'" popover-placement="bottom-left"
popover-title="Instructions" popover-trigger="'outsideClick'">
<span class="pficon pficon-help"></span>
</button>
</h1>
<div ng-include="'plugin/artemistoolbar.html'"></div>
<pf-table-view config="$ctrl.tableConfig"
dt-options="$ctrl.dtOptions"
columns="$ctrl.tableColumns"
action-buttons="$ctrl.tableActionButtons"
items="$ctrl.sessions">
</pf-table-view>
<div ng-include="'plugin/artemispagination.html'"></div>
<div hawtio-confirm-dialog="$ctrl.closeDialog" title="Close Session?"
ok-button-text="Close"
cancel-button-text="Cancel"
on-ok="$ctrl.closeSession()">
<div class="dialog-body">
<p class="alert alert-warning">
<span class="pficon pficon-warning-triangle-o"></span>
You are about to close the selected session: {{$ctrl.sessionToDelete}}
<p>Are you sure you want to continue.</p>
</p>
</div>
</div>
<script type="text/ng-template" id="sessions-instructions.html">
<div>
<p>
This page allows you to browse all session currently open on the broker. These can be narrowed down
by specifying a filter and also sorted using the sort function in the toolbar. To execute a query
click on the <span class="fa fa-search"></span> button.
</p>
<p>
Sessions can be closed by using the <code>close</code> button under the <code>Actions</code> column and you can
navigate to the connection, consumers and producers by clicking on the appropriate field.
</p>
<p>
Note that each page is loaded in from the broker when navigating to a new page or when a query is executed.
</p>
</div>
</script>
`,
controller: SessionsController
})
.name;
function SessionsController($scope, workspace, jolokia, localStorage, artemisMessage, $location, $timeout, $filter, $sanitize, pagination, artemisConnection, artemisSession, artemisConsumer, artemisProducer) {
var ctrl = this;
ctrl.pagination = pagination;
ctrl.pagination.reset();
var mbean = Artemis.getBrokerMBean(workspace, jolokia);
ctrl.allSessions = [];
ctrl.sessions = [];
ctrl.pageNumber = 1;
ctrl.workspace = workspace;
ctrl.refreshed = false;
ctrl.sessionToDeletesConnection = '';
ctrl.sessionToDelete = '';
ctrl.closeDialog = false;
ctrl.dtOptions = {
// turn of ordering as we do it ourselves
ordering: false,
columns: [
{name: "ID", visible: true},
{name: "Connection", visible: true},
{name: "User", visible: true},
{name: "Consumer Count", visible: true},
{name: "Producer Count", visible: true},
{name: "Creation Time", visible: true}
]
};
Artemis.log.debug('localStorage: sessionsColumnDefs =', localStorage.getItem('sessionsColumnDefs'));
if (localStorage.getItem('sessionsColumnDefs')) {
loadedDefs = JSON.parse(localStorage.getItem('sessionsColumnDefs'));
//sanity check to make sure columns havent been added
if(loadedDefs.length === ctrl.dtOptions.columns.length) {
ctrl.dtOptions.columns = loadedDefs;
}
}
ctrl.updateColumns = function () {
var attributes = [];
ctrl.dtOptions.columns.forEach(function (column) {
attributes.push({name: column.name, visible: column.visible});
});
Artemis.log.debug("saving columns " + JSON.stringify(attributes));
localStorage.setItem('sessionsColumnDefs', JSON.stringify(attributes));
}
ctrl.filter = {
fieldOptions: [
{id: 'id', name: 'ID'},
{id: 'connectionID', name: 'Connection ID'},
{id: 'consumerCount', name: 'Consumer Count'},
{id: 'user', name: 'User'},
{id: 'protocol', name: 'Protocol'},
{id: 'clientID', name: 'Client ID'},
{id: 'localAddress', name: 'Local Address'},
{id: 'remoteAddress', name: 'Remote Address'}
],
operationOptions: [
{id: 'EQUALS', name: 'Equals'},
{id: 'CONTAINS', name: 'Contains'},
{id: 'NOT_CONTAINS', name: 'Does Not Contain'},
{id: 'GREATER_THAN', name: 'Greater Than'},
{id: 'LESS_THAN', name: 'Less Than'}
],
sortOptions: [
{id: 'asc', name: 'ascending'},
{id: 'desc', name: 'descending'}
],
values: {
field: "",
operation: "",
value: "",
sortOrder: "asc",
sortColumn: "id"
},
text: {
fieldText: "Filter Field..",
operationText: "Operation..",
sortOrderText: "ascending",
sortByText: "ID"
}
};
ctrl.tableActionButtons = [
{
name: 'Close',
title: 'Close the Session',
actionFn: openCloseDialog
}
];
ctrl.tableConfig = {
selectionMatchProp: 'id',
showCheckboxes: false
};
ctrl.tableColumns = [
{ header: 'ID', itemField: 'id' },
{ header: 'Connection', itemField: 'connectionID', templateFn: function(value, item) { return '<a href="#" onclick="selectConnection(' + item.idx + ')">' + $sanitize(value) + '</a>' }},
{ header: 'User', itemField: 'user' },
{ header: 'Consumer Count', itemField: 'consumerCount', templateFn: function(value, item) { return '<a href="#" onclick="selectConsumers(' + item.idx + ')">' + $sanitize(value) + '</a>' }},
{ header: 'Producer Count', itemField: 'producerCount', templateFn: function(value, item) { return '<a href="#" onclick="selectProducers(' + item.idx + ')">' + $sanitize(value) + '</a>' }},
{ header: 'Creation Time', itemField: 'creationTime' }
];
ctrl.refresh = function () {
ctrl.refreshed = true;
ctrl.pagination.load();
};
ctrl.reset = function () {
ctrl.filter.values.field = "";
ctrl.filter.values.operation = "";
ctrl.filter.values.value = "";
ctrl.filter.sortOrder = "asc";
ctrl.filter.sortColumn = "id";
ctrl.filter.text.fieldText = "Filter Field..";
ctrl.filter.text.operationText = "Operation..";
ctrl.filter.text.sortOrderText = "ascending";
ctrl.filter.text.sortByText = "ID";
ctrl.refreshed = true;
artemisConnection.connection = null;
artemisSession.session = null;
artemisConsumer.consumer = null;
ctrl.pagination.load();
};
selectConnection = function (idx) {
var connection = ctrl.sessions[idx].connectionID;
Artemis.log.debug("navigating to connection:" + connection)
artemisSession.session = { connectionID: connection };
$location.path("artemis/artemisConnections");
};
selectConsumers = function (idx) {
var session = ctrl.sessions[idx].id;
Artemis.log.debug("navigating to consumers:" + session)
artemisConsumer.consumer = { sessionID: session };
$location.path("artemis/artemisConsumers");
};
selectProducers = function (idx) {
var session = ctrl.sessions[idx].id;
Artemis.log.debug("navigating to producers:" + session)
artemisProducer.producer = { sessionID: session };
$location.path("artemis/artemisProducers");
};
if (artemisConnection.connection) {
Artemis.log.debug("navigating to connection = " + artemisConnection.connection.connectionID);
ctrl.filter.values.field = ctrl.filter.fieldOptions[1].id;
ctrl.filter.values.operation = ctrl.filter.operationOptions[0].id;
ctrl.filter.values.value = artemisConnection.connection.connectionID;
artemisConnection.connection = null;
}
if (artemisSession.session) {
Artemis.log.debug("navigating to session = " + artemisSession.session.session);
ctrl.filter.values.field = ctrl.filter.fieldOptions[0].id;
ctrl.filter.values.operation = ctrl.filter.operationOptions[0].id;
ctrl.filter.values.value = artemisSession.session.session;
artemisSession.session = null;
}
function openCloseDialog(action, item) {
ctrl.sessionToDelete = item.id;
ctrl.sessionToDeletesConnection = item.connectionID;
ctrl.closeDialog = true;
}
ctrl.closeSession = function () {
Artemis.log.debug("closing session: " + ctrl.sessionToDelete);
if (mbean) {
jolokia.request({ type: 'exec',
mbean: mbean,
operation: 'closeSessionWithID(java.lang.String,java.lang.String)',
arguments: [ctrl.sessionToDeletesConnection, ctrl.sessionToDelete] },
Core.onSuccess(ctrl.pagination.load(), { error: function (response) {
Core.defaultJolokiaErrorHandler("Could not close session: " + response);
}}));
}
};
ctrl.loadOperation = function () {
if (mbean) {
var method = 'listSessions(java.lang.String, int, int)';
var sessionsFilter = {
field: ctrl.filter.values.field,
operation: ctrl.filter.values.operation,
value: ctrl.filter.values.value,
sortOrder: ctrl.filter.values.sortOrder,
sortColumn: ctrl.filter.values.sortColumn
};
if (ctrl.refreshed == true) {
ctrl.pagination.reset();
ctrl.refreshed = false;
}
jolokia.request({ type: 'exec', mbean: mbean, operation: method, arguments: [JSON.stringify(sessionsFilter), ctrl.pagination.pageNumber, ctrl.pagination.pageSize] }, Core.onSuccess(populateTable, { error: onError }));
}
};
ctrl.pagination.setOperation(ctrl.loadOperation);
function onError(response) {
Core.notification("error", "could not invoke list sessions" + response.error);
$scope.workspace.selectParentNode();
};
function populateTable(response) {
var data = JSON.parse(response.value);
ctrl.sessions = [];
angular.forEach(data["data"], function (value, idx) {
value.idx = idx;
ctrl.sessions.push(value);
});
ctrl.pagination.page(data["count"]);
allSessions = ctrl.sessions;
ctrl.sessions = allSessions;
Core.$apply($scope);
}
ctrl.pagination.load();
}
SessionsController.$inject = ['$scope', 'workspace', 'jolokia', 'localStorage', 'artemisMessage', '$location', '$timeout', '$filter', '$sanitize', 'pagination', 'artemisConnection', 'artemisSession', 'artemisConsumer', 'artemisProducer'];
})(Artemis || (Artemis = {}));

View File

@ -0,0 +1,179 @@
/*-
* ~~~~~~licensing~~~~~~
* artemis-plugin-entaxy
* ==========
* 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~~~~~~
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/// <reference path="tree.component.ts"/>
var Artemis;
(function (Artemis) {
Artemis.log.debug("loading status");
Artemis._module.component('artemisStatus', {
template:
`<h1>Current Status
<button type="button" class="btn btn-link jvm-title-popover"
uib-popover-template="'status-instructions.html'" popover-placement="bottom-left"
popover-title="Instructions" popover-trigger="'outsideClick'">
<span class="pficon pficon-help"></span>
</button>
</h1>
<div class="container-fluid">
<div class="row">
<div class="col-md-3 text-center">
<label>Address Memory Used</label>
<p class="text-left">
<pf-donut-pct-chart config="$ctrl.addressMemoryConfig" data="$ctrl.addressMemoryData" center-label="$ctrl.addressMemoryLabel"></pf-donut-pct-chart>
</p>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-4">
<pf-info-status-card status="$ctrl.infoStatus" show-top-border="true"></pf-info-status-card>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-4">
<pf-info-status-card status="$ctrl.clusterInfoStatus" show-top-border="true"></pf-info-status-card>
</div>
</div>
</div>
<script type="text/ng-template" id="status-instructions.html">
<div>
<p>
This page allows you to view the current status of the broker as well as the status of the cluster it belongs to.
</p>
<p>
It also shows the current address memory usage in relationship to the <code>global-max-size</code>
</p>
<p>Note these metrics update every 5 seconds</p>
</div>
</script>
`,
controller: StatusController
})
.name;
Artemis.log.debug("loaded address " + Artemis.addressModule);
function StatusController($scope, workspace, jolokia, localStorage, $interval) {
var ctrl = this;
var mbean = Artemis.getBrokerMBean(workspace, jolokia);
StatusController.prototype.$onInit = function () {
jolokia.request({ type: 'read', mbean: mbean, attribute: 'Version'}, Core.onSuccess(function(response) {
ctrl.infoStatus.info[0] = "version: " + response.value;
}));
jolokia.request({ type: 'read', mbean: mbean, attribute: 'HAPolicy'}, Core.onSuccess(function(response) {
ctrl.clusterInfoStatus.info[2] = "HA Policy: " + response.value;
}));
loadStatus();
ctrl.promise = $interval(function () { return loadStatus(); }, 5000);
};
StatusController.prototype.$onDestroy = function () {
$interval.cancel(this.promise);
};
ctrl.infoStatus = {
"title":"Broker Info",
"href":"#",
"iconClass": "pficon pficon-ok",
"info":[
"version",
"uptime:",
"started:"
]
};
ctrl.clusterInfoStatus = {
"title":"Cluster Info",
"href":"#",
"iconClass": "pficon pficon-ok",
"info":[
"Lives:",
"Backups:",
"HA Policy: :"
]
};
ctrl.addressMemoryConfig = {
'chartId': 'addressMemoryChart',
'units': 'MB',
'thresholds':{'warning':'75','error':'90'}
};
ctrl.addressMemoryData = {
'used': '0',
'total': '1000'
};
ctrl.addressMemoryLabel = "used";
function loadStatus() {
jolokia.request({ type: 'read', mbean: mbean, attribute: 'GlobalMaxSize'}, Core.onSuccess(function(response) { ctrl.addressMemoryData.total = (response.value / 1048576).toFixed(2); }));
jolokia.request({ type: 'read', mbean: mbean, attribute: 'AddressMemoryUsage'}, Core.onSuccess(function(response) { ctrl.addressMemoryData.used = (response.value / 1048576).toFixed(2); }));
jolokia.request({ type: 'read', mbean: mbean, attribute: 'Uptime'}, Core.onSuccess(function(response) {
ctrl.infoStatus.info[1] = "uptime: " + response.value;
}));
jolokia.request({ type: 'read', mbean: mbean, attribute: 'Started'}, Core.onSuccess(function(response) {
ctrl.infoStatus.info[2] = "started: " + response.value;
if(response.value == false) {
ctrl.infoStatus.iconClass = "pficon pficon-error-circle-o";
} else {
ctrl.infoStatus.iconClass = "pficon pficon-ok";
}
}));
var lives = 0;
var backups = 0;
var response = jolokia.request({ type: 'exec', mbean: mbean, operation: 'listNetworkTopology()' }, Core.onSuccess(null));
var responseValue = response.value;
var brokers = angular.fromJson(responseValue);
angular.forEach(brokers, function (broker) {
if (broker.live) {
lives++;
}
if (broker.backup) {
backups++;
}
})
ctrl.clusterInfoStatus.info[0] = "Lives: " + lives;
ctrl.clusterInfoStatus.info[1] = "Backups: " + backups;
if (ctrl.clusterInfoStatus.info[2] == "HA Policy: Replicated") {
jolokia.request({ type: 'read', mbean: mbean, attribute: 'ReplicaSync'}, Core.onSuccess(function(response) {
ctrl.clusterInfoStatus.info[3] = "replicating: " + response.value;
if (response.value == false) {
ctrl.clusterInfoStatus.iconClass = "pficon pficon-error-circle-o";
} else {
ctrl.clusterInfoStatus.iconClass = "pficon pficon-ok";
}
}));
}
}
}
StatusController.$inject = ['$scope', 'workspace', 'jolokia', 'localStorage', '$interval'];
})(Artemis || (Artemis = {}));

View File

@ -0,0 +1,210 @@
/*-
* ~~~~~~licensing~~~~~~
* artemis-plugin-entaxy
* ==========
* 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~~~~~~
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/// <reference path="tree.component.ts"/>
var Artemis;
(function (Artemis) {
Artemis._module.component('artemisTreeHeader', {
template:
`<div class="tree-nav-sidebar-header">
<form role="form" class="search-pf has-button">
<div class="form-group has-clear">
<div class="search-pf-input-group">
<label for="input-search" class="sr-only">Search Tree:</label>
<input id="input-search" type="search" class="form-control" placeholder="Search tree:"
ng-model="$ctrl.filter">
<button type="button" class="clear" aria-hidden="true"
ng-hide="$ctrl.filter.length === 0"
ng-click="$ctrl.filter = ''">
<span class="pficon pficon-close"></span>
</button>
</div>
</div>
<div class="form-group tree-nav-buttons">
<span class="badge" ng-class="{positive: $ctrl.result.length > 0}"
ng-show="$ctrl.filter.length > 0">
{{$ctrl.result.length}}
</span>
<i class="fa fa-plus-square-o" title="Expand All" ng-click="$ctrl.expandAll()"></i>
<i class="fa fa-minus-square-o" title="Collapse All" ng-click="$ctrl.contractAll()"></i>
</div>
</form>
</div>
`,
controller: TreeHeaderController
})
.component('artemisTree', {
template:
`<div class="tree-nav-sidebar-content">
<div id="artemistree" class="treeview-pf-hover treeview-pf-select"></div>
</div>
`,
controller: TreeController
})
.name;
treeElementId = '#artemistree';
Artemis.log.debug("loaded tree" + Artemis.treeModule);
function TreeHeaderController($scope, $element) {
'ngInject';
Artemis.log.debug("TreeHeaderController ");
this.$scope = $scope;
this.$element = $element;
this.filter = '';
this.result = [];
// it's not possible to declare classes to the component host tag in AngularJS
$element.addClass('tree-nav-sidebar-header');
TreeHeaderController.prototype.$onInit = function () {
Artemis.log.debug("TreeHeaderController init");
var _this = this;
this.$scope.$watch(angular.bind(this, function () { return _this.filter; }), function (filter, previous) {
if (filter !== previous) {
_this.search(filter);
}
});
};
TreeHeaderController.prototype.search = function (filter) {
Artemis.log.debug("TreeHeaderController search");
var _this = this;
var doSearch = function (filter) {
var result = _this.tree().search(filter, {
ignoreCase: true,
exactMatch: false,
revealResults: true
});
_this.result.length = 0;
(_a = _this.result).push.apply(_a, result);
Core.$apply(_this.$scope);
var _a;
};
_.debounce(doSearch, 300, { leading: false, trailing: true })(filter);
};
TreeHeaderController.prototype.tree = function () {
Artemis.log.debug("TreeHeaderController tree");
return $(treeElementId).treeview(true);
};
TreeHeaderController.prototype.expandAll = function () {
Artemis.log.debug("TreeHeaderController expand");
return this.tree()
.expandNode(this.tree().getNodes(), { levels: HawtioTree.getMaxTreeLevel(this.tree()), silent: true });
};
TreeHeaderController.prototype.contractAll = function () {
Artemis.log.debug("TreeHeaderController contract");
return this.tree()
.collapseNode(this.tree().getNodes(), { ignoreChildren: true, silent: true });
};
}
TreeHeaderController.$inject = ['$scope', '$element'];
function TreeController($scope, $location, workspace, $element) {
'ngInject';
this.$scope = $scope;
this.$location = $location;
this.workspace = workspace;
this.$element = $element;
// it's not possible to declare classes to the component host tag in AngularJS
$element.addClass('tree-nav-sidebar-content');
Artemis.log.debug("TreeController ");
var artemisJmxDomain = localStorage['artemisJmxDomain'] || "org.apache.activemq.artemis";
TreeController.prototype.$onInit = function () {
Artemis.log.debug("TreeController onInit");
var _this = this;
this.$scope.$on('$destroy', function () { return _this.removeTree(); });
this.$scope.$on('$routeChangeStart', function () { return Jmx.updateTreeSelectionFromURL(_this.$location, $(treeElementId)); });
this.$scope.$on('jmxTreeUpdated', function () { return _this.populateTree(); });
this.populateTree();
};
TreeController.prototype.updateSelectionFromURL = function () {
Jmx.updateTreeSelectionFromURLAndAutoSelect(this.$location, $(treeElementId), function (first) {
if (first.children == null) {
return null;
}
// use function to auto select the queue folder on the 1st broker
var queues = first.children[0];
if (queues && queues.text === 'Queue') {
return queues;
}
return null;
}, true);
};
TreeController.prototype.populateTree = function () {
var _this = this;
var children = [];
var tree = this.workspace.tree;
Artemis.log.debug("tree= "+tree);
if (tree) {
var domainName = artemisJmxDomain;
var folder = tree.get(domainName);
if (folder) {
children = folder.children;
}
angular.forEach(children, function(child) {
Artemis.log.debug("child=" + child.text + " " + child.id);
});
var treeElement = $("#artemistree");
this.removeTree();
Jmx.enableTree(this.$scope, this.$location, this.workspace, $(treeElementId), children);
this.updateSelectionFromURL();
}
};
TreeController.prototype.removeTree = function () {
var tree = $(treeElementId).treeview(true);
// There is no exposed API to check whether the tree has already been initialized,
// so let's just check if the methods are presents
if (tree.clearSearch) {
tree.clearSearch();
// Bootstrap tree view leaks the node elements into the data structure
// so let's clean this up when the user leaves the view
var cleanTreeFolder_1 = function (node) {
delete node['$el'];
if (node.nodes)
node.nodes.forEach(cleanTreeFolder_1);
};
cleanTreeFolder_1(this.workspace.tree);
// Then call the tree clean-up method
tree.remove();
}
}
}
TreeController.$inject = ['$scope', '$location', 'workspace', '$element'];
})(Artemis || (Artemis = {}));

View File

@ -0,0 +1,116 @@
/*-
* ~~~~~~licensing~~~~~~
* artemis-plugin-entaxy
* ==========
* 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~~~~~~
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
var Artemis;
(function (Artemis) {
Artemis._module.factory('pagination',
function () {
return {
pageSizeOptions: [10,20,50,100],
pageSize: 10,
pageNumber: 1,
totalItems: 1,
firstItem: 1,
lastItem: 1,
pages: 1,
page: function (resultsSize) {
this.totalItems = resultsSize;
this.firstItem = this.pageNumber * this.pageSize - this.pageSize + 1;
this.lastItem = this.firstItem + this.pageSize - 1;
if (this.lastItem > this.totalItems) {
this.lastItem = this.totalItems;
}
this.pages = Math.ceil(this.totalItems/this.pageSize);
},
nextPage: function () {
this.pageNumber++;
this.load();
},
previousPage: function () {
this.pageNumber--;
this.load();
},
lastPage: function () {
this.pageNumber = this.pages;
this.load();
},
firstPage: function () {
this.pageNumber = 1;
this.load();
},
reset: function () {
this.pageNumber = 1;
},
load: function () {},
setOperation: function (operation) {
this.load = operation;
}
}
}).run(configurePagination);
function configurePagination($templateCache) {
$templateCache.put('plugin/artemispagination.html',
`
<div ng_show="$ctrl.pagination.totalItems > 0">
<form class="content-view-pf-pagination table-view-pf-pagination clearfix" id="pagination1">
<div class="form-group">
<select ng-model="$ctrl.pagination.pageSize" ng-options="qn for qn in $ctrl.pagination.pageSizeOptions" id="pagination.values.pageSize">
</select>
<span>per page</span>
</div>
<div class="form-group">
<span><span class="pagination-pf-items-current">{{$ctrl.pagination.firstItem}}-{{$ctrl.pagination.lastItem}}</span> of <span class="pagination-pf-items-total">{{$ctrl.pagination.totalItems}}</span></span>
<ul class="pagination pagination-pf-back">
<li class="{{$ctrl.pagination.pageNumber == 1 ? 'disabled' : ''}}"><a href="#" title="First Page" ng-click="$ctrl.pagination.pageNumber != 1 && $ctrl.pagination.firstPage()"><span class="i fa fa-angle-double-left"></span></a></li>
<li class="{{$ctrl.pagination.pageNumber == 1 ? 'disabled' : ''}}"><a href="#" title="Previous Page" ng-click="$ctrl.pagination.pageNumber != 1 && $ctrl.pagination.previousPage()"><span class="i fa fa-angle-left"></span></a></li>
</ul>
<label for="pagination1-page" class="sr-only">Current Page</label>
<input class="pagination-pf-page" type="text" value="{{$ctrl.pagination.pageNumber}}" id="pagination1-page" on-change="$ctrl.firstPage()"/>
<span>of <span class="pagination-pf-pages">{{$ctrl.pagination.pages}}</span></span>
<ul class="pagination pagination-pf-forward">
<li class="{{$ctrl.pagination.pageNumber == $ctrl.pagination.pages ? 'disabled' : ''}}"><a href="#" title="Next Page" ng-click="$ctrl.pagination.pageNumber != $ctrl.pagination.pages && $ctrl.pagination.nextPage()"><span class="i fa fa-angle-right"></span></a></li>
<li class="{{$ctrl.pagination.pageNumber == $ctrl.pagination.pages ? 'disabled' : ''}}"><a href="#" title="Last Page" ng-click="$ctrl.pagination.pageNumber != $ctrl.pagination.pages && $ctrl.pagination.lastPage()"><span class="i fa fa-angle-double-right"></span></a></li>
</ul>
</div>
</form>
</div>
`
)
}
configurePagination.$inject = ['$templateCache'];
})(Artemis || (Artemis = {}));

View File

@ -0,0 +1,61 @@
/*-
* ~~~~~~licensing~~~~~~
* artemis-plugin-entaxy
* ==========
* 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~~~~~~
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
var Artemis;
(function (Artemis) {
Artemis._module.factory('artemisMessage', function () {
return { 'message': null };
})
.factory('artemisConnection', function () {
return { 'connection': null };
})
.factory('artemisSession', function () {
return { 'session': null };
})
.factory('artemisConsumer', function () {
return { 'consumer': null };
})
.factory('artemisProducer', function () {
return { 'producer': null };
})
.factory('artemisQueue', function () {
return { 'queue': null };
})
.factory('artemisAddress', function () {
return { 'address': null };
});
})(Artemis || (Artemis = {}));

View File

@ -0,0 +1,202 @@
/*-
* ~~~~~~licensing~~~~~~
* artemis-plugin-entaxy
* ==========
* 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~~~~~~
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
var Artemis;
(function (Artemis) {
Artemis._module.factory('messageCreator',
function () {
return {
createNewMessage: function (scope, location, route, localStorage, artemisMessage, workspace, element, timeout, jolokia) {
return new message(scope, location, route, localStorage, artemisMessage, workspace, element, timeout, jolokia);
}
}
})
function message(scope, location, route, localStorage, artemisMessage, workspace, element, timeout, jolokia) {
this.noCredentials = false,
this.durable = true,
this.messageID = false;
this.message = "",
this.headers = [],
this.scope = scope;
this.element = element;
this.timeout = timeout;
this.workspace = workspace;
this.jolokia = jolokia;
this.artemisMessage = artemisMessage;
// bind model values to search params...
Core.bindModelToSearchParam(scope, location, "tab", "subtab", "compose");
Core.bindModelToSearchParam(scope, location, "searchText", "q", "");
// only reload the page if certain search parameters change
Core.reloadWhenParametersChange(route, scope, location, localStorage);
if (location.path().indexOf('artemis') > -1) {
this.localStorage = localStorage;
scope.$watch('localStorage.artemisUserName', this.checkCredentials);
scope.$watch('localStorage.artemisPassword', this.checkCredentials);
//prefill if it's a resend
if (artemisMessage.message !== null) {
this.message = artemisMessage.message.bodyText;
if (artemisMessage.message.PropertiesText !== null) {
for (var p in artemisMessage.message.StringProperties) {
this.headers.push({name: p, value: artemisMessage.message.StringProperties[p]});
}
}
}
// always reset at the end
artemisMessage.message = null;
}
var LANGUAGE_FORMAT_PREFERENCE = "defaultLanguageFormat";
var sourceFormat = workspace.getLocalStorage(LANGUAGE_FORMAT_PREFERENCE) || "javascript";
scope.codeMirrorOptions = CodeEditor.createEditorSettings({
mode: {
name: sourceFormat
}
});
scope.$on('hawtioEditor_default_instance', function (event, codeMirror) {
scope.codeMirror = codeMirror;
});
checkCredentials = function () {
this.noCredentials = (Core.isBlank(localStorage['artemisUserName']) || Core.isBlank(localStorage['artemisPassword']));
};
this.openPrefs = function (location) {
Artemis.log.debug("opening prefs");
location.path('/preferences').search({'pref': 'Artemis'});
};
this.addHeader = function () {
this.headers.push({name: "", value: ""});
// lets set the focus to the last header
var element = this.element;
if (element) {
this.timeout(function () {
var lastHeader = element.find("input.headerName").last();
lastHeader.focus();
}, 100);
}
};
this.removeHeader = function (header) {
var index = this.headers.indexOf(header);
this.headers.splice(index, 1);
};
this.defaultHeaderNames = function () {
var answer = [];
function addHeaderSchema(schema) {
angular.forEach(schema.definitions.headers.properties, function (value, name) {
answer.push(name);
});
}
addHeaderSchema(Artemis.jmsHeaderSchema);
return answer;
};
this.operationSuccess = function () {
Core.notification("success", "Message sent!");
this.headers = [];
this.message = "";
};
this.onError = function (response) {
Core.notification("error", "Could not send message: " + response.error);
};
this.formatMessage = function () {
CodeEditor.autoFormatEditor(this.scope.codeMirror);
};
this.sendMessage = function (durable, createMessageId) {
var body = this.message;
Artemis.log.debug(body);
this.doSendMessage(this.durable, createMessageId, body);
};
this.doSendMessage = function(durable, createMessageId, body) {
var selection = this.workspace.selection;
if (selection) {
var mbean = selection.objectName;
if (mbean) {
var headers = null;
if (this.headers.length) {
headers = {};
angular.forEach(this.headers, function (object) {
var key = object.name;
if (key) {
headers[key] = object.value;
}
});
Artemis.log.debug("About to send headers: " + JSON.stringify(headers));
}
var user = this.localStorage["artemisUserName"];
var pwd = this.localStorage["artemisPassword"];
if (!headers) {
headers = {};
}
var type = 3;
Artemis.log.debug(headers);
Artemis.log.debug(type);
Artemis.log.debug(body);
Artemis.log.debug(durable);
this.jolokia.execute(mbean, "sendMessage(java.util.Map, int, java.lang.String, boolean, java.lang.String, java.lang.String, boolean)", headers, type, body, durable, user, pwd, createMessageId, Core.onSuccess(this.operationSuccess(), { error: this.onError }));
Core.$apply(this.scope);
}
}
};
}
})(Artemis || (Artemis = {}));

View File

@ -0,0 +1,157 @@
/*-
* ~~~~~~licensing~~~~~~
* artemis-plugin-entaxy
* ==========
* 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~~~~~~
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
var Artemis;
(function (Artemis) {
Artemis._module.run(configureToolbar);
function configureToolbar($templateCache) {
$templateCache.put('plugin/artemistoolbar.html',
`
<div class="row toolbar-pf table-view-pf-toolbar" id="toolbar1">
<form class="toolbar-pf-actions">
<div class="form-group toolbar-pf-filter">
<div class="input-group">
<div class="input-group-btn" style="padding-left: 10px">
<button id="filter.values.field" type="button" class="btn btn-default dropdown-toggle" id="filter" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{{$ctrl.filter.text.fieldText}} <span class="caret"></span></button>
<ul class="dropdown-menu">
<li ng-repeat="option in $ctrl.filter.fieldOptions"
id="option.id" ng-click="$ctrl.filter.values.field = option.id;$ctrl.filter.text.fieldText = option.name">{{ option.name }}</ul>
</ul>
</div>
<div class="input-group-btn">
<button type="button" class="btn btn-default dropdown-toggle" id="filter" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{{$ctrl.filter.text.operationText}}<span class="caret"></span></button>
<ul class="dropdown-menu">
<li ng-repeat="option in $ctrl.filter.operationOptions"
id="option.id" ng-click="$ctrl.filter.values.operation = option.id;$ctrl.filter.text.operationText = option.name">{{ option.name }}</ul>
</ul>
</div>
<input type="text" class="form-control" ng-model="$ctrl.filter.values.value" placeholder="Value" autocomplete="off" id="filterInput">
<div class="input-group-btn" style="padding-left: 10px">
<button type="button" class="btn btn-default dropdown-toggle" id="filter" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{{$ctrl.filter.text.sortOrderText}}<span class="caret"></span></button>
<ul class="dropdown-menu">
<li ng-repeat="option in $ctrl.filter.sortOptions"
id="option.id" ng-click="$ctrl.filter.values.sortOrder = option.id;$ctrl.filter.text.sortOrderText = option.name">{{ option.name }}</ul>
</ul>
</div>
<div class="input-group-btn">
<button type="button" class="btn btn-default dropdown-toggle" id="filter" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{{$ctrl.filter.text.sortByText}}<span class="caret"></span></button>
<ul class="dropdown-menu">
<li ng-repeat="option in $ctrl.filter.fieldOptions"
id="option.id" ng-click="$ctrl.filter.values.sortColumn = option.id;$ctrl.filter.text.sortByText = option.name">{{ option.name }}</ul>
</ul>
</div>
<div class="input-group-btn">
<button class="btn btn-link btn-find" ng-click="$ctrl.refresh()" type="button">
&nbsp;&nbsp;<span class="fa fa-search"></span>&nbsp;&nbsp;
</button>
</div>
<div class="input-group-btn">
<button class="btn btn-default primary-action ng-binding ng-scope"
type="button"
title=""
ng-click="$ctrl.reset()">Reset
</button>
</div>
<div class="input-group-btn" style="padding-left: 10px">
<button class="btn btn-default primary-action ng-binding ng-scope"
type="button"
title=""
ng-click="$ctrl.showColumns = true">Columns
</button>
</div>
</div>
</div>
<div hawtio-confirm-dialog="$ctrl.showColumns"
title="Column Selector"
cancel-button-text="Close"
on-cancel="$ctrl.updateColumns()"
show-ok-button="false">
<div class="dialog-body ng-non-bindable" >
<table class="table-view-container table table-striped table-bordered table-hover dataTable no-footer">
<tr ng-repeat="col in $ctrl.dtOptions.columns">
<td>{{ col.name }}</td>
<td><input type="checkbox" ng-model="col.visible" placeholder="Name" autocomplete="off" id="name"></td>
</tr>
</table>
</div>
</div>
</form>
</div>
`
)
$templateCache.put('plugin/artemismessagetoolbar.html',
`
<div class="row toolbar-pf table-view-pf-toolbar" id="toolbar1">
<div class="col-sm-20">
<form class="toolbar-pf-actions">
<div class="form-group toolbar-pf-filter">
<div class="input-group">
<input type="text" class="form-control" ng-model="$ctrl.filter.values.value" placeholder="Filter..." autocomplete="off" id="filterInput">
<div class="input-group-btn">
<button class="btn btn-link btn-find" ng-click="$ctrl.refresh()" type="button">
&nbsp;&nbsp;<span class="fa fa-search"></span>&nbsp;&nbsp;
</button>
</div>
</div>
</div>
<div class="form-group">
<button class="btn btn-default primary-action ng-binding ng-scope"
type="button"
title=""
ng-click="$ctrl.reset()">Reset
</button>
<button ng-show="$ctrl.dlq" class="btn btn-default primary-action ng-binding ng-scope"
type="button"
title=""
ng-click="$ctrl.retry()">Retry Messages
</button>
<button ng-show="$ctrl.dlq" class="btn btn-default primary-action ng-binding ng-scope"
type="button"
title=""
ng-click="$ctrl.retry()">Move Messages
</button>
</div>
</form>
</div>
</div>
`
)
}
configureToolbar.$inject = ['$templateCache'];
})(Artemis || (Artemis = {}));