Skip to content

If there is only 1 pod, navigate directly to it from the donut #999

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 7, 2016
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
7 changes: 5 additions & 2 deletions app/scripts/directives/deploymentDonut.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,12 @@ angular.module('openshiftConsole')
$scope.viewPodsForDeployment = function(deployment) {
if (hashSizeFilter($scope.pods) === 0) {
return;
} else if (hashSizeFilter($scope.pods) === 1) {
// there should only be 1 pod, so navigate to it
Navigate.toResourceURL(_.sample($scope.pods));
} else {
Navigate.toPodsForDeployment(deployment);
}

Navigate.toPodsForDeployment(deployment);
};

$scope.scaleUp = function() {
Expand Down
5 changes: 5 additions & 0 deletions app/scripts/services/navigate.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,11 @@ angular.module("openshiftConsole")
return url.toString();
},

// Navigate to the URL of the resource
toResourceURL: function (resource) {
$location.url(this.resourceURL(resource));
},

// Returns the build config URL for a build or the deployment config URL for a deployment.
configURLForResource: function(resource, /* optional */ action) {
var bc, dc,
Expand Down
5 changes: 4 additions & 1 deletion dist/scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -2252,6 +2252,9 @@ group:n.group
}
return i.toString();
},
toResourceURL:function(b) {
a.url(this.resourceURL(b));
},
configURLForResource:function(a, b) {
var c, d, e = _.get(a, "kind"), f = _.get(a, "metadata.namespace");
if (!e || !f) return null;
Expand Down Expand Up @@ -11907,7 +11910,7 @@ return e.scale(a, b.desiredReplicas).then(_.noop, m);
}
}, p = _.debounce(o, 650);
b.viewPodsForDeployment = function(a) {
0 !== j(b.pods) && i.toPodsForDeployment(a);
0 !== j(b.pods) && (1 === j(b.pods) ? i.toResourceURL(_.sample(b.pods)) :i.toPodsForDeployment(a));
}, b.scaleUp = function() {
b.scalable && (b.desiredReplicas = b.getDesiredReplicas(), b.desiredReplicas++, p(), c = !0);
}, b.scaleDown = function() {
Expand Down