Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ngfire/angular/src/lib/auth/services/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ export class AuthService {
firebase.auth().languageCode = langCode;
return firebase.auth()
.sendPasswordResetEmail( email )
.then(() => this._toastService.doSimpleToast('A password reset link has been sent to your email address.'))
.catch(() => this._toastService.doSimpleToast('An error occurred while attempting to reset your password. Please contact support.'));
// .then(() => this._toastService.doSimpleToast('A password reset link has been sent to your email address.'))
// .catch(() => this._toastService.doSimpleToast('An error occurred while attempting to reset your password. Please contact support.'));
}

public createUserWithEmailAndPassword(displayName: string, email: string, password: string, userProfile: UserProfile, roles: Roles)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
<iote-modal>
<div modalTitle>Add folder</div>

<form [formGroup]="createFolderForm" (ngSubmit)="createFolder(createFolderForm.value)">'

<div style="text-align: right"><span (click)="exitModal()" class="close-modal-btn"><i class="fas fa-times-circle"></i></span></div>
<div class="top-subtitle"></div>

<form [formGroup]="createFolderForm" (ngSubmit)="createFolder(createFolderForm.value)">'
<mat-form-field>
<mat-label>Name</mat-label>
<input matInput type="text" formControlName="name" name="name" />
</mat-form-field>

<div footer>
<button type="submit" [disabled]="!createFolderForm.valid"
<div *ngIf="(name.touched || name.dirty)" class="errorMessage">
<mat-error *ngIf="name.errors" >
"Name Already Exists"
</mat-error>
</div>

<div footer>
<button type="submit" [disabled]="!createFolderForm?.valid"
fxLayoutAlign="end" mat-raised-button color="accent">
Create
</button>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.errorMessage {
font-size: 13px;
padding-right: 45px;
margin-top: -10px;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {Component, EventEmitter, OnInit, Input, Output, Inject } from '@angular/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { FormGroup, FormBuilder, Validators, ValidationErrors, ControlContainer } from '@angular/forms';
import { ValidatorFn, AbstractControl } from '@angular/forms';

import * as _ from 'lodash';
import { Logger } from '@iote/bricks-angular';
Expand All @@ -18,29 +19,46 @@ export class AddFolderModalComponent implements OnInit

// Form Data
createFolderForm: FormGroup;

constructor(private _fb: FormBuilder,
private _dialogRef: MatDialogRef<AddFolderModalComponent>,
@Inject(MAT_DIALOG_DATA) private _data: any,
private _logger: Logger)
{}

ngOnInit()
{
this.createFolderForm = this._fb.group({
name: ['', [Validators.required]]
});
}
name: ['', [Validators.required, this.ValidateExisting(this._data.names) ]]
},

// --
// Create Bill
);

}

// Create Bill

createFolder(frm)
{
if(this.createFolderForm.valid)
{
this._dialogRef.close(frm.name);
this._dialogRef.close(frm.name);
}
}

}
exitModal = () => this._dialogRef.close();

ValidateExisting(names: string[]): ValidatorFn
{
return (control: AbstractControl): { [key: string]: any } | null => {
const returnVal = names.includes (control.value)
? { nameExists: true} as ValidationErrors
: null;

return returnVal
}
}
get name(){
return this.createFolderForm.get('name');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import { MatDialog } from '@angular/material/dialog';
import { AddFolderModalComponent } from '../add-folder-modal/add-folder-modal.component';
import { DELETE_DIALOG_WIDTH } from '@iote/ui-workflows';
import { SubSink } from 'subsink';
import { ChildActivationEnd } from '@angular/router';

import { BehaviorSubject } from 'rxjs';


@Component({
selector: 'ngfire-file-manager-breadcrumbs',
Expand Down Expand Up @@ -44,10 +48,13 @@ export class FileManagerCrumbComponent implements OnInit, OnDestroy
filesSelected = (files: any) => this.curr.upload(files.target.files).subscribe();

addFolder() {
this._sbS.sink = this._dialog.open(AddFolderModalComponent, { width: DELETE_DIALOG_WIDTH })
const names: string[] = this.curr.children.map(child => child.name)
this._sbS.sink = this._dialog.open(AddFolderModalComponent,
{width: DELETE_DIALOG_WIDTH, data: { names }})
.afterClosed()
.subscribe(name =>
this._sbS.sink = this.curr.addFolder(name).subscribe());
.subscribe(
name =>
this._sbS.sink = this.curr.addFolder(name).subscribe());
}

private _toCrumbs(position: FolderIterator, first?: boolean) : FileManagerCrumb[]
Expand Down