Added created time column
This commit is contained in:
parent
8d4d5ebb16
commit
9623d62831
@ -14,7 +14,11 @@
|
|||||||
/// limitations under the License.
|
/// limitations under the License.
|
||||||
///
|
///
|
||||||
|
|
||||||
import { EntityTableColumn, EntityTableConfig } from '@home/models/entity/entities-table-config.models';
|
import {
|
||||||
|
DateEntityTableColumn,
|
||||||
|
EntityTableColumn,
|
||||||
|
EntityTableConfig
|
||||||
|
} from '@home/models/entity/entities-table-config.models';
|
||||||
import { EntityType, entityTypeTranslations } from '@shared/models/entity-type.models';
|
import { EntityType, entityTypeTranslations } from '@shared/models/entity-type.models';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { Direction } from '@shared/models/page/sort-order';
|
import { Direction } from '@shared/models/page/sort-order';
|
||||||
@ -54,6 +58,7 @@ import {
|
|||||||
} from './components/public-api';
|
} from './components/public-api';
|
||||||
import { ImportExportService } from '@shared/import-export/import-export.service';
|
import { ImportExportService } from '@shared/import-export/import-export.service';
|
||||||
import { isObject } from '@core/utils';
|
import { isObject } from '@core/utils';
|
||||||
|
import { DatePipe } from '@angular/common';
|
||||||
|
|
||||||
export class CalculatedFieldsTableConfig extends EntityTableConfig<CalculatedField, PageLink> {
|
export class CalculatedFieldsTableConfig extends EntityTableConfig<CalculatedField, PageLink> {
|
||||||
|
|
||||||
@ -70,6 +75,7 @@ export class CalculatedFieldsTableConfig extends EntityTableConfig<CalculatedFie
|
|||||||
constructor(private calculatedFieldsService: CalculatedFieldsService,
|
constructor(private calculatedFieldsService: CalculatedFieldsService,
|
||||||
private translate: TranslateService,
|
private translate: TranslateService,
|
||||||
private dialog: MatDialog,
|
private dialog: MatDialog,
|
||||||
|
private datePipe: DatePipe,
|
||||||
public entityId: EntityId = null,
|
public entityId: EntityId = null,
|
||||||
private store: Store<AppState>,
|
private store: Store<AppState>,
|
||||||
private durationLeft: DurationLeftPipe,
|
private durationLeft: DurationLeftPipe,
|
||||||
@ -108,7 +114,7 @@ export class CalculatedFieldsTableConfig extends EntityTableConfig<CalculatedFie
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
this.defaultSortOrder = {property: 'name', direction: Direction.DESC};
|
this.defaultSortOrder = {property: 'createdTime', direction: Direction.DESC};
|
||||||
|
|
||||||
const expressionColumn = new EntityTableColumn<CalculatedField>('expression', 'calculated-fields.expression', '300px');
|
const expressionColumn = new EntityTableColumn<CalculatedField>('expression', 'calculated-fields.expression', '300px');
|
||||||
expressionColumn.sortable = false;
|
expressionColumn.sortable = false;
|
||||||
@ -121,6 +127,7 @@ export class CalculatedFieldsTableConfig extends EntityTableConfig<CalculatedFie
|
|||||||
return expressionLabel.length < 50 ? null : expressionLabel
|
return expressionLabel.length < 50 ? null : expressionLabel
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.columns.push(new DateEntityTableColumn<CalculatedField>('createdTime', 'common.created-time', this.datePipe, '150px'));
|
||||||
this.columns.push(new EntityTableColumn<CalculatedField>('name', 'common.name', '33%'));
|
this.columns.push(new EntityTableColumn<CalculatedField>('name', 'common.name', '33%'));
|
||||||
this.columns.push(new EntityTableColumn<CalculatedField>('type', 'common.type', '50px', entity => this.translate.instant(CalculatedFieldTypeTranslations.get(entity.type))));
|
this.columns.push(new EntityTableColumn<CalculatedField>('type', 'common.type', '50px', entity => this.translate.instant(CalculatedFieldTypeTranslations.get(entity.type))));
|
||||||
this.columns.push(expressionColumn);
|
this.columns.push(expressionColumn);
|
||||||
|
|||||||
@ -35,6 +35,7 @@ import { DurationLeftPipe } from '@shared/pipe/duration-left.pipe';
|
|||||||
import { TbPopoverService } from '@shared/components/popover.service';
|
import { TbPopoverService } from '@shared/components/popover.service';
|
||||||
import { CalculatedFieldsService } from '@core/http/calculated-fields.service';
|
import { CalculatedFieldsService } from '@core/http/calculated-fields.service';
|
||||||
import { ImportExportService } from '@shared/import-export/import-export.service';
|
import { ImportExportService } from '@shared/import-export/import-export.service';
|
||||||
|
import { DatePipe } from '@angular/common';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'tb-calculated-fields-table',
|
selector: 'tb-calculated-fields-table',
|
||||||
@ -56,6 +57,7 @@ export class CalculatedFieldsTableComponent {
|
|||||||
private translate: TranslateService,
|
private translate: TranslateService,
|
||||||
private dialog: MatDialog,
|
private dialog: MatDialog,
|
||||||
private store: Store<AppState>,
|
private store: Store<AppState>,
|
||||||
|
private datePipe: DatePipe,
|
||||||
private durationLeft: DurationLeftPipe,
|
private durationLeft: DurationLeftPipe,
|
||||||
private popoverService: TbPopoverService,
|
private popoverService: TbPopoverService,
|
||||||
private cd: ChangeDetectorRef,
|
private cd: ChangeDetectorRef,
|
||||||
@ -69,6 +71,7 @@ export class CalculatedFieldsTableComponent {
|
|||||||
this.calculatedFieldsService,
|
this.calculatedFieldsService,
|
||||||
this.translate,
|
this.translate,
|
||||||
this.dialog,
|
this.dialog,
|
||||||
|
this.datePipe,
|
||||||
this.entityId(),
|
this.entityId(),
|
||||||
this.store,
|
this.store,
|
||||||
this.durationLeft,
|
this.durationLeft,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user