-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into plugins_support
Conflicts: application/client/src/app/service/actions.ts application/client/src/app/service/actions/index.ts application/holder/src/service/actions/index.ts application/platform/ipc/request/actions/index.ts
- Loading branch information
Showing
32 changed files
with
454 additions
and
935 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
application/client/src/app/service/actions/export.session.state.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { Base } from './action'; | ||
import { session } from '@service/session'; | ||
import { bridge } from '@service/bridge'; | ||
import { Notification, notifications } from '@ui/service/notifications'; | ||
|
||
export const ACTION_UUID = 'export_session_state'; | ||
|
||
export class Action extends Base { | ||
public group(): number { | ||
return 4; | ||
} | ||
public uuid(): string { | ||
return ACTION_UUID; | ||
} | ||
|
||
public caption(): string { | ||
return 'Export Current Filters'; | ||
} | ||
|
||
public async apply(): Promise<void> { | ||
const active = session.active().session(); | ||
if (active === undefined) { | ||
return; | ||
} | ||
const snap = active.snap().get(); | ||
const filename = await bridge.files().select.save('state', undefined); | ||
if (filename === undefined) { | ||
return Promise.resolve(); | ||
} | ||
bridge | ||
.files() | ||
.write(filename, snap, true) | ||
.catch((err: Error) => { | ||
notifications.notify( | ||
new Notification({ | ||
message: `Export failed with: ${err.message}`, | ||
actions: [], | ||
}), | ||
); | ||
}); | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
application/client/src/app/service/actions/import.session.state.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { Base } from './action'; | ||
import { session } from '@service/session'; | ||
import { bridge } from '@service/bridge'; | ||
import { Notification, notifications } from '@ui/service/notifications'; | ||
|
||
export const ACTION_UUID = 'import_session_state'; | ||
|
||
export class Action extends Base { | ||
public group(): number { | ||
return 4; | ||
} | ||
public uuid(): string { | ||
return ACTION_UUID; | ||
} | ||
|
||
public caption(): string { | ||
return 'Import Filters'; | ||
} | ||
|
||
public async apply(): Promise<void> { | ||
const active = session.active().session(); | ||
if (active === undefined) { | ||
return; | ||
} | ||
const files = await bridge.files().select.any(); | ||
if (files.length !== 1) { | ||
return Promise.resolve(); | ||
} | ||
bridge | ||
.files() | ||
.read(files[0].filename) | ||
.then((content: string) => { | ||
const err = active.snap().load(content); | ||
if (err instanceof Error) { | ||
return Promise.reject(err); | ||
} | ||
return undefined; | ||
}) | ||
.catch((err: Error) => { | ||
notifications.notify( | ||
new Notification({ | ||
message: `Import failed with: ${err.message}`, | ||
actions: [], | ||
}), | ||
); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.