Added a new Library Access modal component and moved directory picker into admin _modals directory to keep consistent.
This commit is contained in:
parent
2b33b79f86
commit
8f07ce9b6d
13 changed files with 76 additions and 17 deletions
|
|
@ -1,3 +1,6 @@
|
||||||
export interface Library {
|
export interface Library {
|
||||||
|
name: string;
|
||||||
|
coverImage: string;
|
||||||
|
type: any;
|
||||||
|
folders: string[];
|
||||||
}
|
}
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { BehaviorSubject } from 'rxjs';
|
import { LibraryService } from '../../../_services/library.service';
|
||||||
import { LibraryService } from '../_services/library.service';
|
|
||||||
|
|
||||||
class Stack {
|
class Stack {
|
||||||
items: any[];
|
items: any[];
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
<p>library-access-modal works!</p>
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
import { Component, Input, OnInit } from '@angular/core';
|
||||||
|
import { Member } from 'src/app/_models/member';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-library-access-modal',
|
||||||
|
templateUrl: './library-access-modal.component.html',
|
||||||
|
styleUrls: ['./library-access-modal.component.scss']
|
||||||
|
})
|
||||||
|
export class LibraryAccessModalComponent implements OnInit {
|
||||||
|
|
||||||
|
@Input() member: Member | undefined;
|
||||||
|
|
||||||
|
constructor() { }
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -7,11 +7,20 @@ import { ManageLibraryComponent } from './manage-library/manage-library.componen
|
||||||
import { ManageUsersComponent } from './manage-users/manage-users.component';
|
import { ManageUsersComponent } from './manage-users/manage-users.component';
|
||||||
import { LibraryEditorModalComponent } from './_modals/library-editor-modal/library-editor-modal.component';
|
import { LibraryEditorModalComponent } from './_modals/library-editor-modal/library-editor-modal.component';
|
||||||
import { SharedModule } from '../shared/shared.module';
|
import { SharedModule } from '../shared/shared.module';
|
||||||
|
import { LibraryAccessModalComponent } from './_modals/library-access-modal/library-access-modal.component';
|
||||||
|
import { DirectoryPickerComponent } from './_modals/directory-picker/directory-picker.component';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [ManageUsersComponent, DashboardComponent, ManageLibraryComponent, LibraryEditorModalComponent],
|
declarations: [
|
||||||
|
ManageUsersComponent,
|
||||||
|
DashboardComponent,
|
||||||
|
ManageLibraryComponent,
|
||||||
|
LibraryEditorModalComponent,
|
||||||
|
LibraryAccessModalComponent,
|
||||||
|
DirectoryPickerComponent
|
||||||
|
],
|
||||||
imports: [
|
imports: [
|
||||||
CommonModule,
|
CommonModule,
|
||||||
AdminRoutingModule,
|
AdminRoutingModule,
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,22 @@
|
||||||
<h2>Libraries</h2>
|
<div class="container">
|
||||||
|
<div class="row mb-2">
|
||||||
|
<div class="col-8"><h3>Libraries</h3></div>
|
||||||
|
<div class="col-4"><button class="btn btn-primary pull-right" (click)="addLibrary()">New Library</button></div>
|
||||||
|
</div>
|
||||||
|
<ul class="list-group" *ngIf="!createLibraryToggle; else createLibrary">
|
||||||
|
<li *ngFor="let library of libraries" class="list-group-item">
|
||||||
|
<!-- We can move this into a view-member component -->
|
||||||
|
<div>
|
||||||
|
<div>{{library.name}}</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- <button class="btn btn-primary pull-right" *ngIf="canEditMember(member)">Edit</button> -->
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<ng-template #createLibrary>
|
||||||
|
<app-library-editor-modal></app-library-editor-modal>
|
||||||
|
</ng-template>
|
||||||
|
</div>
|
||||||
|
|
||||||
<button class="btn btn-primary" (click)="addFolder('')">Add Folder</button>
|
<button class="btn btn-primary" (click)="addFolder('')">Add Folder</button>
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { DirectoryPickerComponent, DirectoryPickerResult } from 'src/app/directory-picker/directory-picker.component';
|
|
||||||
import { Library } from 'src/app/_models/library';
|
import { Library } from 'src/app/_models/library';
|
||||||
import { LibraryService } from 'src/app/_services/library.service';
|
import { LibraryService } from 'src/app/_services/library.service';
|
||||||
|
import { DirectoryPickerComponent, DirectoryPickerResult } from '../_modals/directory-picker/directory-picker.component';
|
||||||
import { LibraryEditorModalComponent } from '../_modals/library-editor-modal/library-editor-modal.component';
|
import { LibraryEditorModalComponent } from '../_modals/library-editor-modal/library-editor-modal.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
|
@ -13,6 +13,7 @@ import { LibraryEditorModalComponent } from '../_modals/library-editor-modal/lib
|
||||||
export class ManageLibraryComponent implements OnInit {
|
export class ManageLibraryComponent implements OnInit {
|
||||||
|
|
||||||
libraries: Library[] = [];
|
libraries: Library[] = [];
|
||||||
|
createLibraryToggle = false;
|
||||||
|
|
||||||
constructor(private modalService: NgbModal, private libraryService: LibraryService) { }
|
constructor(private modalService: NgbModal, private libraryService: LibraryService) { }
|
||||||
|
|
||||||
|
|
@ -29,9 +30,7 @@ export class ManageLibraryComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
addFolder(library: string) {
|
addFolder(library: string) {
|
||||||
|
|
||||||
const modalRef = this.modalService.open(DirectoryPickerComponent);
|
const modalRef = this.modalService.open(DirectoryPickerComponent);
|
||||||
//modalRef.componentInstance.name = 'World';
|
|
||||||
modalRef.closed.subscribe((closeResult: DirectoryPickerResult) => {
|
modalRef.closed.subscribe((closeResult: DirectoryPickerResult) => {
|
||||||
console.log('Closed Result', closeResult);
|
console.log('Closed Result', closeResult);
|
||||||
if (closeResult.success) {
|
if (closeResult.success) {
|
||||||
|
|
|
||||||
|
|
@ -9,13 +9,19 @@
|
||||||
<li *ngFor="let member of members" class="list-group-item">
|
<li *ngFor="let member of members" class="list-group-item">
|
||||||
<!-- We can move this into a view-member component -->
|
<!-- We can move this into a view-member component -->
|
||||||
<div>
|
<div>
|
||||||
<div>Name: {{member.username | titlecase}} <span *ngIf="member.isAdmin">(Admin)</span></div>
|
<h4>
|
||||||
<div *ngIf="!member.isAdmin">Sharing: {{member?.libraries ? member?.libraries : 'None'}}</div>
|
{{member.username | titlecase}} <span *ngIf="member.isAdmin" class="badge badge-pill badge-secondary">Admin</span>
|
||||||
|
<div class="pull-right" *ngIf="canEditMember(member)">
|
||||||
|
<button class="btn btn-danger">Delete</button>
|
||||||
|
<button class="btn btn-primary" (click)="openEditLibraryAccess(member)">Edit</button>
|
||||||
|
</div>
|
||||||
|
</h4>
|
||||||
<div>Last Active: {{member.lastActive | date}}</div>
|
<div>Last Active: {{member.lastActive | date}}</div>
|
||||||
|
<div *ngIf="!member.isAdmin">Sharing: {{member?.libraries ? member?.libraries : 'None'}}</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button class="btn btn-primary pull-right" [disabled]="canEditMember(member)">Edit</button>
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<ng-template #createUser>
|
<ng-template #createUser>
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { take } from 'rxjs/operators';
|
import { take } from 'rxjs/operators';
|
||||||
import { DirectoryPickerComponent, DirectoryPickerResult } from 'src/app/directory-picker/directory-picker.component';
|
|
||||||
import { MemberService } from 'src/app/member.service';
|
import { MemberService } from 'src/app/member.service';
|
||||||
import { Member } from 'src/app/_models/member';
|
import { Member } from 'src/app/_models/member';
|
||||||
import { User } from 'src/app/_models/user';
|
import { User } from 'src/app/_models/user';
|
||||||
import { AccountService } from 'src/app/_services/account.service';
|
import { AccountService } from 'src/app/_services/account.service';
|
||||||
|
import { LibraryAccessModalComponent } from '../_modals/library-access-modal/library-access-modal.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-manage-users',
|
selector: 'app-manage-users',
|
||||||
|
|
@ -20,14 +20,13 @@ export class ManageUsersComponent implements OnInit {
|
||||||
// Create User functionality
|
// Create User functionality
|
||||||
createMemberToggle = false;
|
createMemberToggle = false;
|
||||||
|
|
||||||
constructor(private memberService: MemberService, public accountService: AccountService) {
|
constructor(private memberService: MemberService, public accountService: AccountService, private modalService: NgbModal) {
|
||||||
this.accountService.currentUser$.pipe(take(1)).subscribe((user: User) => {
|
this.accountService.currentUser$.pipe(take(1)).subscribe((user: User) => {
|
||||||
this.loggedInUsername = user.username;
|
this.loggedInUsername = user.username;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
console.log('User Component');
|
|
||||||
this.loadMembers();
|
this.loadMembers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -49,4 +48,12 @@ export class ManageUsersComponent implements OnInit {
|
||||||
this.createMemberToggle = false;
|
this.createMemberToggle = false;
|
||||||
this.loadMembers();
|
this.loadMembers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
openEditLibraryAccess(member: Member) {
|
||||||
|
const modalRef = this.modalService.open(LibraryAccessModalComponent);
|
||||||
|
modalRef.componentInstance.member = member;
|
||||||
|
modalRef.closed.subscribe((closeResult: any) => {
|
||||||
|
console.log('Closed Result', closeResult);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ import { UserLoginComponent } from './user-login/user-login.component';
|
||||||
import { ToastrModule } from 'ngx-toastr';
|
import { ToastrModule } from 'ngx-toastr';
|
||||||
import { ErrorInterceptor } from './_interceptors/error.interceptor';
|
import { ErrorInterceptor } from './_interceptors/error.interceptor';
|
||||||
import { LibraryComponent } from './library/library.component';
|
import { LibraryComponent } from './library/library.component';
|
||||||
import { DirectoryPickerComponent } from './directory-picker/directory-picker.component';
|
|
||||||
import { SharedModule } from './shared/shared.module';
|
import { SharedModule } from './shared/shared.module';
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -26,7 +25,6 @@ import { SharedModule } from './shared/shared.module';
|
||||||
NavHeaderComponent,
|
NavHeaderComponent,
|
||||||
UserLoginComponent,
|
UserLoginComponent,
|
||||||
LibraryComponent,
|
LibraryComponent,
|
||||||
DirectoryPickerComponent,
|
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
HttpClientModule,
|
HttpClientModule,
|
||||||
|
|
@ -44,7 +42,7 @@ import { SharedModule } from './shared/shared.module';
|
||||||
{provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptor, multi: true},
|
{provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptor, multi: true},
|
||||||
{provide: HTTP_INTERCEPTORS, useClass: JwtInterceptor, multi: true}
|
{provide: HTTP_INTERCEPTORS, useClass: JwtInterceptor, multi: true}
|
||||||
],
|
],
|
||||||
entryComponents: [DirectoryPickerComponent],
|
entryComponents: [],
|
||||||
bootstrap: [AppComponent]
|
bootstrap: [AppComponent]
|
||||||
})
|
})
|
||||||
export class AppModule { }
|
export class AppModule { }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue