Skip to content

Commit

Permalink
Solve issues with progress modal.
Browse files Browse the repository at this point in the history
  • Loading branch information
negative0 committed Sep 29, 2019
1 parent a5e8849 commit f17ff79
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 15 deletions.
6 changes: 6 additions & 0 deletions src/scss/_custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@
margin-bottom: 5px;
right: 0;
font-size: small;
max-width: 25vw;
}

.progress-modal-body {
max-height: 30vh;
}

.task-modal {
Expand Down Expand Up @@ -127,3 +132,4 @@
-webkit-transform: rotate(270deg) translateX(-100%);
-ms-transform: rotate(270deg) translateX(-100%);
}

20 changes: 10 additions & 10 deletions src/utils/API/endpoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ const urls = {
/**
* Purge a directory.
*/
purge: "/operations/purge",
purge: "operations/purge",
/**
* Delete a file.
*/
deleteFile: "/operations/deletefile",
deleteFile: "operations/deletefile",
/**
* Create public link.
*/
Expand All @@ -26,19 +26,19 @@ const urls = {
/**
* Move a directory.
*/
moveDir: "/sync/move",
moveDir: "sync/move",
/**
* Move a file.
*/
moveFile: "/operations/movefile",
moveFile: "operations/movefile",
/**
* Copy Directory
*/
copyDir: "/sync/copy",
copyDir: "sync/copy",
/**
* Copy Files.
*/
copyFile: "/operations/copyfile",
copyFile: "operations/copyfile",
/**
* Cleanup the remote recycle bin(trash).
*/
Expand All @@ -64,11 +64,11 @@ const urls = {
/**
* Get providers configuration in the rclone backend.
*/
getProviders: "/config/providers",
getProviders: "config/providers",
/**
* Get entire remote configuration dump from backend.
*/
getConfigDump: "/config/dump",
getConfigDump: "config/dump",
/**
* List the currently running jobs.
*/
Expand All @@ -84,7 +84,7 @@ const urls = {
/**
* Create a new config with parameters.
*/
createConfig: "/config/create",
createConfig: "config/create",
/**
* Update an existing config with parameters.
*/
Expand All @@ -110,7 +110,7 @@ const urls = {
/**
* Delete a config with config name.
*/
deleteConfig: "/config/delete"
deleteConfig: "config/delete"

};
export default urls;
26 changes: 21 additions & 5 deletions src/views/Base/RunningJobs/RunningJobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,28 @@ function JobCard({job}) {
return null;
}

function getCroppedName(name) {
const leftChars = 30;
const rightChars = 5;

if (name.length > leftChars) {
const croppedName = name.substr(0, leftChars) + " ... " + name.substr(-rightChars);
return croppedName;
}
return name;

}

function JobCardRow({job}) {
const {name, percentage, speed, size} = job;
return (
<React.Fragment>
<Row>
{(size && speed) ? (<Col lg={12}>{name}({formatBytes(size)}) - {formatBytes(speed)}PS </Col>) : (
<Row className="runningJobs">
{(size && speed) ? (

<Col lg={12} className="itemName"> {getCroppedName(name)} {" "}
({formatBytes(size)}) - {formatBytes(speed)}PS </Col>
) : (
<Col lg={12}>Calculating</Col>)}

</Row>
Expand Down Expand Up @@ -113,7 +129,7 @@ function GlobalStatus({stats}) {
function TransferringJobs({transferring}) {
if (transferring !== undefined) {
return transferring.map((item, idx) => {
return (<JobCard key={idx} job={item}/>);
return (<JobCard key={item.name} job={item}/>);
});
}
return null;
Expand All @@ -122,7 +138,7 @@ function TransferringJobs({transferring}) {
function TransferringJobsRow({transferring}) {
if (transferring !== undefined) {
return transferring.map((item, idx) => {
return (<JobCardRow key={idx} job={item}/>);
return (<JobCardRow key={item.name} job={item}/>);
});
}
return null;
Expand Down Expand Up @@ -202,7 +218,7 @@ class RunningJobs extends React.Component {
</Button>
</div>
</CardHeader>
<CardBody className={!this.state.isShowing ? "d-none" : ""}>
<CardBody className={!this.state.isShowing ? "d-none" : "progress-modal-body"}>
<TransferringJobsRow transferring={transferring}/>

</CardBody>
Expand Down

0 comments on commit f17ff79

Please sign in to comment.