Testing fixes 0.53.4 (#7600)
* view hosting setting backspace, and storage setting scroll to button * fix duplicate settings_get call * avoid unneccessary setDaemonSetting unlimited
This commit is contained in:
parent
168ae17eb6
commit
7b0d38eca7
6 changed files with 28 additions and 12 deletions
|
@ -14,7 +14,7 @@ const select = (state) => ({
|
|||
const perform = (dispatch) => ({
|
||||
getDaemonStatus: () => dispatch(doGetDaemonStatus()),
|
||||
setDaemonSetting: (key, value) => dispatch(doSetDaemonSetting(key, value)),
|
||||
cleanBlobs: () => dispatch(doCleanBlobs()),
|
||||
cleanBlobs: () => dispatch(doCleanBlobs(false)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(SettingWalletServer);
|
||||
|
|
|
@ -45,7 +45,7 @@ export default function SettingStorage(props: Props) {
|
|||
</h2>
|
||||
</div>
|
||||
<Card
|
||||
id={SETTINGS_GRP.SYSTEM}
|
||||
id={SETTINGS_GRP.STORAGE}
|
||||
isBodyList
|
||||
body={
|
||||
<>
|
||||
|
|
|
@ -14,7 +14,7 @@ const select = (state) => ({
|
|||
const perform = (dispatch) => ({
|
||||
getDaemonStatus: () => dispatch(doGetDaemonStatus()),
|
||||
setDaemonSetting: (key, value) => dispatch(doSetDaemonSetting(key, value)),
|
||||
cleanBlobs: () => dispatch(doCleanBlobs()),
|
||||
cleanBlobs: () => dispatch(doCleanBlobs(false)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(SettingViewHosting);
|
||||
|
|
|
@ -67,6 +67,16 @@ function SettingViewHosting(props: Props) {
|
|||
}
|
||||
}
|
||||
|
||||
function getContentLimitValue() {
|
||||
if (contentBlobSpaceLimitGB === '') {
|
||||
return '';
|
||||
} else if (Number(contentBlobSpaceLimitGB) <= Number(MINIMUM_VIEW_SETTING)) {
|
||||
return '0';
|
||||
} else {
|
||||
return contentBlobSpaceLimitGB;
|
||||
}
|
||||
}
|
||||
|
||||
async function handleApply() {
|
||||
if (unlimited) {
|
||||
await setDaemonSetting(DAEMON_SETTINGS.BLOB_STORAGE_LIMIT_MB, '0');
|
||||
|
@ -91,10 +101,11 @@ function SettingViewHosting(props: Props) {
|
|||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
if (unlimited) {
|
||||
// basically handle setUnlimited
|
||||
if (unlimited && viewHostingLimit !== 0) {
|
||||
handleApply();
|
||||
}
|
||||
}, [unlimited]);
|
||||
}, [unlimited, viewHostingLimit]);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
@ -119,6 +130,9 @@ function SettingViewHosting(props: Props) {
|
|||
// disabled if settings are equal or not valid amounts
|
||||
(viewHostingLimit === 1 && contentBlobSpaceLimitGB <= MINIMUM_VIEW_SETTING) ||
|
||||
(unlimited && viewHostingLimit === 0) ||
|
||||
(!unlimited &&
|
||||
(String(viewHostingLimit) === convertGbToMbStr(contentBlobSpaceLimitGB) ||
|
||||
!isValidHostingAmount(String(contentBlobSpaceLimitGB)))) ||
|
||||
(!unlimited &&
|
||||
String(viewHostingLimit) ===
|
||||
convertGbToMbStr(
|
||||
|
@ -139,8 +153,10 @@ function SettingViewHosting(props: Props) {
|
|||
(viewHostingLimit === 1 && contentBlobSpaceLimitGB <= MINIMUM_VIEW_SETTING) ||
|
||||
(unlimited && viewHostingLimit === 0) ||
|
||||
(!unlimited &&
|
||||
(String(viewHostingLimit) === convertGbToMbStr(contentBlobSpaceLimitGB) ||
|
||||
!isValidHostingAmount(String(contentBlobSpaceLimitGB)))) ||
|
||||
String(viewHostingLimit) ===
|
||||
convertGbToMbStr(
|
||||
contentBlobSpaceLimitGB || !isValidHostingAmount(String(contentBlobSpaceLimitGB))
|
||||
)) ||
|
||||
isSetting ||
|
||||
disabled
|
||||
}
|
||||
|
@ -156,7 +172,7 @@ function SettingViewHosting(props: Props) {
|
|||
onWheel={(e) => e.preventDefault()}
|
||||
label={__(`View Hosting Limit (GB)`)}
|
||||
onChange={(e) => handleContentLimitChange(e.target.value)}
|
||||
value={Number(contentBlobSpaceLimitGB) <= Number(MINIMUM_VIEW_SETTING) ? '0' : contentBlobSpaceLimitGB}
|
||||
value={getContentLimitValue()}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
|
|
|
@ -7,9 +7,7 @@ import React from 'react';
|
|||
import { useHistory } from 'react-router-dom';
|
||||
import classnames from 'classnames';
|
||||
import Button from 'component/button';
|
||||
// @if TARGET='app'
|
||||
import { IS_MAC } from 'component/app/view';
|
||||
// @endif
|
||||
import { useIsMediumScreen } from 'effects/use-screensize';
|
||||
|
||||
type SideNavLink = {
|
||||
|
|
|
@ -154,10 +154,12 @@ export function doSetDaemonSetting(key, value, doNotDispatch = false) {
|
|||
};
|
||||
}
|
||||
|
||||
export function doCleanBlobs() {
|
||||
export function doCleanBlobs(fetchAfter = true) {
|
||||
return (dispatch) => {
|
||||
return Lbry.blob_clean().then(() => {
|
||||
dispatch(doFetchDaemonSettings());
|
||||
if (fetchAfter) {
|
||||
dispatch(doFetchDaemonSettings());
|
||||
}
|
||||
return 'done';
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue