Skip to content
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

Upload pier with SFTP #2062

Merged
merged 10 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion cypress/e2e/purchase-id.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,18 @@ describe('hosting.holium.com', () => {
cy.get('button').contains('Submit').click();

/* --- BOOTING STEP --- */
// Intercept first GET /get-user-ships, then click button with text 'Next'
// Intercept first 4 GET /get-user-ships, then click button with text 'Next'
cy.intercept('GET', `${API_BASE_URL}/get-user-ships`, {
statusCode: 200,
body: getUserShipsFixture,
}).as('getUserShips');

// Wait until GET /get-user-ships is called
cy.wait('@getUserShips', { timeout: 10000 });
cy.wait('@getUserShips', { timeout: 10000 });
cy.wait('@getUserShips', { timeout: 10000 });
cy.wait('@getUserShips', { timeout: 10000 });

// Wait until Next button is enabled and click it
cy.get('button').contains('Next').should('not.be.disabled').click();

Expand Down
8 changes: 4 additions & 4 deletions hosting-holium-com/src/pages/account/custom-domain.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,17 @@ const CustomDomainPresenter = () => {
goToPage(accountPageUrl[section]);
};

const onClickUploadId = () => {
const onClickUploadPier = () => {
const byopInProgress = ships.find(
(ship) => ship.product_type === 'byop-p' && ship.ship_type !== 'planet'
);

if (byopInProgress) {
goToPage('/upload-id', {
goToPage('/upload-pier', {
back_url: '/account/custom-domain',
});
} else {
goToPage('/upload-id-disclaimer', {
goToPage('/upload-pier-disclaimer', {
back_url: '/account/custom-domain',
});
}
Expand All @@ -98,7 +98,7 @@ const CustomDomainPresenter = () => {
onChangeDomain={setDomain}
onSubmit={onSubmit}
onClickPurchaseId={onClickPurchaseId}
onClickUploadId={onClickUploadId}
onClickUploadPier={onClickUploadPier}
onClickSidebarSection={onClickSidebarSection}
onExit={logout}
/>
Expand Down
8 changes: 4 additions & 4 deletions hosting-holium-com/src/pages/account/download-realm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ const DownloadRealmPresenter = () => {
}
};

const onClickUploadId = () => {
const onClickUploadPier = () => {
const byopInProgress = ships.find(
(ship) => ship.product_type === 'byop-p' && ship.ship_type !== 'planet'
);

if (byopInProgress) {
goToPage('/upload-id', {
goToPage('/upload-pier', {
back_url: '/account/download-realm',
});
} else {
goToPage('/upload-id-disclaimer', {
goToPage('/upload-pier-disclaimer', {
back_url: '/account/download-realm',
});
}
Expand Down Expand Up @@ -64,7 +64,7 @@ const DownloadRealmPresenter = () => {
onDownloadWindows={onDownloadWindows}
onDownloadLinux={onDownloadLinux}
onClickPurchaseId={onClickPurchaseId}
onClickUploadId={onClickUploadId}
onClickUploadPier={onClickUploadPier}
onClickSidebarSection={onClickSidebarSection}
onExit={logout}
/>
Expand Down
6 changes: 3 additions & 3 deletions hosting-holium-com/src/pages/account/get-realm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export const joinWaitlist = async (email: string) => {
const GetRealmPresenter = () => {
const { goToPage, logout } = useNavigation();

const onClickUploadId = () => {
goToPage('/upload-id-disclaimer', {
const onClickUploadPier = () => {
goToPage('/upload-pier-disclaimer', {
back_url: '/account/get-realm',
});
};
Expand All @@ -52,7 +52,7 @@ const GetRealmPresenter = () => {
onClickJoinWaitlist={joinWaitlist}
onClickSidebarSection={onClickSidebarSection}
onClickPurchaseId={onClickPurchaseId}
onClickUploadId={onClickUploadId}
onClickUploadPier={onClickUploadPier}
onExit={logout}
/>
);
Expand Down
16 changes: 8 additions & 8 deletions hosting-holium-com/src/pages/account/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,24 +179,24 @@ const HostingPresenter = () => {
return false;
};

const onClickUploadId = () => {
const onClickUploadPier = () => {
const byopInProgress = ships.find(
(ship) => ship.product_type === 'byop-p' && ship.ship_type !== 'planet'
);

if (byopInProgress) {
goToPage('/upload-id', {
goToPage('/upload-pier', {
back_url: '/account',
});
} else {
goToPage('/upload-id-disclaimer', {
goToPage('/upload-pier-disclaimer', {
back_url: '/account',
});
}
};

const onClickReuploadId = () => {
goToPage('/upload-id', {
const onClickReuploadPier = () => {
goToPage('/upload-pier', {
product_type: 'byop-p',
back_url: '/account',
});
Expand All @@ -213,9 +213,9 @@ const HostingPresenter = () => {
<AccountUnfinishedUploadDialog
ships={ships}
selectedShipId={selectedShipId}
onClickReuploadId={onClickReuploadId}
onClickReuploadPier={onClickReuploadPier}
onClickPurchaseId={onClickPurchaseId}
onClickUploadId={onClickUploadId}
onClickUploadPier={onClickUploadPier}
setSelectedShipId={setSelectedShipId}
onClickSidebarSection={onClickSidebarSection}
onClickExit={logout}
Expand Down Expand Up @@ -265,7 +265,7 @@ const HostingPresenter = () => {
serverCode={selectedShip?.code}
serverMaintenanceWindow={selectedShip?.maintenance_window}
onClickPurchaseId={onClickPurchaseId}
onClickUploadId={onClickUploadId}
onClickUploadPier={onClickUploadPier}
setSelectedShipId={setSelectedShipId}
onClickChangeEmail={changeEmailModal.toggleOn}
onClickChangePassword={changePasswordModal.toggleOn}
Expand Down
8 changes: 4 additions & 4 deletions hosting-holium-com/src/pages/account/storage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ const S3StoragePresenter = () => {
goToPage(accountPageUrl[section]);
};

const onClickUploadId = () => {
const onClickUploadPier = () => {
const byopInProgress = ships.find(
(ship) => ship.product_type === 'byop-p' && ship.ship_type !== 'planet'
);

if (byopInProgress) {
goToPage('/upload-id', {
goToPage('/upload-pier', {
back_url: '/account/storage',
});
} else {
goToPage('/upload-id-disclaimer', {
goToPage('/upload-pier-disclaimer', {
back_url: '/account/storage',
});
}
Expand Down Expand Up @@ -90,7 +90,7 @@ const S3StoragePresenter = () => {
dataSent={{ networkUsage, minioUsage }}
onClickRestartStorage={onClickRestartStorage}
onClickPurchaseId={onClickPurchaseId}
onClickUploadId={onClickUploadId}
onClickUploadPier={onClickUploadPier}
onClickSidebarSection={onClickSidebarSection}
onExit={logout}
/>
Expand Down
8 changes: 4 additions & 4 deletions hosting-holium-com/src/pages/account/support.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ const SupportPresenter = ({ alerts }: Props) => {
}
};

const onClickUploadId = () => {
const onClickUploadPier = () => {
const byopInProgress = ships.find(
(ship) => ship.product_type === 'byop-p' && ship.ship_type !== 'planet'
);

if (byopInProgress) {
goToPage('/upload-id', {
goToPage('/upload-pier', {
back_url: '/account/support',
});
} else {
goToPage('/upload-id-disclaimer', {
goToPage('/upload-pier-disclaimer', {
back_url: '/account/support',
});
}
Expand All @@ -65,7 +65,7 @@ const SupportPresenter = ({ alerts }: Props) => {
selectedShipId={selectedShipId}
setSelectedShipId={setSelectedShipId}
onClickPurchaseId={onClickPurchaseId}
onClickUploadId={onClickUploadId}
onClickUploadPier={onClickUploadPier}
onClickSidebarSection={onClickSidebarSection}
onExit={logout}
/>
Expand Down
19 changes: 10 additions & 9 deletions hosting-holium-com/src/pages/booting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,25 +76,18 @@ export default function Booting({ product_type }: ServerSideProps) {
`${serverId} will be ready in a few minutes.`,
]);
}
} else if (logs.length === 2) {
setLogs((logs) => [...logs, 'Go touch some grass.']);
}

const serverCode = ship.code;
if (serverCode) {
if (serverCode && logs.length === 2) {
setLogs((logs) => [...logs, 'Assigning a domain.']);
}

const serverUrl = ship.link;
const isBooted = serverUrl.includes('https://');
if (isBooted) {
booting.toggleOff();
if (intervalRef.current) clearInterval(intervalRef.current);

if (serverUrl && logs.length === 3) {
setLogs((logs) => [
...logs,
`Successfully assigned a domain: ${serverUrl}.`,
'Booting complete.',
]);

// Store credentials for next page.
Expand All @@ -103,6 +96,14 @@ export default function Booting({ product_type }: ServerSideProps) {
serverCode,
});
}

const isBooted = ship.ship_type === 'planet';
if (isBooted && logs.length === 4) {
booting.toggleOff();
if (intervalRef.current) clearInterval(intervalRef.current);

setLogs((logs) => [...logs, 'Booting complete.']);
}
}, [logs, booting, isBYOP]);

const onNext = () => {
Expand Down
4 changes: 2 additions & 2 deletions hosting-holium-com/src/pages/get-realm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ export default function GetRealm({ prefilledEmail }: Props) {
goToPage('/create-account', { email: prefilledEmail });
};

const onUploadId = () => {};
const onUploadPier = () => {};

return (
<Page title="Get Realm">
<GetRealmDialog
onBack={onBack}
onPurchaseId={onPurchaseId}
onUploadId={onUploadId}
onUploadPier={onUploadPier}
/>
</Page>
);
Expand Down
4 changes: 2 additions & 2 deletions hosting-holium-com/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function GetOnRealm({ email }: Props) {
window.location.href = 'https://holium.com';
};

const onUploadId = () => {
const onUploadPier = () => {
return goToPage('/create-account', {
haha: 'true',
product_type: 'byop-p',
Expand All @@ -51,7 +51,7 @@ export default function GetOnRealm({ email }: Props) {
return (
<Page title="Get on Realm">
<GetOnRealmDialog
onUploadId={onUploadId}
onUploadPier={onUploadPier}
onPurchaseId={onPurchaseId}
// Email query parameter means they're coming from the landing page.
onBack={email ? onBack : undefined}
Expand Down
2 changes: 1 addition & 1 deletion hosting-holium-com/src/pages/payment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export default function Payment({
console.error(e);
}

return goToPage('/upload-id', {
return goToPage('/upload-pier', {
product_type: 'byop-p',
});
} else {
Expand Down
Loading