diff --git a/ui-ngx/src/app/core/http/widget.service.ts b/ui-ngx/src/app/core/http/widget.service.ts index 4b1a1e19c6..d153521a24 100644 --- a/ui-ngx/src/app/core/http/widget.service.ts +++ b/ui-ngx/src/app/core/http/widget.service.ts @@ -181,8 +181,9 @@ export class WidgetService { public saveWidgetType(widgetInfo: WidgetInfo, id: WidgetTypeId, bundleAlias: string, + createdTime: number, config?: RequestConfig): Observable { - const widgetTypeInstance = toWidgetType(widgetInfo, id, undefined, bundleAlias); + const widgetTypeInstance = toWidgetType(widgetInfo, id, undefined, bundleAlias, createdTime); return this.http.post('/api/widgetType', widgetTypeInstance, defaultHttpOptionsFromConfig(config)).pipe( tap((savedWidgetType) => { diff --git a/ui-ngx/src/app/modules/home/components/widget/widget-component.service.ts b/ui-ngx/src/app/modules/home/components/widget/widget-component.service.ts index 7d5ac92ef5..3bbff4078b 100644 --- a/ui-ngx/src/app/modules/home/components/widget/widget-component.service.ts +++ b/ui-ngx/src/app/modules/home/components/widget/widget-component.service.ts @@ -107,7 +107,7 @@ export class WidgetComponentService { image: this.utils.editWidgetInfo.image, description: this.utils.editWidgetInfo.description, defaultConfig: this.utils.editWidgetInfo.defaultConfig - }, new WidgetTypeId('1'), new TenantId( NULL_UUID ), 'customWidgetBundle' + }, new WidgetTypeId('1'), new TenantId( NULL_UUID ), 'customWidgetBundle', undefined ); } const initSubject = new ReplaySubject(); diff --git a/ui-ngx/src/app/modules/home/models/widget-component.models.ts b/ui-ngx/src/app/modules/home/models/widget-component.models.ts index c24298b369..4ecce2db91 100644 --- a/ui-ngx/src/app/modules/home/models/widget-component.models.ts +++ b/ui-ngx/src/app/modules/home/models/widget-component.models.ts @@ -446,7 +446,8 @@ export function toWidgetInfo(widgetTypeEntity: WidgetType): WidgetInfo { }; } -export function toWidgetType(widgetInfo: WidgetInfo, id: WidgetTypeId, tenantId: TenantId, bundleAlias: string): WidgetType { +export function toWidgetType(widgetInfo: WidgetInfo, id: WidgetTypeId, tenantId: TenantId, + bundleAlias: string, createdTime: number): WidgetType { const descriptor: WidgetTypeDescriptor = { type: widgetInfo.type, sizeX: widgetInfo.sizeX, @@ -462,6 +463,7 @@ export function toWidgetType(widgetInfo: WidgetInfo, id: WidgetTypeId, tenantId: return { id, tenantId, + createdTime, bundleAlias, alias: widgetInfo.alias, name: widgetInfo.widgetName, diff --git a/ui-ngx/src/app/modules/home/pages/widget/widget-editor.component.ts b/ui-ngx/src/app/modules/home/pages/widget/widget-editor.component.ts index 6efb88be0b..2f7d274037 100644 --- a/ui-ngx/src/app/modules/home/pages/widget/widget-editor.component.ts +++ b/ui-ngx/src/app/modules/home/pages/widget/widget-editor.component.ts @@ -516,7 +516,8 @@ export class WidgetEditorComponent extends PageComponent implements OnInit, OnDe private commitSaveWidget() { const id = (this.widgetType && this.widgetType.id) ? this.widgetType.id : undefined; - this.widgetService.saveWidgetType(this.widget, id, this.widgetsBundle.alias).subscribe( + const createdTime = (this.widgetType && this.widgetType.createdTime) ? this.widgetType.createdTime : undefined; + this.widgetService.saveWidgetType(this.widget, id, this.widgetsBundle.alias, createdTime).subscribe( (widgetTypeInstance) => { this.setWidgetType(widgetTypeInstance); this.saveWidgetPending = false; @@ -543,7 +544,7 @@ export class WidgetEditorComponent extends PageComponent implements OnInit, OnDe config.title = this.widget.widgetName; this.widget.defaultConfig = JSON.stringify(config); this.isDirty = false; - this.widgetService.saveWidgetType(this.widget, undefined, saveWidgetAsData.bundleAlias).subscribe( + this.widgetService.saveWidgetType(this.widget, undefined, saveWidgetAsData.bundleAlias, undefined).subscribe( (widgetTypeInstance) => { this.router.navigateByUrl(`/widgets-bundles/${saveWidgetAsData.bundleId}/widgetTypes/${widgetTypeInstance.id.id}`); }