Skip to content

Commit 95d5b6e

Browse files
authored
KNOX-3012 - Fix the DN links on the Ozone SCM UI (#873)
* Fix outbound rule for DN links * Fix filter path too * Add new version directory for ozone-scm and add changes there
1 parent bd3972d commit 95d5b6e

File tree

2 files changed

+247
-0
lines changed

2 files changed

+247
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2+
<!--
3+
Licensed to the Apache Software Foundation (ASF) under one or more
4+
contributor license agreements. See the NOTICE file distributed with
5+
this work for additional information regarding copyright ownership.
6+
The ASF licenses this file to You under the Apache License, Version 2.0
7+
(the "License"); you may not use this file except in compliance with
8+
the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
-->
18+
19+
20+
<rules>
21+
<!-- SCM inbound rule -->
22+
<rule dir="IN" name="OZONE-SCM/ozone-scm/inbound/request" pattern="*://*:*/**/ozone-scm/{path=**}?host={host}?{**}">
23+
<rewrite template="{host}/{path=**}?{**}"/>
24+
</rule>
25+
26+
<!-- SCM outbound rules -->
27+
<rule dir="OUT" name="OZONE-SCM/ozone-scm/outbound/filter/scmjs" pattern="scm.js">
28+
<rewrite template="{gateway.url}/ozone-scm/scm.js?host={$inboundurl[host]}"/>
29+
</rule>
30+
31+
<rule dir="OUT" name="OZONE-SCM/ozone-scm/outbound/filter/main" pattern="main.html">
32+
<rewrite template="main.html?host={$inboundurl[host]}"/>
33+
</rule>
34+
35+
<rule dir="OUT" name="OZONE-SCM/ozone-scm/outbound/filter/scmoverview" pattern="scm-overview.html">
36+
<rewrite template="scm-overview.html?host={$inboundurl[host]}"/>
37+
</rule>
38+
39+
<rule dir="OUT" name="OZONE-SCM/ozone-scm/outbound/filter/jmx" pattern="/jmx?{**}">
40+
<rewrite template="{gateway.url}/ozone-scm/jmx?host={$inboundurl[host]}?{**}"/>
41+
</rule>
42+
43+
<rule dir="OUT" name="OZONE-SCM/ozone-scm/outbound/filter/jmx2" pattern="jmx?{**}">
44+
<rewrite template="jmx?host={$inboundurl[host]}?{**}"/>
45+
</rule>
46+
47+
<rule dir="OUT" name="OZONE-SCM/ozone-scm/outbound/filter/conf" pattern="conf?{**}">
48+
<rewrite template="{gateway.url}/ozone-scm/conf?host={$inboundurl[host]}?{**}"/>
49+
</rule>
50+
51+
<rule dir="OUT" name="OZONE-SCM/ozone-scm/outbound/filter/logLevel" pattern="logLevel">
52+
<rewrite template="{gateway.url}/ozone-scm/logLevel/?host={$inboundurl[host]}"/>
53+
</rule>
54+
55+
<rule dir="OUT" name="OZONE-SCM/ozone-scm/outbound/filter/stacks" pattern="stacks">
56+
<rewrite template="{gateway.url}/ozone-scm/stacks/?host={$inboundurl[host]}"/>
57+
</rule>
58+
59+
<rule dir="OUT" name="OZONE-SCM/ozone-scm/outbound/filter/static">
60+
<match pattern="/static/{path=**}">
61+
<rewrite template="{gateway.url}/ozone-scm/static/{path=**}?host={$inboundurl[host]}"/>
62+
</match>
63+
</rule>
64+
65+
<rule dir="OUT" name="OZONE-SCM/ozone-scm/outbound/filter/docs">
66+
<rewrite template="{gateway.url}/ozone-scm/documentation/docs/index.html?host={$inboundurl[host]}"/>
67+
</rule>
68+
69+
<!-- SCM filter -->
70+
71+
<filter name="OZONE-SCM/ozone-scm/outbound/response">
72+
<content type="*/html">
73+
<apply path="scm.js" rule="OZONE-SCM/ozone-scm/outbound/filter/scmjs"/>
74+
<apply path=".*\.js" rule="OZONE-SCM/ozone-scm/outbound/filter/static"/>
75+
<apply path=".*\.css" rule="OZONE-SCM/ozone-scm/outbound/filter/static"/>
76+
<apply path="/docs" rule="OZONE-SCM/ozone-scm/outbound/filter/docs"/>
77+
<apply path="logLevel" rule="OZONE-SCM/ozone-scm/outbound/filter/logLevel"/>
78+
<apply path="stacks" rule="OZONE-SCM/ozone-scm/outbound/filter/stacks"/>
79+
<apply path="\{\{typestat\.protocol\}\}\:\/\/\{\{typestat\.hostname\}\}\:\{\{typestat\.port\}\}" rule="OZONE-SCM/ozone-scm/outbound/datanode/address"/>
80+
</content>
81+
<content type="*/javascript">
82+
<apply path="main\.html" rule="OZONE-SCM/ozone-scm/outbound/filter/main"/>
83+
<apply path="scm-overview\.html" rule="OZONE-SCM/ozone-scm/outbound/filter/scmoverview"/>
84+
<apply path="docs/index\.html" rule="OZONE-SCM/ozone-scm/outbound/filter/docs"/>
85+
<apply path="static/templates/.*\.html" rule="OZONE-SCM/ozone-scm/outbound/filter/static"/>
86+
<apply path="/jmx" rule="OZONE-SCM/ozone-scm/outbound/filter/jmx"/>
87+
<apply path="jmx\?qry" rule="OZONE-SCM/ozone-scm/outbound/filter/jmx2"/>
88+
<apply path="conf\?cmd" rule="OZONE-SCM/ozone-scm/outbound/filter/conf"/>
89+
</content>
90+
</filter>
91+
92+
<!-- documentation inbound rule -->
93+
94+
<rule dir="IN" name="OZONE-SCM/ozone-scm/documentation/inbound/request" pattern="*://*:*/**/ozone-scm/documentation/{path=**}?host={host}?{**}">
95+
<rewrite template="{host}/{path=**}?{**}"/>
96+
</rule>
97+
98+
<!-- documentation outbound rule -->
99+
100+
<rule dir="OUT" name="OZONE-SCM/ozone-scm/documentation/outbound/filter/docs">
101+
<match pattern="{**}">
102+
<rewrite template="{**}?host={$inboundurl[host]}"/>
103+
</match>
104+
</rule>
105+
106+
<!-- documentation filter -->
107+
108+
<filter name="OZONE-SCM/ozone-scm/documentation/outbound/response">
109+
<content type="*/html">
110+
<apply path=".*\.js" rule="OZONE-SCM/ozone-scm/documentation/outbound/filter/docs"/>
111+
<apply path=".*\.css" rule="OZONE-SCM/ozone-scm/documentation/outbound/filter/docs"/>
112+
<apply path=".*\.png" rule="OZONE-SCM/ozone-scm/documentation/outbound/filter/docs"/>
113+
<apply path=".*\.html" rule="OZONE-SCM/ozone-scm/documentation/outbound/filter/docs"/>
114+
</content>
115+
</filter>
116+
117+
<!-- outbound rule for the datanode links on SCM UI -->
118+
119+
<rule dir="OUT" name="OZONE-SCM/ozone-scm/outbound/datanode/address">
120+
<match pattern="{{typestat.protocol}}://{{typestat.hostname}}:{{typestat.port}}"/>
121+
<rewrite template="{gateway.url}/ozone-scm/datanode/index.html?host={{typestat.protocol}}://{{typestat.hostname}}:{{typestat.port}} "/>
122+
</rule>
123+
124+
<!-- datanode inbound rules -->
125+
126+
<rule dir="IN" name="OZONE-SCM/ozone-scm/datanode/inbound/request" pattern="*://*:*/**/ozone-scm/datanode/{path=**}?host={host}?{**}">
127+
<rewrite template="{host}/{path=**}?{**}"/>
128+
</rule>
129+
130+
<!-- datanode outbound rules -->
131+
132+
<rule dir="OUT" name="OZONE-SCM/ozone-scm/datanode/outbound/filter/dnjs" pattern="dn.js">
133+
<rewrite template="{gateway.url}/ozone-scm/datanode/dn.js?host={$inboundurl[host]}"/>
134+
</rule>
135+
136+
<rule dir="OUT" name="OZONE-SCM/ozone-scm/datanode/outbound/filter/main" pattern="main.html">
137+
<rewrite template="main.html?host={$inboundurl[host]}"/>
138+
</rule>
139+
140+
<rule dir="OUT" name="OZONE-SCM/ozone-scm/datanode/outbound/filter/dnoverview" pattern="dn-overview.html">
141+
<rewrite template="dn-overview.html?host={$inboundurl[host]}"/>
142+
</rule>
143+
144+
<rule dir="OUT" name="OZONE-SCM/ozone-scm/datanode/outbound/filter/jmx" pattern="/jmx?{**}">
145+
<rewrite template="{gateway.url}/ozone-scm/datanode/jmx?host={$inboundurl[host]}?{**}"/>
146+
</rule>
147+
148+
<rule dir="OUT" name="OZONE-SCM/ozone-scm/datanode/outbound/filter/jmx2" pattern="jmx?{**}">
149+
<rewrite template="jmx?host={$inboundurl[host]}?{**}"/>
150+
</rule>
151+
152+
<rule dir="OUT" name="OZONE-SCM/ozone-scm/datanode/outbound/filter/conf" pattern="conf?{**}">
153+
<rewrite template="{gateway.url}/ozone-scm/datanode/conf?host={$inboundurl[host]}?{**}"/>
154+
</rule>
155+
156+
<rule dir="OUT" name="OZONE-SCM/ozone-scm/datanode/outbound/filter/logLevel" pattern="logLevel">
157+
<rewrite template="{gateway.url}/ozone-scm/datanode/logLevel/?host={$inboundurl[host]}"/>
158+
</rule>
159+
160+
<rule dir="OUT" name="OZONE-SCM/ozone-scm/datanode/outbound/filter/stacks" pattern="stacks">
161+
<rewrite template="{gateway.url}/ozone-scm/datanode/stacks/?host={$inboundurl[host]}"/>
162+
</rule>
163+
164+
<rule dir="OUT" name="OZONE-SCM/ozone-scm/datanode/outbound/filter/static">
165+
<match pattern="/static/{path=**}">
166+
<rewrite template="{gateway.url}/ozone-scm/datanode/static/{path=**}?host={$inboundurl[host]}"/>
167+
</match>
168+
</rule>
169+
170+
<rule dir="OUT" name="OZONE-SCM/ozone-scm/datanode/outbound/filter/docs">
171+
<rewrite template="{gateway.url}/ozone-scm/documentation/docs/index.html?host={$inboundurl[host]}"/>
172+
</rule>
173+
174+
<!-- datanode filter -->
175+
176+
<filter name="OZONE-SCM/ozone-scm/datanode/outbound/response">
177+
<content type="*/html">
178+
<apply path="dn.js" rule="OZONE-SCM/ozone-scm/datanode/outbound/filter/dnjs"/>
179+
<apply path=".*\.js" rule="OZONE-SCM/ozone-scm/datanode/outbound/filter/static"/>
180+
<apply path=".*\.css" rule="OZONE-SCM/ozone-scm/datanode/outbound/filter/static"/>
181+
<apply path="/docs" rule="OZONE-SCM/ozone-scm/datanode/outbound/filter/docs"/>
182+
<apply path="logLevel" rule="OZONE-SCM/ozone-scm/datanode/outbound/filter/logLevel"/>
183+
<apply path="stacks" rule="OZONE-SCM/ozone-scm/datanode/outbound/filter/stacks"/>
184+
</content>
185+
<content type="*/javascript">
186+
<apply path="main\.html" rule="OZONE-SCM/ozone-scm/datanode/outbound/filter/main"/>
187+
<apply path="dn-overview\.html" rule="OZONE-SCM/ozone-scm/datanode/outbound/filter/dnoverview"/>
188+
<apply path="docs/index\.html" rule="OZONE-SCM/ozone-scm/datanode/outbound/filter/docs"/>
189+
<apply path="static/templates/.*\.html" rule="OZONE-SCM/ozone-scm/datanode/outbound/filter/static"/>
190+
<apply path="/jmx" rule="OZONE-SCM/ozone-scm/datanode/outbound/filter/jmx"/>
191+
<apply path="jmx\?qry" rule="OZONE-SCM/ozone-scm/datanode/outbound/filter/jmx2"/>
192+
<apply path="conf\?cmd" rule="OZONE-SCM/ozone-scm/datanode/outbound/filter/conf"/>
193+
</content>
194+
</filter>
195+
196+
</rules>
197+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2+
<!--
3+
Licensed to the Apache Software Foundation (ASF) under one or more
4+
contributor license agreements. See the NOTICE file distributed with
5+
this work for additional information regarding copyright ownership.
6+
The ASF licenses this file to You under the Apache License, Version 2.0
7+
(the "License"); you may not use this file except in compliance with
8+
the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
-->
18+
<service role="OZONE-SCM" name="ozone-scm" version="1.2.0">
19+
<metadata>
20+
<type>UI</type>
21+
<context>/ozone-scm/index.html?host={{BACKEND_HOST}}</context>
22+
<shortDesc>OZONE SCM UI</shortDesc>
23+
</metadata>
24+
<routes>
25+
<!-- SCM routes -->
26+
<route path="/ozone-scm/">
27+
<rewrite apply="OZONE-SCM/ozone-scm/inbound/request" to="request.url"/>
28+
<rewrite apply="OZONE-SCM/ozone-scm/outbound/response" to="response.body"/>
29+
</route>
30+
<route path="/ozone-scm/**">
31+
<rewrite apply="OZONE-SCM/ozone-scm/inbound/request" to="request.url"/>
32+
<rewrite apply="OZONE-SCM/ozone-scm/outbound/response" to="response.body"/>
33+
</route>
34+
<!-- datanode routes -->
35+
<route path="/ozone-scm/datanode/">
36+
<rewrite apply="OZONE-SCM/ozone-scm/datanode/inbound/request" to="request.url"/>
37+
<rewrite apply="OZONE-SCM/ozone-scm/datanode/outbound/response" to="response.body"/>
38+
</route>
39+
<route path="/ozone-scm/datanode/**">
40+
<rewrite apply="OZONE-SCM/ozone-scm/datanode/inbound/request" to="request.url"/>
41+
<rewrite apply="OZONE-SCM/ozone-scm/datanode/outbound/response" to="response.body"/>
42+
</route>
43+
<!-- documentation route -->
44+
<route path="/ozone-scm/documentation/**">
45+
<rewrite apply="OZONE-SCM/ozone-scm/documentation/inbound/request" to="request.url"/>
46+
<rewrite apply="OZONE-SCM/ozone-scm/documentation/outbound/response" to="response.body"/>
47+
</route>
48+
</routes>
49+
<dispatch classname="org.apache.knox.gateway.dispatch.URLDecodingDispatch" ha-classname="org.apache.knox.gateway.dispatch.URLDecodingDispatch"/>
50+
</service>

0 commit comments

Comments
 (0)