From f4ed933049862d90662bd5f9ef456061ad350801 Mon Sep 17 00:00:00 2001 From: deliciousmonster Date: Tue, 3 Mar 2020 10:44:36 -0700 Subject: [PATCH 1/2] lint --- src/api/instance/addUser.js | 1 - src/api/instance/listUsers.js | 1 - src/api/lms/addLicense.js | 2 +- src/api/lms/getProducts.js | 16 +++++++--------- src/api/lms/updateLicense.js | 2 +- src/api/queryLMS.js | 13 ++----------- src/components/account/billing/cardEdit.js | 2 +- src/components/instance/config/index.js | 2 +- src/util/datatable/instanceUserColumns.js | 1 - src/util/stripe/getInstancePrice.js | 4 ---- 10 files changed, 13 insertions(+), 31 deletions(-) delete mode 100644 src/util/stripe/getInstancePrice.js diff --git a/src/api/instance/addUser.js b/src/api/instance/addUser.js index 7cffef00f..5b0cf42c4 100644 --- a/src/api/instance/addUser.js +++ b/src/api/instance/addUser.js @@ -1,4 +1,3 @@ import queryInstance from '../queryInstance'; export default async ({ auth, role, username, password }) => queryInstance({ operation: 'add_user', role, username, password, active: true }, auth); - diff --git a/src/api/instance/listUsers.js b/src/api/instance/listUsers.js index 813fe3aa9..9274de66b 100644 --- a/src/api/instance/listUsers.js +++ b/src/api/instance/listUsers.js @@ -1,4 +1,3 @@ import queryInstance from '../queryInstance'; export default async ({ auth }) => queryInstance({ operation: 'list_users' }, auth); - diff --git a/src/api/lms/addLicense.js b/src/api/lms/addLicense.js index 9a9bc0a35..cc4d732f9 100644 --- a/src/api/lms/addLicense.js +++ b/src/api/lms/addLicense.js @@ -8,5 +8,5 @@ export default async ({ auth, payload: { instance_id, customer_id, stripe_produc auth, }); - return response.body + return response.body; }; diff --git a/src/api/lms/getProducts.js b/src/api/lms/getProducts.js index c1fe916e0..a2f7dab7a 100644 --- a/src/api/lms/getProducts.js +++ b/src/api/lms/getProducts.js @@ -1,14 +1,12 @@ import queryLMS from '../queryLMS'; -const buildRadioSelectProductOptions = ({ id, amount_decimal, interval, amount, metadata: { instance_ram } }) => { - return { - price: amount_decimal !== '0' ? (amount_decimal / 100).toFixed(2) : 'FREE', - ram: instance_ram, - interval, - label: `${instance_ram} RAM | ${amount_decimal !== '0' ? `${amount}/${interval}` : 'FREE'}`, - value: id, - }; -}; +const buildRadioSelectProductOptions = ({ id, amount_decimal, interval, amount, metadata: { instance_ram } }) => ({ + price: amount_decimal !== '0' ? (amount_decimal / 100).toFixed(2) : 'FREE', + ram: instance_ram, + interval, + label: `${instance_ram} RAM | ${amount_decimal !== '0' ? `${amount}/${interval}` : 'FREE'}`, + value: id, +}); const buildRadioSelectStorageOptions = (size, { tiers, interval }) => { const pricingTier = tiers.find((p) => (p.up_to && size <= p.up_to) || !p.up_to); diff --git a/src/api/lms/updateLicense.js b/src/api/lms/updateLicense.js index 6610c3d47..9798119dd 100644 --- a/src/api/lms/updateLicense.js +++ b/src/api/lms/updateLicense.js @@ -9,4 +9,4 @@ export default async ({ auth, payload: { license_id, instance_id, customer_id, s }); return response.body; -} +}; diff --git a/src/api/queryLMS.js b/src/api/queryLMS.js index ce77d0d0d..07c9f3dfc 100644 --- a/src/api/queryLMS.js +++ b/src/api/queryLMS.js @@ -9,20 +9,11 @@ import licenses from '../../mock_data/LMS_API.licenses.json'; // eslint-disable-next-line no-unused-vars export default async ({ endpoint, payload, auth }) => { - if ((auth.user !== 'test@harperdb.io' || auth.pass !== 'a') && (auth.user !== 'david@harperdb.io' || auth.pass !== 'harperdb')) { - return { - body: { - result: false, - message: 'unknown user or password', - }, - }; - } - - const completedEndpoints = ['addCustomer']; + const completedEndpoints = ['addCustomer', 'getUser']; if (completedEndpoints.includes(endpoint)) { const request = await fetch( - `https://api.harperdbcloudservices.com/Prod/${endpoint}`, + `https://poqwe1evwb.execute-api.us-east-2.amazonaws.com/Dev/${endpoint}`, { method: 'POST', body: JSON.stringify(payload), diff --git a/src/components/account/billing/cardEdit.js b/src/components/account/billing/cardEdit.js index f2139d2ad..a704aef76 100644 --- a/src/components/account/billing/cardEdit.js +++ b/src/components/account/billing/cardEdit.js @@ -3,7 +3,7 @@ import { Button, Row, Col, Input } from '@nio/ui-kit'; import { CardNumberElement, CardExpiryElement, CardCvcElement, useElements, useStripe } from '@stripe/react-stripe-js'; import useAsyncEffect from 'use-async-effect'; import { useLocation, useHistory } from 'react-router-dom'; -import queryString from 'query-string' +import queryString from 'query-string'; import cardOptions from '../../../util/stripe/cardOptions'; import useLMS from '../../../state/stores/lmsAuth'; diff --git a/src/components/instance/config/index.js b/src/components/instance/config/index.js index 3ff163315..56dcb4afc 100644 --- a/src/components/instance/config/index.js +++ b/src/components/instance/config/index.js @@ -23,4 +23,4 @@ export default ({ auth, details, refreshInstance }) => { )} ); -} +}; diff --git a/src/util/datatable/instanceUserColumns.js b/src/util/datatable/instanceUserColumns.js index 762cd5579..4476d2104 100644 --- a/src/util/datatable/instanceUserColumns.js +++ b/src/util/datatable/instanceUserColumns.js @@ -2,7 +2,6 @@ import React from 'react'; import { Button } from '@nio/ui-kit'; - const toggleCellPadding = { paddingTop: 3, paddingBottom: 0, paddingLeft: 0, paddingRight: 2 }; export default ({ deleteUser }) => [{ diff --git a/src/util/stripe/getInstancePrice.js b/src/util/stripe/getInstancePrice.js deleted file mode 100644 index ae05764eb..000000000 --- a/src/util/stripe/getInstancePrice.js +++ /dev/null @@ -1,4 +0,0 @@ -export default ({ products, plan_id }) => { - const selectedPlan = products.find((p) => p.stripe_product_id === instanceDetails.stripe_product_id); - return instanceDetails.is_local ? selectedProduct.local_price_annual : selectedProduct.cloud_price_monthly; -}; From 45eea4f4be24fdd712ce75762bfd796e7f4c7015 Mon Sep 17 00:00:00 2001 From: deliciousmonster Date: Tue, 3 Mar 2020 10:48:17 -0700 Subject: [PATCH 2/2] Update package.json --- package.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/package.json b/package.json index b920f8ba5..c41ecdba2 100644 --- a/package.json +++ b/package.json @@ -6,10 +6,8 @@ "private": true, "scripts": { "build": "webpack --mode production --config webpack.prod.js", - "clean-source": "rm ./public/hdb.css && rm ./public/hdb.js", "start": "webpack-dev-server --mode development --config webpack.dev.js", - "lint": "eslint --fix src && sass-lint --verbose", - "deploy": "npm run build && npm run clean-source && scp -r ./public/* ubuntu@fcfleet.demo.harperdb.io:/home/ubuntu/sites/studio-stage" + "lint": "eslint --fix src && sass-lint --verbose" }, "author": "harperdb", "license": "Apache-2.0",