Finished upload logic
This commit is contained in:
parent
b607424d8a
commit
cd9a800bf0
@ -98,9 +98,12 @@
|
||||
<p class="text-sm text-gray-500 mt-1">Your file is now securely stored on our servers.</p>
|
||||
|
||||
<div class="mt-4 flex flex-col w-full items-center">
|
||||
<button class="btn btn-success w-full max-w-xs text-white">Copy URL</button>
|
||||
<button class="btn btn-primary mt-2 w-full max-w-xs">Upload Another File</button>
|
||||
<button class="btn btn-outline btn-secondary mt-2 w-full max-w-xs">Delete this file</button>
|
||||
<button class="btn btn-success w-full max-w-xs text-white" (click)="copyUrlToClipboard(this.fileUrls?.downloadUrl)">
|
||||
<div *ngIf="!urlCopied">Copy Download URL</div>
|
||||
<div *ngIf="urlCopied"><img width="20" src="./assets/check-solid.svg" alt="kk"></div>
|
||||
</button>
|
||||
<button class="btn btn-primary mt-2 w-full max-w-xs" routerLink="/home">Home</button>
|
||||
<button class="btn btn-outline btn-secondary mt-2 w-full max-w-xs" disabled>Delete this file</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -109,5 +112,6 @@
|
||||
<!-- Invisible SVGs to prevent lazy loading -->
|
||||
<div class="invisible h-0 w-0">
|
||||
<img src="./assets/file-solid.svg">
|
||||
<img src="./assets/check-solid.svg">
|
||||
<img src="./assets/circle-check-solid.svg">
|
||||
</div>
|
||||
|
@ -4,6 +4,7 @@ import {FormatFileSizePipePipe} from "../format-file-size-pipe.pipe";
|
||||
import {FormsModule} from "@angular/forms";
|
||||
import axios, {AxiosProgressEvent} from "axios";
|
||||
import { DevelopmentStore } from '../../store/DevelopmentStore';
|
||||
import {RouterLink} from "@angular/router";
|
||||
|
||||
@Component({
|
||||
selector: 'app-upload',
|
||||
@ -13,7 +14,8 @@ import { DevelopmentStore } from '../../store/DevelopmentStore';
|
||||
FormatFileSizePipePipe,
|
||||
FormsModule,
|
||||
DecimalPipe,
|
||||
NgClass
|
||||
NgClass,
|
||||
RouterLink
|
||||
],
|
||||
templateUrl: './upload.component.html',
|
||||
styleUrl: './upload.component.scss'
|
||||
@ -36,6 +38,7 @@ export class UploadComponent {
|
||||
|
||||
uploadData: FileDetails | null = null;
|
||||
fileUrls: { downloadUrl: string, statusUrl: string, deleteUrl: string } | null = null;
|
||||
urlCopied: boolean = false;
|
||||
|
||||
|
||||
constructor(private developmentStore: DevelopmentStore) {
|
||||
@ -184,6 +187,17 @@ export class UploadComponent {
|
||||
this.uploadProgress = this.targetUploadProgress;
|
||||
}
|
||||
}
|
||||
|
||||
copyUrlToClipboard(url: string | undefined) {
|
||||
if(url) {
|
||||
navigator.clipboard.writeText(url).then(() => {
|
||||
this.urlCopied = true;
|
||||
console.log('Text successfully copied to clipboard');
|
||||
}).catch(err => {
|
||||
console.error('Failed to copy text to clipboard', err);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
interface FileDetails {
|
||||
fileId: string;
|
||||
|
1
frontend/src/assets/check-solid.svg
Normal file
1
frontend/src/assets/check-solid.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path fill="#fff" d="M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"/></svg>
|
After Width: | Height: | Size: 424 B |
@ -58,7 +58,10 @@ public class FileService {
|
||||
|
||||
String fileId = fileIdService.generateNewUniqueId();
|
||||
|
||||
String password = fileSecurityService.generateFilePassword(); // TODO: generate password
|
||||
String password = "";
|
||||
if (passwordProtected) {
|
||||
password = fileSecurityService.generateFilePassword();
|
||||
}
|
||||
|
||||
FileUpload fileUpload = FileUpload.builder()
|
||||
.fileId(fileId)
|
||||
|
Loading…
x
Reference in New Issue
Block a user