Skip to content

Commit

Permalink
SHIBUI-522 Updated dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Jun 11, 2018
1 parent c2d25bd commit 23f1180
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 31 deletions.
10 changes: 5 additions & 5 deletions ui/src/app/dashboard/component/entity-item.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div class="w-10 pr-3 pull-left">
<i class="fa fa-fw fa-3x text-primary" [class.fa-caret-right]="!isOpen" [class.fa-caret-down]="isOpen"></i>
&nbsp;
<span class="label-icon sr-hidden" [ngSwitch]="entity.type">
<span class="label-icon sr-hidden" [ngSwitch]="entity.kind">
<i class="fa fa-fw fa-3x text-info fa-cubes" *ngSwitchCase="types.filter"></i>
<i class="fa fa-fw fa-3x text-info fa-cube" *ngSwitchCase="types.provider"></i>
<i class="fa fa-fw fa-3x text-info fa-" *ngSwitchDefault></i>
Expand Down Expand Up @@ -37,7 +37,7 @@
<div class="col-10">
<div class="row">
<div class="col text-right font-weight-bold" i18n="@@label--service-provider">
{entity.type, select, filter {Filter} provider {Service Provider} other {other}} Name:
{entity.kind, select, filter {Filter} provider {Service Provider} other {other}} Name:
</div>
<div class="col">{{ entity.name }}</div>
<div class="col text-right font-weight-bold" i18n="@@label--created-date">Created Date:</div>
Expand All @@ -46,11 +46,11 @@
</div>
<div class="row">
<div class="col text-right font-weight-bold" i18n="@@label--service-entity-id">
{entity.type, select, filter {Filter} provider {Service Provider} other {other}} Entity ID:
{entity.kind, select, filter {Filter} provider {Service Provider} other {other}} Entity ID:
</div>
<div class="col">{{ entity.entityId }}</div>
<div class="col text-right font-weight-bold" i18n="@@label--service-provider-status">
{entity.type, select, filter {Filter} provider {Service Provider} other {other}} Status:
{entity.kind, select, filter {Filter} provider {Service Provider} other {other}} Status:
</div>
<div class="col" *ngIf="entity.createdDate">
<i class="fa fa-fw" [ngClass]="{
Expand All @@ -66,7 +66,7 @@
</div>
</div>
<div class="col-2">
<button *ngIf="!entity.createdDate && entity.type === 'provider'"
<button *ngIf="!entity.createdDate && entity.kind === 'provider'"
class="btn btn-link pull-right"
(click)="delete.emit(entity)"
aria-label="Delete selected service provider">
Expand Down
4 changes: 2 additions & 2 deletions ui/src/app/dashboard/component/entity-item.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, ChangeDetectionStrategy, Input, Output, EventEmitter } from '@angular/core';

import { MetadataEntity, DomainTypes } from '../../domain/domain.type';
import { MetadataEntity, DomainEntityKinds } from '../../domain/domain.type';

