add hosting to first run #7598

Merged
jessopb merged 8 commits from feat-autoHosting-and-firstRun into master 2022-06-02 21:24:11 +02:00
Showing only changes of commit 66f7f1c330 - Show all commits

View file

@ -13,6 +13,7 @@ type SetDaemonSettingArg = boolean | string | number;
kauffj commented 2022-06-02 18:56:00 +02:00 (Migrated from github.com)
Review

what's 0.2?

(I know, but variable would make this clearer)

what's 0.2? (I know, but variable would make this clearer)
kauffj commented 2022-06-02 18:56:27 +02:00 (Migrated from github.com)
Review

if 0.01 is special value it probably merits abstraction

if 0.01 is special value it probably merits abstraction
kauffj commented 2022-06-02 18:56:00 +02:00 (Migrated from github.com)
Review

what's 0.2?

(I know, but variable would make this clearer)

what's 0.2? (I know, but variable would make this clearer)
kauffj commented 2022-06-02 18:56:27 +02:00 (Migrated from github.com)
Review

if 0.01 is special value it probably merits abstraction

if 0.01 is special value it probably merits abstraction
type Props = { type Props = {
// --- select --- // --- select ---
viewBlobSpace: number,
kauffj commented 2022-06-02 18:56:00 +02:00 (Migrated from github.com)
Review

what's 0.2?

(I know, but variable would make this clearer)

what's 0.2? (I know, but variable would make this clearer)
kauffj commented 2022-06-02 18:56:27 +02:00 (Migrated from github.com)
Review

if 0.01 is special value it probably merits abstraction

if 0.01 is special value it probably merits abstraction
viewHostingLimit: number, viewHostingLimit: number,
disabled?: boolean, disabled?: boolean,
isSetting: boolean, isSetting: boolean,
@ -20,14 +21,32 @@ type Props = {
kauffj commented 2022-06-02 18:56:00 +02:00 (Migrated from github.com)
Review

what's 0.2?

(I know, but variable would make this clearer)

what's 0.2? (I know, but variable would make this clearer)
kauffj commented 2022-06-02 18:56:27 +02:00 (Migrated from github.com)
Review

if 0.01 is special value it probably merits abstraction

if 0.01 is special value it probably merits abstraction
kauffj commented 2022-06-02 18:56:00 +02:00 (Migrated from github.com)
Review

what's 0.2?

(I know, but variable would make this clearer)

what's 0.2? (I know, but variable would make this clearer)
kauffj commented 2022-06-02 18:56:27 +02:00 (Migrated from github.com)
Review

if 0.01 is special value it probably merits abstraction

if 0.01 is special value it probably merits abstraction
setDaemonSetting: (string, ?SetDaemonSettingArg) => void, setDaemonSetting: (string, ?SetDaemonSettingArg) => void,
cleanBlobs: () => string, cleanBlobs: () => string,
getDaemonStatus: () => void, getDaemonStatus: () => void,
diskSpace: DiskSpace,
kauffj commented 2022-06-02 18:56:00 +02:00 (Migrated from github.com)
Review

what's 0.2?

(I know, but variable would make this clearer)

what's 0.2? (I know, but variable would make this clearer)
kauffj commented 2022-06-02 18:56:27 +02:00 (Migrated from github.com)
Review

if 0.01 is special value it probably merits abstraction

if 0.01 is special value it probably merits abstraction
}; };
function SettingViewHosting(props: Props) { function SettingViewHosting(props: Props) {
const { viewHostingLimit, setDaemonSetting, cleanBlobs, getDaemonStatus, disabled, isSetting } = props; const {
kauffj commented 2022-06-02 18:56:00 +02:00 (Migrated from github.com)
Review

what's 0.2?

(I know, but variable would make this clearer)

what's 0.2? (I know, but variable would make this clearer)
kauffj commented 2022-06-02 18:56:27 +02:00 (Migrated from github.com)
Review

if 0.01 is special value it probably merits abstraction

if 0.01 is special value it probably merits abstraction
kauffj commented 2022-06-02 18:56:00 +02:00 (Migrated from github.com)
Review

what's 0.2?

(I know, but variable would make this clearer)

what's 0.2? (I know, but variable would make this clearer)
kauffj commented 2022-06-02 18:56:27 +02:00 (Migrated from github.com)
Review

if 0.01 is special value it probably merits abstraction

if 0.01 is special value it probably merits abstraction
diskSpace,
kauffj commented 2022-06-02 18:56:00 +02:00 (Migrated from github.com)
Review

what's 0.2?

(I know, but variable would make this clearer)

what's 0.2? (I know, but variable would make this clearer)
kauffj commented 2022-06-02 18:56:27 +02:00 (Migrated from github.com)
Review

if 0.01 is special value it probably merits abstraction

if 0.01 is special value it probably merits abstraction
viewHostingLimit,
kauffj commented 2022-06-02 18:56:00 +02:00 (Migrated from github.com)
Review

what's 0.2?

(I know, but variable would make this clearer)

what's 0.2? (I know, but variable would make this clearer)
kauffj commented 2022-06-02 18:56:27 +02:00 (Migrated from github.com)
Review

if 0.01 is special value it probably merits abstraction

if 0.01 is special value it probably merits abstraction
viewBlobSpace,
kauffj commented 2022-06-02 18:56:00 +02:00 (Migrated from github.com)
Review

what's 0.2?

(I know, but variable would make this clearer)

what's 0.2? (I know, but variable would make this clearer)
kauffj commented 2022-06-02 18:56:27 +02:00 (Migrated from github.com)
Review

if 0.01 is special value it probably merits abstraction

if 0.01 is special value it probably merits abstraction
setDaemonSetting,
kauffj commented 2022-06-02 18:56:00 +02:00 (Migrated from github.com)
Review

what's 0.2?

(I know, but variable would make this clearer)

what's 0.2? (I know, but variable would make this clearer)
kauffj commented 2022-06-02 18:56:27 +02:00 (Migrated from github.com)
Review

if 0.01 is special value it probably merits abstraction

if 0.01 is special value it probably merits abstraction
cleanBlobs,
kauffj commented 2022-06-02 18:56:00 +02:00 (Migrated from github.com)
Review

what's 0.2?

(I know, but variable would make this clearer)

what's 0.2? (I know, but variable would make this clearer)
kauffj commented 2022-06-02 18:56:27 +02:00 (Migrated from github.com)
Review

if 0.01 is special value it probably merits abstraction

if 0.01 is special value it probably merits abstraction
getDaemonStatus,
kauffj commented 2022-06-02 18:56:00 +02:00 (Migrated from github.com)
Review

what's 0.2?

(I know, but variable would make this clearer)

what's 0.2? (I know, but variable would make this clearer)
kauffj commented 2022-06-02 18:56:27 +02:00 (Migrated from github.com)
Review

if 0.01 is special value it probably merits abstraction

if 0.01 is special value it probably merits abstraction
disabled,
kauffj commented 2022-06-02 18:56:00 +02:00 (Migrated from github.com)
Review

what's 0.2?

(I know, but variable would make this clearer)

what's 0.2? (I know, but variable would make this clearer)
kauffj commented 2022-06-02 18:56:27 +02:00 (Migrated from github.com)
Review

if 0.01 is special value it probably merits abstraction

if 0.01 is special value it probably merits abstraction
isSetting,
kauffj commented 2022-06-02 18:56:00 +02:00 (Migrated from github.com)
Review

what's 0.2?

(I know, but variable would make this clearer)

what's 0.2? (I know, but variable would make this clearer)
kauffj commented 2022-06-02 18:56:27 +02:00 (Migrated from github.com)
Review

if 0.01 is special value it probably merits abstraction

if 0.01 is special value it probably merits abstraction
} = props;
kauffj commented 2022-06-02 18:56:00 +02:00 (Migrated from github.com)
Review

what's 0.2?

(I know, but variable would make this clearer)

what's 0.2? (I know, but variable would make this clearer)
kauffj commented 2022-06-02 18:56:27 +02:00 (Migrated from github.com)
Review

if 0.01 is special value it probably merits abstraction

if 0.01 is special value it probably merits abstraction
// best effort to recommend a hosting amount default for the user
kauffj commented 2022-06-02 18:56:00 +02:00 (Migrated from github.com)
Review

what's 0.2?

(I know, but variable would make this clearer)

what's 0.2? (I know, but variable would make this clearer)
kauffj commented 2022-06-02 18:56:27 +02:00 (Migrated from github.com)
Review

if 0.01 is special value it probably merits abstraction

if 0.01 is special value it probably merits abstraction
const totalMB = diskSpace && Math.floor(Number(diskSpace.total) / 1024);
kauffj commented 2022-06-02 18:56:00 +02:00 (Migrated from github.com)
Review

what's 0.2?

(I know, but variable would make this clearer)

what's 0.2? (I know, but variable would make this clearer)
kauffj commented 2022-06-02 18:56:27 +02:00 (Migrated from github.com)
Review

if 0.01 is special value it probably merits abstraction

if 0.01 is special value it probably merits abstraction
const freeMB = diskSpace && Math.floor(Number(diskSpace.free) / 1024);
kauffj commented 2022-06-02 18:56:00 +02:00 (Migrated from github.com)
Review

what's 0.2?

(I know, but variable would make this clearer)

what's 0.2? (I know, but variable would make this clearer)
kauffj commented 2022-06-02 18:56:27 +02:00 (Migrated from github.com)
Review

if 0.01 is special value it probably merits abstraction

if 0.01 is special value it probably merits abstraction
const getGB = (val) => (Number(val) / 1024).toFixed(2);
kauffj commented 2022-06-02 18:56:00 +02:00 (Migrated from github.com)
Review

what's 0.2?

(I know, but variable would make this clearer)

what's 0.2? (I know, but variable would make this clearer)
kauffj commented 2022-06-02 18:56:27 +02:00 (Migrated from github.com)
Review

if 0.01 is special value it probably merits abstraction

if 0.01 is special value it probably merits abstraction
const recommendedSpace =
kauffj commented 2022-06-02 18:56:00 +02:00 (Migrated from github.com)
Review

what's 0.2?

(I know, but variable would make this clearer)

what's 0.2? (I know, but variable would make this clearer)
kauffj commented 2022-06-02 18:56:27 +02:00 (Migrated from github.com)
Review

if 0.01 is special value it probably merits abstraction

if 0.01 is special value it probably merits abstraction
freeMB > totalMB * 0.2 // plenty of space?
kauffj commented 2022-06-02 18:56:00 +02:00 (Migrated from github.com)
Review

what's 0.2?

(I know, but variable would make this clearer)

what's 0.2? (I know, but variable would make this clearer)
kauffj commented 2022-06-02 18:56:27 +02:00 (Migrated from github.com)
Review

if 0.01 is special value it probably merits abstraction

if 0.01 is special value it probably merits abstraction
? Math.ceil(Number(getGB(totalMB * 0.1))) // 10% of total
kauffj commented 2022-06-02 18:56:00 +02:00 (Migrated from github.com)
Review

what's 0.2?

(I know, but variable would make this clearer)

what's 0.2? (I know, but variable would make this clearer)
kauffj commented 2022-06-02 18:56:27 +02:00 (Migrated from github.com)
Review

if 0.01 is special value it probably merits abstraction

if 0.01 is special value it probably merits abstraction
: Math.ceil(Number(getGB(viewBlobSpace))); // current amount to avoid deleting
kauffj commented 2022-06-02 18:56:00 +02:00 (Migrated from github.com)
Review

what's 0.2?

(I know, but variable would make this clearer)

what's 0.2? (I know, but variable would make this clearer)
kauffj commented 2022-06-02 18:56:27 +02:00 (Migrated from github.com)
Review

if 0.01 is special value it probably merits abstraction

if 0.01 is special value it probably merits abstraction
// daemon settings come in as 'number', but we manage them as 'String'. // daemon settings come in as 'number', but we manage them as 'String'.
const [contentBlobSpaceLimitGB, setContentBlobSpaceLimit] = React.useState( const [contentBlobSpaceLimitGB, setContentBlobSpaceLimit] = React.useState(
viewHostingLimit === 0 ? '0.01' : String(viewHostingLimit / 1024) viewHostingLimit === 0 ? String(recommendedSpace) : String(viewHostingLimit / 1024)
kauffj commented 2022-06-02 18:56:00 +02:00 (Migrated from github.com)
Review

what's 0.2?

(I know, but variable would make this clearer)

what's 0.2? (I know, but variable would make this clearer)
kauffj commented 2022-06-02 18:56:27 +02:00 (Migrated from github.com)
Review

if 0.01 is special value it probably merits abstraction

if 0.01 is special value it probably merits abstraction
kauffj commented 2022-06-02 18:56:00 +02:00 (Migrated from github.com)
Review

what's 0.2?

(I know, but variable would make this clearer)

what's 0.2? (I know, but variable would make this clearer)
kauffj commented 2022-06-02 18:56:27 +02:00 (Migrated from github.com)
Review

if 0.01 is special value it probably merits abstraction

if 0.01 is special value it probably merits abstraction
); );
const [unlimited, setUnlimited] = React.useState(viewHostingLimit === 0); const [unlimited, setUnlimited] = React.useState(viewHostingLimit === 0);

kauffj commented 2022-06-02 18:56:00 +02:00 (Migrated from github.com)
Review

what's 0.2?

(I know, but variable would make this clearer)

what's 0.2? (I know, but variable would make this clearer)
kauffj commented 2022-06-02 18:56:27 +02:00 (Migrated from github.com)
Review

if 0.01 is special value it probably merits abstraction

if 0.01 is special value it probably merits abstraction
kauffj commented 2022-06-02 18:56:00 +02:00 (Migrated from github.com)
Review

what's 0.2?

(I know, but variable would make this clearer)

what's 0.2? (I know, but variable would make this clearer)
kauffj commented 2022-06-02 18:56:27 +02:00 (Migrated from github.com)
Review

if 0.01 is special value it probably merits abstraction

if 0.01 is special value it probably merits abstraction