-
Notifications
You must be signed in to change notification settings - Fork 16
hide quota check in the FM if the target doesn't support that #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -143,31 +143,25 @@ export const sftp_chmod = (fm, cwd, name, mode, recursive) => { | |
| fm.showAlert('Error: ' + error.message); | ||
| } | ||
| }); | ||
| } | ||
| }; | ||
|
|
||
| export const sftp_quota = (fm, cwd, ms) => { | ||
| fm.setState({ | ||
| loading: true | ||
| }) | ||
| axios.post("/exec_blocking", { | ||
| // load silently as much as possible | ||
| // because not all machines support quota checking | ||
| axios.post('/exec_blocking', { | ||
| session_id: fm.session_id, | ||
| cmd: "quota -s | tail -n 1" | ||
| cmd: 'quota -s | tail -n 1' | ||
| }).then(res => { | ||
| fm.loadDir(cwd) | ||
| const mem = res.data.match(/[0-9]+[a-zA-Z]+/g) | ||
| const mem = res.data.match(/[0-9]+[a-zA-Z]+/g); | ||
| ms.setState({ | ||
| memQuota: parseInt(mem[1]), | ||
| memUnit: mem[0].replace(/[0-9]+/,''), | ||
| memUsed: parseInt(mem[0]) | ||
| }) | ||
| used: parseInt(mem[0]), | ||
| usedUnit: mem[0].replace(/[0-9]+/, ''), | ||
| quota: parseInt(mem[1]), | ||
| quotaUnit: mem[1].replace(/[0-9]+/, ''), | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. parse the quota unit as well: the number is usually in 'human readable size' format so the 'quota' unit might not always be the same as the 'used' unit |
||
| }); | ||
| }).catch(error => { | ||
| fm.loadDir(cwd) | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we might want to handle this silently because not all targets have a quota / support quota checking |
||
| if (error.response) { | ||
| fm.showAlert(htmlResponseToReason(error.response.data)); | ||
| } else { | ||
| // Something happened in setting up the request that triggered an Error | ||
| fm.showAlert('Error: ' + error.message); | ||
| } | ||
| // handle this silently because not all machines support quota checking | ||
| ms.setState({quota: null}); | ||
| }); | ||
| } | ||
| }; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we might want to load silently because not all targets have a quota / support quota checking