@Component({
selector: 'entity-item',
Expand All @@ -10,7 +10,7 @@ import { MetadataEntity, DomainTypes } from '../../domain/domain.type';
})
export class EntityItemComponent {

types = DomainTypes;
types = DomainEntityKinds;

@Input() entity: MetadataEntity;
@Input() isOpen: boolean;
Expand Down
10 changes: 5 additions & 5 deletions ui/src/app/dashboard/container/dashboard.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';

import { MetadataEntity, MetadataProvider, DomainTypes } from '../../domain/domain.type';
import { Provider } from '../../domain/entity/provider';
import { MetadataEntity, MetadataProvider, DomainEntityKinds } from '../../domain/domain.type';
import * as searchActions from '../action/search.action';
import * as providerActions from '../../domain/action/provider-collection.action';
import * as draftActions from '../../domain/action/draft-collection.action';
import * as fromDashboard from '../reducer';
import { ToggleEntityDisplay } from '../action/dashboard.action';
Expand All @@ -35,7 +33,7 @@ export class DashboardComponent implements OnInit {

entitiesOpen$: Observable<{[key: string]: boolean}>;

filterOptions = ['all', 'filter', 'provider'];
filterOptions = ['all', DomainEntityKinds.filter, DomainEntityKinds.provider];
filtering$: Observable<string>;
filtering = 'all';

Expand All @@ -54,6 +52,8 @@ export class DashboardComponent implements OnInit {
this.total$ = this.providers$.pipe(map(list => list.length));

this.limited$ = this.getPagedProviders(this.page, this.providers$);

// this.providers$.subscribe(p => console.log(p));
}

ngOnInit (): void {
Expand Down Expand Up @@ -88,7 +88,7 @@ export class DashboardComponent implements OnInit {
edit(entity: MetadataEntity): void {
let path = entity.id ? 'edit' : 'wizard',
id = entity.id ? entity.id : entity.entityId;
this.router.navigate([entity.type, id, path]);
this.router.navigate([entity.kind, id, path]);
}

toggleProvider(entity: MetadataEntity): void {
Expand Down
14 changes: 6 additions & 8 deletions ui/src/app/dashboard/effect/search.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,29 @@ import * as entitySearch from '../action/search.action';
import * as fromCollections from '../../domain/reducer';
import * as fromDashboard from '../reducer';
import { MetadataProvider } from '../../domain/model/metadata-provider';
import { EntityDescriptorService } from '../../domain/service/entity-descriptor.service';
import { Provider } from '../../domain/entity/provider';
import { Filter } from '../../domain/entity/filter';
import { MetadataEntity, DomainTypes, MetadataFilter } from '../../domain/domain.type';
import { MetadataEntity, MetadataFilter } from '../../domain/domain.type';
import { EntityAttributesFilter } from '../../domain/entity/entity-attributes.filter';


@Injectable()
export class SearchEffects {
@Effect()
filter$ = this.actions$.pipe(
ofType<entitySearch.FilterAction>(entitySearch.ENTITY_FILTER),
switchMap(filter => this.performSearch())
switchMap(() => this.performSearch())
);

@Effect()
search$ = this.actions$.pipe(
ofType<entitySearch.SearchAction>(entitySearch.ENTITY_SEARCH),
map(action => action.payload),
switchMap(query => this.performSearch())
switchMap(() => this.performSearch())
);

matcher = (value, query) => value ? value.toLocaleLowerCase().match(query.toLocaleLowerCase()) : false;

constructor(
private descriptorService: EntityDescriptorService,
private actions$: Actions,
private store: Store<fromCollections.CollectionState>
) { }
Expand All @@ -44,14 +42,14 @@ export class SearchEffects {
this.store.select(fromCollections.getAllFilters),
(o: any[], p: MetadataProvider[], f: MetadataFilter[]): Array<MetadataEntity> => {
return o.concat(
f.map(filter => new Filter(filter)),
f.map(filter => new EntityAttributesFilter(filter)),
p.map(provider => new Provider(provider))
);
}
),
combineLatest(
this.store.select(fromDashboard.getFilterType),
(entities, type) => type !== 'all' ? entities.filter(e => e.type === type) : entities
(entities, kind) => kind !== 'all' ? entities.filter(e => e.kind === kind) : entities
),
combineLatest(
this.store.select(fromDashboard.getSearchQuery),
Expand Down
10 changes: 5 additions & 5 deletions ui/src/app/dashboard/reducer/search.reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ export interface SearchState {
entities: (MetadataProvider | MetadataFilter)[];
loading: boolean;
query: string;
type: string;
kind: string;
}

const initialState: SearchState = {
entities: [],
loading: false,
query: '',
type: 'all'
kind: 'all'
};

export function reducer(state = initialState, action: searchActions.Actions): SearchState {
Expand All @@ -29,7 +29,7 @@ export function reducer(state = initialState, action: searchActions.Actions): Se
case searchActions.ENTITY_FILTER: {
return {
...state,
type: action.payload,
kind: action.payload,
loading: true
};
}
Expand All @@ -39,7 +39,7 @@ export function reducer(state = initialState, action: searchActions.Actions): Se
entities: action.payload,
loading: false,
query: state.query,
type: state.type
kind: state.kind
};
}

Expand All @@ -55,4 +55,4 @@ export const getQuery = (state: SearchState) => state.query;

export const getLoading = (state: SearchState) => state.loading;

export const getFilter = (state: SearchState) => state.type;
export const getFilter = (state: SearchState) => state.kind;
12 changes: 6 additions & 6 deletions ui/src/locale/en.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1384,24 +1384,24 @@
</context-group>
</trans-unit>
<trans-unit id="label--service-provider" datatype="html">
<source><x id="ICU" equiv-text="{entity.type, select, filter {...} provider {...} other {...}}"/> Name:</source>
<target><x id="ICU" equiv-text="{entity.type, select, filter {...} provider {...} other {...}}"/> Name:</target>
<source><x id="ICU" equiv-text="{entity.kind, select, filter {...} provider {...} other {...}}"/> Name:</source>
<target><x id="ICU" equiv-text="{entity.kind, select, filter {...} provider {...} other {...}}"/> Name:</target>
<context-group purpose="location">
<context context-type="sourcefile">app/dashboard/component/provider-item.component.ts</context>
<context context-type="linenumber">33</context>
</context-group>
</trans-unit>
<trans-unit id="label--service-entity-id" datatype="html">
<source><x id="ICU" equiv-text="{entity.type, select, filter {...} provider {...} other {...}}"/> Entity ID:</source>
<target><x id="ICU" equiv-text="{entity.type, select, filter {...} provider {...} other {...}}"/> Entity ID:</target>
<source><x id="ICU" equiv-text="{entity.kind, select, filter {...} provider {...} other {...}}"/> Entity ID:</source>
<target><x id="ICU" equiv-text="{entity.kind, select, filter {...} provider {...} other {...}}"/> Entity ID:</target>
<context-group purpose="location">
<context context-type="sourcefile">app/dashboard/component/provider-item.component.ts</context>
<context context-type="linenumber">40</context>
</context-group>
</trans-unit>
<trans-unit id="label--service-provider-status" datatype="html">
<source><x id="ICU" equiv-text="{entity.type, select, filter {...} provider {...} other {...}}"/> Status:</source>
<target><x id="ICU" equiv-text="{entity.type, select, filter {...} provider {...} other {...}}"/> Status:</target>
<source><x id="ICU" equiv-text="{entity.kind, select, filter {...} provider {...} other {...}}"/> Status:</source>
<target><x id="ICU" equiv-text="{entity.kind, select, filter {...} provider {...} other {...}}"/> Status:</target>
<context-group purpose="location">
<context context-type="sourcefile">app/dashboard/component/provider-item.component.ts</context>
<context context-type="linenumber">42</context>
Expand Down

0 comments on commit 23f1180

Please sign in to comment.