Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pluginDefinition.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"defaultWindowStyle": {
"width": 850,
"height": 450
}
},
"autosave": true
},
"dataServices": [
{
Expand Down
20 changes: 16 additions & 4 deletions webClient/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/

import { Component, Inject, Optional } from '@angular/core';
import { Angular2InjectionTokens, ContextMenuItem, Angular2PluginWindowActions } from 'pluginlib/inject-resources';
import { Angular2InjectionTokens, ContextMenuItem, Angular2PluginWindowActions, Angular2PluginSessionEvents } from 'pluginlib/inject-resources';

import { ZluxPopupManagerService, ZluxErrorSeverity } from '@zlux/widgets';

Expand Down Expand Up @@ -56,13 +56,16 @@ export class AppComponent {
serverResponseMessage: string;
private menuItems: ContextMenuItem[];

autoSaveEvent:any;

constructor(
public locale: LocaleService,
public translation: TranslationService,
@Inject(Angular2InjectionTokens.PLUGIN_DEFINITION) private pluginDefinition: ZLUX.ContainerPluginDefinition,
@Inject(Angular2InjectionTokens.LOGGER) private log: ZLUX.ComponentLogger,
@Inject(Angular2InjectionTokens.LAUNCH_METADATA) private launchMetadata: any,
@Optional() @Inject(Angular2InjectionTokens.WINDOW_ACTIONS) private windowActions: Angular2PluginWindowActions,
@Inject(Angular2InjectionTokens.SESSION_EVENTS) private sessionEvents: Angular2PluginSessionEvents,
private popupManager: ZluxPopupManagerService,
private helloService: HelloService,
private settingsService: SettingsService) {
Expand All @@ -73,6 +76,12 @@ export class AppComponent {
if (this.launchMetadata != null && this.launchMetadata.data != null && this.launchMetadata.data.type != null) {
this.handleLaunchOrMessageObject(this.launchMetadata.data);
}

this.autoSaveEvent = this.sessionEvents.autosaveEmitter.subscribe((saveThis: any)=> {
if (saveThis) {
saveThis({'appData':{'requestText':this.parameters,'targetAppId':this.targetAppId}});
}
});
}

handleLaunchOrMessageObject(data: any) {
Expand All @@ -85,8 +94,8 @@ export class AppComponent {
if (mode == 'PluginCreate' || mode == 'PluginFindAnyOrCreate') {
this.actionType = actionType;
this.targetMode = mode;
this.targetAppId = data.targetAppId;
this.parameters = data.requestText;
this.targetAppId = data.appData.targetAppId;
this.parameters = data.appData.requestText;
} else {
msg = `Invalid target mode given (${mode})`;
this.log.warn(msg);
Expand Down Expand Up @@ -353,7 +362,10 @@ export class AppComponent {
}
return false;
}


ngOnDestroy(){
this.autoSaveEvent.unsubscribe();
}

}

Expand Down