diff --git a/src/frontend/app/app.module.ts b/src/frontend/app/app.module.ts index bc185208..9e34b8bd 100644 --- a/src/frontend/app/app.module.ts +++ b/src/frontend/app/app.module.ts @@ -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 {SettingsEntryComponent} from './ui/settings/template/settings-entry/settings-entry.component'; import { UsersComponent } from './ui/settings/users/users.component'; +import { SharingsListComponent } from './ui/settings/sharings-list/sharings-list.component'; @Injectable() export class MyHammerConfig extends HammerGestureConfig { @@ -238,6 +239,7 @@ Marker.prototype.options.icon = iconDefault; FileDTOToPathPipe, PhotoFilterPipe, UsersComponent, + SharingsListComponent, ], providers: [ {provide: HTTP_INTERCEPTORS, useClass: CSRFInterceptor, multi: true}, diff --git a/src/frontend/app/ui/admin/admin.component.html b/src/frontend/app/ui/admin/admin.component.html index 3c03e92d..fc376309 100644 --- a/src/frontend/app/ui/admin/admin.component.html +++ b/src/frontend/app/ui/admin/admin.component.html @@ -106,6 +106,7 @@ + diff --git a/src/frontend/app/ui/settings/sharings-list/sharing-list.service.ts b/src/frontend/app/ui/settings/sharings-list/sharing-list.service.ts new file mode 100644 index 00000000..9add6089 --- /dev/null +++ b/src/frontend/app/ui/settings/sharings-list/sharing-list.service.ts @@ -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 { + if (!this.settingsService.settings.value.Sharing.enabled) { + return Promise.resolve([]); + } + return this.networkService.getJson('/share/list'); + } + + public deleteSharing(sharing: SharingDTO): Promise { + return this.networkService.deleteJson('/share/' + sharing.sharingKey); + } +} diff --git a/src/frontend/app/ui/settings/sharings-list/sharings-list.component.css b/src/frontend/app/ui/settings/sharings-list/sharings-list.component.css new file mode 100644 index 00000000..e69de29b diff --git a/src/frontend/app/ui/settings/sharings-list/sharings-list.component.html b/src/frontend/app/ui/settings/sharings-list/sharings-list.component.html new file mode 100644 index 00000000..ac82fff4 --- /dev/null +++ b/src/frontend/app/ui/settings/sharings-list/sharings-list.component.html @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + +
KeyFolderCreatorExpires
{{share.sharingKey}}{{share.path}}{{share.creator.name}}{{share.expires | date}} + +
+
+ + +
+ No sharing was created. +
+
diff --git a/src/frontend/app/ui/settings/sharings-list/sharings-list.component.ts b/src/frontend/app/ui/settings/sharings-list/sharings-list.component.ts new file mode 100644 index 00000000..9bd28f2f --- /dev/null +++ b/src/frontend/app/ui/settings/sharings-list/sharings-list.component.ts @@ -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 { + await this.sharingList.deleteSharing(sharing); + await this.getSharingList(); + } + + private async getSharingList(): Promise { + try { + this.shares = await this.sharingList.getSharingList(); + } catch (err) { + this.shares = []; + throw err; + } + } + +}