Skip to content

Commit

Permalink
Merge pull request #439 from DigitalExcellence/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
RubenFricke authored Mar 19, 2021
2 parents 3bf28e9 + a1f5b85 commit 5e4f844
Show file tree
Hide file tree
Showing 33 changed files with 594 additions and 63 deletions.
12 changes: 10 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Deprecated


### Removed


### Fixed

### Security



## Release v.1.1.0-beta - 18-03-2021

### Fixed

- Fixed list view animation bug which prevented like animation from playing - [#419](https://github.com/DigitalExcellence/dex-frontend/issues/419)
- Auto dismiss the login warning when liking project if you're not logged in - [#433](https://github.com/DigitalExcellence/dex-frontend/issues/433)
- Hide the active modal when you navigate to another page via browser navigation arrows - [#423](https://github.com/DigitalExcellence/dex-frontend/issues/423)

## Release v.1.0.1-beta - 31-01-2021

### Added
Expand Down
19 changes: 19 additions & 0 deletions src/app/components/file-uploader/DndDirective.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/*
*
* Digital Excellence Copyright (C) 2020 Brend Smits
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You can find a copy of the GNU Lesser General Public License
* along with this program, in the LICENSE.md file in the root project directory.
* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt
*
*/

import {
Directive,
Output,
Expand Down
33 changes: 26 additions & 7 deletions src/app/components/file-uploader/file-uploader.component.html
Original file line number Diff line number Diff line change
@@ -1,30 +1,49 @@
<!--
Digital Excellence Copyright (C) 2020 Brend Smits
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation version 3 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You can find a copy of the GNU Lesser General Public License
along with this program, in the LICENSE.md file in the root project directory.
If not, see https://www.gnu.org/licenses/lgpl-3.0.txt
-->

<div class="container" DndDirective>
<input type="file" #fileDropRef id="fileDropRef" (change)="fileBrowseHandler($event.target)"
[multiple]="acceptMultiple" [accept]="acceptedTypes.join(',')" />
<img src="assets/images/file-dnd.svg" alt="file-dnd-icon">
<label for="fileDropRef">
<strong>Choose a file</strong>
<span class="box__dragndrop"> or drag it here</span>.
<strong>Choose a file</strong>
<span class="box__dragndrop"> or drag it here</span>.
</label>
</div>
<div class="files-list">
<div class="single-file" *ngFor="let file of files; let i = index">
<div class="file-info">
<button type="button" class="btn btn-icon btn-danger" aria-label="error"
(click)="deleteFile(i)"><span aria-hidden="true">&times;</span>
<button type="button" class="btn btn-icon btn-danger" aria-label="error" (click)="deleteFile(i)"><span
aria-hidden="true">&times;</span>
</button>
<img alt="image-preview" class="file-icon" [src]=file?.preview >
<img alt="image-preview" class="file-icon" [src]=file?.preview>
<h4 class="file-name">
{{ file?.name }}
</h4>
<h4 class="file-size">
{{ file?.readableSize }}
</h4>
</div>
<div *ngIf="file.progress" class="file-progress" >
<div *ngIf="file.progress" class="file-progress">
<div class="progress-bar" id="progress-bar-{{i}}" [style.width]="file.progress + '%'">{{file.progress}}%
</div>
</div>

</div>
</div>
</div>
18 changes: 18 additions & 0 deletions src/app/components/file-uploader/file-uploader.component.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
*
* Digital Excellence Copyright (C) 2020 Brend Smits
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You can find a copy of the GNU Lesser General Public License
* along with this program, in the LICENSE.md file in the root project directory.
* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt
*
*/
@import "assets/styles/variables";

.container {
Expand Down
70 changes: 46 additions & 24 deletions src/app/components/file-uploader/file-uploader.component.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/*
*
* Digital Excellence Copyright (C) 2020 Brend Smits
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You can find a copy of the GNU Lesser General Public License
* along with this program, in the LICENSE.md file in the root project directory.
* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt
*
*/

import { Component, ElementRef, Input, ViewChild } from '@angular/core';
import { HttpEventType } from '@angular/common/http';
import { forkJoin, Observable, of } from 'rxjs';
Expand Down Expand Up @@ -33,9 +52,10 @@ export class FileUploaderComponent {
*/
private maxFileSizeReadable: string = this.formatBytes(this.maxFileSize, 0);

constructor(private uploadService: FileUploaderService,
private alertService: AlertService,
private fileRetrieverService: FileRetrieverService) { }
constructor(
private uploadService: FileUploaderService,
private alertService: AlertService,
private fileRetrieverService: FileRetrieverService) { }

files: Array<UploadFile> = new Array<UploadFile>();

Expand All @@ -50,9 +70,9 @@ export class FileUploaderComponent {
* handle file from the file explorer
*/
public fileBrowseHandler(files): void {
if (files.files !== this.files) {
if (files.files !== this.files) {
this.prepareFilesList(files.files);
}
}
}

/**
Expand All @@ -71,7 +91,7 @@ export class FileUploaderComponent {
*/
private prepareFilesList(files: Array<UploadFile>): void {
// If the user can only select 1 image we want to reset the array
if ( !this.acceptMultiple) {
if (!this.acceptMultiple) {
this.files = [];
}
for (const file of files) {
Expand Down Expand Up @@ -148,23 +168,24 @@ export class FileUploaderComponent {
// Check if any files were uploaded
if (this.fileInput.nativeElement.value !== '') {
// Map all the files to an observable
const fileUploads = this.files.map(file => this.uploadService.uploadFile(file)
.pipe(
map(event => {
switch (event.type) {
case HttpEventType.UploadProgress:
// divide the (uploaded bytes * 100) by the total bytes to calculate the progress in percentage
this.files.find(value => value.name === file.name).progress = Math.round(event.loaded * 100 / event.total);
break;
case HttpEventType.Response:
return event.body;
default:
return;
}})
)
const fileUploads = this.files.map(file => this.uploadService.uploadFile(file)
.pipe(
map(event => {
switch (event.type) {
case HttpEventType.UploadProgress:
// divide the (uploaded bytes * 100) by the total bytes to calculate the progress in percentage
this.files.find(value => value.name === file.name).progress = Math.round(event.loaded * 100 / event.total);
break;
case HttpEventType.Response:
return event.body;
default:
return;
}
})
)
);
// forkJoin the observables so they can be uploaded at the same time
return forkJoin(fileUploads);
// forkJoin the observables so they can be uploaded at the same time
return forkJoin(fileUploads);
}
// If no files were updated return original list

Expand All @@ -189,7 +210,8 @@ export class FileUploaderComponent {
this.files.push({
...uploadedFile,
preview: this.fileRetrieverService.getIconUrl(uploadedFile)
});
}});
});
}
});
}
}
19 changes: 19 additions & 0 deletions src/app/components/not-found/not-found.component.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
<!--
Digital Excellence Copyright (C) 2020 Brend Smits
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation version 3 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You can find a copy of the GNU Lesser General Public License
along with this program, in the LICENSE.md file in the root project directory.
If not, see https://www.gnu.org/licenses/lgpl-3.0.txt
-->

<div class="row">
<div class="col-12 container-not-found">
<h1 class="large">404</h1>
Expand Down
19 changes: 19 additions & 0 deletions src/app/components/not-found/not-found.component.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/*
*
* Digital Excellence Copyright (C) 2020 Brend Smits
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You can find a copy of the GNU Lesser General Public License
* along with this program, in the LICENSE.md file in the root project directory.
* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt
*
*/

import { Component } from '@angular/core';

/**
Expand Down
19 changes: 19 additions & 0 deletions src/app/config/resource-config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/*
*
* Digital Excellence Copyright (C) 2020 Brend Smits
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You can find a copy of the GNU Lesser General Public License
* along with this program, in the LICENSE.md file in the root project directory.
* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt
*
*/

import { environment } from 'src/environments/environment';

export interface ResourceConfig {
Expand Down
2 changes: 1 addition & 1 deletion src/app/interceptors/http.interceptor.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { API_CONFIG } from 'src/app/config/api-config';
/*
* Digital Excellence Copyright (C) 2020 Brend Smits
*
Expand All @@ -15,6 +14,7 @@ import { API_CONFIG } from 'src/app/config/api-config';
* along with this program, in the LICENSE.md file in the root project directory.
* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt
*/
import { API_CONFIG } from 'src/app/config/api-config';
import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { EMPTY, Observable } from 'rxjs';
Expand Down
19 changes: 19 additions & 0 deletions src/app/interfaces/select-form-option.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/*
*
* Digital Excellence Copyright (C) 2020 Brend Smits
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You can find a copy of the GNU Lesser General Public License
* along with this program, in the LICENSE.md file in the root project directory.
* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt
*
*/

/**
* Interface to define a select field form option.
*/
Expand Down
19 changes: 19 additions & 0 deletions src/app/models/domain/embedded-project.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/*
*
* Digital Excellence Copyright (C) 2020 Brend Smits
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You can find a copy of the GNU Lesser General Public License
* along with this program, in the LICENSE.md file in the root project directory.
* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt
*
*/

import { User } from './user';
import { Project } from './project';

Expand Down
19 changes: 19 additions & 0 deletions src/app/models/domain/projectLike.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/*
*
* Digital Excellence Copyright (C) 2020 Brend Smits
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You can find a copy of the GNU Lesser General Public License
* along with this program, in the LICENSE.md file in the root project directory.
* If not, see https://www.gnu.org/licenses/lgpl-3.0.txt
*
*/

export interface ProjectLike {
userId: number;
data: Date;
Expand Down
Loading

0 comments on commit 5e4f844

Please sign in to comment.