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

12 show flags in cloud provider and regions #133

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d3d894a
fix typos
Apr 4, 2024
ce4a0b6
add build for frontend and mail separately
Apr 4, 2024
8b813f2
added support for custom smtp provider
Apr 3, 2024
52c5449
fix typos
Apr 4, 2024
01e8a1d
add build for frontend and mail separately
Apr 4, 2024
75e4e30
fix server env validation
Apr 4, 2024
359abc8
Merge remote-tracking branch 'origin/114-split-frontend-and-server'
Apr 4, 2024
87c7b81
trigger build
Apr 4, 2024
a9ef8ec
add return statement
Apr 4, 2024
510ab8e
Merge pull request #3 from FalkorDB/119-missing-return-statement-in-_…
dudizimber Apr 4, 2024
1ff787d
change input type when field is password
Apr 4, 2024
0c13de4
add formatDateLocal to convert dates to local tz
Apr 4, 2024
47227e3
add agreement to tos and privacy policy
Apr 4, 2024
ab625a0
remove console.log
Apr 4, 2024
2ba76ce
Merge pull request #4 from FalkorDB/57-password-field-should-be-shown…
dudizimber Apr 4, 2024
d11333e
Merge pull request #5 from FalkorDB/107-time-should-be-localized
dudizimber Apr 4, 2024
5a53f6d
Merge pull request #6 from FalkorDB/121-add-tos-privacy-agreement
dudizimber Apr 4, 2024
908c5e1
Merge branch 'main' into fix-conflicts-omnistrate
dudizimber Apr 5, 2024
c647350
Remove GA var from email server
dudizimber Apr 5, 2024
1c24754
Merge pull request #7 from FalkorDB/fix-conflicts-omnistrate
dudizimber Apr 5, 2024
25f7e2b
sort fields: name, description, user, password
Apr 5, 2024
952fcab
Merge pull request #8 from FalkorDB/sort-create-instance-fields
dudizimber Apr 5, 2024
a35d21a
show flags in cloud provider and regions
Apr 8, 2024
40b8249
Update src/slices/providerSlice.js
dudizimber Apr 9, 2024
08df584
fix iconmapping
Apr 9, 2024
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

# production
/build
/dist

# misc
.DS_Store
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile → Dockerfile.frontend
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ RUN yarn install --frozen-lockfile --production=false
COPY --link . .

# Build application
RUN yarn run build
RUN yarn run build:frontend

# Remove development dependencies
RUN yarn install --production=true
Expand Down
55 changes: 55 additions & 0 deletions Dockerfile.mail
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# syntax = docker/dockerfile:1

# Adjust NODE_VERSION as desired
ARG NODE_VERSION=20.11.1
FROM node:${NODE_VERSION}-slim as base

# App lives here
WORKDIR /app

# Set production environment
ENV NODE_ENV="production"
ARG YARN_VERSION=1.22.21
RUN npm install -g yarn@$YARN_VERSION --force


# Throw-away build stage to reduce size of final image
FROM base as build

# Install packages needed to build node modules
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential node-gyp pkg-config python-is-python3

# Install node modules
COPY --link package.json yarn.lock ./
RUN yarn install --frozen-lockfile --production=false

# Copy application code
COPY --link . .

# Build application
RUN yarn run build:mail

# Remove development dependencies
RUN yarn install --production=true


# Final stage for app image
FROM base

ENV NODE_ENV production
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

# Copy built application
COPY --from=build /app /app

RUN chown -R nextjs:nodejs /app

# Start the server by default, this can be overwritten at runtime
EXPOSE 3000

USER nextjs


CMD [ "node", "dist/mail-server/index.js" ]
20 changes: 20 additions & 0 deletions mail-server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const path = require("path");
const dotenv = require("dotenv");
dotenv.config({
path: path.resolve(process.cwd(), process.env.NODE_ENV === "production" ? ".env.production" : ".env.local"),
});
const { startMailServiceCron } = require("./src/server/mail-service/mail-cron");
const verifyEnvironmentVariables = require("./src/server/utils/verifyEnvironmentVariables");

(async () => {

const { isVerified, envVariablesStatus } = await verifyEnvironmentVariables();

console.log("Environment variables status", envVariablesStatus);
if (isVerified) {
startMailServiceCron();
} else {
console.error("Mail service cron not started");
}

})();
11 changes: 11 additions & 0 deletions mail-server.webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const path = require('path');

