-
Notifications
You must be signed in to change notification settings - Fork 16
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
Refactoring error directive #1403
base: master
Are you sure you want to change the base?
Conversation
## What The event emitter service can't be used in component scope. All events are visible globally and this can lead to misplaced usage between global scope and component scope if events has same names. ## Why The event emitter functionality is globally scoped, and it has to be used for global communication between components only. ## How The "EventEmitterService" was renamed to "GlobalEventBuss" for better semantic meaning. All inner functionality has been moved to a new service "EventEmitterService". When "GlobalEventBuss" is created an instance of EventEmitterService is created.
8d2c5ab
to
04e82c3
Compare
Jenkins retry build |
04e82c3
to
8e39fdf
Compare
## What Implements global store. It will hold all shared data for the whole WB. ## Why We want to remove the dependencies between components. This will make the code more extendable and readable. It will also simplify migration to a new version of the framework. ## How A core functionality of component store has been implemented. Its responsibility is to maintains property-value couples. It has functionality to notify all components that are subscribed for some property change event. A globalStoreService has been created. It uses core component store functionality. At this moment, the selected repository object has been moved to the global store. It now takes care of persisting and loading it from the browser store. This will simplify the task of adding the repository ID to the URL.
## What Moved all functionality of active repository reading and persistence to global store. ## Why We want to remove the dependencies between components. This will make the code more extendable and readable. It will also simplify migration to a new version of the framework. ## How All functionality of active repository reading and persistence has been moved to global store.
## What Refactored license service to use the global store. ## Why We want to remove the dependencies between components. This will make the code more extendable and readable. It will also simplify migration to a new version of the framework. ## How Injects GlobalStoreService into LicenseService and refactoring all inner logic to use it.
…nality; ## What Reorganized the code of core error directive without changing functionality. ## Why For better reading and futture refactoring. ## How Reorganized the code of core error directive without changing functionality.
## What Refactored core error directive. ## Why - There was a brief display of the error template when refreshing some views; - We want to remove the dependencies between components. This will make the code more extendable and readable. It will also simplify migration to a new version of the framework. ## How The core error directive was moved in separate file. Its scope was changed to isolate. Creates core error store that is used where is needed in components that used directive.
8e39fdf
to
ec531de
Compare
Quality Gate failedFailed conditions See analysis details on SonarCloud Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
/** | ||
* A service responsible for emitting events between components. It takes care to registering subscribers and calling them when an event for which they are registered occurs. | ||
*/ | ||
function GlobalEmitterBuss() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not an event bus implementation but a simple event emitter or pub/sub
// makes directive isolated scope | ||
scope: {}, | ||
templateUrl: 'js/angular/core/directives/core-error/templates/core-errors.html', | ||
link: function (scope, element, attrs) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the dollar sign in front of the scope. It's kind of convention.
}, Promise.resolve(eventData)); | ||
|
||
eventSubscribersChain.then(() => { | ||
if (angular.isFunction(callback)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try to avoid using these builtin angular utility functions. There is no alternative in Angular2> for them. Better use vanillajs or lodash.
Not ready yet. Just for run the test.