1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-21 18:53:29 +00:00

cipher attachments

This commit is contained in:
Kyle Spearrin
2018-04-11 13:51:09 -04:00
parent 2005e00f27
commit f725aa9a60
6 changed files with 111 additions and 2 deletions

View File

@@ -82,6 +82,11 @@ export class AddEditComponent extends BaseAddEditComponent implements OnInit {
return false;
}
attachments() {
super.attachments();
this.router.navigate(['/attachments'], { queryParams: { cipherId: this.cipher.id } });
}
cancel() {
super.cancel();
this.location.back();

View File

@@ -0,0 +1,53 @@
<form #form (ngSubmit)="submit()" [appApiAction]="formPromise">
<header>
<div class="left">
<button type="button" appBlurClick (click)="back()">
<span class="header-icon"><i class="fa fa-chevron-left"></i></span>
<span>{{'back' | i18n}}</span>
</button>
</div>
<div class="center">
<span class="title">{{'attachments' | i18n}}</span>
</div>
<div class="right">
<button type="submit" appBlurClick [disabled]="form.loading">
<span [hidden]="form.loading">{{'save' | i18n}}</span>
<i class="fa fa-spinner fa-lg fa-spin" [hidden]="!form.loading"></i>
</button>
</div>
</header>
<content>
<div class="box" *ngIf="cipher && cipher.hasAttachments">
<div class="box-content no-hover">
<div class="box-content-row box-content-row-flex" *ngFor="let a of cipher.attachments">
<div class="row-main">
{{a.fileName}}
</div>
<small class="row-sub-label">{{a.sizeName}}</small>
<div class="action-buttons no-pad">
<button class="row-btn btn" type="button" appStopClick appBlurClick title="{{'delete' | i18n}}"
(click)="delete(a)" #deleteBtn [appApiAction]="deletePromises[a.id]"
[disabled]="deleteBtn.loading">
<i class="fa fa-trash-o fa-lg fa-fw" [hidden]="deleteBtn.loading"></i>
<i class="fa fa-spinner fa-spin fa-lg fa-fw" [hidden]="!deleteBtn.loading"></i>
</button>
</div>
</div>
</div>
</div>
<div class="box">
<div class="box-header">
{{'newAttachment' | i18n}}
</div>
<div class="box-content no-hover">
<div class="box-content-row">
<label for="file">{{'file' | i18n}}</label>
<input type="file" id="file" name="file" required>
</div>
</div>
<div class="box-footer">
{{'maxFileSize' | i18n}}
</div>
</div>
</content>
</form>

View File

@@ -0,0 +1,40 @@
import { Location } from '@angular/common';
import { Component } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { CipherService } from 'jslib/abstractions/cipher.service';
import { CryptoService } from 'jslib/abstractions/crypto.service';
import { I18nService } from 'jslib/abstractions/i18n.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { TokenService } from 'jslib/abstractions/token.service';
import { AttachmentsComponent as BaseAttachmentsComponent } from 'jslib/angular/components/attachments.component';
@Component({
selector: 'app-vault-attachments',
templateUrl: 'attachments.component.html',
})
export class AttachmentsComponent extends BaseAttachmentsComponent {
constructor(cipherService: CipherService, analytics: Angulartics2,
toasterService: ToasterService, i18nService: I18nService,
cryptoService: CryptoService, tokenService: TokenService,
platformUtilsService: PlatformUtilsService, private location: Location,
private route: ActivatedRoute) {
super(cipherService, analytics, toasterService, i18nService, cryptoService, tokenService,
platformUtilsService);
}
async ngOnInit() {
this.route.queryParams.subscribe(async (params) => {
this.cipherId = params.cipherId;
await super.ngOnInit();
});
}
back() {
this.location.back();
}
}