module.exports = {
target: 'node',
entry: './mail-server.js',
mode: 'production',
output: {
filename: 'index.js',
path: path.resolve(__dirname, 'dist/mail-server'),
},
};
20 changes: 16 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,21 @@
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "nodemon server.js",
"build": "next build",
"start": "NODE_ENV=production node server.js",
"dev": "concurrently \"npm run dev:frontend\" \"npm run dev:mail\"",
"build": "concurrently \"npm run build:frontend\" \"npm run build:mail\"",
"build:frontend": "next build",
"build:mail": "webpack --config mail-server.webpack.config.js",
"start": "concurrently \"npm run start:frontend\" \"npm run start:mail\"",
"lint": "next lint",
"format:check": "prettier --check --ignore-path .prettierignore .",
"format:fix": "prettier --write --ignore-path .gitignore .",
"find:unused": "next-unused"
"find:unused": "next-unused",
"dev:frontend": "nodemon server.js",
"dev:mail": "nodemon mail-server.js",
"start:frontend": "NODE_ENV=production node server.js",
"start:mail": "NODE_ENV=production node dist/mail-server/index.js",
"docker:frontend": "docker build -t sharmaamits/saasbuilder -f Dockerfile.frontend --platform linux/amd64 .",
"docker:mail": "docker build -t sharmaamits/saasbuilder-mail -f Dockerfile.mail --platform linux/amd64 ."
},
"dependencies": {
"@curvenote/ansi-to-react": "^7.0.0",
Expand All @@ -25,6 +33,7 @@
"@tanstack/react-query": "^4.36.1",
"axios": "^1.2.2",
"clipboardy": "^3.0.0",
"cloud-regions-country-flags": "^1.1.4",
"crypto-js": "^4.2.0",
"date-fns": "^2.29.3",
"dompurify": "^3.0.9",
Expand Down Expand Up @@ -54,10 +63,13 @@
"sass": "^1.56.1",
"sharp": "0.32.6",
"swagger-ui-react": "^5.4.2",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4",
"yup": "^0.32.11"
},
"devDependencies": {
"@flydotio/dockerfile": "^0.5.2",
"concurrently": "^8.2.2",
"eslint": "^8.56.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-react": "^7.33.2",
Expand Down
2 changes: 1 addition & 1 deletion pages/access/[serviceId]/[environmentId]/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ function Events() {
</DashboardLayout>
);
}

