|
|
|
@ -19,6 +19,7 @@ import { WidgetSettings, WidgetSettingsComponent } from '@shared/models/widget.m |
|
|
|
import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms'; |
|
|
|
import { Store } from '@ngrx/store'; |
|
|
|
import { AppState } from '@core/core.state'; |
|
|
|
import { customDateFormat, simpleDateFormat } from '@shared/models/widget-settings.models'; |
|
|
|
|
|
|
|
@Component({ |
|
|
|
selector: 'tb-timeseries-table-widget-settings', |
|
|
|
@ -29,6 +30,10 @@ export class TimeseriesTableWidgetSettingsComponent extends WidgetSettingsCompon |
|
|
|
|
|
|
|
timeseriesTableWidgetSettingsForm: UntypedFormGroup; |
|
|
|
|
|
|
|
dateFormatList = ['yyyy-MM-dd HH:mm:ss', 'yyyy-MM-dd HH:mm:ss.SSS', 'MMM dd yyyy HH:mm', 'dd MMM yyyy HH:mm', 'yyyy MMM dd HH:mm', |
|
|
|
'MM/dd/yyyy HH:mm', 'dd/MM/yyyy HH:mm', 'yyyy/MM/dd HH:mm:ss'] |
|
|
|
.map(f => simpleDateFormat(f)).concat([customDateFormat('EEE, MMMM dd, yyyy')]); |
|
|
|
|
|
|
|
constructor(protected store: Store<AppState>, |
|
|
|
private fb: UntypedFormBuilder) { |
|
|
|
super(store); |
|
|
|
@ -47,8 +52,7 @@ export class TimeseriesTableWidgetSettingsComponent extends WidgetSettingsCompon |
|
|
|
showCellActionsMenu: true, |
|
|
|
reserveSpaceForHiddenAction: 'true', |
|
|
|
showTimestamp: true, |
|
|
|
showMilliseconds: false, |
|
|
|
timeFormat: '24h', |
|
|
|
dateFormat: {format: 'yyyy-MM-dd HH:mm:ss'}, |
|
|
|
displayPagination: true, |
|
|
|
useEntityLabel: false, |
|
|
|
defaultPageSize: 10, |
|
|
|
@ -60,6 +64,12 @@ export class TimeseriesTableWidgetSettingsComponent extends WidgetSettingsCompon |
|
|
|
} |
|
|
|
|
|
|
|
protected onSettingsSet(settings: WidgetSettings) { |
|
|
|
// For backward compatibility
|
|
|
|
const dateFormat = settings.dateFormat; |
|
|
|
if (settings?.showMilliseconds) { |
|
|
|
dateFormat.format = 'yyyy-MM-dd HH:mm:ss.SSS'; |
|
|
|
} |
|
|
|
|
|
|
|
this.timeseriesTableWidgetSettingsForm = this.fb.group({ |
|
|
|
enableSearch: [settings.enableSearch, []], |
|
|
|
enableSelectColumnDisplay: [settings.enableSelectColumnDisplay, []], |
|
|
|
@ -68,8 +78,7 @@ export class TimeseriesTableWidgetSettingsComponent extends WidgetSettingsCompon |
|
|
|
showCellActionsMenu: [settings.showCellActionsMenu, []], |
|
|
|
reserveSpaceForHiddenAction: [settings.reserveSpaceForHiddenAction, []], |
|
|
|
showTimestamp: [settings.showTimestamp, []], |
|
|
|
showMilliseconds: [settings.showMilliseconds, []], |
|
|
|
timeFormat: [settings.timeFormat, []], |
|
|
|
dateFormat: [dateFormat, []], |
|
|
|
displayPagination: [settings.displayPagination, []], |
|
|
|
useEntityLabel: [settings.useEntityLabel, []], |
|
|
|
defaultPageSize: [settings.defaultPageSize, [Validators.min(1)]], |
|
|
|
|