Skip to content

Commit

Permalink
Merge pull request #364 from HarperDB/stage
Browse files Browse the repository at this point in the history
v4.3.8
  • Loading branch information
deliciousmonster authored Dec 21, 2023
2 parents f6831b9 + f548724 commit 151cc10
Show file tree
Hide file tree
Showing 10 changed files with 311 additions and 512 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "harperdb-studio",
"version": "4.3.7",
"version": "4.3.8",
"description": "A UI for HarperDB",
"deploymentUrl": "studio.harperdb.io",
"private": true,
Expand Down Expand Up @@ -73,10 +73,10 @@
"postcss-custom-properties": "^13.0.0",
"prettier": "^3.1.0",
"sass": "^1.46.0",
"stylelint": "^15.10.1",
"stylelint": "^16.0.2",
"stylelint-config-sass-guidelines": "^10.0.0",
"stylelint-config-standard": "^34.0.0",
"stylelint-config-standard": "^35.0.0",
"stylelint-order": "^6.0.1",
"stylelint-scss": "^5.0.0"
"stylelint-scss": "^6.0.0"
}
}
2 changes: 1 addition & 1 deletion src/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function App() {
<div className={`${theme} ${config.maintenance ? 'maintenance' : ''}`}>
<div id="app-container">
<Suspense fallback={<Loader header=" " spinner />}>
<TopNav isMaintenance={isMaintenance} loggedIn />
<TopNav isMaintenance={isMaintenance} loggedIn={loggedIn} />
</Suspense>
{fetchingUser ? (
<Loader header="signing in" spinner />
Expand Down
4 changes: 2 additions & 2 deletions src/components/instance/config/Details.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ function Details({ clusterNodeName, instanceConfig }) {
const authHeader = auth?.user ? `${btoa(`${auth.user}:${auth.pass}`)}` : '...';
const iopsString = is_local ? 'HARDWARE LIMIT' : `${storage?.iops}`;
const formatted_creation_date = creation_date ? new Date(creation_date).toLocaleDateString() : 'N/A';
const { hostname } = window.location;
const { hostname, origin } = window.location;

const urlObject = new URL(url);
const urlObject = new URL(config.is_local_studio ? origin : url);

const operationsApiURL = !config.is_local_studio
? `${instanceConfig.operationsApi?.network?.securePort ? 'https://' : 'http://'}${urlObject.hostname}:${
Expand Down
32 changes: 14 additions & 18 deletions src/components/instances/new/Confirm.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ function Confirm() {
const is_unpaid = useStoreState(appState, (s) => s.customer.is_unpaid);
const unlimited_local_install = useStoreState(appState, (s) => s.customer.unlimited_local_install);
const stripeCoupons = useStoreState(appState, (s) => s.customer?.stripe_coupons);
const usedFreetrial = stripeCoupons.find((c) => c.name === 'FREETRIAL');
const subdomain = useStoreState(appState, (s) => s.customer?.subdomain);
const totalPrice = (newInstance?.compute_price || 0) + (newInstance?.storage_price || 0);
const allPrePaid = newInstance.compute_subscription_id && (newInstance.is_local || newInstance.storage_subscription_id);
Expand Down Expand Up @@ -171,33 +172,28 @@ function Confirm() {
<b>{totalPriceString}</b>
</Col>
</Row>
{newInstance.trial_period_days && (
<>
<hr />
<Row>
<Col sm="8" className="text-nowrap text-grey">
Free Trial Period
</Col>
<Col sm="4" className="text-sm-end text-nowrap">
<b>{newInstance.trial_period_days} Days</b>
</Col>
</Row>
</>
)}
</CardBody>
</Card>
<hr className="my-3" />
{is_unpaid ? (
<Unpaid />
) : unlimited_local_install ? (
<UnlimitedEnterprise />
) : stripeCoupons?.length ? (
<div className="px-2 text-center text-success">
This organization has <b>{stripeCoupons.length}</b> coupon{stripeCoupons.length > 1 && 's'} on file, good for a total product credit of{' '}
<b>${stripeCoupons.reduce((total, coupon) => total + parseInt(coupon.amount_off / 100, 10), 0)}</b>. Charges beyond that amount will be billed to your card.
</div>
) : (
<div className="px-2">
{stripeCoupons?.length > 0 && (
<div className="mb-3">
This organization has <b>{stripeCoupons.length}</b> coupon{stripeCoupons.length > 1 && 's'} on file, good for a total product credit of{' '}
<b>${stripeCoupons.reduce((total, coupon) => total + parseInt(coupon.amount_off / 100, 10), 0)}</b>. Charges beyond that amount will be billed to your card.
</div>
)}
{!usedFreetrial && (
<div className="mb-3">
This organization is entitled to a credit equal to 1 month of 1GB RAM/1GB Disk (a $33 value) with coupon code <b className="text-success">FREETRIAL</b>. Enter the
code into the form below to receive the credit.
</div>
)}
<hr />
<CouponForm />
</div>
)}
Expand Down
2 changes: 1 addition & 1 deletion src/components/instances/new/MetaLocal.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ function MetaLocal() {
&nbsp;
{formState.url && (
<a href={formState.url} target="_blank" rel="noopener noreferrer">
<i className="ms-3 fa fa-lg fa-external-link-square text-purple" />
<i className="ms-3 fa-lg fas fa-external-link-alt text-purple" />
</a>
)}
</CardBody>
Expand Down
18 changes: 10 additions & 8 deletions src/components/instances/new/Payment.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ function Payment() {
const auth = useStoreState(appState, (s) => s.auth);
const hasCard = useStoreState(appState, (s) => s.hasCard);
const stripeId = useStoreState(appState, (s) => s.customer?.stripe_id);
const stripeCoupons = useStoreState(appState, (s) => s.customer?.stripe_coupons);
const usedFreetrial = stripeCoupons.find((c) => c.name === 'FREETRIAL');
const products = useStoreState(appState, (s) => s.products);
const [newInstance] = useNewInstance({});
const [formData, setFormData] = useState({ postal_code: false, card: false, expire: false, cvc: false });
Expand Down Expand Up @@ -105,21 +107,21 @@ function Payment() {
<div className="mb-4">
{computeProduct?.value?.compute_price ? (
<div className="mb-2">
The selected <b>instance type</b> has a cost of <b>{computeProduct?.value?.compute_price_string_with_interval}</b>
{computeProduct?.value?.trial_period_days && (
<span>
,<span className="text-danger"> which will begin after your {computeProduct?.value?.trial_period_days} free trial</span>
</span>
)}
.
The selected <b>instance type</b> has a cost of <b>{computeProduct?.value?.compute_price_string_with_interval}</b>.
</div>
) : null}
{storageProduct?.value?.storage_price ? (
<div className="mb-2">
The selected <b>storage size</b> has a cost of <b>{storageProduct?.value?.storage_price_string_with_interval}</b>.
</div>
) : null}
Please add a credit card to your account using the form below. If you registered using a promo code, your card will not be charged until your promo credits run out.
{!usedFreetrial && (
<div className="mb-2">
This organization is entitled to a credit equal to 1 month of 1GB RAM/1GB Disk (a $33 value) with coupon code <b className="text-success">FREETRIAL</b>. Enter the
code into the form on the next page to receive the credit.
</div>
)}
Please add a credit card to your account using the form below. If you have a coupon code, your card will not be charged until your credits run out.
</div>
<ContentContainer header="Credit Card Details">
<CreditCardForm setFormData={setFormData} formData={formData} setFormState={setFormState} />
Expand Down
7 changes: 5 additions & 2 deletions src/components/instances/new/TypeAWS.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import appState from '../../../functions/state/appState';

function TypeAWS({ setFormData }) {
const theme = useStoreState(appState, (s) => s.theme);
const stripeCoupons = useStoreState(appState, (s) => s.customer.stripe_coupons);
const usedFreetrial = stripeCoupons.find((c) => c.name === 'FREETRIAL');

return (
<Card className="mb-3">
<CardBody className="instance-form-card-body">
Expand All @@ -28,9 +31,9 @@ function TypeAWS({ setFormData }) {
<hr />
<ul className="mb-0">
<li>On AWS EC2</li>
<li>Billed Monthly, Free Tier Available</li>
<li>Billed Monthly</li>
<li>24/7 Customer Support</li>
<li>Choose RAM and Disk Size</li>
{usedFreetrial ? <li>Choose RAM and Disk Size</li> : <li className="text-danger">1 MONTH FREE TRIAL (1GB RAM/1GB DISK)</li>}
</ul>
</CardBody>
</Card>
Expand Down
2 changes: 1 addition & 1 deletion src/components/instances/new/TypeEnterprise.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function TypeEnterprise({ setFormData }) {
<li>Billed Annually, Free Tier Available</li>
<li>24/7 Customer Support</li>
<li>
<a href="https://docs.harperdb.io/docs/install-harperdb" target="_blank" rel="noopener noreferrer">
<a href="https://docs.harperdb.io/docs/getting-started" target="_blank" rel="noopener noreferrer">
Click To View Install Docs
</a>
</li>
Expand Down
4 changes: 1 addition & 3 deletions src/functions/products/buildRadioSelectProductOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export default (plans) => {
name = undefined,
quantity = undefined,
available = undefined,
trial_period_days = null,
metadata: { ram_allocation, instance_type, has_gpus },
}) => {
const compute_price = subscription_id ? 0 : parseInt(amount_decimal, 10) / 100;
Expand All @@ -25,7 +24,7 @@ export default (plans) => {
const compute_ram_string = `${compute_ram / 1024}GB`;
const label = `${compute_ram_string} RAM ${has_gpus ? '+ GPU Support ' : ''}${
subscription_id ? `${name}${available} remaining` : amount_decimal !== '0' ? `${compute_comma_amount}/${interval}` : 'FREE'
} ${!active ? '(legacy)' : ''} ${trial_period_days ? `• ${trial_period_days} DAY FREE TRIAL` : ''}`;
} ${!active ? '(legacy)' : ''}`;

return (
compute_ram &&
Expand All @@ -34,7 +33,6 @@ export default (plans) => {
value: {
active,
instance_type,
trial_period_days,
stripe_plan_id: id,
compute_interval: interval,
compute_subscription_name: name,
Expand Down
Loading

0 comments on commit 151cc10

Please sign in to comment.