return (
<DashboardLayout
setSupportDrawerOpen={setSupportDrawerOpen}
Expand Down
6 changes: 3 additions & 3 deletions pages/access/service/[serviceId].js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ import {
} from "../../../src/slices/resourceInstanceListSlice";
import { selectUserrootData } from "../../../src/slices/userDataSlice";
import loadingStatuses from "../../../src/utils/constants/loadingStatuses";
import formatDateUTC from "../../../src/utils/formatDateUTC";
import formatDateLocal from "../../../src/utils/formatDateLocal";
import {
getEnumFromUserRoleString,
isOperationAllowedByRBAC,
Expand Down Expand Up @@ -343,7 +343,7 @@ function MarketplaceService() {
align: "center",
headerAlign: "center",
valueGetter: (params) => {
const value = formatDateUTC(params.row.created_at);
const value = formatDateLocal(params.row.created_at);
return value;
},
},
Expand All @@ -355,7 +355,7 @@ function MarketplaceService() {
align: "center",
headerAlign: "center",
valueGetter: (params) => {
const value = formatDateUTC(params.row.last_modified_at);
const value = formatDateLocal(params.row.last_modified_at);
return value;
},
},
Expand Down
6 changes: 3 additions & 3 deletions pages/api/action.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ export default async function handleAction(nextRequest, nextResponse) {
.setHeader("content-type", response.headers["content-type"])
.send(data);
}
if (data) nextResponse.send({ ...data });
else nextResponse.send();
if (data) return nextResponse.send({ ...data });
else return nextResponse.send();
}
} catch (error) {
console.error("Action Route error", error?.response?.data);
const errorCode = error?.response?.status || 500;
const errorMessage =
error?.response?.data?.message || defaultErrorMessage;
nextResponse.status(errorCode).send({
return nextResponse.status(errorCode).send({
message: errorMessage,
});
}
Expand Down
8 changes: 4 additions & 4 deletions pages/api/provider-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,25 @@ export default async function handleGetProviderDetails(
const response = await getProviderOrgDetails();

const faviconURL = response?.data?.orgFavIconURL;
nextResponse.status(200).send({ providerOrgFaviconURL: faviconURL });
return nextResponse.status(200).send({ providerOrgFaviconURL: faviconURL });
} catch (error) {
let defaultErrorMessage = "Something went wrong. Please retry";

if (
error.name === "ProviderAuthError" ||
error?.response?.status === undefined
) {
nextResponse.status(500).send({
return nextResponse.status(500).send({
message: defaultErrorMessage,
});
} else {
nextResponse.status(error.response?.status || 500).send({
return nextResponse.status(error.response?.status || 500).send({
message: error.response?.data?.message || defaultErrorMessage,
});
}
}
} else {
nextResponse.status(404).json({
return nextResponse.status(404).json({
message: "Endpoint not found",
});
}
Expand Down
10 changes: 5 additions & 5 deletions pages/api/reset-password.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,31 @@ export default async function handleResetPassword(nextRequest, nextResponse) {
if (nextRequest.method === "POST") {
try {
const response = await customerUserResetPassword(nextRequest.body);
nextResponse.status(200).send();
return nextResponse.status(200).send();
} catch (error) {
let defaultErrorMessage = "Something went wrong. Please retry";

if (
error.name === "ProviderAuthError" ||
error?.response?.status === undefined
) {
nextResponse.status(500).send({
return nextResponse.status(500).send({
message: defaultErrorMessage,
});
} else {
let responseErrorMessage = error.response?.data?.message;

if (responseErrorMessage === "user not found: record not found") {
nextResponse.status(200).send()
return nextResponse.status(200).send()
}

nextResponse.status(error.response?.status || 500).send({
return nextResponse.status(error.response?.status || 500).send({
message: responseErrorMessage || defaultErrorMessage,
});
}
}
} else {
nextResponse.status(404).json({
return nextResponse.status(404).json({
message: "Endpoint not found",
});
}
Expand Down
10 changes: 5 additions & 5 deletions pages/api/signin.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default async function handleSignIn(nextRequest, nextResponse) {
if (nextRequest.method === "POST") {
try {
const response = await customerUserSignIn(nextRequest.body);
nextResponse.status(200).send({ ...response.data });
return nextResponse.status(200).send({ ...response.data });
} catch (error) {
let defaultErrorMessage =
"Failed to sign in. Either the credentials are incorrect or the user does not exist";
Expand All @@ -13,23 +13,23 @@ export default async function handleSignIn(nextRequest, nextResponse) {
error.name === "ProviderAuthError" ||
error?.response?.status === undefined
) {
nextResponse.status(500).send({
return nextResponse.status(500).send({
message: defaultErrorMessage,
});
} else if (
error.response?.data?.message === "wrong user email or password"
) {
nextResponse.status(400).send({
return nextResponse.status(400).send({
message: defaultErrorMessage,
});
} else {
nextResponse.status(error.response?.status || 500).send({
return nextResponse.status(error.response?.status || 500).send({
message: error.response?.data?.message || defaultErrorMessage,
});
}
}
} else {
nextResponse.status(404).json({
return nextResponse.status(404).json({
message: "Endpoint not found",
});
}
Expand Down
10 changes: 5 additions & 5 deletions pages/api/signup.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default async function handleSignup(nextRequest, nextResponse) {
if (nextRequest.method === "POST") {
try {
const response = await customerUserSignUp(nextRequest.body);
nextResponse.status(200).send();
return nextResponse.status(200).send();
} catch (error) {
console.error(error?.response?.data);
let defaultErrorMessage = "Something went wrong. Please retry";
Expand All @@ -13,22 +13,22 @@ export default async function handleSignup(nextRequest, nextResponse) {
error.name === "ProviderAuthError" ||
error?.response?.status === undefined
) {
nextResponse.status(500).send({
return nextResponse.status(500).send({
message: defaultErrorMessage,
});
} else {
let responseErrorMessage = error.response?.data?.message;

if (responseErrorMessage === "tenant already exists") {
nextResponse.status(200).send();
return nextResponse.status(200).send();
}
nextResponse.status(error.response?.status || 500).send({
return nextResponse.status(error.response?.status || 500).send({
message: responseErrorMessage || defaultErrorMessage,
});
}
}
} else {
nextResponse.status(404).json({
return nextResponse.status(404).json({
message: "Endpoint not found",
});
}
Expand Down
Loading