-
Notifications
You must be signed in to change notification settings - Fork 230
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
Display Lifecycle hooks on the DC browse page #966
Conversation
I like having the separate tab. Shorten it to just "Hooks"? I'm not sure about using the pod template styling for hooks. We currently use it as a distinct visual style for pod templates. Maybe something closer to the styling we use for dc details. Otherwise looks good! |
yeah regarding similar styling that we have for the pod template.. I've reused it since it's using the concept of separating the details per container and thats basically what the lifecycle hooks do. |
Honestly I prefer option 2. I think if we were going to split stuff into another tab, we should really take a look at everything we have on that Details tab and come up with a logical split. Hooks as its own tab doesn't make sense to me. I'd expect a split more like (not necessarily this order): How am I deploying:
What am I deploying:
|
I liked the the pod-template like styling more, but dont have any major objection against the styling in the last comment as well (exepct #966 (comment)) |
I've updated the PR based on the conversation with @spadgett .. Also had to refactor the PTAL Will add the |
if (!strategyName) { | ||
return null; | ||
} | ||
return strategyName.toLowerCase() + 'Params'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't assume this will always work. I'd rather have a switch statement for all the strategies we know about.
<dt>Max Surge:</dt> | ||
<dd>{{deploymentConfig.spec.strategy.rollingParams.maxSurge}}</dd> | ||
<dd>{{deploymentConfig.spec.strategy[strategyParams].timeoutSeconds}} sec</dd> | ||
<div ng-if="deploymentConfig.spec.strategy.rollingParams"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While you're in the code, can you change this to...?
<dt ng-if-start="deploymentConfig.spec.strategy.rollingParams">Update Period:</dt>
<dd>{{deploymentConfig.spec.strategy.rollingParams.updatePeriodSeconds}} sec</dd>
...
<dt>Max Surge:</dt>
<dd ng-if-end>{{deploymentConfig.spec.strategy.rollingParams.maxSurge}}</dd>
Then you don't have the unnecessary div in the middle of the dl
.
<div class="col-lg-6" ng-if="deploymentConfig.spec.strategy.type !== 'Custom'"> | ||
<h3> | ||
Hooks | ||
<a href="{{'lifecycle_hooks' | helpLink}}" style="display: inline-block;" target="_blank"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not use inline styles. Does class="learn-more-inline"
work here?
<h3> | ||
Hooks | ||
<a href="{{'lifecycle_hooks' | helpLink}}" style="display: inline-block;" target="_blank"> | ||
<span class="learn-more-block">Learn more <i class="fa fa-external-link"> </i></span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be using learn-more-inline
not learn-more-block
.
Can you try
<span class="learn-more-inline">
<a ng-href="{{'lifecycle_hooks' | helpLink}}" target="_blank">Learn more <i class="fa fa-external-link" aria-hidden="true"></i></a>
</span>
scope: { | ||
hookParams: "=", | ||
namespace: "=", | ||
type: "@" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is better as
scope: {
deploymentConfig: '=',
type: '@' // "pre", "mid", or "post"
}
Should be able to determine strategy from the deployment config spec, correct? Then you don't need to pass namespace because it's in the deployment config metadata.
<dt>Environment Variables:</dt> | ||
<dd> | ||
<div ng-repeat="env in hookParams.execNewPod.env"> | ||
{{env.name}} → {{env.value}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think {{env.name}}={{env.value}}
is more natural for environment variables.
<div ng-if="hookParams.execNewPod"> | ||
<h5 class="container-name">Container {{hookParams.execNewPod.containerName}}</h5> | ||
<dl class="dl-horizontal left"> | ||
<div class="is-item-description"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see where this CSS class is defined.
<div ng-repeat="tagImage in hookParams.tagImages"> | ||
<h5 class="container-name">Container {{tagImage.containerName}}</h5> | ||
<dl class="dl-horizontal left"> | ||
<div class="is-item-description"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see where this CSS class is defined.
<istag-select model="istagHook" allow-custom-tag="true" select-disabled="view.isDisabled"></istag-select> | ||
<h4> | ||
{{type}} Hook | ||
<small class="text-muted">{{hookParams.execNewPod ? "Runs a command in a new pod based on the specified container" : "Tags image on deployment success"}}</small> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as failure policy: I don't think we should style this as help text because it's a configuration value that changes. I'd rather describe the pre/mid/post hook type in help text, then show execNewPod
and failurePolicy
clearly as configuration below the header.
<div class="is-item-description"> | ||
<dt>Tag As:</dt> | ||
<dd> | ||
<a ng-href="{{tagImage.to.name | navigateResourceURL : 'ImageStreamTag' : namespace}}"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need to check first for tagImage.to.namespace
? Then fall back namespace
if not defined. (If tagImage.to.namespace && tagImage.to.namespace !== namespace
, it should not be a link.)
@spadgett I've updated the PR based on your comments. Here is the screen of the Hooks in the DC browse page: Wasnt really sure how to properly name the PTAL |
}, | ||
templateUrl: 'views/directives/lifecycle-hook.html', | ||
controller: function($scope) { | ||
$scope.strategyParams = $filter('deploymentStrategyNameToParams')($scope.deploymentConfig.spec.strategy.type); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should watch the type in case it changes.
$scope.$watch('deploymentConfig.spec.strategy.type', function(type) {
$scope.strategyParams = $filter('deploymentStrategyNameToParams')(type);
});
@@ -1012,6 +1012,20 @@ angular.module('openshiftConsole') | |||
return 'PAUSED_PENDING_INPUT' === stage.status; | |||
}; | |||
}) | |||
.filter('deploymentStrategyNameToParams', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather the filter give me the strategy params instead of the property name.
.filter('strategyParams', function() {
return function(deploymentConfig) {
var strategy = _.get(deploymentConfig, 'spec.strategy.type');
switch (strategy) {
case 'Recreate':
return _.get(deploymentConfig, 'spec.strategy.recreateParams', {});
// ...
default:
return null;
}
};
});
Then in the directive link
function, you can get the strategy params with
$scope.$watch('deploymentConfig', function(deploymentConfig) {
$scope.strategyParams = $filter('strategyParams')(deploymentConfig);
});
(Should have made that comment on first review, sorry.)
@@ -188,7 +188,7 @@ | |||
} | |||
} | |||
|
|||
code.probe-command { | |||
code.command { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
<h3> | ||
Hooks | ||
<span class="learn-more-inline"> | ||
<a ng-href="{{'lifecycle_hooks' | helpLink}}" target="_blank">Learn more <i class="fa fa-external-link" aria-hidden="true"></i></a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be "Learn More" (uppercase M) now. Changed the doc links in #978.
<span ng-switch="type"> | ||
<small class="text-muted" ng-switch-when="pre">Pre hooks execute before the deployment begins.</small> | ||
<small class="text-muted" ng-switch-when="mid">Mid hooks execute after the previous deployment is scaled down to zero and before the first pod of the new deployment is created.</small> | ||
<small class="text-muted" ng-switch-when="post">Post hooks execute after the deployment strategy completes.</small> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of small
, let's use the help-block
style. (Margin looked off in the screenshot, but I think help-block
will fix that.)
</span> | ||
<dl class="dl-horizontal left"> | ||
<dt>Action:</dt> | ||
<dd>{{deploymentConfig.spec.strategy[strategyParams][type].execNewPod ? "Runs a command in a new pod based on the specified container" : "Tags image on deployment success"}}</dd> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd probably shorten these to "Run a command" and "Tag the image"
<div ng-repeat="tagImage in deploymentConfig.spec.strategy[strategyParams][type].tagImages"> | ||
<h5 class="container-name">Container {{tagImage.containerName}}</h5> | ||
<dl class="dl-horizontal left"> | ||
<dt>Tag As:</dt> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there is only ever one item in this dl
, I'd just put it in a div
.
<div>
Tag image as <a href=...>myproject/image:latest</a>
</div>
@spadgett comments addressed |
896b559
to
dda4522
Compare
<span ng-switch="type"> | ||
<small ng-switch-when="pre">– runs before the deployment begins.</small> | ||
<small ng-switch-when="mid">– runs after the previous deployment is scaled down to zero and before the first pod of the new deployment is created.</small> | ||
<small ng-switch-when="post">– runs after the deployment strategy completes.</small> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: remove the period from the end of these messages
Instead of truncate long text, does |
If we switch to |
@spadgett updated :) |
[merge] |
Evaluated for origin web console merge up to 8d402e9 |
Origin Web Console Merge Results: SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin_web_console/819/) (Base Commit: a9f4523) |
I've created 3 previews on how we could display lifecycle hooks on the DC browse page. All three previews have similar structure, they only differ by the section where the particular hook description is displayed and the position of the action that the hook is doing, which is either right from the hook type, or under the hook type (
text-muted
class)As part of the Configuration section
Separate section in the
Details
tabHere I was not sure where to put the section so I've put it under the
Triggers
sectionA separate
Lifecycle Hooks
tab since as you can see on the previous screens theDetails
tab can get pretty messy whe it contains a lot of things.IMHO I like the last option with the new tab, since it makes things more clean&clear. But I also understand that the hooks are more or less part of a "Configuration". On the other hand I kinda like the idea to split the some sections of the
Details
tab into a standalone tabs... eg: Autoscaling or Triggers ?!?@jwforres @spadgett please let me know what what do you think. Please dont review the code for now ..was just prototyping. Thanks :)