Reformat loading thing

This commit is contained in:
Alex 2022-02-28 21:45:43 +01:00
parent 51d96396ef
commit 7e324ec541
Signed by: lx
GPG key ID: 0E496D15096376BE

View file

@ -151,15 +151,6 @@ class ObjectList extends React.Component<Props, State> {
}
render() {
if (!this.state.loaded) {
return (
<>
{ this.renderBreadcrumbs() }
<Alert variant="secondary">Loading...</Alert>
</>
);
}
return (
<>
{ this.state.iUpload > 0 ?
@ -191,42 +182,46 @@ class ObjectList extends React.Component<Props, State> {
</div>
</Stack>
</Container>
<ListGroup>
{ this.state.folders.map((f) =>
<LinkContainer key={f + "/"} to={ "/" + this.props.bucket + "/" + this.props.prefix + f }>
<ListGroup.Item action>
<BsFolder /> { f }
</ListGroup.Item>
</LinkContainer>
)}
{ this.state.files.map((f) =>
<ListGroup.Item key={f}>
<Stack direction="horizontal">
<div><BsFileEarmarkText /> { f }</div>
<div className="ms-auto">
<Button size="sm" className="mx-1" variant="primary" onClick={(event) => {
event.stopPropagation();
downloadFile(this.props.client, this.props.bucket, this.props.prefix + f, f);
}}>
<BsDownload />
</Button>
<Button size="sm" className="mx-1" variant="danger" onClick={(event) => {
event.stopPropagation();
this.deleteFile(f);
}}>
<AiOutlineDelete />
</Button>
<Button size="sm" className="mx-1" variant="secondary" onClick={(event) => {
event.stopPropagation();
this.openInfo(f);
}}>
<BsInfoCircle />
</Button>
</div>
</Stack>
</ListGroup.Item>
)}
</ListGroup>
{ this.state.loaded ?
<ListGroup>
{ this.state.folders.map((f) =>
<LinkContainer key={f + "/"} to={ "/" + this.props.bucket + "/" + this.props.prefix + f }>
<ListGroup.Item action>
<BsFolder /> { f }
</ListGroup.Item>
</LinkContainer>
)}
{ this.state.files.map((f) =>
<ListGroup.Item key={f}>
<Stack direction="horizontal">
<div><BsFileEarmarkText /> { f }</div>
<div className="ms-auto">
<Button size="sm" className="mx-1" variant="primary" onClick={(event) => {
event.stopPropagation();
downloadFile(this.props.client, this.props.bucket, this.props.prefix + f, f);
}}>
<BsDownload />
</Button>
<Button size="sm" className="mx-1" variant="danger" onClick={(event) => {
event.stopPropagation();
this.deleteFile(f);
}}>
<AiOutlineDelete />
</Button>
<Button size="sm" className="mx-1" variant="secondary" onClick={(event) => {
event.stopPropagation();
this.openInfo(f);
}}>
<BsInfoCircle />
</Button>
</div>
</Stack>
</ListGroup.Item>
)}
</ListGroup>
:
<Alert variant="secondary">Loading...</Alert>
}
</>
);
}