mirror of https://github.com/ghostfolio/ghostfolio
Browse Source
* Add user interface for granting and revoking public access * Update changelogpull/440/head
Thomas Kaul
3 years ago
committed by
GitHub
23 changed files with 401 additions and 29 deletions
@ -0,0 +1 @@ |
|||
export class CreateAccessDto {} |
@ -0,0 +1,37 @@ |
|||
import { |
|||
ChangeDetectionStrategy, |
|||
Component, |
|||
Inject, |
|||
OnDestroy |
|||
} from '@angular/core'; |
|||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; |
|||
import { Subject } from 'rxjs'; |
|||
|
|||
import { CreateOrUpdateAccessDialogParams } from './interfaces/interfaces'; |
|||
|
|||
@Component({ |
|||
changeDetection: ChangeDetectionStrategy.OnPush, |
|||
host: { class: 'h-100' }, |
|||
selector: 'gf-create-or-update-access-dialog', |
|||
styleUrls: ['./create-or-update-access-dialog.scss'], |
|||
templateUrl: 'create-or-update-access-dialog.html' |
|||
}) |
|||
export class CreateOrUpdateAccessDialog implements OnDestroy { |
|||
private unsubscribeSubject = new Subject<void>(); |
|||
|
|||
public constructor( |
|||
public dialogRef: MatDialogRef<CreateOrUpdateAccessDialog>, |
|||
@Inject(MAT_DIALOG_DATA) public data: CreateOrUpdateAccessDialogParams |
|||
) {} |
|||
|
|||
ngOnInit() {} |
|||
|
|||
public onCancel(): void { |
|||
this.dialogRef.close(); |
|||
} |
|||
|
|||
public ngOnDestroy() { |
|||
this.unsubscribeSubject.next(); |
|||
this.unsubscribeSubject.complete(); |
|||
} |
|||
} |
@ -0,0 +1,25 @@ |
|||
<form #addAccessForm="ngForm" class="d-flex flex-column h-100"> |
|||
<h1 i18n mat-dialog-title>Grant access</h1> |
|||
<div class="flex-grow-1" mat-dialog-content> |
|||
<div> |
|||
<mat-form-field appearance="outline" class="w-100"> |
|||
<mat-label i18n>Type</mat-label> |
|||
<mat-select name="type" required [(value)]="data.access.type"> |
|||
<mat-option i18n value="PUBLIC">Public</mat-option> |
|||
</mat-select> |
|||
</mat-form-field> |
|||
</div> |
|||
</div> |
|||
<div class="justify-content-end" mat-dialog-actions> |
|||
<button i18n mat-button (click)="onCancel()">Cancel</button> |
|||
<button |
|||
color="primary" |
|||
i18n |
|||
mat-flat-button |
|||
[disabled]="!addAccessForm.form.valid" |
|||
[mat-dialog-close]="data" |
|||
> |
|||
Save |
|||
</button> |
|||
</div> |
|||
</form> |
@ -0,0 +1,25 @@ |
|||
import { CommonModule } from '@angular/common'; |
|||
import { NgModule } from '@angular/core'; |
|||
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; |
|||
import { MatButtonModule } from '@angular/material/button'; |
|||
import { MatDialogModule } from '@angular/material/dialog'; |
|||
import { MatFormFieldModule } from '@angular/material/form-field'; |
|||
import { MatSelectModule } from '@angular/material/select'; |
|||
|
|||
import { CreateOrUpdateAccessDialog } from './create-or-update-access-dialog.component'; |
|||
|
|||
@NgModule({ |
|||
declarations: [CreateOrUpdateAccessDialog], |
|||
exports: [], |
|||
imports: [ |
|||
CommonModule, |
|||
FormsModule, |
|||
MatButtonModule, |
|||
MatDialogModule, |
|||
MatFormFieldModule, |
|||
MatSelectModule, |
|||
ReactiveFormsModule |
|||
], |
|||
providers: [] |
|||
}) |
|||
export class GfCreateOrUpdateAccessDialogModule {} |
@ -0,0 +1,7 @@ |
|||
:host { |
|||
display: block; |
|||
|
|||
.mat-dialog-content { |
|||
max-height: unset; |
|||
} |
|||
} |
@ -0,0 +1,5 @@ |
|||
import { Access } from '@ghostfolio/common/interfaces'; |
|||
|
|||
export interface CreateOrUpdateAccessDialogParams { |
|||
access: Access; |
|||
} |
Loading…
Reference in new issue