Skip to content

Commit

Permalink
Merged in bugfix/SHIBUI-814 (pull request #199)
Browse files Browse the repository at this point in the history
SHIBUI-814 Fixed issue with date pipe

Approved-by: Ryan Mathis <rmathis@unicon.net>
  • Loading branch information
rmathis committed Sep 24, 2018
2 parents 0d10c77 + 3d3cbd3 commit 057090a
Show file tree
Hide file tree
Showing 16 changed files with 36 additions and 4,422 deletions.
3 changes: 0 additions & 3 deletions run-app-es.sh

This file was deleted.

3 changes: 0 additions & 3 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
"scripts": {
"ng": "ng",
"start": "ng serve --proxy-config proxy.conf.json",
"start:en": "ng serve --proxy-config proxy.conf.json --i18nFile=./src/locale/en.xlf --i18nFormat=xlf --locale=en --aot",
"start:es": "ng serve --proxy-config proxy.conf.json --i18nFile=./src/locale/es.xlf --i18nFormat=xlf --locale=es --aot",
"start:prod": "ng serve --proxy-config proxy.conf.json --i18nFile=./src/locale/en.xlf --i18nFormat=xlf --locale=en --aot --environment=prod",
"build": "ng build",
"test": "ng test --code-coverage",
"lint": "ng lint",
Expand Down
3 changes: 1 addition & 2 deletions ui/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule, LOCALE_ID } from '@angular/core';
import { NgModule } from '@angular/core';
import { StoreModule } from '@ngrx/store';
import { EffectsModule } from '@ngrx/effects';
import { StoreDevtoolsModule } from '@ngrx/store-devtools';
Expand Down Expand Up @@ -58,7 +58,6 @@ import { I18nModule } from './i18n/i18n.module';
AppRoutingModule
],
providers: [
{ provide: LOCALE_ID, useValue: getCurrentLocale(null) },
NavigatorService,
{ provide: RouterStateSerializer, useClass: CustomRouterStateSerializer },
{
Expand Down
1 change: 0 additions & 1 deletion ui/src/app/i18n/component/translate.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export class TranslateComponent implements OnDestroy {

@Input() set params(params: any) {
this.currentParams = params || {};
console.log(params);
this.update();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<div class="col text-right font-weight-bold">
Created Date:
</div>
<div class="col">{{ provider.createdDate | date:'medium' }}</div>
<div class="col">{{ provider.createdDate | customDate }}</div>
</div>
<div class="row">
<div class="col text-right font-weight-bold">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ProviderItemComponent } from './provider-item.component';
import { ViewChild, Component } from '@angular/core';
import { MetadataProvider } from '../../domain/model';
import { MockI18nModule } from '../../../../testing/i18n.stub';
import { CustomDatePipe } from '../../../shared/pipe/date.pipe';

@Component({
template: `
Expand Down Expand Up @@ -50,7 +51,8 @@ describe('Provider List item', () => {
],
declarations: [
ProviderItemComponent,
TestHostComponent
TestHostComponent,
CustomDatePipe
],
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</div>
<div class="col">{{ entity.name }}</div>
<div class="col text-right font-weight-bold" translate="label.created-date">Created Date:</div>
<div class="col" *ngIf="!entity.isDraft()">{{ entity.getCreationDate() | date:'medium' }}</div>
<div class="col" *ngIf="!entity.isDraft()">{{ entity.getCreationDate() | customDate }}</div>
<div class="col" *ngIf="entity.isDraft()"> &mdash; </div>
</div>
<div class="row">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { EntityItemComponent } from './entity-item.component';
import { FileBackedHttpMetadataResolver } from '../../domain/entity';
import { ResolverItemComponent } from './resolver-item.component';
import { MockI18nModule } from '../../../../testing/i18n.stub';
import { CustomDatePipe } from '../../../shared/pipe/date.pipe';

describe('Resolver List item', () => {
let fixture: ComponentFixture<ResolverItemComponent>;
Expand All @@ -19,7 +20,8 @@ describe('Resolver List item', () => {
MockI18nModule
],
declarations: [
ResolverItemComponent
ResolverItemComponent,
CustomDatePipe
],
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { MetadataProvider } from '../../domain/model';
import { ProviderItemComponent } from '../component/provider-item.component';
import { FileBackedHttpMetadataResolver } from '../../domain/entity';
import { MockI18nModule } from '../../../../testing/i18n.stub';
import { CustomDatePipe } from '../../../shared/pipe/date.pipe';


describe('Dashboard Providers List Page', () => {
Expand Down Expand Up @@ -49,7 +50,8 @@ describe('Dashboard Providers List Page', () => {
DashboardProvidersListComponent,
ProviderSearchComponent,
ProviderItemComponent,
DeleteDialogComponent
DeleteDialogComponent,
CustomDatePipe
],
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { FileBackedHttpMetadataResolver } from '../../domain/entity';
import { DashboardResolversListComponent } from './dashboard-resolvers-list.component';
import { ResolverItemComponent } from '../component/resolver-item.component';
import { MockI18nModule } from '../../../../testing/i18n.stub';
import { CustomDatePipe } from '../../../shared/pipe/date.pipe';


describe('Dashboard Resolvers List Page', () => {
Expand Down Expand Up @@ -54,7 +55,8 @@ describe('Dashboard Resolvers List Page', () => {
DashboardResolversListComponent,
ProviderSearchComponent,
ResolverItemComponent,
DeleteDialogComponent
DeleteDialogComponent,
CustomDatePipe
],
});

Expand Down
4 changes: 3 additions & 1 deletion ui/src/app/metadata/manager/manager.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { SearchEffects } from './effect/search.effects';
import { DeleteDialogComponent } from './component/delete-dialog.component';
import { NgbModalModule } from '@ng-bootstrap/ng-bootstrap/modal/modal.module';
import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap';
import { SharedModule } from '../../shared/shared.module';

@NgModule({
declarations: [
Expand All @@ -41,7 +42,8 @@ import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap';
RouterModule,
NgbModalModule,
NgbDropdownModule,
HttpClientModule
HttpClientModule,
SharedModule
]
})
export class ManagerModule {
Expand Down
13 changes: 13 additions & 0 deletions ui/src/app/shared/pipe/date.pipe.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { PipeTransform, Pipe } from '@angular/core';
import { DatePipe } from '@angular/common';

@Pipe({ name: 'customDate' })
export class CustomDatePipe implements PipeTransform {
pipe: DatePipe;
constructor() {
this.pipe = new DatePipe('en');
}
transform(value: string, format: string): string {
return this.pipe.transform(value, format);
}
}
5 changes: 4 additions & 1 deletion ui/src/app/shared/shared.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { ToggleSwitchComponent } from './switch/switch.component';
import { ContenteditableDirective } from './contenteditable/contenteditable.directive';
import { ReplacePipe } from './pipe/replace.pipe';
import { I18nModule } from '../i18n/i18n.module';
import { CustomDatePipe } from './pipe/date.pipe';

@NgModule({
imports: [
Expand All @@ -30,6 +31,7 @@ import { I18nModule } from '../i18n/i18n.module';
InfoLabelDirective,
PrettyXml,
ReplacePipe,
CustomDatePipe,
ContenteditableDirective
],
exports: [
Expand All @@ -44,7 +46,8 @@ import { I18nModule } from '../i18n/i18n.module';
ValidationClassDirective,
InfoLabelDirective,
ContenteditableDirective,
ReplacePipe
ReplacePipe,
CustomDatePipe
]
})
export class SharedModule { }
2 changes: 1 addition & 1 deletion ui/src/assets/schema/filter/entity-attributes.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"type": "string",
"widget": {
"id": "string",
"help": "Must be unique."
"help": "message.must-be-unique"
}
},
"@type": {
Expand Down
Loading

0 comments on commit 057090a

Please sign in to comment.