Skip to content

Commit d0d3e7b

Browse files
committed
Fix log viewer urls
1 parent 26a7ddb commit d0d3e7b

File tree

9 files changed

+14
-10
lines changed

9 files changed

+14
-10
lines changed

app/scripts/directives/logViewer.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ angular.module('openshiftConsole')
3636
scope: {
3737
followAffixTop: '=?',
3838
followAffixBottom: '=?',
39-
kind: '@',
39+
resource: '@',
4040
name: '=',
4141
context: '=',
4242
options: '=?',
@@ -234,7 +234,7 @@ angular.module('openshiftConsole')
234234
tailLines: 1000,
235235
limitBytes: 10 * 1024 * 1024 // Limit log size to 10 MiB
236236
}, $scope.options);
237-
streamer = DataService.createStream($scope.kind, $scope.name, $scope.context, options);
237+
streamer = DataService.createStream($scope.resource, $scope.name, $scope.context, options);
238238

239239
var lastLineNumber = 0;
240240
var addLine = function(text) {

app/scripts/services/data.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -366,9 +366,9 @@ function b64_to_utf8( str ) {
366366
}
367367

368368
// TODO (bpeterse): Create a new Streamer service & get this out of DataService.
369-
DataService.prototype.createStream = function(kind, name, context, opts, isRaw) {
369+
DataService.prototype.createStream = function(resource, name, context, opts, isRaw) {
370370
var self = this;
371-
var resource = APIService.toResourceGroupVersion(APIService.kindToResource(kind));
371+
resource = APIService.toResourceGroupVersion(resource);
372372

373373
var protocols = isRaw ? 'binary.k8s.io' : 'base64.binary.k8s.io';
374374
var identifier = 'stream_';

app/views/browse/build.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ <h1>
9090
ng-if="selectedTab.logs"
9191
follow-affix-top="390"
9292
follow-affix-bottom="90"
93-
kind="builds/log"
93+
resource="builds/log"
9494
name="build.metadata.name"
9595
context="logContext"
9696
options="logOptions"

app/views/browse/deployment.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ <h3>Container {{container.name}}</h3>
7777
ng-if="selectedTab.logs"
7878
follow-affix-top="390"
7979
follow-affix-bottom="90"
80-
kind="deploymentconfigs/log"
80+
resource="deploymentconfigs/log"
8181
name="deploymentConfigName"
8282
context="logContext"
8383
options="logOptions"

app/views/browse/pod.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ <h3>Container {{container.name}}</h3>
9090
ng-if="selectedTab.logs"
9191
follow-affix-top="390"
9292
follow-affix-bottom="90"
93-
kind="pods/log"
93+
resource="pods/log"
9494
name="pod.metadata.name"
9595
context="logContext"
9696
options="logOptions"

app/views/logs/chromeless-build-log.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</div>
1414
<div class="middle-content"><!-- flex item (fill the parent) -->
1515
<log-viewer
16-
kind="builds/log"
16+
resource="builds/log"
1717
name="build.metadata.name"
1818
context="logContext"
1919
status="build.status.phase"

app/views/logs/chromeless-deployment-log.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<div class="middle-content">
1515
<log-viewer
1616
ng-if="deploymentConfigName && logOptions.version"
17-
kind="deploymentconfigs/log"
17+
resource="deploymentconfigs/log"
1818
name="deploymentConfigName"
1919
context="logContext"
2020
options="logOptions"

app/views/logs/chromeless-pod-log.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</div>
1414
<div class="middle-content">
1515
<log-viewer
16-
kind="pods/log"
16+
resource="pods/log"
1717
name="pod.metadata.name"
1818
context="logContext"
1919
options="logOptions"

test/spec/services/dataServiceSpec.js

+4
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,12 @@ describe("DataService", function(){
6363
[{resource:'pods', namespace:"foo", isWebsocket:true, watch: true, resourceVersion:"5" }, "ws://localhost:8443/api/v1/namespaces/foo/pods?watch=true&resourceVersion=5"],
6464

6565
// Follow log
66+
// subresource is ignored without a resource name
6667
[{resource:'pods/log', namespace:"foo", isWebsocket:true, follow: true }, "ws://localhost:8443/api/v1/namespaces/foo/pods?follow=true"],
6768
[{resource:'builds/log', namespace:"foo", isWebsocket:true, follow: true }, "ws://localhost:8443/oapi/v1/namespaces/foo/builds?follow=true"],
69+
// subresource is honored with a resource name
70+
[{resource:'pods/log', name:"p", namespace:"foo", isWebsocket:true, follow: true }, "ws://localhost:8443/api/v1/namespaces/foo/pods/p/log?follow=true"],
71+
[{resource:'builds/log', name:"b", namespace:"foo", isWebsocket:true, follow: true }, "ws://localhost:8443/oapi/v1/namespaces/foo/builds/b/log?follow=true"],
6872

6973

7074

0 commit comments

Comments
 (0)