✨ Loader for anchoring download
This commit is contained in:
parent
c8c30c05c5
commit
6138f774f6
@ -48,6 +48,7 @@ type IState = {
|
|||||||
hasValidateAnchoring: boolean;
|
hasValidateAnchoring: boolean;
|
||||||
isVerifDeleteModalVisible: boolean;
|
isVerifDeleteModalVisible: boolean;
|
||||||
isPreventArchiveModalOpen: boolean;
|
isPreventArchiveModalOpen: boolean;
|
||||||
|
loadingAnchoring: boolean;
|
||||||
};
|
};
|
||||||
class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
||||||
public constructor(props: IPropsClass) {
|
public constructor(props: IPropsClass) {
|
||||||
@ -59,6 +60,7 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
|||||||
hasValidateAnchoring: false,
|
hasValidateAnchoring: false,
|
||||||
isVerifDeleteModalVisible: false,
|
isVerifDeleteModalVisible: false,
|
||||||
isPreventArchiveModalOpen: false,
|
isPreventArchiveModalOpen: false,
|
||||||
|
loadingAnchoring: false,
|
||||||
};
|
};
|
||||||
this.openArchivedModal = this.openArchivedModal.bind(this);
|
this.openArchivedModal = this.openArchivedModal.bind(this);
|
||||||
this.closeArchivedModal = this.closeArchivedModal.bind(this);
|
this.closeArchivedModal = this.closeArchivedModal.bind(this);
|
||||||
@ -159,8 +161,16 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
|||||||
{this.props.isAnchored === AnchorStatus.VERIFIED_ON_CHAIN && (
|
{this.props.isAnchored === AnchorStatus.VERIFIED_ON_CHAIN && (
|
||||||
<Button
|
<Button
|
||||||
variant={EButtonVariant.PRIMARY}
|
variant={EButtonVariant.PRIMARY}
|
||||||
onClick={() => this.downloadAnchoringProof(this.props.selectedFolder?.uid)}>
|
onClick={() => this.downloadAnchoringProof(this.props.selectedFolder?.uid)}
|
||||||
|
disabled={this.state.loadingAnchoring}>
|
||||||
Télécharger la preuve d'ancrage
|
Télécharger la preuve d'ancrage
|
||||||
|
{this.state.loadingAnchoring && (
|
||||||
|
<div className={classes["loader-container"]}>
|
||||||
|
<div className={classes["loader"]}>
|
||||||
|
<Loader />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
@ -339,7 +349,7 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
|||||||
|
|
||||||
private async downloadAnchoringProof(uid?: string) {
|
private async downloadAnchoringProof(uid?: string) {
|
||||||
if (!uid) return;
|
if (!uid) return;
|
||||||
|
this.setState({ loadingAnchoring: true });
|
||||||
try {
|
try {
|
||||||
const file: Blob = await OfficeFolderAnchors.getInstance().download(uid);
|
const file: Blob = await OfficeFolderAnchors.getInstance().download(uid);
|
||||||
const url = window.URL.createObjectURL(file);
|
const url = window.URL.createObjectURL(file);
|
||||||
@ -351,7 +361,9 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
|||||||
document.body.appendChild(a);
|
document.body.appendChild(a);
|
||||||
a.click();
|
a.click();
|
||||||
window.URL.revokeObjectURL(url);
|
window.URL.revokeObjectURL(url);
|
||||||
|
this.setState({ loadingAnchoring: false });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
this.setState({ loadingAnchoring: false });
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
.loader {
|
.loader {
|
||||||
width: 40px;
|
width: 21px;
|
||||||
height: 40px;
|
height: 21px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@ type IPropsClass = IProps & {
|
|||||||
type IState = {
|
type IState = {
|
||||||
selectedFolder: OfficeFolder | null;
|
selectedFolder: OfficeFolder | null;
|
||||||
isArchivedModalOpen: boolean;
|
isArchivedModalOpen: boolean;
|
||||||
|
loadingAnchoring: boolean;
|
||||||
};
|
};
|
||||||
class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
||||||
public constructor(props: IPropsClass) {
|
public constructor(props: IPropsClass) {
|
||||||
@ -39,6 +40,7 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
|||||||
this.state = {
|
this.state = {
|
||||||
selectedFolder: null,
|
selectedFolder: null,
|
||||||
isArchivedModalOpen: false,
|
isArchivedModalOpen: false,
|
||||||
|
loadingAnchoring: false,
|
||||||
};
|
};
|
||||||
this.onSelectedFolder = this.onSelectedFolder.bind(this);
|
this.onSelectedFolder = this.onSelectedFolder.bind(this);
|
||||||
this.openArchivedModal = this.openArchivedModal.bind(this);
|
this.openArchivedModal = this.openArchivedModal.bind(this);
|
||||||
@ -119,8 +121,16 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
|||||||
{this.props.isAnchored === AnchorStatus.VERIFIED_ON_CHAIN && (
|
{this.props.isAnchored === AnchorStatus.VERIFIED_ON_CHAIN && (
|
||||||
<Button
|
<Button
|
||||||
variant={EButtonVariant.PRIMARY}
|
variant={EButtonVariant.PRIMARY}
|
||||||
onClick={() => this.downloadAnchoringProof(this.props.selectedFolder?.uid)}>
|
onClick={() => this.downloadAnchoringProof(this.props.selectedFolder?.uid)}
|
||||||
|
disabled={this.state.loadingAnchoring}>
|
||||||
Télécharger la preuve d'ancrage
|
Télécharger la preuve d'ancrage
|
||||||
|
{this.state.loadingAnchoring && (
|
||||||
|
<div className={classes["loader-container"]}>
|
||||||
|
<div className={classes["loader"]}>
|
||||||
|
<Loader />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@ -180,7 +190,7 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
|||||||
|
|
||||||
private async downloadAnchoringProof(uid?: string) {
|
private async downloadAnchoringProof(uid?: string) {
|
||||||
if (!uid) return;
|
if (!uid) return;
|
||||||
|
this.setState({ loadingAnchoring: true });
|
||||||
try {
|
try {
|
||||||
const file: Blob = await OfficeFolderAnchors.getInstance().download(uid);
|
const file: Blob = await OfficeFolderAnchors.getInstance().download(uid);
|
||||||
const url = window.URL.createObjectURL(file);
|
const url = window.URL.createObjectURL(file);
|
||||||
@ -192,7 +202,9 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
|||||||
document.body.appendChild(a);
|
document.body.appendChild(a);
|
||||||
a.click();
|
a.click();
|
||||||
window.URL.revokeObjectURL(url);
|
window.URL.revokeObjectURL(url);
|
||||||
|
this.setState({ loadingAnchoring: false });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
this.setState({ loadingAnchoring: false });
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user