Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions assets/app/scripts/services/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -570,13 +570,20 @@ angular.module('openshiftConsole')
var URL_WATCH_LIST = URL_ROOT_TEMPLATE + "watch/{type}{?q*}";
var URL_GET_LIST = URL_ROOT_TEMPLATE + "{type}{?q*}";
var URL_GET_OBJECT = URL_ROOT_TEMPLATE + "{type}/{id}{?q*}";
var URL_NAMESPACED_WATCH_LIST = URL_ROOT_TEMPLATE + "watch/ns/{namespace}/{type}{?q*}";
var URL_NAMESPACED_GET_LIST = URL_ROOT_TEMPLATE + "ns/{namespace}/{type}{?q*}";
var URL_NAMESPACED_GET_OBJECT = URL_ROOT_TEMPLATE + "ns/{namespace}/{type}/{id}{?q*}";


var apicfg = OPENSHIFT_CONFIG.api;

// Set the api version the console is currently able to talk to
apicfg.openshift.version = "v1beta1";
apicfg.k8s.version = "v1beta3";

// Set whether namespace is a path or query parameter
apicfg.openshift.namespacePath = false;
apicfg.k8s.namespacePath = true;

// TODO this is not the ideal, issue open to discuss adding
// an introspection endpoint that would give us this mapping
Expand All @@ -597,6 +604,7 @@ angular.module('openshiftConsole')
};

DataService.prototype._urlForType = function(type, id, context, isWebsocket, params) {
var params = params || {};
var protocol;
if (isWebsocket) {
protocol = window.location.protocol === "http:" ? "ws" : "wss";
Expand All @@ -605,15 +613,22 @@ angular.module('openshiftConsole')
protocol = window.location.protocol === "http:" ? "http" : "https";
}

var namespaceInPath = params.namespace && SERVER_TYPE_MAP[type].namespacePath;
var namespace = null;
if (namespaceInPath) {
namespace = params.namespace;
params = angular.copy(params);
delete params.namespace;
}
var template;
if (isWebsocket) {
template = URL_WATCH_LIST;
template = namespaceInPath ? URL_NAMESPACED_WATCH_LIST : URL_WATCH_LIST;
}
else if (id) {
template = URL_GET_OBJECT;
template = namespaceInPath ? URL_NAMESPACED_GET_OBJECT : URL_GET_OBJECT;
}
else {
template = URL_GET_LIST;
template = namespaceInPath ? URL_NAMESPACED_GET_LIST : URL_GET_LIST;
}

// TODO where do we specify what the server URL and api version should be
Expand All @@ -624,6 +639,7 @@ angular.module('openshiftConsole')
apiVersion: SERVER_TYPE_MAP[type].version,
type: type,
id: id,
namespace: namespace,
q: params
});
};
Expand Down
43 changes: 23 additions & 20 deletions pkg/assets/bindata.go
Original file line number Diff line number Diff line change
Expand Up @@ -12999,32 +12999,35 @@ f._watchCallbacks(a, b).fire(f._data(a, b), e.type, e.object);
}, f.prototype.objectsByAttribute = function(a, b, c, d, e) {
for (var f = 0; f < a.length; f++) g(a[f], b, c, d ? d[f] :null, e);
};
var h = "{protocol}://{+serverUrl}{+apiPrefix}/{apiVersion}/", i = h + "watch/{type}{?q*}", j = h + "{type}{?q*}", k = h + "{type}/{id}{?q*}", l = OPENSHIFT_CONFIG.api;
l.openshift.version = "v1beta1", l.k8s.version = "v1beta3";
var m = {
builds:l.openshift,
deploymentConfigs:l.openshift,
images:l.openshift,
oAuthAccessTokens:l.openshift,
projects:l.openshift,
users:l.openshift,
pods:l.k8s,
replicationcontrollers:l.k8s,
services:l.k8s,
resourcequotas:l.k8s,
limitranges:l.k8s
var h = "{protocol}://{+serverUrl}{+apiPrefix}/{apiVersion}/", i = h + "watch/{type}{?q*}", j = h + "{type}{?q*}", k = h + "{type}/{id}{?q*}", l = h + "watch/ns/{namespace}/{type}{?q*}", m = h + "ns/{namespace}/{type}{?q*}", n = h + "ns/{namespace}/{type}/{id}{?q*}", o = OPENSHIFT_CONFIG.api;
o.openshift.version = "v1beta1", o.k8s.version = "v1beta3", o.openshift.namespacePath = !1, o.k8s.namespacePath = !0;
var p = {
builds:o.openshift,
deploymentConfigs:o.openshift,
images:o.openshift,
oAuthAccessTokens:o.openshift,
projects:o.openshift,
users:o.openshift,
pods:o.k8s,
replicationcontrollers:o.k8s,
services:o.k8s,
resourcequotas:o.k8s,
limitranges:o.k8s
};
return f.prototype._urlForType = function(a, b, c, d, e) {
var f;
var f, e = e || {};
f = d ? "http:" === window.location.protocol ? "ws" :"wss" :"http:" === window.location.protocol ? "http" :"https";
var g;
return g = d ? i :b ? k :j, URI.expand(g, {
var g = e.namespace && p[a].namespacePath, h = null;
g && (h = e.namespace, e = angular.copy(e), delete e.namespace);
var o;
return o = d ? g ? l :i :b ? g ? n :k :g ? m :j, URI.expand(o, {
protocol:f,
serverUrl:m[a].hostPort,
apiPrefix:m[a].prefix,
apiVersion:m[a].version,
serverUrl:p[a].hostPort,
apiPrefix:p[a].prefix,
apiVersion:p[a].version,
type:a,
id:b,
namespace:h,
q:e
});
}, new f();
Expand Down