Skip to content

Convert wizard directive #377

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

Conversation

dgutride
Copy link
Member

This completes the wizard conversion from directive syntax to component syntax. No unit tests had to be changed to support this (all pass, linters pass and test pages work as expected).

allowClickNav: '<?',
description: '@',
wizardData: '=',
onShow: '=?',
Copy link
Member

Choose a reason for hiding this comment

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

So it seems like for our callback functions we are using "=" or "<", should we be looking to using real output bindings "&". On the other hand, I think if we do use "&" we have to change our API to use $event obj.

Copy link
Member

Choose a reason for hiding this comment

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

@dgutride ^^ any thoughts on this? -thanks

Copy link
Member Author

@dgutride dgutride Dec 21, 2016

Choose a reason for hiding this comment

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

We should probably take a second pass after conversion to look at output bindings - that would really change the interface quite a bit and isn't completely necessary right now. The callback functions won't stop working anytime soon and will allow for easier migration. @dtaylor113

Copy link
Member

Choose a reason for hiding this comment

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

Ok, sounds good to me. Thanks!

'use strict';

var firstRun = true,
ctrl = this;
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be in an $onInit?

};

ctrl.steps = [];
ctrl.context = {};
Copy link
Member

Choose a reason for hiding this comment

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

$onInit?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm ok with variable initialization to empty values outside of $oninit if you are - I think if we are doing any complex checks - i.e. see an if() outside of the init, I like to move it, though.

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 prefer to see all initialization together rather than scattered between function definitions, etc.

Copy link
Member Author

Choose a reason for hiding this comment

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

@jeff-phillips-18, @dtaylor113 - I'll refactor all initialization first thing tomorrow.

}
};

this.addStep = function (step) {
Copy link
Member

Choose a reason for hiding this comment

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

I notice we have defined functions in three different ways. 1. this.funcName = function (..., 2. var foo = function bar(), and 3. ctrl.funcName = function(... What's the diff between 1 and 3? -thanks

Copy link
Member Author

Choose a reason for hiding this comment

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

1 and 3 are identical, just a remnant of refactoring to not use scope anymore - I tried to clean those up as I went through but there were quite a few of them. 2 is internal and not exposed via the controller.

Copy link
Member Author

Choose a reason for hiding this comment

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

@dtaylor113 - I'll clean this up tomorrow, too - please hold . . .

Copy link
Member

@dlabrecq dlabrecq left a comment

Choose a reason for hiding this comment

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

LGTM

};

ctrl.steps = [];
ctrl.context = {};
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 prefer to see all initialization together rather than scattered between function definitions, etc.

if (angular.isUndefined(ctrl.allowClickNav)) {
ctrl.allowClickNav = true;
}

Copy link
Member

Choose a reason for hiding this comment

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

Seems like all this should be in $onInit

if (angular.isUndefined(ctrl.allowClickNav)) {
ctrl.allowClickNav = true;
}

Copy link
Member

Choose a reason for hiding this comment

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

This should be done in $onInit

ctrl.title = ctrl.stepTitle;
ctrl.step.addStep(ctrl);
};

Copy link
Member

Choose a reason for hiding this comment

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

Prefer to see $onInit as the first thing in the controller function, easier to read/understand.

Copy link
Member

Choose a reason for hiding this comment

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

Just weird that $onInit is called AFTER $onchange, making charts difficult since they rely on c3 to generate the chart in-the-correct-order :-)

@dtaylor113
Copy link
Member

LGTM :-)

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.

👍

@jeff-phillips-18 jeff-phillips-18 merged commit bc090c9 into patternfly:branch-4.0-dev Dec 22, 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.

4 participants