Skip to content

Commit 9786faf

Browse files
committed
make habpanel work with non-root context path
Signed-off-by: Hubert Nusser <[email protected]>
1 parent ebb5ad0 commit 9786faf

File tree

7 files changed

+20
-20
lines changed

7 files changed

+20
-20
lines changed

bundles/org.openhab.ui.habpanel/web/app/services/icon.service.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
function getIconUrl(iconset, icon, state) {
2727
if (iconset === 'custom-icon') {
28-
return '/icon/' + icon + '?format=svg' + ((state) ? '&state=' + state : '');
28+
return '../icon/' + icon + '?format=svg' + ((state) ? '&state=' + state : '');
2929
} else if (iconset === 'custom-url') {
3030
return icon;
3131
}
@@ -34,7 +34,7 @@
3434
if (set.type === 'builtin') {
3535
return 'assets/icons/' + set.id + '/' + icon + '.svg';
3636
} else {
37-
return '/icon/' + icon + '?format=svg' + ((state) ? '&state=' + state : '');
37+
return '../icon/' + icon + '?format=svg' + ((state) ? '&state=' + state : '');
3838
}
3939
}
4040

bundles/org.openhab.ui.habpanel/web/app/services/oh2storage.service.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
$http({
3333
method: 'GET',
34-
url: '/rest/services/' + SERVICE_NAME + '/config',
34+
url: '../rest/services/' + SERVICE_NAME + '/config',
3535
headers: headers
3636
}).then(function (resp) {
3737
console.log('openHAB 2 service configuration loaded');
@@ -77,7 +77,7 @@
7777
OH3StorageService.getAccessToken().then(function (accessToken) {
7878
$http({
7979
method: 'PUT',
80-
url: '/rest/services/' + SERVICE_NAME + '/config',
80+
url: '../rest/services/' + SERVICE_NAME + '/config',
8181
data: OH2ServiceConfiguration,
8282
headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + accessToken }
8383
}).then (function (resp) {

bundles/org.openhab.ui.habpanel/web/app/services/oh3storage.service.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
} else {
2727
$http({
2828
method: 'POST',
29-
url: '/rest/auth/token',
29+
url: '../rest/auth/token',
3030
data: 'grant_type=refresh_token&client_id=' + window.location.origin +
3131
'&redirect_uri=' + window.location.origin + '&refresh_token=' + refreshToken,
3232
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
@@ -49,7 +49,7 @@
4949
if (!refreshToken) {
5050
$rootScope.lockEditing = true;
5151
}
52-
$http.get('/rest/ui/components/habpanel:panelconfig').then(function (data) {
52+
$http.get('../rest/ui/components/habpanel:panelconfig').then(function (data) {
5353
console.log('Panel configurations loaded');
5454
$rootScope.panelsRegistry = transformUIComponentsToPanelRegistry(data.data);
5555
deferred.resolve($rootScope.panelsRegistry);
@@ -77,11 +77,11 @@
7777
headers['Authorization'] = 'Bearer ' + accessToken
7878
}
7979

80-
$http.get('/rest/ui/components/habpanel:panelconfig/' + getCurrentPanelConfig()).then(function (data) {
80+
$http.get('../rest/ui/components/habpanel:panelconfig/' + getCurrentPanelConfig()).then(function (data) {
8181
// update
8282
$http({
8383
method: 'PUT',
84-
url: '/rest/ui/components/habpanel:panelconfig/' + getCurrentPanelConfig(),
84+
url: '../rest/ui/components/habpanel:panelconfig/' + getCurrentPanelConfig(),
8585
data: transformPanelConfigurationToUIComponent(getCurrentPanelConfig(), panelConfiguration),
8686
headers: headers
8787
}).then (function (resp) {
@@ -95,7 +95,7 @@
9595
// assume the error is 404?
9696
$http({
9797
method: 'POST',
98-
url: '/rest/ui/components/habpanel:panelconfig',
98+
url: '../rest/ui/components/habpanel:panelconfig',
9999
data: transformPanelConfigurationToUIComponent(getCurrentPanelConfig(), panelConfiguration),
100100
headers: headers
101101
}).then (function (resp) {
@@ -127,7 +127,7 @@
127127

128128
$http({
129129
method: 'DELETE',
130-
url: '/rest/ui/components/habpanel:panelconfig/' + id,
130+
url: '../rest/ui/components/habpanel:panelconfig/' + id,
131131
headers: headers
132132
}).then (function (resp) {
133133
console.log('Panel configuration deleted');

bundles/org.openhab.ui.habpanel/web/app/services/openhab.service.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
$timeout($rootScope.$emit('openhab-update'));
3333
}
3434

35-
$http.get('/rest/items')
35+
$http.get('../rest/items')
3636
.then(function (data) {
3737
if (angular.isArray(data.data)) {
3838
console.log("Loaded " + data.data.length + " openHAB items");
@@ -71,7 +71,7 @@
7171
function sendCmd(item, cmd) {
7272
$http({
7373
method : 'POST',
74-
url : '/rest/items/' + item,
74+
url : '../rest/items/' + item,
7575
data : cmd,
7676
headers: { 'Content-Type': 'text/plain' }
7777
}).then(function (data) {
@@ -92,7 +92,7 @@
9292
if (locale) {
9393
deferred.resolve(locale);
9494
} else {
95-
$http.get('/rest/')
95+
$http.get('../rest/')
9696
.then(function (response) {
9797
if (!response.data.locale) {
9898
if (navigator && navigator.languages) {
@@ -145,7 +145,7 @@
145145
function sendVoice(text) {
146146
$http({
147147
method : 'POST',
148-
url : '/rest/voice/interpreters',
148+
url : '../rest/voice/interpreters',
149149
data : text,
150150
headers: { 'Content-Type': 'text/plain' }
151151
}).then(function (data) {
@@ -161,7 +161,7 @@
161161

162162
function registerEventSource() {
163163
if (typeof(EventSource) !== "undefined") {
164-
var source = new EventSource('/rest/events?topics=openhab/items/*/statechanged,openhab/items/*/*/statechanged,openhab/webaudio/playurl');
164+
var source = new EventSource('../rest/events?topics=openhab/items/*/statechanged,openhab/items/*/*/statechanged,openhab/webaudio/playurl');
165165
liveUpdatesEnabled = true;
166166

167167
source.onmessage = function (event) {
@@ -192,7 +192,7 @@
192192
}
193193
} else {
194194
// fetch the new transformed state
195-
$http.get('/rest/items/' + item.name).then(function (response) {
195+
$http.get('../rest/items/' + item.name).then(function (response) {
196196
if (response.data && response.data.transformedState) {
197197
item.transformedState = response.data.transformedState;
198198
$rootScope.$emit('openhab-update', item);

bundles/org.openhab.ui.habpanel/web/app/settings/settings.widgets.gallery.controller.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
vm.progressMax = 1;
2121
vm.progressCurrent = 1;
2222

23-
$http.get('/rest/habpanel/gallery/community/widgets')
23+
$http.get('../rest/habpanel/gallery/community/widgets')
2424
.then(function (resp) {
2525
vm.busy = false;
2626
if (resp.data) {
@@ -52,7 +52,7 @@
5252
vm.progressMax = 1;
5353
vm.progressCurrent = 1;
5454

55-
$http.get('/rest/habpanel/gallery/community/widgets/' + id)
55+
$http.get('../rest/habpanel/gallery/community/widgets/' + id)
5656
.then(function (resp) {
5757
vm.galleryItemDetails = resp.data;
5858
if (vm.galleryItemDetails.authorAvatarUrl)

bundles/org.openhab.ui.habpanel/web/app/widgets/chart/chart.widget.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117

118118
vm.rawdata = [];
119119
for (var i = 0; i < vm.widget.series.length; i++) {
120-
vm.rawdata[i] = $http.get('/rest/persistence/items/' + vm.widget.series[i].item + "?starttime=" + startDate.toISOString() + (vm.widget.service ? '&serviceId=' + vm.widget.service : ''));
120+
vm.rawdata[i] = $http.get('../rest/persistence/items/' + vm.widget.series[i].item + "?starttime=" + startDate.toISOString() + (vm.widget.service ? '&serviceId=' + vm.widget.service : ''));
121121
}
122122

123123
$q.all(vm.rawdata).then(function (values) {

bundles/org.openhab.ui.habpanel/web/app/widgets/timeline/timeline.widget.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@
218218

219219
vm.rawdata = [];
220220
for (var i = 0; i < vm.widget.series.length; i++) {
221-
vm.rawdata[i] = $http.get('/rest/persistence/items/' + vm.widget.series[i].item + "?boundary=true&starttime=" + startDate.toISOString() + (vm.widget.service ? '&serviceId=' + vm.widget.service : ''));
221+
vm.rawdata[i] = $http.get('../rest/persistence/items/' + vm.widget.series[i].item + "?boundary=true&starttime=" + startDate.toISOString() + (vm.widget.service ? '&serviceId=' + vm.widget.service : ''));
222222
}
223223

224224

0 commit comments

Comments
 (0)