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

2540110741_AxelValent #9

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=e01b7895a403fa7364061b2f01a650fc
BACKEND_API_HOST=https://demo.duendesoftware.com
BACKEND_CUSTOM_API_HOST=https://new-dev.accelist.com:1234
OIDC_ISSUER=https://demo.duendesoftware.com
OIDC_CLIENT_ID=interactive.public.short
OIDC_SCOPE=openid profile email api offline_access
1 change: 1 addition & 0 deletions appsettings.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module.exports = {
backendApiHost: process.env['BACKEND_API_HOST'] ?? '',
backendCustomApiHost: process.env['BACKEND_CUSTOM_API_HOST'] ?? '',
oidcIssuer: process.env['OIDC_ISSUER'] ?? '',
oidcClientId: process.env['OIDC_CLIENT_ID'] ?? '',
oidcScope: process.env['OIDC_SCOPE'] ?? '',
Expand Down
68 changes: 4 additions & 64 deletions components/DefautLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState } from "react";
import Head from 'next/head';
import { Avatar, Button, ConfigProvider, Drawer, Layout, Menu, MenuProps } from "antd";
import { faBars, faSignOut, faSignIn, faHome, faCubes, faUser, faUsers, faFlaskVial } from '@fortawesome/free-solid-svg-icons'
import { faBars, faSignOut, faSignIn, faHome, faCubes, faUser} from '@fortawesome/free-solid-svg-icons'
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useRouter } from "next/router";
import { useSession, signIn, signOut } from "next-auth/react";
Expand Down Expand Up @@ -29,77 +29,17 @@ const DefaultLayout: React.FC<{

menu.push({
key: '/',
label: 'Home',
label: 'Main Menu',
icon: <FontAwesomeIcon icon={faHome}></FontAwesomeIcon>,
onClick: () => router.push('/')
});

menu.push(
{
key: '#menu-1',
label: 'Menu 1',
label: 'Post',
icon: <FontAwesomeIcon icon={faCubes}></FontAwesomeIcon>,
children: [
{
key: '/dashboard',
label: 'Dashboard',
onClick: () => router.push('/dashboard')
},
{
key: '/sub-menu-b',
label: 'Sub Menu B',
onClick: () => router.push('/')
},
{
key: '/sub-menu-c',
label: 'Sub Menu C',
onClick: () => router.push('/')
}
]
},
{
key: '#menu-2',
label: 'Menu 2',
icon: <FontAwesomeIcon icon={faUsers}></FontAwesomeIcon>,
children: [
{
key: '/sub-menu-d',
label: 'Sub Menu D',
onClick: () => router.push('/')
},
{
key: '/sub-menu-e',
label: 'Sub Menu E',
onClick: () => router.push('/')
},
{
key: '/sub-menu-f',
label: 'Sub Menu F',
onClick: () => router.push('/')
}
]
},
{
key: '#menu-3',
label: 'Menu 3',
icon: <FontAwesomeIcon icon={faFlaskVial}></FontAwesomeIcon>,
children: [
{
key: '/sub-menu-g',
label: 'Sub Menu G',
onClick: () => router.push('/')
},
{
key: '/sub-menu-h',
label: 'Sub Menu H',
onClick: () => router.push('/')
},
{
key: '/sub-menu-i',
label: 'Sub Menu I',
onClick: () => router.push('/')
}
]
onClick: () => router.push('/post')
}
);

Expand Down
29 changes: 29 additions & 0 deletions components/DeleteConfirmation.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// components/ConfirmationModal.tsx
import React from 'react';

interface DeleteConfirmation {
isOpen: boolean;
onClose: () => void;
onConfirm: () => void;
}

const DeleteConfirmation: React.FC<DeleteConfirmation> = ({ isOpen, onClose, onConfirm }) => {
return (
<>
{isOpen && (
<div className="fixed inset-0 z-10 flex items-center justify-center">
<div className="fixed inset-0 bg-gray-500 opacity-75"></div>
<div className="bg-white p-4 rounded shadow-md z-20">
<p>Are you sure you want to delete this order?</p>
<div className="flex justify-end mt-4">
<button className="mr-2 px-4 py-2 bg-gray-200 text-gray-700 rounded" onClick={onClose}>Cancel</button>
<button className="px-4 py-2 bg-red-500 text-white rounded" onClick={onConfirm}>Delete</button>
</div>
</div>
</div>
)}
</>
);
};

export default DeleteConfirmation;
100 changes: 100 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"nprogress": "0.2.0",
"openid-client": "5.4.0",
"react": "18.2.0",
"react-datepicker": "^6.9.0",
"react-dom": "18.2.0",
"react-hook-form": "7.43.9",
"swr": "2.1.2",
Expand Down
4 changes: 2 additions & 2 deletions pages/api/be/[...apiGateway].ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { AppSettings } from '../../../functions/AppSettings';
// Great way to avoid using CORS and making API calls from HTTPS pages to back-end HTTP servers
// Recommendation for projects in Kubernetes cluster: set target to Service DNS name instead of public DNS name
const server = Proxy.createProxyServer({
target: AppSettings.current.backendApiHost,
target: AppSettings.current.backendCustomApiHost,
// changeOrigin to support name-based virtual hosting
changeOrigin: true,
xfwd: true,
Expand All @@ -23,7 +23,7 @@ server.on('proxyReq', (proxyReq, req) => {
}
proxyReq.removeHeader('cookie');
// console.log(JSON.stringify(proxyReq.getHeaders(), null, 4));
console.log('API Proxy:', req.url, '-->', AppSettings.current.backendApiHost + urlRewrite);
console.log('API Proxy:', req.url, '-->', AppSettings.current.backendCustomApiHost + urlRewrite);
});

const apiGateway = async (req: NextApiRequest, res: NextApiResponse) => {
Expand Down
Loading
Loading