Skip to content

Commit

Permalink
KNOX-3012 - Fix the DN links on the Ozone SCM UI (#873)
Browse files Browse the repository at this point in the history
* Fix outbound rule for DN links

* Fix filter path too

* Add new version directory for ozone-scm and add changes there
  • Loading branch information
dombizita authored Mar 4, 2024
1 parent bd3972d commit 95d5b6e
Show file tree
Hide file tree
Showing 2 changed files with 247 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
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.
-->


<rules>
<!-- SCM inbound rule -->
<rule dir="IN" name="OZONE-SCM/ozone-scm/inbound/request" pattern="*://*:*/**/ozone-scm/{path=**}?host={host}?{**}">
<rewrite template="{host}/{path=**}?{**}"/>
</rule>

<!-- SCM outbound rules -->
<rule dir="OUT" name="OZONE-SCM/ozone-scm/outbound/filter/scmjs" pattern="scm.js">
<rewrite template="{gateway.url}/ozone-scm/scm.js?host={$inboundurl[host]}"/>
</rule>

<rule dir="OUT" name="OZONE-SCM/ozone-scm/outbound/filter/main" pattern="main.html">
<rewrite template="main.html?host={$inboundurl[host]}"/>
</rule>

<rule dir="OUT" name="OZONE-SCM/ozone-scm/outbound/filter/scmoverview" pattern="scm-overview.html">
<rewrite template="scm-overview.html?host={$inboundurl[host]}"/>
</rule>

<rule dir="OUT" name="OZONE-SCM/ozone-scm/outbound/filter/jmx" pattern="/jmx?{**}">
<rewrite template="{gateway.url}/ozone-scm/jmx?host={$inboundurl[host]}?{**}"/>
</rule>

<rule dir="OUT" name="OZONE-SCM/ozone-scm/outbound/filter/jmx2" pattern="jmx?{**}">
<rewrite template="jmx?host={$inboundurl[host]}?{**}"/>
</rule>

<rule dir="OUT" name="OZONE-SCM/ozone-scm/outbound/filter/conf" pattern="conf?{**}">
<rewrite template="{gateway.url}/ozone-scm/conf?host={$inboundurl[host]}?{**}"/>
</rule>

<rule dir="OUT" name="OZONE-SCM/ozone-scm/outbound/filter/logLevel" pattern="logLevel">
<rewrite template="{gateway.url}/ozone-scm/logLevel/?host={$inboundurl[host]}"/>
</rule>

<rule dir="OUT" name="OZONE-SCM/ozone-scm/outbound/filter/stacks" pattern="stacks">
<rewrite template="{gateway.url}/ozone-scm/stacks/?host={$inboundurl[host]}"/>
</rule>

<rule dir="OUT" name="OZONE-SCM/ozone-scm/outbound/filter/static">
<match pattern="/static/{path=**}">
<rewrite template="{gateway.url}/ozone-scm/static/{path=**}?host={$inboundurl[host]}"/>
</match>
</rule>

<rule dir="OUT" name="OZONE-SCM/ozone-scm/outbound/filter/docs">
<rewrite template="{gateway.url}/ozone-scm/documentation/docs/index.html?host={$inboundurl[host]}"/>
</rule>

<!-- SCM filter -->

<filter name="OZONE-SCM/ozone-scm/outbound/response">
<content type="*/html">
<apply path="scm.js" rule="OZONE-SCM/ozone-scm/outbound/filter/scmjs"/>
<apply path=".*\.js" rule="OZONE-SCM/ozone-scm/outbound/filter/static"/>
<apply path=".*\.css" rule="OZONE-SCM/ozone-scm/outbound/filter/static"/>
<apply path="/docs" rule="OZONE-SCM/ozone-scm/outbound/filter/docs"/>
<apply path="logLevel" rule="OZONE-SCM/ozone-scm/outbound/filter/logLevel"/>
<apply path="stacks" rule="OZONE-SCM/ozone-scm/outbound/filter/stacks"/>
<apply path="\{\{typestat\.protocol\}\}\:\/\/\{\{typestat\.hostname\}\}\:\{\{typestat\.port\}\}" rule="OZONE-SCM/ozone-scm/outbound/datanode/address"/>
</content>
<content type="*/javascript">
<apply path="main\.html" rule="OZONE-SCM/ozone-scm/outbound/filter/main"/>
<apply path="scm-overview\.html" rule="OZONE-SCM/ozone-scm/outbound/filter/scmoverview"/>
<apply path="docs/index\.html" rule="OZONE-SCM/ozone-scm/outbound/filter/docs"/>
<apply path="static/templates/.*\.html" rule="OZONE-SCM/ozone-scm/outbound/filter/static"/>
<apply path="/jmx" rule="OZONE-SCM/ozone-scm/outbound/filter/jmx"/>
<apply path="jmx\?qry" rule="OZONE-SCM/ozone-scm/outbound/filter/jmx2"/>
<apply path="conf\?cmd" rule="OZONE-SCM/ozone-scm/outbound/filter/conf"/>
</content>
</filter>

<!-- documentation inbound rule -->

<rule dir="IN" name="OZONE-SCM/ozone-scm/documentation/inbound/request" pattern="*://*:*/**/ozone-scm/documentation/{path=**}?host={host}?{**}">
<rewrite template="{host}/{path=**}?{**}"/>
</rule>

<!-- documentation outbound rule -->

<rule dir="OUT" name="OZONE-SCM/ozone-scm/documentation/outbound/filter/docs">
<match pattern="{**}">
<rewrite template="{**}?host={$inboundurl[host]}"/>
</match>
</rule>

<!-- documentation filter -->

<filter name="OZONE-SCM/ozone-scm/documentation/outbound/response">
<content type="*/html">
<apply path=".*\.js" rule="OZONE-SCM/ozone-scm/documentation/outbound/filter/docs"/>
<apply path=".*\.css" rule="OZONE-SCM/ozone-scm/documentation/outbound/filter/docs"/>
<apply path=".*\.png" rule="OZONE-SCM/ozone-scm/documentation/outbound/filter/docs"/>
<apply path=".*\.html" rule="OZONE-SCM/ozone-scm/documentation/outbound/filter/docs"/>
</content>
</filter>

<!-- outbound rule for the datanode links on SCM UI -->

<rule dir="OUT" name="OZONE-SCM/ozone-scm/outbound/datanode/address">
<match pattern="{{typestat.protocol}}://{{typestat.hostname}}:{{typestat.port}}"/>
<rewrite template="{gateway.url}/ozone-scm/datanode/index.html?host={{typestat.protocol}}://{{typestat.hostname}}:{{typestat.port}} "/>
</rule>

<!-- datanode inbound rules -->

<rule dir="IN" name="OZONE-SCM/ozone-scm/datanode/inbound/request" pattern="*://*:*/**/ozone-scm/datanode/{path=**}?host={host}?{**}">
<rewrite template="{host}/{path=**}?{**}"/>
</rule>

<!-- datanode outbound rules -->

<rule dir="OUT" name="OZONE-SCM/ozone-scm/datanode/outbound/filter/dnjs" pattern="dn.js">
<rewrite template="{gateway.url}/ozone-scm/datanode/dn.js?host={$inboundurl[host]}"/>
</rule>

<rule dir="OUT" name="OZONE-SCM/ozone-scm/datanode/outbound/filter/main" pattern="main.html">
<rewrite template="main.html?host={$inboundurl[host]}"/>
</rule>

<rule dir="OUT" name="OZONE-SCM/ozone-scm/datanode/outbound/filter/dnoverview" pattern="dn-overview.html">
<rewrite template="dn-overview.html?host={$inboundurl[host]}"/>
</rule>

<rule dir="OUT" name="OZONE-SCM/ozone-scm/datanode/outbound/filter/jmx" pattern="/jmx?{**}">
<rewrite template="{gateway.url}/ozone-scm/datanode/jmx?host={$inboundurl[host]}?{**}"/>
</rule>

<rule dir="OUT" name="OZONE-SCM/ozone-scm/datanode/outbound/filter/jmx2" pattern="jmx?{**}">
<rewrite template="jmx?host={$inboundurl[host]}?{**}"/>
</rule>

<rule dir="OUT" name="OZONE-SCM/ozone-scm/datanode/outbound/filter/conf" pattern="conf?{**}">
<rewrite template="{gateway.url}/ozone-scm/datanode/conf?host={$inboundurl[host]}?{**}"/>
</rule>

<rule dir="OUT" name="OZONE-SCM/ozone-scm/datanode/outbound/filter/logLevel" pattern="logLevel">
<rewrite template="{gateway.url}/ozone-scm/datanode/logLevel/?host={$inboundurl[host]}"/>
</rule>

<rule dir="OUT" name="OZONE-SCM/ozone-scm/datanode/outbound/filter/stacks" pattern="stacks">
<rewrite template="{gateway.url}/ozone-scm/datanode/stacks/?host={$inboundurl[host]}"/>
</rule>

<rule dir="OUT" name="OZONE-SCM/ozone-scm/datanode/outbound/filter/static">
<match pattern="/static/{path=**}">
<rewrite template="{gateway.url}/ozone-scm/datanode/static/{path=**}?host={$inboundurl[host]}"/>
</match>
</rule>

<rule dir="OUT" name="OZONE-SCM/ozone-scm/datanode/outbound/filter/docs">
<rewrite template="{gateway.url}/ozone-scm/documentation/docs/index.html?host={$inboundurl[host]}"/>
</rule>

<!-- datanode filter -->

<filter name="OZONE-SCM/ozone-scm/datanode/outbound/response">
<content type="*/html">
<apply path="dn.js" rule="OZONE-SCM/ozone-scm/datanode/outbound/filter/dnjs"/>
<apply path=".*\.js" rule="OZONE-SCM/ozone-scm/datanode/outbound/filter/static"/>
<apply path=".*\.css" rule="OZONE-SCM/ozone-scm/datanode/outbound/filter/static"/>
<apply path="/docs" rule="OZONE-SCM/ozone-scm/datanode/outbound/filter/docs"/>
<apply path="logLevel" rule="OZONE-SCM/ozone-scm/datanode/outbound/filter/logLevel"/>
<apply path="stacks" rule="OZONE-SCM/ozone-scm/datanode/outbound/filter/stacks"/>
</content>
<content type="*/javascript">
<apply path="main\.html" rule="OZONE-SCM/ozone-scm/datanode/outbound/filter/main"/>
<apply path="dn-overview\.html" rule="OZONE-SCM/ozone-scm/datanode/outbound/filter/dnoverview"/>
<apply path="docs/index\.html" rule="OZONE-SCM/ozone-scm/datanode/outbound/filter/docs"/>
<apply path="static/templates/.*\.html" rule="OZONE-SCM/ozone-scm/datanode/outbound/filter/static"/>
<apply path="/jmx" rule="OZONE-SCM/ozone-scm/datanode/outbound/filter/jmx"/>
<apply path="jmx\?qry" rule="OZONE-SCM/ozone-scm/datanode/outbound/filter/jmx2"/>
<apply path="conf\?cmd" rule="OZONE-SCM/ozone-scm/datanode/outbound/filter/conf"/>
</content>
</filter>

</rules>

Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
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.
-->
<service role="OZONE-SCM" name="ozone-scm" version="1.2.0">
<metadata>
<type>UI</type>
<context>/ozone-scm/index.html?host={{BACKEND_HOST}}</context>
<shortDesc>OZONE SCM UI</shortDesc>
</metadata>
<routes>
<!-- SCM routes -->
<route path="/ozone-scm/">
<rewrite apply="OZONE-SCM/ozone-scm/inbound/request" to="request.url"/>
<rewrite apply="OZONE-SCM/ozone-scm/outbound/response" to="response.body"/>
</route>
<route path="/ozone-scm/**">
<rewrite apply="OZONE-SCM/ozone-scm/inbound/request" to="request.url"/>
<rewrite apply="OZONE-SCM/ozone-scm/outbound/response" to="response.body"/>
</route>
<!-- datanode routes -->
<route path="/ozone-scm/datanode/">
<rewrite apply="OZONE-SCM/ozone-scm/datanode/inbound/request" to="request.url"/>
<rewrite apply="OZONE-SCM/ozone-scm/datanode/outbound/response" to="response.body"/>
</route>
<route path="/ozone-scm/datanode/**">
<rewrite apply="OZONE-SCM/ozone-scm/datanode/inbound/request" to="request.url"/>
<rewrite apply="OZONE-SCM/ozone-scm/datanode/outbound/response" to="response.body"/>
</route>
<!-- documentation route -->
<route path="/ozone-scm/documentation/**">
<rewrite apply="OZONE-SCM/ozone-scm/documentation/inbound/request" to="request.url"/>
<rewrite apply="OZONE-SCM/ozone-scm/documentation/outbound/response" to="response.body"/>
</route>
</routes>
<dispatch classname="org.apache.knox.gateway.dispatch.URLDecodingDispatch" ha-classname="org.apache.knox.gateway.dispatch.URLDecodingDispatch"/>
</service>

0 comments on commit 95d5b6e

Please sign in to comment.