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

Extended service, vm, instance & orch. stack retirement functionality #2250

Conversation

mzazrivec
Copy link
Contributor

@mzazrivec mzazrivec commented Sep 27, 2017

This change allows for setting retirement date & time for services, virtual machines and orchestration templates. In the past, the form would only allow to select retirement date. From now on, we're able
to select the time to retire as well (all in UTC time zone).

This change also introduces date & time picker from Patternfly. For it to work nicely with our application
and angular, we're using a new angular directive datetimepicker.

https://www.pivotaltracker.com/story/show/150934417

BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1422422

What won't currently work:

  • translated month names: with some locales (e.g. Japanese) the widget would throw an ugly
    javascript error. This would have to be addressed on the datepicker upstream side.
  • localized date formats: for this to work, we'd need to supply a date format that moment.js would understand. For now, we're using MM/DD/YYYY HH:mm.

Initial retirement screen:
retirement01

Date / time picker, the date selection part:
retirement02

Date / time picker, the time selection part:
retirement03

The retirement date & time has been set:
retirement04

@mzazrivec mzazrivec force-pushed the extended_retirement_date_functionality branch 9 times, most recently from ded7cbe to 8668fa3 Compare September 28, 2017 10:30
@mzazrivec mzazrivec changed the title [WIP] Extended service, vm, instance & orch. template retirement functionality Extended service, vm, instance & orch. template retirement functionality Sep 28, 2017
@mzazrivec mzazrivec removed the wip label Sep 28, 2017
@mzazrivec
Copy link
Contributor Author

@himdel @martinpovolny @dclarizio Review please?

@mzazrivec mzazrivec changed the title Extended service, vm, instance & orch. template retirement functionality Extended service, vm, instance & orch. stack retirement functionality Sep 28, 2017
@mzazrivec mzazrivec force-pushed the extended_retirement_date_functionality branch from 8668fa3 to 0e9b167 Compare September 28, 2017 10:41
@dclarizio
Copy link

translated month names: with some locales (e.g. Japanese) the widget would throw an ugly
javascript error. This would have to be addressed on the datepicker upstream side.

@mzazrivec can we get around this for now by locking the datepicker to english or maybe blacklisting certain locales that don't work?

@skateman could you investigate what it would take to get an upstream fix for this (i.e. can we get it by dev freeze at the end of Oct)?

@dclarizio dclarizio self-assigned this Sep 28, 2017
@mzazrivec
Copy link
Contributor Author

@dclarizio Yes, the way things are right now in this PR, the datetimepicker defaults to English,
regardless of the locale used.

@dclarizio
Copy link

@dclarizio Yes, the way things are right now in this PR, the datetimepicker defaults to English,
regardless of the locale used.

Awesome, so a non-issue for now.

Will let @martinpovolny do a review, but can you also see if you can get address the 3 CC issues? Thx, Dan

@mzazrivec
Copy link
Contributor Author

I think those CC errors do not need to be addressed. Or am I wrong @himdel ?

@martinpovolny
Copy link
Member

CC issues 2,3 are easy to fix. The Rubocop issue is trivial to fix. I think you can add a commit fixing these ;-)

@martinpovolny
Copy link
Member

translated month names: with some locales (e.g. Japanese) the widget would throw an ugly
javascript error. This would have to be addressed on the datepicker upstream side.

Did you open an issue for that? We need to track that issues to properly support Japanese.

@mzazrivec mzazrivec force-pushed the extended_retirement_date_functionality branch from 0e9b167 to f1b785a Compare September 30, 2017 09:12
@mzazrivec
Copy link
Contributor Author

@martinpovolny What I meant to write was that I don't even know how I'd go about fixing those
CC issues. The else after return is not unnecessary. And the formatter does return at the end
of the function. Or maybe I'm reading the CC report wrong. Dunno.

As far as I can tell, the PF datetimepicker currently does not contain any translations, so maybe
it's not specific to Japanese. I just found the problem with Japanese locale (which we in ManageIQ
support), so I disabled the locale in the component for the time being.

@martinpovolny
Copy link
Member

Fixes:

link: function(scope, elem, attr, ctrl) {

This is the first line of a function. That function does not have a return statement. Just add a return. That fixes the CC issue.

2nd issue is here:

 +        } else {
 +          return null;
 +        }

This can be changed to:

}
return null;

The return null; does not need to be inside the else branch because the positive branch returns ;-)

@mzazrivec mzazrivec force-pushed the extended_retirement_date_functionality branch from f1b785a to f314783 Compare October 2, 2017 08:12
@mzazrivec
Copy link
Contributor Author

@martinpovolny I guess I could add the return to the link function, but we don't do it anywhere
in our directives and I'm wondering why we'd want to do it now.

@mzazrivec mzazrivec force-pushed the extended_retirement_date_functionality branch from f314783 to 8184fa4 Compare October 2, 2017 11:56
This change allows for setting retirement date & time for services, virtual
machines and orchestration templates.

This change also introduces date & time picker from Patternfly.
For it to work nicely with our application and angular, we're using
a new angular directive 'datetimepicker'.
@mzazrivec mzazrivec force-pushed the extended_retirement_date_functionality branch from 8184fa4 to 7359e60 Compare October 2, 2017 12:25
@mzazrivec
Copy link
Contributor Author

@martinpovolny Actually, the return CC thing applies to the formatter function, to the link function.
And in this particular case, adding the return null there won't help anything really. So I'd rather leave
it as it is.

@miq-bot
Copy link
Member

miq-bot commented Oct 2, 2017

Checked commit mzazrivec@7359e60 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
4 files checked, 0 offenses detected
Everything looks fine. 🏆

@martinpovolny martinpovolny merged commit ff2b12e into ManageIQ:master Oct 2, 2017
@martinpovolny martinpovolny added this to the Sprint 70 Ending Oct 2, 2017 milestone Oct 2, 2017
@mzazrivec mzazrivec deleted the extended_retirement_date_functionality branch February 22, 2018 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants