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

Core store references #4580

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8,112 changes: 2,547 additions & 5,565 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions src/frontend/packages/core/src/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { DOCUMENT } from '@angular/common';
import { AfterContentInit, Component, HostBinding, Inject, OnDestroy, OnInit } from '@angular/core';
import { Store } from '@ngrx/store';
import { AuthOnlyAppState, ThemeService } from '@stratosui/store';
import { Observable } from 'rxjs';
import { create } from 'rxjs-spy';

import { AuthOnlyAppState } from '../../store/src/app-state';
import { ThemeService } from '../../store/src/theme.service';
import { environment } from './environments/environment';
import { LoggedInService } from './logged-in.service';

Expand Down
41 changes: 23 additions & 18 deletions src/frontend/packages/core/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,31 @@ import { Params, RouteReuseStrategy, RouterStateSnapshot } from '@angular/router
import { DefaultRouterStateSerializer, RouterStateSerializer, StoreRouterConnectingModule } from '@ngrx/router-store';
import { Store } from '@ngrx/store';
import { StoreDevtoolsModule } from '@ngrx/store-devtools';
import {
generateStratosEntities,
EndpointModel,
FavoritesConfigMapper,
AppStoreModule,
IFavoriteMetadata,
UserFavorite,
getAPIRequestDataState,
selectEntity,
SetRecentlyVisitedEntityAction,
EntityCatalogHelpers,
recentlyVisitedSelector,
stratosEntityCatalog,
EntityCatalogModule,
endpointEntityType,
STRATOS_ENDPOINT_TYPE,
internalEventStateSelector,
UserFavoriteManager,
GeneralEntityAppState,
GeneralRequestDataState,
entityCatalog,
EntityCatalogHelper,
} from '@stratosui/store';
import { debounceTime, filter, withLatestFrom } from 'rxjs/operators';

import { SetRecentlyVisitedEntityAction } from '../../store/src/actions/recently-visited.actions';
import { GeneralEntityAppState, GeneralRequestDataState } from '../../store/src/app-state';
import { EntityCatalogModule } from '../../store/src/entity-catalog.module';
import { entityCatalog } from '../../store/src/entity-catalog/entity-catalog';
import { EntityCatalogHelper } from '../../store/src/entity-catalog/entity-catalog-entity/entity-catalog.service';
import { EntityCatalogHelpers } from '../../store/src/entity-catalog/entity-catalog.helper';
import { FavoritesConfigMapper } from '../../store/src/favorite-config-mapper';
import { endpointEntityType, STRATOS_ENDPOINT_TYPE } from '../../store/src/helpers/stratos-entity-factory';
import { getAPIRequestDataState, selectEntity } from '../../store/src/selectors/api.selectors';
import { internalEventStateSelector } from '../../store/src/selectors/internal-events.selectors';
import { recentlyVisitedSelector } from '../../store/src/selectors/recently-visitied.selectors';
import { AppStoreModule } from '../../store/src/store.module';
import { stratosEntityCatalog } from '../../store/src/stratos-entity-catalog';
import { generateStratosEntities } from '../../store/src/stratos-entity-generator';
import { EndpointModel } from '../../store/src/types/endpoint.types';
import { IFavoriteMetadata, UserFavorite } from '../../store/src/types/user-favorites.types';
import { UserFavoriteManager } from '../../store/src/user-favorite-manager';
import { AppComponent } from './app.component';
import { RouteModule } from './app.routing';
import { CoreModule } from './core/core.module';
Expand Down Expand Up @@ -185,7 +191,6 @@ export class AppModule {
type: 'error'
});


// This should be brought back in in the future
// eventService.addEventConfig<IRequestEntityTypeState<EndpointModel>, EndpointModel>(
// {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { Injectable } from '@angular/core';
import { CanActivate } from '@angular/router';
import { Store } from '@ngrx/store';
import { RouterNav, AppState } from '@stratosui/store';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';

import { RouterNav } from '../../../store/src/actions/router.actions';
import { AppState } from '../../../store/src/app-state';
import { CurrentUserPermissionsService } from './permissions/current-user-permissions.service';
import { StratosCurrentUserPermissions } from './permissions/stratos-user-permissions.checker';

Expand All @@ -27,4 +26,4 @@ export class APIKeyAuthGuardService implements CanActivate {
})
);
}
}
}
4 changes: 1 addition & 3 deletions src/frontend/packages/core/src/core/auth-guard.service.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { Injectable } from '@angular/core';
import { ActivatedRoute, CanActivate, Router } from '@angular/router';
import { Store } from '@ngrx/store';
import { RouterNav, InternalAppState } from '@stratosui/store';
import { Observable } from 'rxjs';
import { first, map } from 'rxjs/operators';

import { RouterNav } from '../../../store/src/actions/router.actions';
import { InternalAppState } from '../../../store/src/app-state';

export function queryParamMap(): { [key: string]: string } {
const paramMap = {};
const query = window.location.search.substring(1);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* tslint:disable:directive-selector */
import { Directive, ElementRef, HostListener, Renderer2 } from '@angular/core';

/* tslint:disable:directive-selector */

@Directive({
selector: 'button [mat-icon-button]'
})
Expand Down
5 changes: 1 addition & 4 deletions src/frontend/packages/core/src/core/core.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@ import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { Title } from '@angular/platform-browser';
import { RouterModule } from '@angular/router';
import { PaginationMonitorFactory, EntityCatalogHelper, EntityServiceFactory, EntityMonitorFactory } from '@stratosui/store';
import { MomentModule } from 'ngx-moment';

import { EntityCatalogHelper } from '../../../store/src/entity-catalog/entity-catalog-entity/entity-catalog.service';
import { EntityServiceFactory } from '../../../store/src/entity-service-factory.service';
import { EntityMonitorFactory } from '../../../store/src/monitors/entity-monitor.factory.service';
import { PaginationMonitorFactory } from '../../../store/src/monitors/pagination-monitor.factory';
import { NoContentMessageComponent } from '../shared/components/no-content-message/no-content-message.component';
import { RecentEntitiesComponent } from '../shared/components/recent-entities/recent-entities.component';
import { UserAvatarComponent } from './../shared/components/user-avatar/user-avatar.component';
Expand Down
1 change: 0 additions & 1 deletion src/frontend/packages/core/src/core/core.types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { InjectionToken } from '@angular/core';

import { Title } from '@angular/platform-browser';

export const APP_TITLE = new InjectionToken<string>('appTitle');
Expand Down
4 changes: 1 addition & 3 deletions src/frontend/packages/core/src/core/dispatch-sequencer.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { Action, Store } from '@ngrx/store';
import { GeneralEntityAppState } from '@stratosui/store';
import { from, Observable, of as observableOf } from 'rxjs';
import { bufferTime, concatMap, delay, filter, map, mergeMap, switchMap, tap } from 'rxjs/operators';

import { GeneralEntityAppState } from '../../../store/src/app-state';


export interface DispatchSequencerAction {
id: string;
action: Action;
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/packages/core/src/core/endpoint-auth.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Validators } from '@angular/forms';
import { EndpointAuthTypeConfig, EndpointType } from '@stratosui/store';

import { EndpointAuthTypeConfig, EndpointType } from '../../../store/src/extension-types';
import {
CredentialsAuthFormComponent,
} from '../features/endpoints/connect-endpoint-dialog/auth-forms/credentials-auth-form.component';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { Injectable } from '@angular/core';

import { entityCatalog } from '../../../store/src/entity-catalog/entity-catalog';
import { EndpointHealthCheck } from '../../../store/src/entity-catalog/entity-catalog.types';
import { EndpointModel } from '../../../store/src/types/endpoint.types';
import { entityCatalog, EndpointHealthCheck, EndpointModel } from '@stratosui/store';

@Injectable({
providedIn: 'root'
Expand Down
21 changes: 12 additions & 9 deletions src/frontend/packages/core/src/core/endpoints.service.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot } from '@angular/router';
import { Store } from '@ngrx/store';
import {
endpointEntitiesSelector,
endpointStatusSelector,
EndpointOnlyAppState,
IRequestEntityTypeState,
entityCatalog,
AuthState,
RouterNav,
EndpointHealthCheck,
EndpointModel,
EndpointState,
} from '@stratosui/store';
import { combineLatest as observableCombineLatest, Observable } from 'rxjs';
import { first, map, skipWhile, withLatestFrom } from 'rxjs/operators';

import { RouterNav } from '../../../store/src/actions/router.actions';
import { EndpointOnlyAppState, IRequestEntityTypeState } from '../../../store/src/app-state';
import { entityCatalog } from '../../../store/src/entity-catalog/entity-catalog';
import { EndpointHealthCheck } from '../../../store/src/entity-catalog/entity-catalog.types';
import { AuthState } from '../../../store/src/reducers/auth.reducer';
import { endpointEntitiesSelector, endpointStatusSelector } from '../../../store/src/selectors/endpoint.selectors';
import { EndpointModel, EndpointState } from '../../../store/src/types/endpoint.types';
import { endpointHasMetricsByAvailable } from '../features/endpoints/endpoint-helpers';
import { EndpointHealthChecks } from './endpoints-health-checks';
import { UserService } from './user.service';



@Injectable()
export class EndpointsService implements CanActivate {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { Component, Input } from '@angular/core';
import { UserFavoriteManager, FavoritesConfigMapper, IFavoriteMetadata, UserFavorite } from '@stratosui/store';
import { Observable } from 'rxjs';
import { first, tap } from 'rxjs/operators';

import { FavoritesConfigMapper } from '../../../../store/src/favorite-config-mapper';
import { IFavoriteMetadata, UserFavorite } from '../../../../store/src/types/user-favorites.types';
import { UserFavoriteManager } from '../../../../store/src/user-favorite-manager';
import { ConfirmationDialogConfig } from '../../shared/components/confirmation-dialog.config';
import { ConfirmationDialogService } from '../../shared/components/confirmation-dialog.service';
import { EndpointsService } from '../endpoints.service';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@

import {fromEvent as observableFromEvent, Observable } from 'rxjs';

import {map, debounceTime} from 'rxjs/operators';
import { Injectable } from '@angular/core';

import { WindowRef } from '../window-ref/window-ref.service';

import {fromEvent as observableFromEvent, Observable } from 'rxjs';
import {map, debounceTime} from 'rxjs/operators';

export class ResizeEventData {
innerWidth: number;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import { Injectable, ModuleWithProviders, NgModule } from '@angular/core';
import { ActivatedRoute, Route, Router } from '@angular/router';
import { Store } from '@ngrx/store';
import { AppState, GeneralEntityAppState, EntityServiceFactory } from '@stratosui/store';
import { Observable } from 'rxjs';

import { AppState, GeneralEntityAppState } from '../../../../store/src/app-state';
import { EntityServiceFactory } from '../../../../store/src/entity-service-factory.service';
import { IPageSideNavTab } from '../../features/dashboard/page-side-nav/page-side-nav.component';
import { CurrentUserPermissionsService } from '../permissions/current-user-permissions.service';

export const extensionsActionRouteKey = 'extensionsActionsKey';


// The different types of Tab
export enum StratosTabType {
Application = 'appTabs',
Expand Down
2 changes: 0 additions & 2 deletions src/frontend/packages/core/src/core/md.module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { MAT_MOMENT_DATE_FORMATS, MomentDateAdapter } from '@angular/material-moment-adapter';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { CanActivate } from '@angular/router';
import { Store } from '@ngrx/store';
import { RouterNav, AppState } from '@stratosui/store';
import { Observable, of as observableOf } from 'rxjs';
import { map, catchError, tap } from 'rxjs/operators';

import { RouterNav } from '../../../store/src/actions/router.actions';
import { AppState } from '../../../store/src/app-state';
import { HttpClient } from '@angular/common/http';
import { environment } from '../environments/environment';

const { proxyAPIVersion } = environment;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PermissionValues } from '../../../../store/src/selectors/current-user-role.selectors';
import { PermissionValues } from '@stratosui/store';

export type PermissionConfigType = PermissionConfig[] | PermissionConfig | PermissionConfigLink;
export interface IPermissionConfigs {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { Inject, Injectable, Optional } from '@angular/core';
import { Store } from '@ngrx/store';
import { stratosEntityCatalog, InternalAppState } from '@stratosui/store';
import { combineLatest, Observable, of } from 'rxjs';
import { distinctUntilChanged, map, switchMap } from 'rxjs/operators';

import { InternalAppState } from '../../../../store/src/app-state';
import { stratosEntityCatalog } from '../../../../store/src/stratos-entity-catalog';
import {
CurrentUserPermissions,
PermissionConfig,
Expand All @@ -18,7 +17,6 @@ import {
} from './current-user-permissions.types';
import { StratosUserPermissionsChecker } from './stratos-user-permissions.checker';


export const CUSTOM_USER_PERMISSION_CHECKERS = 'custom_user_perm_checkers';

@Injectable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ export abstract class BaseCurrentUserPermissionsChecker {
distinctUntilChanged()
);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { Store } from '@ngrx/store';
import { Observable, of } from 'rxjs';
import { switchMap } from 'rxjs/operators';

import { GeneralEntityAppState } from '../../../../store/src/app-state';
import { selectSessionData } from '../../../../store/src/reducers/auth.reducer';
import {
selectSessionData,
APIKeysEnabled,
GeneralEntityAppState,
getCurrentUserStratosHasScope,
getCurrentUserStratosRole,
PermissionValues,
} from '../../../../store/src/selectors/current-user-role.selectors';
import { APIKeysEnabled } from '../../../../store/src/types/auth.types';
} from '@stratosui/store';
import { Observable, of } from 'rxjs';
import { switchMap } from 'rxjs/operators';

import { IPermissionConfigs, PermissionConfig, PermissionTypes } from './current-user-permissions.config';
import {
BaseCurrentUserPermissionsChecker,
Expand All @@ -18,7 +18,6 @@ import {
IPermissionCheckCombiner,
} from './current-user-permissions.types';


export enum StratosCurrentUserPermissions {
ENDPOINT_REGISTER = 'register.endpoint',
PASSWORD_CHANGE = 'change-password',
Expand All @@ -33,7 +32,6 @@ export enum StratosPermissionStrings {
STRATOS_ADMIN = 'isAdmin'
}


export enum StratosScopeStrings {
STRATOS_CHANGE_PASSWORD = 'password.write',
SCIM_READ = 'scim.read'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Component, Input, TemplateRef } from '@angular/core';

import { StratosStatus } from '../../../../store/src/types/shared.types';
import { StratosStatus } from '@stratosui/store';

interface IconDefinition {
icon: string;
Expand Down
21 changes: 12 additions & 9 deletions src/frontend/packages/core/src/core/user-profile.service.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import { Injectable } from '@angular/core';
import { Store } from '@ngrx/store';
import {
SessionData,
EntityService,
AuthState,
stratosEntityCatalog,
AppState,
ActionState,
getDefaultActionState,
UserProfileInfo,
UserProfileInfoEmail,
UserProfileInfoUpdates,
} from '@stratosui/store';
import { combineLatest, Observable, of as observableOf } from 'rxjs';
import { filter, first, map, publishReplay, refCount, switchMap } from 'rxjs/operators';

import { AppState } from '../../../store/src/app-state';
import { EntityService } from '../../../store/src/entity-service';
import { ActionState, getDefaultActionState } from '../../../store/src/reducers/api-request-reducer/types';
import { AuthState } from '../../../store/src/reducers/auth.reducer';
import { stratosEntityCatalog } from '../../../store/src/stratos-entity-catalog';
import { SessionData } from '../../../store/src/types/auth.types';
import { UserProfileInfo, UserProfileInfoEmail, UserProfileInfoUpdates } from '../../../store/src/types/user-profile.types';


@Injectable()
export class UserProfileService {

Expand Down
8 changes: 3 additions & 5 deletions src/frontend/packages/core/src/core/user.service.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@

import { map } from 'rxjs/operators';
import { AuthState } from '../../../store/src/reducers/auth.reducer';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { Store } from '@ngrx/store';
import { AuthOnlyAppState } from '../../../store/src/app-state';
import { AuthOnlyAppState, AuthState } from '@stratosui/store';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';

@Injectable()
export class UserService {
Expand Down
1 change: 0 additions & 1 deletion src/frontend/packages/core/src/core/utils.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@ export const arraysEqual = (a: any[], b: any[]): boolean => {
return false;
};


/* tslint:disable:no-bitwise */
export const createGuid = (): string => {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
Expand Down
Loading