exporting organization data

This commit is contained in:
Kyle Spearrin 2018-07-05 14:40:53 -04:00
parent 9d4e0849d6
commit ba3b2fbed1
8 changed files with 97 additions and 7 deletions

2
jslib

@ -1 +1 @@
Subproject commit 47ab71e73098d1b83a1bdcbae3cd3e2b1d9ccacc
Subproject commit 87e273252be42dab90d9a33857fe7755f378338b

View File

@ -14,7 +14,10 @@ import { LoginComponent } from './accounts/login.component';
import { RegisterComponent } from './accounts/register.component';
import { TwoFactorComponent } from './accounts/two-factor.component';
import { VaultComponent as OrganizationVaultComponent } from './organizations/vault/vault.component';
import { ExportComponent as OrgExportComponent } from './organizations/tools/export.component';
import { ToolsComponent as OrgToolsComponent } from './organizations/tools/tools.component';
import { VaultComponent as OrgVaultComponent } from './organizations/vault/vault.component';
import { AccountComponent } from './settings/account.component';
import { CreateOrganizationComponent } from './settings/create-organization.component';
@ -92,7 +95,16 @@ const routes: Routes = [
component: OrganizationLayoutComponent,
children: [
{ path: '', pathMatch: 'full', redirectTo: 'vault' },
{ path: 'vault', component: OrganizationVaultComponent, canActivate: [AuthGuardService] },
{ path: 'vault', component: OrgVaultComponent, canActivate: [AuthGuardService] },
{
path: 'tools',
component: OrgToolsComponent,
children: [
{ path: '', pathMatch: 'full', redirectTo: 'export' },
// { path: 'import', component: ImportComponent, canActivate: [AuthGuardService] },
{ path: 'export', component: OrgExportComponent, canActivate: [AuthGuardService] },
],
},
],
},
{ path: '**', redirectTo: '' },

View File

@ -32,6 +32,9 @@ import { RegisterComponent } from './accounts/register.component';
import { TwoFactorOptionsComponent } from './accounts/two-factor-options.component';
import { TwoFactorComponent } from './accounts/two-factor.component';
import { ExportComponent as OrgExportComponent } from './organizations/tools/export.component';
import { ToolsComponent as OrgToolsComponent } from './organizations/tools/tools.component';
import { AddEditComponent as OrgAddEditComponent } from './organizations/vault/add-edit.component';
import { AttachmentsComponent as OrgAttachmentsComponent } from './organizations/vault/attachments.component';
import { CiphersComponent as OrgCiphersComponent } from './organizations/vault/ciphers.component';
@ -159,7 +162,9 @@ import { SearchCiphersPipe } from 'jslib/angular/pipes/search-ciphers.pipe';
OrgAttachmentsComponent,
OrgCiphersComponent,
OrgCollectionsComponent,
OrgExportComponent,
OrgGroupingsComponent,
OrgToolsComponent,
OrganizationsComponent,
OrganizationLayoutComponent,
OrgVaultComponent,

View File

@ -0,0 +1,43 @@
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { Component } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { CryptoService } from 'jslib/abstractions/crypto.service';
import { ExportService } from 'jslib/abstractions/export.service';
import { I18nService } from 'jslib/abstractions/i18n.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { UserService } from 'jslib/abstractions/user.service';
import { ExportComponent as BaseExportComponent } from '../../tools/export.component';
@Component({
selector: 'app-org-export',
templateUrl: '../../tools/export.component.html',
})
export class ExportComponent extends BaseExportComponent {
organizationId: string;
constructor(analytics: Angulartics2, toasterService: ToasterService,
cryptoService: CryptoService, userService: UserService,
i18nService: I18nService, platformUtilsService: PlatformUtilsService,
exportService: ExportService, private route: ActivatedRoute, ) {
super(analytics, toasterService, cryptoService, userService, i18nService, platformUtilsService,
exportService);
}
ngOnInit() {
this.route.parent.parent.params.subscribe(async (params) => {
this.organizationId = params.organizationId;
});
}
getExportData() {
return this.exportService.getOrganizationExport(this.organizationId, 'csv');
}
getFileName() {
return super.getFileName('org');
}
}

View File

@ -0,0 +1,20 @@
<div class="container page-content">
<div class="row">
<div class="col-3">
<div class="card">
<div class="card-header">{{'tools' | i18n}}</div>
<div class="list-group list-group-flush">
<a routerLink="import" class="list-group-item" routerLinkActive="active">
{{'import' | i18n}}
</a>
<a routerLink="export" class="list-group-item" routerLinkActive="active">
{{'exportVault' | i18n}}
</a>
</div>
</div>
</div>
<div class="col-9">
<router-outlet></router-outlet>
</div>
</div>
</div>

View File

@ -0,0 +1,9 @@
import {
Component,
} from '@angular/core';
@Component({
selector: 'app-org-tools',
templateUrl: 'tools.component.html',
})
export class ToolsComponent { }

View File

@ -102,7 +102,7 @@ const totpService = new TotpService(storageService, cryptoFunctionService);
const containerService = new ContainerService(cryptoService, platformUtilsService);
const authService = new AuthService(cryptoService, apiService,
userService, tokenService, appIdService, i18nService, platformUtilsService, messagingService);
const exportService = new ExportService(folderService, cipherService);
const exportService = new ExportService(folderService, cipherService, apiService);
const auditService = new AuditService(cryptoFunctionService);
const analytics = new Analytics(window, () => platformUtilsService.isDev(),

View File

@ -1,4 +1,4 @@
<form (ngSubmit)="submit()" ngNativeValidate>
<form #form (ngSubmit)="submit()" ngNativeValidate [appApiAction]="formPromise">
<div class="page-header">
<h1>{{'exportVault' | i18n}}</h1>
</div>
@ -10,7 +10,8 @@
<input id="masterPassword" type="password" name="MasterPassword" class="form-control" [(ngModel)]="masterPassword" required>
</div>
</div>
<button appBlurClick type="submit" class="btn btn-primary">
{{'exportVault' | i18n}}
<button appBlurClick type="submit" class="btn btn-primary btn-submit" [disabled]="form.loading">
<i class="fa fa-spinner fa-spin"></i>
<span>{{'exportVault' | i18n}}</span>
</button>
</form>