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

Notifications drawer #1326

Merged
merged 1 commit into from
Aug 28, 2017
Merged

Conversation

benjaminapetersen
Copy link
Contributor

@benjaminapetersen benjaminapetersen commented Mar 8, 2017

https://trello.com/c/o82aiHhh

WIP Prototype of the notification drawer.

  • using sessionStorage to store read/unread (though we may eliminate this)
  • using a service to process events & reduce watch thrashing on nagivation

screen shot 2017-03-08 at 11 09 27 am

TODO:

  • Decide on best way to filter/curate notifications, though we don't necessarily want an open drawer with practically nothing in it.
  • Collapse history of objects, if mongodb-1-deploy, mongodb-2-deploy and mongodb-3-delpoy all have events, only show what is current & relevant (mongodb-3-deploy).
  • need build events (blocker)
  • other text tweaks possible? some events are not terribly friendly.
  • click to dismiss notifications, if all dismissed for a group, remove group.

Designs for reference:

@jwforres @spadgett opening up for conversation.

@benjaminapetersen
Copy link
Contributor Author

benjaminapetersen commented Mar 9, 2017

More thoughts:

  • Top level groups should be like the menu, "Applications", "Builds", "Storage". Not named things.
    (See latest designs)

// eliminates the callback form the list
// closes the watch if it is no longer needed
unsubscribe: function(handler) {
subscriptions[handler.projectName].callbacks.splice(handler.cbIndex, 1);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This .splice() mutates the array & throws off all the indices, so it wont work for the following .unsubscribe() call. Per @jwforres using something like $.Callbacks() will take care of this problem.

@benjaminapetersen
Copy link
Contributor Author

benjaminapetersen commented Mar 13, 2017

Per google doc, check to see if we have the following events available:

  • build started
  • build completed
  • build cancelled
  • build failed
  • new image for ImageStream (roll up both sync & push, may be unecessary?)
  • deployment in progress (dc, k8sdep, pod, etc)
    • deployment config deployment created (normal)
    • replication controller successful create (normal)
    • deployment config started (normal)
    • deployment config replication controller scaled (normal)
  • deployment cancelled (dc, k8sdep, pod, etc)
  • deployment completed (dc, k8sdep, pod, etc)
    • replication controller successful delete (normal)
  • deployment failed (dc, k8sdep, pod, etc)
  • deployment idled (dc, k8sdep, pod, etc)
  • pod crashing
    • pod unhealthy (warning)
    • pod failed sync (warning)
    • pod backoff (warning)
    • pod failed mount (warning)
    • pod failed (warning)
  • pod failed to schedule
  • autoscale scale change
    • horizontal pod autoscaler failed get scale (normal)
  • pvc failed to bind / time out

Events we are currently choosing to ignore:

  • pod killing (normal)
  • pod scheduled (normal)
  • pod pulled (normal)
  • pod created (normal)
  • pod started (normal)
  • pod pulling (normal)

Working on mapping the events I can trigger into something easy to parse in this gist, so we can clarify what is still needed.

@benjaminapetersen
Copy link
Contributor Author

Updated drawer headings to match the 3 primary in the menu, sorting events appropriately (still working on filtering):

screen shot 2017-03-14 at 11 41 22 am

@benjaminapetersen
Copy link
Contributor Author

@jwforres keeping track of the types of Events I've been able to generate here, per our last discussion. gist with events

@spadgett
Copy link
Member

@benjaminapetersen You should grab the reason codes, which is probably the best way to identify the events

@jwforres
Copy link
Member

jwforres commented Mar 15, 2017 via email

@benjaminapetersen
Copy link
Contributor Author

benjaminapetersen commented Mar 16, 2017

Will do, I have a much bigger list going now after going fishing in the Go code to find eventRecorder.Eventf() calls in origin/pkg and origin/vendor/k8s.io.

@benjaminapetersen
Copy link
Contributor Author

Tracked what I found in the doc, top has the things we were looking for, bottom has the full list.

@openshift-bot openshift-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 16, 2017
@openshift-bot openshift-bot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jul 18, 2017
@serenamarie125
Copy link

@benjaminapetersen this is likely early for me to comment, but just want to make sure that the badge will be blue ( the upcoming PF update should do that ), and verify that you are aware that will not be using #s inside the badge. Tagging @beanh66 as well

@benjaminapetersen
Copy link
Contributor Author

@serenamarie125 yup, thanks! As far as I understand this is where things are currently:
https://github.com/patternfly/patternfly-design/pull/297/files#diff-7ae80772f8926108946cd31ddaa5e2d4

@jeff-phillips-18 is keeping me updated on some changes he has in progress.

@openshift-bot openshift-bot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jul 25, 2017
@openshift-bot openshift-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 31, 2017
@benjaminapetersen
Copy link
Contributor Author

benjaminapetersen commented Aug 3, 2017

  • Bug fix coming for accordion within the drawer here
  • Recent design updates here | files

@benjaminapetersen benjaminapetersen force-pushed the notifications branch 2 times, most recently from ac16065 to 52a0764 Compare August 7, 2017 14:00
@benjaminapetersen
Copy link
Contributor Author

@spadgett this pass is prob ready to start reviewing. My API server was crashing & giving me trouble over the weekend, so I haven't included the work to include our internal Notifications quite yet. Working on diagnosing that issue this morning.

@benjaminapetersen
Copy link
Contributor Author

Depends on web-common PR 138 for some fixes to notification-drawer

// BuildConfig
//
// Deployment
Failed: true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of these are so general, I'd rather pair it to a specific kind. Although API groups make it a little harder. Maybe something like

Failed: {
  resources: [{ group: 'apps', resource: 'deployments' }],
  drawer: true,
  toast: true
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can make this a follow on.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok sounds good. I can definitely iterate on this.

//
// PodAutoscaler
SuccessfulRescale: true,
FailedRescale: true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some events for when the autoscaler can't get metrics. We should show those.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was able to find the following related to autoscalers:

  PodAutoscaler 
    Normal 
      DesiredReplicasComputed 
      DesiredReplicasComputedCustomMetric
      SuccessfulRescale 
    Warning 
        FailedRescale 

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind, I'm thinking of a condition on the HPA object, not an event.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

'$rootScope',
'Constants',
'DataService',
function($routeParams, $rootScope, Constants, DataService) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I'd like to keep a consistent style for declaring components. In other places, we don't use an inline function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -84,7 +84,11 @@ angular.extend(window.OPENSHIFT_CONSTANTS, {

// This blacklist hides certain kinds from the "Other Resources" page because they are unpersisted, disallowed for most end users, or not supported by openshift but exist in kubernetes
AVAILABLE_KINDS_BLACKLIST: [],

// Kill switches for features that are not in tech-preview
FEATURE_FLAGS: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wish we had done this from the start, but the other flags are currently DISABLE_<FEATURE_NAME>. A few of those are documented. Trying to decide what's best for consistency.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll change for consistency now. I prob prefer this way for clarity, but def isn't a huge deal.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

counter.$onInit = function() {
reset();
rootScopeWatches.push($rootScope.$on("$routeChangeSuccess", function () {
reset();
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 only reset if the project route param changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

class="notification-counter notification-counter-offset"
row main-axis="center" cross-axis="center">
<span><!--{{countDisplay}}--></span>
</div>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the content is commented out?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, the latest designs indicate we won't show count. We just show the indicator.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, mind removing out the commented out expression (and any unnecessary markup)?

We should add some screenreader text as well per my comment below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

row main-axis="center" cross-axis="center">
<span><!--{{countDisplay}}--></span>
</div>
<span class="fa fa-bell" aria-hidden="true"></span>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs some sr-only text somewhere here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This strays from the patternfly designs adding indicator colors and such. Why not follow the example from patternfly:

<li class="drawer-pf-trigger">
  <a class="nav-item-iconic">
    <span class="fa fa-bell" title="Notifications"></span>
    <span class="badge"> </span>
  </a>
</li>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeff-phillips-18 Agree, but I see some problems with the example as well. Can we fix in Patternfly?

  • a needs an href or you can't access it by the keyboard or screen reader
  • fa-bell should have aria-hidden="true"
  • Needs some sr-only text for screen readers

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, we can fix the example, but it is still just example so would need to be done here as well. I tried replacing and the biggest issue is the navbar-alt-pf styling.

Adding the following fixes it up and allows the removal of the other counter settings:

_notifications-counter.html (yeah needs some of the above fixes):

<li class="drawer-pf-trigger" ng-if="!$ctrl.hide">
  <a href="" class="nav-item-iconic" ng-click="$ctrl.onClick()">
    <span class="fa fa-bell" title="Notifications" aria-hidden="true"></span>
    <span ng-if="$ctrl.showNewNotificationIndicator" class="badge"> </span>
  </a>
</li>

_notifications.less:

.navbar-pf-alt .nav .nav-item-iconic .badge {
  font-size: 9px;
  margin: -15px 0 0 -12px;
  min-width: 10px;
  min-height: 10px;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeff-phillips-18 thanks! I'll update to bring in line w/patternfly.

@@ -0,0 +1,8 @@
<a
ng-if="$ctrl.customScope.hasUnread(notificationGroup)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would rather calculate this only when things change instead of in each digest loop.

@@ -0,0 +1,8 @@
<a
ng-if="$ctrl.customScope.hasUnread(notificationGroup)"
class="btn btn-link btn-block"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confusing why it's an a but we're using the btn-link style

class="btn btn-link btn-block"
role="button"
ng-click="$ctrl.customScope.clearAll(notificationGroup)">
<span class="pficon pficon-close"></span>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aria-hidden="true"

@benjaminapetersen
Copy link
Contributor Author

Nixed that last comment, after a rebuild it seems that bug does not exist.

@benjaminapetersen
Copy link
Contributor Author

benjaminapetersen commented Aug 25, 2017

@beanh66 I believe you made a previous comment expecting the drawer to be full width @ mobile. Is that correct? Quick screenshot for reference:

screen shot 2017-08-25 at 11 32 57 am

I tend to agree & think it might be a better use of screen real estate if it became full width @ mobile & filled whatever space was available.

@jeff-phillips-18
Copy link
Member

@benjaminapetersen Could you comment in the patternfly PR for this?
patternfly/patternfly#717

@benjaminapetersen
Copy link
Contributor Author

@jeff-phillips-18 yup, just submitted my review.

@benjaminapetersen benjaminapetersen force-pushed the notifications branch 2 times, most recently from 03fac47 to 3107661 Compare August 25, 2017 20:01
@openshift-bot openshift-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 25, 2017
@benjaminapetersen
Copy link
Contributor Author

benjaminapetersen commented Aug 28, 2017

One thing to note, the counter is still in the old nav in this PR, which means it re-renders on every view. The "new" indicator disappears. This will not happen in our new design by @sg00dwin as the header is persistent (the counter will not lose its internal state).

rootScopeWatches.push($rootScope.$on("$routeChangeSuccess", function (evt, next, current) {
if(projectChanged(next, current)) {
drawer.customScope.projectName = $routeParams.project;
reset();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you check that reset() is not called twice when first loading the page?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, it is only called once.

if(DISABLE_GLOBAL_EVENT_WATCH || LIMIT_WATCHES) {
return;
}
if (AuthService.isLoggedIn()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know I suggested this, but I'd like to check if we can get away with only starting the watch $onRouteChangeSuccess and if this is still needed in that case?

@spadgett
Copy link
Member

The expand and close links in the drawer titlebar aren't accessible because the a element doesn't have an href. @benjaminapetersen Do you mind opening upstream issues for these?

@jeff-phillips-18 FYI

screen shot 2017-08-28 at 12 19 49 pm

screen shot 2017-08-28 at 12 19 41 pm

@spadgett
Copy link
Member

The icons in the drawer should also have sr-only text. Right now they are invisible to screen readers.

screen shot 2017-08-28 at 12 23 43 pm

- Show events that pass the white list in OPENSHIFT_CONSTANTS.EVENTS_TO_SHOW
  - Internal Notifications coming in next iteration
- Add patternfly.notifications
	- add notification counter to top bar
  - add notification event service
  - add drawer-wrapper as a proxy to pf-notification-drawer
    - need our own controller for filtering, etc
- Update event system to use $rootScope.$emit rather than a custom service
- add sessionStorage cache to keep track of read/unread state
- Debounce watch in notification service based on work recently done in DataService to support
- Update web-common to 0.0.43, includes DataService.watch() flag
- Add FEATURE_FLAG.global_event_watch_for_notification_drawer
   - kill switch in case watching events is too expensive
   - would still allow internal notifications to appear in drawer
- Add link to events page, update index.html
- Migrate EVENTS_TO_SHOW map out of EventsService into Constants
- Add naviateEventInvolvedObjectURL filter for drawer & events
- Update Events service to track read, cleared, namespace SessionStorage, etc
- Animate w/a fade-out when a notification is cleared to ensure user notices the subtle change
- Add BrowserStorage service
	- auto namespace openshift- on all Local & Session storage keys
- Add links to objects in event-sidebar
- Disabled in IE & Edge due to insufficient watches
@openshift-bot
Copy link

Evaluated for origin web console test up to 2fb7ef6

counter.hide = true;
return;
}
initWatches();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spadgett the Auth items removed.

aria-hidden="true"
class="pull-left"
ng-class="$ctrl.customScope.getNotficationStatusIconClass(notification.event)"></span>
<span class="sr-only">{{notification.event.type}}</span>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spadgett the sr-only for the icon.

@@ -7,15 +7,15 @@ const projectHelpers = require('../helpers/project.js');
let goToAddToProjectPage = (projectName) => {
let uri = 'project/' + projectName + '/create';
h.goToPage(uri);
expect(element(by.cssContainingText('h1', "Create Using Your Code")).isPresent()).toBe(true);
expect(element(by.cssContainingText('h1', "Create Using a Template")).isPresent()).toBe(true);
expect(element(by.cssContainingText('.middle-container h1', "Create Using Your Code")).isPresent()).toBe(true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI @sg00dwin @rhamilto We'll need to update these tests in the vertical nav PR

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. See spadgett@ff58b22

@spadgett
Copy link
Member

[merge]

@openshift-bot
Copy link

Origin Web Console Test Results: SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin_web_console/94/) (Base Commit: cf0278b) (PR Branch Commit: 2fb7ef6)

@spadgett
Copy link
Member

Flake #1684

Error: Timed out waiting for the WebDriver server at http://172.18.0.16:39874/wd/hub

@@ -0,0 +1,67 @@
// fixes positioning that doesn't quite work w/core patternfly styles
.navbar-pf-alt .nav .nav-item-iconic .badge {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This rule will be obsoleted by changes in #1932. @rhamilto, remove this after merge.

@openshift-bot
Copy link

openshift-bot commented Aug 28, 2017

Origin Web Console Merge Results: Waiting: You are in the build queue at position: 1

@spadgett
Copy link
Member

[merge]

@openshift-bot
Copy link

Evaluated for origin web console merge up to 2fb7ef6

@openshift-bot openshift-bot merged commit c6ac85f into openshift:master Aug 28, 2017
@benjaminapetersen benjaminapetersen deleted the notifications branch August 28, 2017 19:55
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

9 participants