Skip to content

Refactoring error directive#1403

Open
boyan-tonchev wants to merge 7 commits intomasterfrom
refactoring-error-directive
Open

Refactoring error directive#1403
boyan-tonchev wants to merge 7 commits intomasterfrom
refactoring-error-directive

Conversation

@boyan-tonchev
Copy link
Copy Markdown
Contributor

Not ready yet. Just for run the test.

## 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.
@boyan-tonchev boyan-tonchev force-pushed the refactoring-error-directive branch from 8d2c5ab to 04e82c3 Compare May 17, 2024 15:52
@boyan-tonchev
Copy link
Copy Markdown
Contributor Author

Jenkins retry build

@boyan-tonchev boyan-tonchev force-pushed the refactoring-error-directive branch from 04e82c3 to 8e39fdf Compare May 18, 2024 03:16
## 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.
@boyan-tonchev boyan-tonchev force-pushed the refactoring-error-directive branch from 8e39fdf to ec531de Compare May 18, 2024 03:23
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
17 Security Hotspots
0.0% Coverage on New Code (required ≥ 80%)
D Reliability Rating on New Code (required ≥ A)

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() {
Copy link
Copy Markdown
Collaborator

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) {
Copy link
Copy Markdown
Collaborator

@svilenvelikov svilenvelikov May 21, 2024

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)) {
Copy link
Copy Markdown
Collaborator

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.

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.

2 participants