Skip to content

Commit

Permalink
Close file redirection issue #192
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanebouget committed Jul 2, 2024
1 parent da9eb94 commit 4fbfd0c
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 22 deletions.
53 changes: 34 additions & 19 deletions src/app/big-file-loading/big-file-loading.component.html
Original file line number Diff line number Diff line change
@@ -1,29 +1,44 @@
<div id="big-file-loading" *ngIf="visible">
Loading very large reports may take more than a minute...
<br />
<span *ngIf="isTextVisible"
>Loading very large reports may take more than a minute...
</span>
<svg
width="20"
height="20"
viewBox="0 0 20 20"
style="width: 100px"
version="1.1"
id="L4"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
x="0px"
y="0px"
viewBox="0 0 100 100"
enable-background="new 0 0 0 0"
xml:space="preserve"
>
<circle cx="10" cy="10" r="8" fill="none" stroke="#000" stroke-width="2" />
<circle
cx="10"
cy="10"
r="8"
fill="none"
stroke="#007bff"
stroke-width="3"
stroke-dasharray="50.2655"
stroke-dashoffset="50.2655"
>
<circle fill="#999" stroke="none" cx="6" cy="50" r="6">
<animate
attributeName="stroke-dashoffset"
begin="0s"
attributeName="opacity"
dur="1s"
values="50.2655;0"
values="0;1;0"
repeatCount="indefinite"
begin="0.1"
/>
</circle>
<circle fill="#999" stroke="none" cx="26" cy="50" r="6">
<animate
attributeName="opacity"
dur="1s"
values="0;1;0"
repeatCount="indefinite"
begin="0.2"
/>
</circle>
<circle fill="#999" stroke="none" cx="46" cy="50" r="6">
<animate
attributeName="opacity"
dur="1s"
values="0;1;0"
repeatCount="indefinite"
begin="0.3"
/>
</circle>
</svg>
Expand Down
2 changes: 1 addition & 1 deletion src/app/big-file-loading/big-file-loading.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
font-family: verdana;
font-size: 0.8rem;
svg {
margin-top: 1rem;
margin-left: 2rem;
}
}
6 changes: 5 additions & 1 deletion src/app/big-file-loading/big-file-loading.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export class BigFileLoadingComponent {
private fileLoaderSub?: Subscription;

visible: boolean = false;
isTextVisible: boolean = false;

constructor(
public fileSystemService: FileSystemService,
Expand All @@ -24,11 +25,14 @@ export class BigFileLoadingComponent {
ngOnInit(): void {
this.fileLoaderSub = this.fileSystemService.fileLoader$.subscribe(
(data: any) => {
if (data?.isBigJsonFile && data?.isLoadingDatas) {
if (data?.isLoadingDatas) {
this.visible = true;
} else {
this.visible = false;
}
if (data?.isBigJsonFile) {
this.isTextVisible = true;
}
this.cdr.detectChanges();
}
);
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/services/file-system.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export class FileSystemService {
this.fileLoaderDatas.datas = undefined;
this.fileLoaderDatas.isLoadingDatas = true;
this.fileLoaderDatas.isBigJsonFile = false;
this._fileLoaderSub.next(this.fileLoaderDatas);

return new Promise((resolve, reject) => {
this.electronService.fs.stat(filename, (err, stats) => {
Expand Down Expand Up @@ -179,7 +180,6 @@ export class FileSystemService {
this.fileLoaderDatas.datas = JSON.parse(datas);
this.fileLoaderDatas.datas.filename = filename;
this._fileLoaderSub.next(this.fileLoaderDatas);

resolve(this.fileLoaderDatas.datas);
}
}
Expand Down

0 comments on commit 4fbfd0c

Please sign in to comment.