Fixed updated widget: Cleared creationTime
This commit is contained in:
parent
885395f119
commit
8237cf4f7c
@ -181,8 +181,9 @@ export class WidgetService {
|
|||||||
public saveWidgetType(widgetInfo: WidgetInfo,
|
public saveWidgetType(widgetInfo: WidgetInfo,
|
||||||
id: WidgetTypeId,
|
id: WidgetTypeId,
|
||||||
bundleAlias: string,
|
bundleAlias: string,
|
||||||
|
createdTime: number,
|
||||||
config?: RequestConfig): Observable<WidgetType> {
|
config?: RequestConfig): Observable<WidgetType> {
|
||||||
const widgetTypeInstance = toWidgetType(widgetInfo, id, undefined, bundleAlias);
|
const widgetTypeInstance = toWidgetType(widgetInfo, id, undefined, bundleAlias, createdTime);
|
||||||
return this.http.post<WidgetType>('/api/widgetType', widgetTypeInstance,
|
return this.http.post<WidgetType>('/api/widgetType', widgetTypeInstance,
|
||||||
defaultHttpOptionsFromConfig(config)).pipe(
|
defaultHttpOptionsFromConfig(config)).pipe(
|
||||||
tap((savedWidgetType) => {
|
tap((savedWidgetType) => {
|
||||||
|
|||||||
@ -107,7 +107,7 @@ export class WidgetComponentService {
|
|||||||
image: this.utils.editWidgetInfo.image,
|
image: this.utils.editWidgetInfo.image,
|
||||||
description: this.utils.editWidgetInfo.description,
|
description: this.utils.editWidgetInfo.description,
|
||||||
defaultConfig: this.utils.editWidgetInfo.defaultConfig
|
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();
|
const initSubject = new ReplaySubject();
|
||||||
|
|||||||
@ -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 = {
|
const descriptor: WidgetTypeDescriptor = {
|
||||||
type: widgetInfo.type,
|
type: widgetInfo.type,
|
||||||
sizeX: widgetInfo.sizeX,
|
sizeX: widgetInfo.sizeX,
|
||||||
@ -462,6 +463,7 @@ export function toWidgetType(widgetInfo: WidgetInfo, id: WidgetTypeId, tenantId:
|
|||||||
return {
|
return {
|
||||||
id,
|
id,
|
||||||
tenantId,
|
tenantId,
|
||||||
|
createdTime,
|
||||||
bundleAlias,
|
bundleAlias,
|
||||||
alias: widgetInfo.alias,
|
alias: widgetInfo.alias,
|
||||||
name: widgetInfo.widgetName,
|
name: widgetInfo.widgetName,
|
||||||
|
|||||||
@ -516,7 +516,8 @@ export class WidgetEditorComponent extends PageComponent implements OnInit, OnDe
|
|||||||
|
|
||||||
private commitSaveWidget() {
|
private commitSaveWidget() {
|
||||||
const id = (this.widgetType && this.widgetType.id) ? this.widgetType.id : undefined;
|
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) => {
|
(widgetTypeInstance) => {
|
||||||
this.setWidgetType(widgetTypeInstance);
|
this.setWidgetType(widgetTypeInstance);
|
||||||
this.saveWidgetPending = false;
|
this.saveWidgetPending = false;
|
||||||
@ -543,7 +544,7 @@ export class WidgetEditorComponent extends PageComponent implements OnInit, OnDe
|
|||||||
config.title = this.widget.widgetName;
|
config.title = this.widget.widgetName;
|
||||||
this.widget.defaultConfig = JSON.stringify(config);
|
this.widget.defaultConfig = JSON.stringify(config);
|
||||||
this.isDirty = false;
|
this.isDirty = false;
|
||||||
this.widgetService.saveWidgetType(this.widget, undefined, saveWidgetAsData.bundleAlias).subscribe(
|
this.widgetService.saveWidgetType(this.widget, undefined, saveWidgetAsData.bundleAlias, undefined).subscribe(
|
||||||
(widgetTypeInstance) => {
|
(widgetTypeInstance) => {
|
||||||
this.router.navigateByUrl(`/widgets-bundles/${saveWidgetAsData.bundleId}/widgetTypes/${widgetTypeInstance.id.id}`);
|
this.router.navigateByUrl(`/widgets-bundles/${saveWidgetAsData.bundleId}/widgetTypes/${widgetTypeInstance.id.id}`);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user