-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into SHIBUI-645
- Loading branch information
Showing
51 changed files
with
1,044 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
import { | ||
MetadataBase, | ||
} from '../model'; | ||
import { MetadataFilter } from './metadata-filter'; | ||
|
||
export interface MetadataProvider extends MetadataBase { | ||
name: string; | ||
'@type': string; | ||
enabled: boolean; | ||
resourceId: string; | ||
xmlId: string; | ||
sortKey: number; | ||
metadataFilters: MetadataFilter[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
ui/src/app/metadata/manager/component/provider-item.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<div class="card"> | ||
<div class="card-header" (click)="toggle.emit(provider)" (keydown.space)="toggle.emit(provider)" tabindex="0"> | ||
<div class="row"> | ||
<div class="reorder-card"> | ||
<p class="text-center text-primary font-weight-bold">1</p> | ||
<button class="btn btn-link" disabled> | ||
<i class="fa text-info fa-lg fa-chevron-circle-down" aria-hidden="true"></i> | ||
</button> | ||
<button class="btn btn-link pull-right" disabled> | ||
<i class="fa text-info fa-lg fa-chevron-circle-up" aria-hidden="true"></i> | ||
</button> | ||
</div> | ||
<div class="col-9 clearfix"> | ||
<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> | ||
| ||
<span class="label-icon sr-hidden"> | ||
<i class="fa fa-fw fa-3x text-info fa-cubes"></i> | ||
</span> | ||
</div> | ||
<div> | ||
{{ provider.name }} | ||
<i *ngIf="!provider.enabled" class="fa fa-fw" [ngClass]="{ | ||
'fa-check-circle text-success': provider.enabled, | ||
'fa-times-circle text-danger': !provider.enabled | ||
}"></i> | ||
<small class="d-block">{{ provider['@type'] }}</small> | ||
</div> | ||
</div> | ||
<div class="col-2 text-right"> | ||
<button class="btn btn-primary btn-filter pull-left"> | ||
<i class="fa fa-filter"></i> | ||
<span class="label">Active Filters</span> | ||
<span class="badge badge-light">{{ provider.metadataFilters.length }}</span> | ||
</button> | ||
<button class="btn btn-link pull-right" (click)="select.emit(provider)" aria-label="Edit selected service provider"> | ||
<i class="fa fa-fw fa-edit fa-2x"></i> | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="collapse" [ngClass]="{'show': isOpen}"> | ||
<div class="card-body" tabindex="0"> | ||
<div class="row"> | ||
<div class="col-10"> | ||
<div class="row"> | ||
<div class="col text-right font-weight-bold"> | ||
Metadata Provider Name: | ||
</div> | ||
<div class="col">{{ provider.name }}</div> | ||
<div class="col text-right font-weight-bold"> | ||
Created Date: | ||
</div> | ||
<div class="col">{{ provider.createdDate | date:'medium' }}</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col text-right font-weight-bold"> | ||
Metadata Provider Type: | ||
</div> | ||
<div class="col">{{ provider['@type'] }}</div> | ||
<div class="col text-right font-weight-bold"> | ||
Metadata Provider Status: | ||
</div> | ||
<div class="col" *ngIf="!provider.enabled"> | ||
<i class="fa fa-fw" [ngClass]="{ | ||
'fa-check-circle text-success': provider.enabled, | ||
'fa-times-circle text-danger': !provider.enabled | ||
}"></i> | ||
<span *ngIf="provider.enabled" i18n="@@value--provider">Enabled</span> | ||
<span *ngIf="!provider.enabled" i18n="@@value--disabled">Disabled</span> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
|
44 changes: 44 additions & 0 deletions
44
ui/src/app/metadata/manager/component/provider-item.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
@import '../../../../theme/palette'; | ||
|
||
.card { | ||
background-color: rgba($light-grey, 0.5); | ||
&:focus { | ||
outline: -webkit-focus-ring-color auto 5px; | ||
} | ||
.btn-link { | ||
&:focus { | ||
outline: -webkit-focus-ring-color auto 5px; | ||
} | ||
} | ||
|
||
.label-icon { | ||
display: inline-block; | ||
min-width: 64px; | ||
text-align: center; | ||
} | ||
|
||
.reorder-card { | ||
width: 65px; | ||
margin-left: 20px; | ||
background-color: $white; | ||
border: 1px solid $gray-400; | ||
border-radius: 4px; | ||
|
||
p { | ||
margin-bottom: 0; | ||
padding-top: 3px; | ||
font-size: 1.40rem; | ||
line-height: 1; | ||
} | ||
|
||
.btn { | ||
padding: 2px 5px; | ||
} | ||
} | ||
|
||
.btn-filter { | ||
.label { | ||
font-size: .90rem; | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
ui/src/app/metadata/manager/component/provider-item.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Component, Input, ChangeDetectionStrategy } from '@angular/core'; | ||
|
||
import { MetadataProvider } from '../../domain/model'; | ||
import { EntityItemComponent } from './entity-item.component'; | ||
|
||
@Component({ | ||
selector: 'provider-item', | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
templateUrl: './provider-item.component.html', | ||
styleUrls: ['./provider-item.component.scss'] | ||
}) | ||
|
||
export class ProviderItemComponent extends EntityItemComponent { | ||
@Input() provider: MetadataProvider; | ||
} |
File renamed without changes.
File renamed without changes.
34 changes: 34 additions & 0 deletions
34
ui/src/app/metadata/manager/component/resolver-item.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { TestBed, ComponentFixture } from '@angular/core/testing'; | ||
import { NoopAnimationsModule } from '@angular/platform-browser/animations'; | ||
import { EntityItemComponent } from './entity-item.component'; | ||
import { FileBackedHttpMetadataResolver } from '../../domain/entity'; | ||
import { ResolverItemComponent } from './resolver-item.component'; | ||
|
||
describe('Resolver List item', () => { | ||
let fixture: ComponentFixture<ResolverItemComponent>; | ||
let instance: ResolverItemComponent; | ||
|
||
let resolver = new FileBackedHttpMetadataResolver({ entityId: 'foo', serviceProviderName: 'bar' }); | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
providers: [], | ||
imports: [ | ||
NoopAnimationsModule | ||
], | ||
declarations: [ | ||
ResolverItemComponent | ||
], | ||
}); | ||
|
||
fixture = TestBed.createComponent(ResolverItemComponent); | ||
instance = fixture.componentInstance; | ||
instance.entity = resolver; | ||
}); | ||
|
||
it('should compile', () => { | ||
fixture.detectChanges(); | ||
|
||
expect(fixture).toBeDefined(); | ||
}); | ||
}); |
14 changes: 14 additions & 0 deletions
14
ui/src/app/metadata/manager/component/resolver-item.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Component, ChangeDetectionStrategy, Input } from '@angular/core'; | ||
|
||
import { MetadataEntity } from '../../domain/model'; | ||
import { EntityItemComponent } from './entity-item.component'; | ||
|
||
@Component({ | ||
selector: 'resolver-item', | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
templateUrl: './resolver-item.component.html', | ||
styleUrls: ['./resolver-item.component.scss'] | ||
}) | ||
export class ResolverItemComponent extends EntityItemComponent { | ||
@Input() entity: MetadataEntity; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
ui/src/app/metadata/manager/container/dashboard-providers-list.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import { TestBed, ComponentFixture } from '@angular/core/testing'; | ||
import { ReactiveFormsModule } from '@angular/forms'; | ||
import { Router } from '@angular/router'; | ||
import { NoopAnimationsModule } from '@angular/platform-browser/animations'; | ||
import { StoreModule, Store, combineReducers } from '@ngrx/store'; | ||
import { NgbPaginationModule } from '@ng-bootstrap/ng-bootstrap/pagination/pagination.module'; | ||
import { NgbModal, NgbModalModule } from '@ng-bootstrap/ng-bootstrap/modal/modal.module'; | ||
import * as fromDashboard from '../reducer'; | ||
import { ProviderSearchComponent } from '../component/provider-search.component'; | ||
import { DeleteDialogComponent } from '../component/delete-dialog.component'; | ||
import { RouterStub } from '../../../../testing/router.stub'; | ||
import { NgbModalStub } from '../../../../testing/modal.stub'; | ||
import { DashboardProvidersListComponent } from './dashboard-providers-list.component'; | ||
import { MetadataProvider } from '../../domain/model'; | ||
import { ProviderItemComponent } from '../component/provider-item.component'; | ||
import { FileBackedHttpMetadataResolver } from '../../domain/entity'; | ||
|
||
|
||
describe('Dashboard Providers List Page', () => { | ||
let fixture: ComponentFixture<DashboardProvidersListComponent>; | ||
let store: Store<fromDashboard.DashboardState>; | ||
let router: Router; | ||
let modal: NgbModal; | ||
let instance: DashboardProvidersListComponent; | ||
|
||
let provider = <MetadataProvider>{ | ||
resourceId: 'foo', | ||
name: 'bar' | ||
}; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
providers: [ | ||
{ provide: Router, useClass: RouterStub }, | ||
{ provide: NgbModal, useClass: NgbModalStub } | ||
], | ||
imports: [ | ||
NoopAnimationsModule, | ||
StoreModule.forRoot({ | ||
manager: combineReducers(fromDashboard.reducers), | ||
}), | ||
ReactiveFormsModule, | ||
NgbPaginationModule, | ||
NgbModalModule | ||
], | ||
declarations: [ | ||
DashboardProvidersListComponent, | ||
ProviderSearchComponent, | ||
ProviderItemComponent, | ||
DeleteDialogComponent | ||
], | ||
}); | ||
|
||
fixture = TestBed.createComponent(DashboardProvidersListComponent); | ||
instance = fixture.componentInstance; | ||
store = TestBed.get(Store); | ||
router = TestBed.get(Router); | ||
modal = TestBed.get(NgbModal); | ||
|
||
spyOn(store, 'dispatch').and.callThrough(); | ||
}); | ||
|
||
it('should compile', () => { | ||
fixture.detectChanges(); | ||
|
||
expect(fixture).toBeDefined(); | ||
}); | ||
|
||
describe('toggleProvider method', () => { | ||
it('should fire a redux action', () => { | ||
instance.toggleEntity(provider); | ||
expect(store.dispatch).toHaveBeenCalled(); | ||
}); | ||
}); | ||
|
||
describe('edit method', () => { | ||
it('should route to the edit page', () => { | ||
spyOn(router, 'navigate'); | ||
instance.edit(provider); | ||
expect(router.navigate).toHaveBeenCalledWith(['metadata', 'provider', provider.resourceId, 'edit']); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.