Skip to content

PatternFly Angular wizard implementation #320

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 7 commits into from
Oct 4, 2016

Conversation

dgutride
Copy link
Member

This PR includes the initial implementation, documentation and unit tests for the angular-patternfly wizard.

@bleathem
Copy link
Member

Thanks @dgutride, I'll take a close look. Probably best if @jeff-phillips-18, @dlabrecq, and @dtaylor113 take a look too.

@@ -39,9 +42,17 @@
"angular-sanitize": "1.3.0 - 1.5.*",
"angular-bootstrap": "0.13.x",
"lodash": "3.x",
"patternfly": "~3.11.0"
"patternfly": "a014002ebcfad2c6ff2fbeda52dfcd425e016f2a"
Copy link
Member

Choose a reason for hiding this comment

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

Is this the pattern now?! PF devs know to change this back to a version number for the next patternfly release? Any reason why this couldn't be "git@github.com:patternfly/patternfly.git#master" -just to be more readable.

Copy link
Member Author

Choose a reason for hiding this comment

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

We can't use #master, but I changed this to master-dist for clarity instead of using the commit.

Copy link
Member

Choose a reason for hiding this comment

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

coolness, thanks

Copy link
Member

@jeff-phillips-18 jeff-phillips-18 left a comment

Choose a reason for hiding this comment

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

Looks really good. Just some minor comments

@@ -39,9 +42,17 @@
"angular-sanitize": "1.3.0 - 1.5.*",
"angular-bootstrap": "0.13.x",
"lodash": "3.x",
"patternfly": "~3.11.0"
"patternfly": "a014002ebcfad2c6ff2fbeda52dfcd425e016f2a"
Copy link
Member

Choose a reason for hiding this comment

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

So this is WIP? I assume this will require patternfly 3.12?

Copy link
Member Author

Choose a reason for hiding this comment

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

Correct - cleaned this up a bit with the last commit.

"bootstrap-touchspin": "~3.1.1",
"datatables-colreorder": "~1.3.2",
"font-awesome": "~4.6.3",
"moment": "~2.14.1"
}
Copy link
Member

Choose a reason for hiding this comment

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

I assume this all goes away when we update to the correct version of patternfly

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed it now.

*
* @description
* Directive for rendering a Wizard modal.
*
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 more information is needed here. The overall structure of the wizard directive, step directive, and sub step directives.

Copy link
Member Author

Choose a reason for hiding this comment

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

More details and an html snippet added to clarify the structure.

*
* @description
* Directive for rendering a Wizard step. Each step can stand alone or have substeps.
*
Copy link
Member

Choose a reason for hiding this comment

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

Indicate that a pfWizardStep must be a child of a pfWizard

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

var closeButton = element.find('.close');
$rootScope.$on('wizard.done', function (event, data) {
expect(data).toBe('cancel');
});
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 that we check that this was called, only that if it was called, the data is correct.

Copy link
Member Author

Choose a reason for hiding this comment

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

You are correct - I removed the .$on portion and added a better emit check lower to make sure the data is correct.

$scope.currentStep = 'Review';
$scope.$digest();
$timeout.flush();
$timeout.flush();
Copy link
Member

Choose a reason for hiding this comment

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

Is this all necessary?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes - there are several layers that need to be rendered and timeouts that cascade - it doesn't show to the naked eye when rendering but they need to be flushed when in a unit test.

$element.height($window.innerHeight - 70);
} else {
$element.height(400);
}
Copy link
Member

Choose a reason for hiding this comment

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

400 comes from where? It would be nice if this value were settable. Some wizards could be smaller, some could be larger depending upon the contents of the pages.

This value could be binded to in the html rather than using $element.height()

Copy link
Member Author

Choose a reason for hiding this comment

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

Modified this logic to use a minHeight optional wizard property now. It needs to adjust on window resize so I left it in the link function.

wizardDoneListener = $rootScope.$on('wizard.done', closeWizard);
};
}
]);
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 a good task for the next breakaway sprint would be to see if we could somehow separate out the ngdoc code from the directive code. When combined it makes for a very large source code file.

…wizard directives (optional values, information about proper structure) and added minHeight property as well.
return {
restrict: 'A',
transclude: true,
replace: true,
Copy link
Member

Choose a reason for hiding this comment

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

directive replace is depreciated. Do we really need it here?

// Add watchers for the selected step
$scope.nextStepEnabledWatcher = $scope.$watch('selectedStep.nextEnabled', function (value) {
$scope.nextEnabled = value;
//console.log('next enabled: ' + value);
Copy link
Member

Choose a reason for hiding this comment

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

Just FYI, best practice to use $log, in this case $log.debug.

Copy link
Member

@dtaylor113 dtaylor113 left a comment

Choose a reason for hiding this comment

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

Wow, tons of code! LGTM. Nice job Dana :-)

* @param {string} loadingWizardTitle The text displayed when the wizard is loading
* @param {string} loadingSecondaryInformation Secondary descriptive information to display when the wizard is loading
* @param {string=} loadingSecondaryInformation Secondary descriptive information to display when the wizard is loading
* @param {number=} minHeight The minimum height the wizard should adjust to if the window height is decreased. The wizard height is adjusted with the window resize event and this sets the minimum.
Copy link
Member

Choose a reason for hiding this comment

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

I was thinking more of a height than a minimum height. If all the pages have only a couple of fields, there is no reason to have the wizard be the full height of the window, making the navigation buttons far from the fields. So, maybe a minimum height and a maximum height? or a set height?

Copy link
Member Author

@dgutride dgutride Sep 28, 2016

Choose a reason for hiding this comment

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

@jeff-phillips-18 - I did it this way to keep it in line with the design and js from PatternFly which keeps the height at a minHeight or within 70 pixels of the page. We'd probably have to go back to the designer to adjust it at this point or we'd be inconsistent between the two.

Copy link
Member

Choose a reason for hiding this comment

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

😞

Does the design specifically call this out or is this just how the Patternfly implementation was done?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good question - I can ask that during the review with the stakeholders - there was a concern about the height being variable that was addressed by the last PF checkin. It was the reason I paid particular attention to the height in the code.

Copy link
Member

Choose a reason for hiding this comment

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

Agreed about the variable height. The height should not change when navigating through pages, but the height used should be configurable imo. 👍 to getting stakeholders input.

@LHinson @serenamarie125

Copy link
Member

Choose a reason for hiding this comment

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

@dgutride @jeff-phillips-18 I agree that the height should be configurable.

@dgutride
Copy link
Member Author

dgutride commented Oct 4, 2016

@jeff-phillips-18 - I think I've addressed all of the comments in this review. Please let me know if there is anything else to do.

@jeff-phillips-18 jeff-phillips-18 merged commit 4cd43fb into patternfly:master Oct 4, 2016
@dgutride dgutride deleted the angular-wizard branch December 9, 2016 16:59
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.

6 participants