-
-
Notifications
You must be signed in to change notification settings - Fork 310
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1728 from AlexandruValeanu/1691_import_export_data
GH-1691: Add import/export menu in client app
- Loading branch information
Showing
10 changed files
with
84 additions
and
7 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
47 changes: 47 additions & 0 deletions
47
packages/altair-app/src/app/modules/altair/effects/windows-meta.effect.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,47 @@ | ||
import { EMPTY, Observable } from 'rxjs'; | ||
|
||
import { switchMap } from 'rxjs/operators'; | ||
import { Injectable } from '@angular/core'; | ||
import { Action } from '@ngrx/store'; | ||
import { Actions, ofType, createEffect } from '@ngrx/effects'; | ||
|
||
import { | ||
ElectronAppService, | ||
} from '../services'; | ||
|
||
import * as windowsMetaActions from '../store/windows-meta/windows-meta.action'; | ||
|
||
import { openFile } from '../utils'; | ||
|
||
@Injectable() | ||
export class WindowsMetaEffects { | ||
|
||
exportBackupData$: Observable<Action> = createEffect(() => { | ||
return this.actions$ | ||
.pipe( | ||
ofType(windowsMetaActions.EXPORT_BACKUP_DATA), | ||
switchMap(() => { | ||
this.electronAppService.exportBackupData(); | ||
return EMPTY; | ||
}) | ||
) | ||
}, { dispatch: false }); | ||
|
||
importBackupData$: Observable<Action> = createEffect(() => { | ||
return this.actions$ | ||
.pipe( | ||
ofType(windowsMetaActions.IMPORT_BACKUP_DATA), | ||
switchMap(() => { | ||
openFile({ accept: '.agbkp' }).then((fileContent: string) => { | ||
this.electronAppService.importBackupData(fileContent); | ||
}); | ||
return EMPTY; | ||
}) | ||
) | ||
}, { dispatch: false }); | ||
|
||
constructor( | ||
private actions$: Actions, | ||
private electronAppService: ElectronAppService, | ||
) {} | ||
} |
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
2 changes: 0 additions & 2 deletions
2
packages/altair-app/src/app/modules/altair/store/windows/windows.action.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
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