Skip to content
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

Merged
merged 1 commit into from
Dec 7, 2016

Conversation

jhadvig
Copy link
Member

@jhadvig jhadvig commented Dec 1, 2016

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)

  1. As part of the Configuration section
    screenshot-67
    screenshot-1

  2. Separate section in the Details tab
    screenshot-68
    screenshot
    Here I was not sure where to put the section so I've put it under the Triggers section

  3. A separate Lifecycle Hooks tab since as you can see on the previous screens the Details tab can get pretty messy whe it contains a lot of things.
    screenshot-69

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 :)

@spadgett
Copy link
Member

spadgett commented Dec 1, 2016

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!

@jhadvig
Copy link
Member Author

jhadvig commented Dec 1, 2016

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.

@jwforres
Copy link
Member

jwforres commented Dec 1, 2016

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:

  • Strategy and params
  • Hooks
  • Scaling / Autoscaling
  • Triggers

What am I deploying:

  • Pod template details
  • Volumes

@jhadvig
Copy link
Member Author

jhadvig commented Dec 1, 2016

@spadgett @jwforres here is preview of the styling we have in dc details in a separate tab:
screenshot-2
screenshot-3

Here is preview of the styling we have in dc details in the Details tab:
screenshot-4
screenshot-5

@jhadvig
Copy link
Member Author

jhadvig commented Dec 1, 2016

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))

@jhadvig
Copy link
Member Author

jhadvig commented Dec 2, 2016

I've updated the PR based on the conversation with @spadgett ..
Here is the screen on the how the Hooks will be displayed:
screenshot-6

Also had to refactor the lifecycleHook directive

PTAL

Will add the dist after review

if (!strategyName) {
return null;
}
return strategyName.toLowerCase() + 'Params';
Copy link
Member

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">
Copy link
Member

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">
Copy link
Member

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>
Copy link
Member

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&nbsp;<i class="fa fa-external-link" aria-hidden="true"></i></a>
</span>

scope: {
hookParams: "=",
namespace: "=",
type: "@"
Copy link
Member

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}}&#8201;&#8594;&#8201;{{env.value}}
Copy link
Member

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">
Copy link
Member

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">
Copy link
Member

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>
Copy link
Member

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}}">
Copy link
Member

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.)

@openshift-bot openshift-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 5, 2016
@spadgett spadgett self-assigned this Dec 5, 2016
@jhadvig
Copy link
Member Author

jhadvig commented Dec 6, 2016

@spadgett I've updated the PR based on your comments.

Here is the screen of the Hooks in the DC browse page:
screenshot-8

Wasnt really sure how to properly name the execNewPod and tagImages actions, so I named it Action and put its description next to it.
Also added a tooltip to the failurePolicy to explain what the value does.

PTAL

@openshift-bot openshift-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 6, 2016
},
templateUrl: 'views/directives/lifecycle-hook.html',
controller: function($scope) {
$scope.strategyParams = $filter('deploymentStrategyNameToParams')($scope.deploymentConfig.spec.strategy.type);
Copy link
Member

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 () {
Copy link
Member

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 {
Copy link
Member

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&nbsp;<i class="fa fa-external-link" aria-hidden="true"></i></a>
Copy link
Member

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>
Copy link
Member

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>
Copy link
Member

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>
Copy link
Member

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>

@jhadvig
Copy link
Member Author

jhadvig commented Dec 6, 2016

@spadgett comments addressed

@jhadvig jhadvig force-pushed the dc_details branch 2 times, most recently from 896b559 to dda4522 Compare December 6, 2016 16:01
@jhadvig
Copy link
Member Author

jhadvig commented Dec 6, 2016

Adding screen:

screenshot-12

wasnt really sure what limit values shall be set for the envVars so I set the name to 40 and the value to 80. Thoughts ?

<span ng-switch="type">
<small ng-switch-when="pre">&ndash; runs before the deployment begins.</small>
<small ng-switch-when="mid">&ndash; 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">&ndash; runs after the deployment strategy completes.</small>
Copy link
Member

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

@spadgett
Copy link
Member

spadgett commented Dec 6, 2016

Instead of truncate long text, does class="truncate" work? Since it's a single line, I prefer to use CSS. Then it will truncate exactly at the edge of the screen.

@spadgett
Copy link
Member

spadgett commented Dec 6, 2016

If we switch to class="truncate", set a title attribute with the full value as well.

@jhadvig
Copy link
Member Author

jhadvig commented Dec 7, 2016

@spadgett updated :)
added the dist as well
PTAL

@spadgett
Copy link
Member

spadgett commented Dec 7, 2016

[merge]

@openshift-bot
Copy link

Evaluated for origin web console merge up to 8d402e9

@openshift-bot
Copy link

openshift-bot commented Dec 7, 2016

Origin Web Console Merge Results: SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin_web_console/819/) (Base Commit: a9f4523)

@openshift-bot openshift-bot merged commit 8fd9c66 into openshift:master Dec 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants