Skip to content

Commit 7d9cd5d

Browse files
committed
Patch web UI to remove commands that break OTBR.
You can always enter the container directly and run `ot-cli` for any sort of management. This patch just disables knobs that break things.
1 parent f554bbd commit 7d9cd5d

2 files changed

Lines changed: 81 additions & 12 deletions

File tree

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
diff --git a/src/web/web-service/frontend/index.html b/src/web/web-service/frontend/index.html
2+
index cb052f26..992f03d6 100644
3+
--- a/src/web/web-service/frontend/index.html
4+
+++ b/src/web/web-service/frontend/index.html
5+
@@ -89,7 +89,7 @@
6+
</header>
7+
<nav class="demo-navigation mdl-navigation mdl-color--blue-grey-800">
8+
<md-list flex>
9+
- <md-list-item md-ink-ripple class="mdl-navigation__link" ng-repeat="item in menu" ng-click="showPanels($index)" layout="row">
10+
+ <md-list-item md-ink-ripple class="mdl-navigation__link" ng-repeat="item in menu" ng-click="showPanels($index)" ng-if="!item.hidden" layout="row">
11+
<div><i class="mdl-color-text--blue-grey-400 material-icons" role="presentation">{{item.icon}}</i>{{item.title}}
12+
</div>
13+
</md-list-item>
14+
@@ -130,7 +130,6 @@
15+
<th>PAN ID</th>
16+
<th>channel</th>
17+
<th>Hardware Address</th>
18+
- <th>Action</th>
19+
20+
</tr>
21+
</thead>
22+
@@ -142,9 +141,6 @@
23+
<td>{{item.pi}}</td>
24+
<td>{{item.ch}}</td>
25+
<td>{{item.ha}}</td>
26+
- <td>
27+
- <button class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored mdl-button show-modal" ng-click="showJoinDialog($event, $index, item)">Join</button>
28+
- </td>
29+
</tr>
30+
</tbody>
31+
</table>
32+
diff --git a/src/web/web-service/frontend/res/js/app.js b/src/web/web-service/frontend/res/js/app.js
33+
index e8453f6c..e0645f83 100644
34+
--- a/src/web/web-service/frontend/res/js/app.js
35+
+++ b/src/web/web-service/frontend/res/js/app.js
36+
@@ -57,7 +57,7 @@
37+
show: true,
38+
},
39+
{
40+
- title: 'Join',
41+
+ title: 'Scan',
42+
icon: 'add_circle_outline',
43+
show: false,
44+
},
45+
@@ -65,6 +65,7 @@
46+
title: 'Form',
47+
icon: 'open_in_new',
48+
show: false,
49+
+ hidden: true,
50+
},
51+
{
52+
title: 'Status',
53+
@@ -124,7 +125,7 @@
54+
};
55+
$scope.showPanels = async function(index) {
56+
$scope.headerTitle = $scope.menu[index].title;
57+
- for (var i = 0; i < 7; i++) {
58+
+ for (var i = 0; i < $scope.menu.length; i++) {
59+
$scope.menu[i].show = false;
60+
}
61+
$scope.menu[index].show = true;
62+
@@ -1226,3 +1227,15 @@
63+
}
64+
};
65+
})();
66+
+
67+
+// Use relative URLs for ingress compatibility
68+
+angular.module('StarterApp').config(['$httpProvider', function($httpProvider) {
69+
+ $httpProvider.interceptors.push(function() {
70+
+ return {
71+
+ request: function(config) {
72+
+ config.url = config.url.replace(/^http:\/\/[^/]+\//, '');
73+
+ return config;
74+
+ }
75+
+ };
76+
+ });
77+
+}]);

openthread_border_router/Dockerfile

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ ENV DOCKER=1
1616

1717

1818
COPY openthread-core-ha-config-posix.h /usr/src/
19+
COPY 0003-ha-web-ui-customizations.patch /usr/src/
1920

2021
WORKDIR /usr/src
2122
RUN \
@@ -37,6 +38,7 @@ WORKDIR /usr/src/ot-br-posix
3738
RUN \
3839
set -x \
3940
&& mv /usr/src/openthread-core-ha-config-posix.h /usr/src/ot-br-posix/third_party/openthread/repo/ \
41+
&& patch -p1 < /usr/src/0003-ha-web-ui-customizations.patch \
4042
&& ./script/cmake-build \
4143
-DBUILD_TESTING=OFF \
4244
-DCMAKE_INSTALL_PREFIX=/opt/otbr-beta \
@@ -85,6 +87,7 @@ ENV DOCKER=1
8587
COPY openthread-core-ha-config-posix.h /usr/src/
8688
COPY 0001-channel-monitor-disable-by-default.patch /usr/src/
8789
COPY 0002-spinel-Clear-source-match-tables-before-restoring.patch /usr/src/
90+
COPY 0003-ha-web-ui-customizations.patch /usr/src/
8891

8992
WORKDIR /usr/src
9093
RUN \
@@ -111,6 +114,7 @@ RUN \
111114
&& patch -p1 < /usr/src/0001-channel-monitor-disable-by-default.patch \
112115
&& patch -p1 < /usr/src/0002-spinel-Clear-source-match-tables-before-restoring.patch \
113116
) \
117+
&& patch -p1 < /usr/src/0003-ha-web-ui-customizations.patch \
114118
&& ./script/cmake-build \
115119
-DBUILD_TESTING=OFF \
116120
-DCMAKE_INSTALL_PREFIX=/opt/otbr-stable \
@@ -185,18 +189,6 @@ COPY --from=otbr-stable-builder /usr/sbin/mdnsd /opt/otbr-stable/sbin/mdnsd
185189
COPY --from=otbr-stable-builder /usr/lib/libdns_sd.so /usr/lib/libdns_sd.so
186190
COPY --from=otbr-stable-builder /usr/lib/libdns_sd.so.1 /usr/lib/libdns_sd.so.1
187191

188-
# Patch app.js to use relative URLs for ingress compatibility
189-
RUN echo "angular.module('StarterApp').config(['\$httpProvider', function(\$httpProvider) { \
190-
\$httpProvider.interceptors.push(function() { \
191-
return { \
192-
request: function(config) { \
193-
config.url = config.url.replace(/^http:\\/\\/[^/]+\\//, ''); \
194-
return config; \
195-
} \
196-
}; \
197-
}); \
198-
}]);" | tee -a /opt/otbr-{stable,beta}/share/otbr-web/frontend/res/js/app.js
199-
200192
COPY rootfs /
201193

202194
ENV \

0 commit comments

Comments
 (0)