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

Adapt angular architecture: gmf.authentication #3216

Merged
merged 20 commits into from
Dec 13, 2017

Conversation

pfirpfel
Copy link
Contributor

@pfirpfel pfirpfel commented Dec 5, 2017

No description provided.

Copy link
Member

@ger-benjamin ger-benjamin left a comment

Choose a reason for hiding this comment

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

Good start.
Please, can you rebase your commits and use "git mv" to rename and move the component and service file ? Currently, we are loosing the git history of these files !
Thanks

* @type {angular.Module}
*/
gmf.authentication.component = angular.module('gmfAuthentication', [
gmf.authentication.service.name
Copy link
Member

Choose a reason for hiding this comment

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

should be gmf.authentication.service.module.name (see comment in the service too)

@@ -2,7 +2,7 @@ goog.provide('gmf.printComponent');

goog.require('gmf');
/** @suppress {extraRequire} */
goog.require('gmf.authenticationDirective');
goog.require('gmf.authentication.module');
Copy link
Member

Choose a reason for hiding this comment

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

Why do we requested the directive ?
So what you have done is correct, but can't we require only the service ?

@@ -0,0 +1,242 @@
goog.provide('gmf.authentication.service');
Copy link
Member

Choose a reason for hiding this comment

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

File name must be wrote with a uppercase s : Service.js. Cause it's a java-script object.
(Unlike the component, that is a description. The controller must also have an uppercase but anyway it's always private in it's own file)

Also. provide / require must use this uppercase S.
And also the Object name itself

};

// todo?
gmf.module.value('gmfUser', {
Copy link
Member

Choose a reason for hiding this comment

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

Looks not suitable.
@gberaudo We move that in another file ?

Copy link
Member

Choose a reason for hiding this comment

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

I do not understand why gmfUser is a standalone value instead of being a property of the authentication service.
To keep things simple I would let the value in this file (but register it into the authentication module).

Alternatives are:

  • move it to its dedicated file, with its own Angular module and depend on it everywhere.
  • make it a property of the authentication service.

*
* @extends {ol.events.EventTarget}
*/
gmf.authentication.service = class {
Copy link
Member

Choose a reason for hiding this comment

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

uppercase

@@ -2,7 +2,7 @@ goog.provide('gmf.filterselectorComponent');

goog.require('gmf');
/** @suppress {extraRequire} */
goog.require('gmf.Authentication');
goog.require('gmf.authentication.module');
Copy link
Member

Choose a reason for hiding this comment

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

Oh, I see, it's for the gmfUser. Definitely, it should be moved in another file. perhaps it's own file like the https://github.com/camptocamp/ngeo/blob/master/src/map/FeatureOverlay.js Object.

And then we require only the user, not the whole module.
(Also in another files with the same situation)

* username: (string|undefined)
* }}
*/
gmf.authentication.AuthenticationLoginResponse;
Copy link
Member

Choose a reason for hiding this comment

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

Please, move this kind of descriptions in the contribs/gmf/options/gmfx.js file

/**
* @enum {string}
*/
gmf.authentication.AuthenticationRouteSuffix = {
Copy link
Member

Choose a reason for hiding this comment

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

If it's in the gmf.authentification.Service file (and used by it), it should be prefixed like that I think:
gmf.authentication.service.AuthenticationRouteSuffix = {...}
Or even gmf.authentication.service.RouteSuffix = {...}

@pfirpfel pfirpfel self-assigned this Dec 12, 2017
@pfirpfel pfirpfel changed the title [wip] gmf.authentication Adapt angular architecture: gmf.authentication Dec 12, 2017
goog.provide('gmf.authentication.component');

goog.require('gmf');
/** @suppress {extraRequire} */
Copy link
Member

Choose a reason for hiding this comment

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

You can remove this suppress line.

}
};

ol.inherits(gmf.authentication.Service, ol.events.EventTarget);
Copy link
Member

Choose a reason for hiding this comment

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

This line is no more used.

@pfirpfel
Copy link
Contributor Author

@ger-benjamin Does it look ok to you now?

@pfirpfel pfirpfel merged commit 1fa38e8 into camptocamp:master Dec 13, 2017
@pfirpfel pfirpfel deleted the gmf.authentication branch December 13, 2017 11:36
@sbrunner sbrunner added this to the 2.3 milestone Apr 12, 2018
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