Commit 8237cf4f7c45a4e6d56437edae97a39856de43e8

Authored by Vladyslav_Prykhodko
1 parent 885395f1

Fixed updated widget: Cleared creationTime

@@ -181,8 +181,9 @@ export class WidgetService { @@ -181,8 +181,9 @@ export class WidgetService {
181 public saveWidgetType(widgetInfo: WidgetInfo, 181 public saveWidgetType(widgetInfo: WidgetInfo,
182 id: WidgetTypeId, 182 id: WidgetTypeId,
183 bundleAlias: string, 183 bundleAlias: string,
  184 + createdTime: number,
184 config?: RequestConfig): Observable<WidgetType> { 185 config?: RequestConfig): Observable<WidgetType> {
185 - const widgetTypeInstance = toWidgetType(widgetInfo, id, undefined, bundleAlias); 186 + const widgetTypeInstance = toWidgetType(widgetInfo, id, undefined, bundleAlias, createdTime);
186 return this.http.post<WidgetType>('/api/widgetType', widgetTypeInstance, 187 return this.http.post<WidgetType>('/api/widgetType', widgetTypeInstance,
187 defaultHttpOptionsFromConfig(config)).pipe( 188 defaultHttpOptionsFromConfig(config)).pipe(
188 tap((savedWidgetType) => { 189 tap((savedWidgetType) => {
@@ -107,7 +107,7 @@ export class WidgetComponentService { @@ -107,7 +107,7 @@ export class WidgetComponentService {
107 image: this.utils.editWidgetInfo.image, 107 image: this.utils.editWidgetInfo.image,
108 description: this.utils.editWidgetInfo.description, 108 description: this.utils.editWidgetInfo.description,
109 defaultConfig: this.utils.editWidgetInfo.defaultConfig 109 defaultConfig: this.utils.editWidgetInfo.defaultConfig
110 - }, new WidgetTypeId('1'), new TenantId( NULL_UUID ), 'customWidgetBundle' 110 + }, new WidgetTypeId('1'), new TenantId( NULL_UUID ), 'customWidgetBundle', undefined
111 ); 111 );
112 } 112 }
113 const initSubject = new ReplaySubject(); 113 const initSubject = new ReplaySubject();
@@ -446,7 +446,8 @@ export function toWidgetInfo(widgetTypeEntity: WidgetType): WidgetInfo { @@ -446,7 +446,8 @@ export function toWidgetInfo(widgetTypeEntity: WidgetType): WidgetInfo {
446 }; 446 };
447 } 447 }
448 448
449 -export function toWidgetType(widgetInfo: WidgetInfo, id: WidgetTypeId, tenantId: TenantId, bundleAlias: string): WidgetType { 449 +export function toWidgetType(widgetInfo: WidgetInfo, id: WidgetTypeId, tenantId: TenantId,
  450 + bundleAlias: string, createdTime: number): WidgetType {
450 const descriptor: WidgetTypeDescriptor = { 451 const descriptor: WidgetTypeDescriptor = {
451 type: widgetInfo.type, 452 type: widgetInfo.type,
452 sizeX: widgetInfo.sizeX, 453 sizeX: widgetInfo.sizeX,
@@ -462,6 +463,7 @@ export function toWidgetType(widgetInfo: WidgetInfo, id: WidgetTypeId, tenantId: @@ -462,6 +463,7 @@ export function toWidgetType(widgetInfo: WidgetInfo, id: WidgetTypeId, tenantId:
462 return { 463 return {
463 id, 464 id,
464 tenantId, 465 tenantId,
  466 + createdTime,
465 bundleAlias, 467 bundleAlias,
466 alias: widgetInfo.alias, 468 alias: widgetInfo.alias,
467 name: widgetInfo.widgetName, 469 name: widgetInfo.widgetName,
@@ -516,7 +516,8 @@ export class WidgetEditorComponent extends PageComponent implements OnInit, OnDe @@ -516,7 +516,8 @@ export class WidgetEditorComponent extends PageComponent implements OnInit, OnDe
516 516
517 private commitSaveWidget() { 517 private commitSaveWidget() {
518 const id = (this.widgetType && this.widgetType.id) ? this.widgetType.id : undefined; 518 const id = (this.widgetType && this.widgetType.id) ? this.widgetType.id : undefined;
519 - this.widgetService.saveWidgetType(this.widget, id, this.widgetsBundle.alias).subscribe( 519 + const createdTime = (this.widgetType && this.widgetType.createdTime) ? this.widgetType.createdTime : undefined;
  520 + this.widgetService.saveWidgetType(this.widget, id, this.widgetsBundle.alias, createdTime).subscribe(
520 (widgetTypeInstance) => { 521 (widgetTypeInstance) => {
521 this.setWidgetType(widgetTypeInstance); 522 this.setWidgetType(widgetTypeInstance);
522 this.saveWidgetPending = false; 523 this.saveWidgetPending = false;
@@ -543,7 +544,7 @@ export class WidgetEditorComponent extends PageComponent implements OnInit, OnDe @@ -543,7 +544,7 @@ export class WidgetEditorComponent extends PageComponent implements OnInit, OnDe
543 config.title = this.widget.widgetName; 544 config.title = this.widget.widgetName;
544 this.widget.defaultConfig = JSON.stringify(config); 545 this.widget.defaultConfig = JSON.stringify(config);
545 this.isDirty = false; 546 this.isDirty = false;
546 - this.widgetService.saveWidgetType(this.widget, undefined, saveWidgetAsData.bundleAlias).subscribe( 547 + this.widgetService.saveWidgetType(this.widget, undefined, saveWidgetAsData.bundleAlias, undefined).subscribe(
547 (widgetTypeInstance) => { 548 (widgetTypeInstance) => {
548 this.router.navigateByUrl(`/widgets-bundles/${saveWidgetAsData.bundleId}/widgetTypes/${widgetTypeInstance.id.id}`); 549 this.router.navigateByUrl(`/widgets-bundles/${saveWidgetAsData.bundleId}/widgetTypes/${widgetTypeInstance.id.id}`);
549 } 550 }