Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

npm - add validator, dependency of angular.validators #4661

Closed
wants to merge 1 commit into from
Closed

npm - add validator, dependency of angular.validators #4661

wants to merge 1 commit into from

Conversation

himdel
Copy link
Contributor

@himdel himdel commented Sep 14, 2018

angular.validators is special:
when loaded in the context of the browser, it bundles its own copy of the validator library
when loaded via require, it expects a global validator object and uses that

=> adding an explicit validator dependency and making sure the object exists

this also allows us to use a more recent version of validator

Fixes #4660 (introduced in #4622)

@djberg96 can you confirm this fixes the issue for you please? :)

angular.validators is special:
  when loaded in the context of the browser, it bundles its own copy of the validator library
  when loaded via require, it expects a global `validator` object and uses that

=> adding an explicit validator dependency and making sure the object exists

this also allows us to use a more recent version of validator
@miq-bot
Copy link
Member

miq-bot commented Sep 14, 2018

Checked commit https://github.com/himdel/manageiq-ui-classic/commit/5697d51557d75c2388efda19b6bdfb2d4b54553e with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
0 files checked, 0 offenses detected
Everything looks fine. 🍪

@mzazrivec mzazrivec self-assigned this Sep 14, 2018
@mzazrivec
Copy link
Contributor

Even with this change in place and bin/update I see the following in javascript console:

TypeError: validator.isUUID is not a function
    at controller.$validators.isUuid (angular.validators.js:1533)
    at angular.js:29186
    at forEach (angular.js:422)
    at processSyncValidators (angular.js:29185)
    at Object.$$runValidators (angular.js:29157)
    at Object.$$parseAndValidate (angular.js:29302)
    at Object.$commitViewValue (angular.js:29268)
    at angular.js:29409
    at ChildScope.$eval (angular.js:18542)
    at ChildScope.$apply (angular.js:18641)
(anonymous) @ angular.js:14800
(anonymous) @ angular.js:11218
$apply @ angular.js:18646
$$debounceViewValueCommit @ angular.js:29408
$setViewValue @ angular.js:29386
listener @ angular.js:25260
dispatch @ jquery.js:4737
elemData.handle @ jquery.js:4549

@himdel
Copy link
Contributor Author

himdel commented Sep 14, 2018

Oops, aah, I misread .. validator is not taken from the global context there, it's injected nodeValidator... and

angular.element('.ng-scope').injector().get('nodeValidator')
> {}

(no methods)

(created gkaimakas/angular.validators#3)

@himdel
Copy link
Contributor Author

himdel commented Sep 14, 2018

Closed in favor of #4667

@himdel himdel closed this Sep 14, 2018
@himdel himdel deleted the fix-validaotr branch September 14, 2018 13:15
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot add Azure provider because validate button is greyed out
3 participants