mirror of
https://github.com/bpatrik/pigallery2.git
synced 2025-01-10 04:07:35 +02:00
Add missing sharing listing #569
This commit is contained in:
parent
c672b9823a
commit
13410b5d1c
@ -104,6 +104,7 @@ import { JobButtonComponent } from './ui/settings/workflow/button/job-button.set
|
|||||||
import { JobProgressComponent } from './ui/settings/workflow/progress/job-progress.settings.component';
|
import { JobProgressComponent } from './ui/settings/workflow/progress/job-progress.settings.component';
|
||||||
import {SettingsEntryComponent} from './ui/settings/template/settings-entry/settings-entry.component';
|
import {SettingsEntryComponent} from './ui/settings/template/settings-entry/settings-entry.component';
|
||||||
import { UsersComponent } from './ui/settings/users/users.component';
|
import { UsersComponent } from './ui/settings/users/users.component';
|
||||||
|
import { SharingsListComponent } from './ui/settings/sharings-list/sharings-list.component';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class MyHammerConfig extends HammerGestureConfig {
|
export class MyHammerConfig extends HammerGestureConfig {
|
||||||
@ -238,6 +239,7 @@ Marker.prototype.options.icon = iconDefault;
|
|||||||
FileDTOToPathPipe,
|
FileDTOToPathPipe,
|
||||||
PhotoFilterPipe,
|
PhotoFilterPipe,
|
||||||
UsersComponent,
|
UsersComponent,
|
||||||
|
SharingsListComponent,
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
{provide: HTTP_INTERCEPTORS, useClass: CSRFInterceptor, multi: true},
|
{provide: HTTP_INTERCEPTORS, useClass: CSRFInterceptor, multi: true},
|
||||||
|
@ -106,6 +106,7 @@
|
|||||||
<app-settings-gallery-statistic></app-settings-gallery-statistic>
|
<app-settings-gallery-statistic></app-settings-gallery-statistic>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<app-settings-users *ngIf="cp=='Users'"></app-settings-users>
|
<app-settings-users *ngIf="cp=='Users'"></app-settings-users>
|
||||||
|
<app-settigns-sharings-list *ngIf="cp=='Sharing'"></app-settigns-sharings-list>
|
||||||
</app-settings-template>
|
</app-settings-template>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -0,0 +1,26 @@
|
|||||||
|
import {Injectable} from '@angular/core';
|
||||||
|
import {SharingDTO} from '../../../../../common/entities/SharingDTO';
|
||||||
|
import {NetworkService} from '../../../model/network/network.service';
|
||||||
|
import {SettingsService} from '../settings.service';
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class SharingListService {
|
||||||
|
|
||||||
|
constructor(private networkService: NetworkService,
|
||||||
|
private settingsService: SettingsService) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public getSharingList(): Promise<SharingDTO[]> {
|
||||||
|
if (!this.settingsService.settings.value.Sharing.enabled) {
|
||||||
|
return Promise.resolve([]);
|
||||||
|
}
|
||||||
|
return this.networkService.getJson('/share/list');
|
||||||
|
}
|
||||||
|
|
||||||
|
public deleteSharing(sharing: SharingDTO): Promise<void> {
|
||||||
|
return this.networkService.deleteJson('/share/' + sharing.sharingKey);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
|
||||||
|
<ng-container *ngIf="shares && shares.length >0">
|
||||||
|
<table class="table table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th i18n>Key</th>
|
||||||
|
<th i18n>Folder</th>
|
||||||
|
<th i18n>Creator</th>
|
||||||
|
<th i18n>Expires</th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr *ngFor="let share of shares">
|
||||||
|
<td>{{share.sharingKey}}</td>
|
||||||
|
<td>{{share.path}}</td>
|
||||||
|
<td>{{share.creator.name}}</td>
|
||||||
|
<td>{{share.expires | date}}</td>
|
||||||
|
<td>
|
||||||
|
<button (click)="deleteSharing(share)" class="btn btn-danger float-end">
|
||||||
|
<span class="oi oi-trash" aria-hidden="true" aria-label="Delete"></span>
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container *ngIf="!shares || shares.length == 0">
|
||||||
|
<div class="panel-info" i18n>
|
||||||
|
No sharing was created.
|
||||||
|
</div>
|
||||||
|
</ng-container>
|
@ -0,0 +1,35 @@
|
|||||||
|
import {Component, OnInit} from '@angular/core';
|
||||||
|
import {SharingDTO} from '../../../../../common/entities/SharingDTO';
|
||||||
|
import {SharingListService} from './sharing-list.service';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-settigns-sharings-list',
|
||||||
|
templateUrl: './sharings-list.component.html',
|
||||||
|
styleUrls: ['./sharings-list.component.css']
|
||||||
|
})
|
||||||
|
export class SharingsListComponent implements OnInit {
|
||||||
|
|
||||||
|
public shares: SharingDTO[] = [];
|
||||||
|
|
||||||
|
constructor(public sharingList: SharingListService) {
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.getSharingList();
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteSharing(sharing: SharingDTO): Promise<void> {
|
||||||
|
await this.sharingList.deleteSharing(sharing);
|
||||||
|
await this.getSharingList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async getSharingList(): Promise<void> {
|
||||||
|
try {
|
||||||
|
this.shares = await this.sharingList.getSharingList();
|
||||||
|
} catch (err) {
|
||||||
|
this.shares = [];
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user