Skip to content

Commit

Permalink
Reverse proxy using base tag (ToolJet#3889)
Browse files Browse the repository at this point in the history
* reverse proxy

* reverse proxy

* Fix for yjs

* Fix for ws

* Fixes org switching

* Fixes org creation

* Fixes login logo

* Fixes download icon

* Construct use invite URL from base URI

* Fixes apiUrl if sub path is set

* Remove commented code

* Fix profile link

* invitation url changes

* Fixes dev env

* Use url-join lib to connect urls for goto app and invitation link

* Use useHistory instead of helper to get history for template modal

* Review changes

Co-authored-by: Sherfin Shamsudeen <sherfin94@gmail.com>
Co-authored-by: gsmithun4 <gsmithun4@gmail.com>
  • Loading branch information
3 people authored Aug 27, 2022
1 parent c75b627 commit 98bb751
Show file tree
Hide file tree
Showing 66 changed files with 939 additions and 363 deletions.
2 changes: 1 addition & 1 deletion frontend/ee/components/LoginPage/GitSSOLoginButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function GitSSOLoginButton({ configs, text }) {
return (
<div data-cy="git-tile">
<button onClick={gitLogin} className="btn border-0 rounded-2">
<img src="/assets/images/sso-buttons/git.svg" className="h-4" data-cy="git-icon" />
<img src="assets/images/sso-buttons/git.svg" className="h-4" data-cy="git-icon" />
<span className="px-1" data-cy="git-sign-in-text">
{text || 'Sign in with GitHub'}
</span>
Expand Down
6 changes: 2 additions & 4 deletions frontend/ee/components/LoginPage/GoogleSSOLoginButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,14 @@ export default function GoogleSSOLoginButton(props) {
buttonText="Login"
cookiePolicy={'single_host_origin'}
uxMode="redirect"
redirectUri={`${window.location.protocol}//${window.location.host}/sso/google${
props.configId ? `/${props.configId}` : ''
}`}
redirectUri={`${window.public_config?.TOOLJET_HOST}/sso/google${props.configId ? `/${props.configId}` : ''}`}
render={(renderProps) => (
<div>
<button {...renderProps} className="btn border-0 rounded-2">
<img
onClick={renderProps.onClick}
disabled={renderProps.disabled}
src="/assets/images/sso-buttons/google.svg"
src="assets/images/sso-buttons/google.svg"
className="h-4"
data-cy="google-icon"
/>
Expand Down
14 changes: 14 additions & 0 deletions frontend/package-lock.json

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

7 changes: 4 additions & 3 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"babel-plugin-import": "^1.13.3",
"bootstrap": "^4.6.0",
"classnames": "^2.3.1",
"compression-webpack-plugin": "^10.0.0",
"css-loader": "^6.5.1",
"date-fns": "^2.28.0",
"dompurify": "^2.2.7",
Expand Down Expand Up @@ -95,13 +96,13 @@
"superstruct": "^0.15.4",
"terser-webpack-plugin": "^5.3.4",
"tinycolor2": "^1.4.2",
"url-join": "^5.0.0",
"uuid": "8.3.2",
"webpack": "^5.55.1",
"webpack-cli": "^4.8.0",
"y-websocket": "^1.4.0",
"yjs": "^13.5.28",
"yup": "^0.27.0",
"compression-webpack-plugin": "^10.0.0"
"yup": "^0.27.0"
},
"devDependencies": {
"eslint": "^7.32.0",
Expand Down Expand Up @@ -154,4 +155,4 @@
"jsx"
]
}
}
}
6 changes: 3 additions & 3 deletions frontend/src/App/App.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import config from 'config';
import { Router, Route, Redirect } from 'react-router-dom';
import { BrowserRouter, Route, Redirect } from 'react-router-dom';
import { history } from '@/_helpers';
import { authenticationService, tooljetService } from '@/_services';
import { PrivateRoute } from '@/_components';
Expand Down Expand Up @@ -86,7 +86,7 @@ class App extends React.Component {

return (
<>
<Router history={history}>
<BrowserRouter history={history} basename={window.public_config?.SUB_PATH || '/'}>
<div className={`main-wrapper ${darkMode ? 'theme-dark' : ''}`}>
{updateAvailable && (
<div className="alert alert-info alert-dismissible" role="alert">
Expand Down Expand Up @@ -258,7 +258,7 @@ class App extends React.Component {
darkMode={darkMode}
/>
</div>
</Router>
</BrowserRouter>
<Toaster toastOptions={toastOptions} />
</>
);
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/ConfirmationPage/ConfirmationPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class ConfirmationPage extends React.Component {
>
<div className="text-center mb-4">
<a href=".">
<img src="/assets/images/logo-color.svg" height="30" alt="" data-cy="page-logo" />
<img src="assets/images/logo-color.svg" height="30" alt="" data-cy="page-logo" />
</a>
</div>
<form className="card card-md" action="." method="get" autoComplete="off" data-cy="confirm-invite-container">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class OrganizationInvitationPage extends React.Component {
<div className="container-tight py-2 invitation-page" data-cy="confirm-invite-container">
<div className="text-center mb-4">
<a href=".">
<img src="/assets/images/logo-color.svg" height="30" alt="" data-cy="page-logo" />
<img src="assets/images/logo-color.svg" height="30" alt="" data-cy="page-logo" />
</a>
</div>
<form className="card card-md" action="." method="get" autoComplete="off">
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/Editor/AppVersionsManager.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export const AppVersionsManager = function AppVersionsManager({
}}
>
<span className={`${releasedVersionId === editingAppVersion.id ? 'released' : ''}`}>
{releasedVersionId === editingAppVersion.id && <img src={'/assets/images/icons/editor/deploy-rocket.svg'} />}
{releasedVersionId === editingAppVersion.id && <img src={'assets/images/icons/editor/deploy-rocket.svg'} />}
<span className="px-1">{editingAppVersion.name}</span>
</span>
{showDropDown && (
Expand All @@ -198,7 +198,7 @@ export const AppVersionsManager = function AppVersionsManager({
>
<div className="col-md-4">{version.name}</div>
<div className="released-subtext">
<img src={'/assets/images/icons/editor/deploy-rocket.svg'} />
<img src={'assets/images/icons/editor/deploy-rocket.svg'} />
<span className="px-1">Currently Released</span>
</div>
</div>
Expand Down Expand Up @@ -229,7 +229,7 @@ export const AppVersionsManager = function AppVersionsManager({
}}
>
<img
src="/assets/images/icons/edit.svg"
src="assets/images/icons/edit.svg"
width="12"
height="12"
className="mx-1"
Expand All @@ -250,7 +250,7 @@ export const AppVersionsManager = function AppVersionsManager({
}}
>
<img
src="/assets/images/icons/query-trash-icon.svg"
src="assets/images/icons/query-trash-icon.svg"
width="12"
height="12"
className="mx-1"
Expand Down Expand Up @@ -423,7 +423,7 @@ const CreateVersionModal = function CreateVersionModal({
<div className="row py-3">
<div className="col-1 py-2">
<span className="pe-1">
<img src={'/assets/images/icons/editor/bulb-sharp.svg'} />
<img src={'assets/images/icons/editor/bulb-sharp.svg'} />
</span>
</div>
<div className="col">
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/Editor/Box.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ export const Box = function Box({
width: '20px',
height: '20px',
backgroundSize: 'contain',
backgroundImage: `url(/assets/images/icons/widgets/${component.name.toLowerCase()}.svg)`,
backgroundImage: `url(assets/images/icons/widgets/${component.name.toLowerCase()}.svg)`,
backgroundRepeat: 'no-repeat',
}}
></div>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/Editor/CodeBuilder/CodeHinter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ const PopupIcon = ({ callback, icon, tip }) => {
>
<img
className="svg-icon m-2 popup-btn"
src={`/assets/images/icons/${icon}.svg`}
src={`assets/images/icons/${icon}.svg`}
width="12"
height="12"
onClick={(e) => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/Editor/Comment/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const Comment = ({
fetchData();
} else {
// resetting the query param
router.push(window.location.pathname);
// router.push(window.location.pathname);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [open]);
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/Editor/Components/DraftEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,19 @@ const HEADINGS = [

const BLOCK_TYPES = [
{
label: <img src="/assets/images/icons/rich-text-editor/blockquote.svg" style={{ height: '16px' }} />,
label: <img src="assets/images/icons/rich-text-editor/blockquote.svg" style={{ height: '16px' }} />,
style: 'blockquote',
},
{
label: <img src="/assets/images/icons/rich-text-editor/ul.svg" style={{ height: '16px' }} />,
label: <img src="assets/images/icons/rich-text-editor/ul.svg" style={{ height: '16px' }} />,
style: 'unordered-list-item',
},
{
label: <img src="/assets/images/icons/rich-text-editor/ol.svg" style={{ height: '16px' }} />,
label: <img src="assets/images/icons/rich-text-editor/ol.svg" style={{ height: '16px' }} />,
style: 'ordered-list-item',
},
{
label: <img src="/assets/images/icons/rich-text-editor/codeblock.svg" style={{ height: '16px' }} />,
label: <img src="assets/images/icons/rich-text-editor/codeblock.svg" style={{ height: '16px' }} />,
style: 'code-block',
},
];
Expand Down Expand Up @@ -114,15 +114,15 @@ const BlockStyleControls = (props) => {

var INLINE_STYLES = [
{
label: <img src="/assets/images/icons/rich-text-editor/bold.svg" style={{ height: '16px' }} />,
label: <img src="assets/images/icons/rich-text-editor/bold.svg" style={{ height: '16px' }} />,
style: 'BOLD',
},
{
label: <img src="/assets/images/icons/rich-text-editor/italic.svg" style={{ height: '16px' }} />,
label: <img src="assets/images/icons/rich-text-editor/italic.svg" style={{ height: '16px' }} />,
style: 'ITALIC',
},
{
label: <img src="/assets/images/icons/rich-text-editor/underline.svg" style={{ height: '16px' }} />,
label: <img src="assets/images/icons/rich-text-editor/underline.svg" style={{ height: '16px' }} />,
style: 'UNDERLINE',
},
];
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/Editor/Components/FilePicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ export const FilePicker = ({
clearSelectedFiles(index);
}}
>
<img src="/assets/images/icons/trash.svg" width="12" height="12" className="mx-1" />
<img src="assets/images/icons/trash.svg" width="12" height="12" className="mx-1" />
</button>
</div>
</>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/Editor/Components/KanbanBoard/Card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export const Card = ({
type="btn btn-sm btn-danger"
onClick={() => removeCardHandler(keyIndex, index)}
>
<img className="mx-1" src={`/assets/images/icons/trash.svg`} width={12} height={12} />
<img className="mx-1" src={`assets/images/icons/trash.svg`} width={12} height={12} />
</span>
)}
{eventPopoverOptions.show && (
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/Editor/Components/KanbanBoard/CardPopover.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export const CardEventPopover = function ({
<h3>
{card?.title ?? ''}
<img
src="/assets/images/icons/editor/edit.svg"
src="assets/images/icons/editor/edit.svg"
style={{ visibility: titleHovered ? 'visible' : 'hidden', height: 15, width: 15, paddingLeft: 1 }}
onClick={() => setTitleEditMode(true)}
/>
Expand Down Expand Up @@ -136,7 +136,7 @@ export const CardEventPopover = function ({
card.description
)}
<img
src="/assets/images/icons/editor/edit.svg"
src="assets/images/icons/editor/edit.svg"
style={{
visibility: descriptionHovered ? 'visible' : 'hidden',
height: 15,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/Editor/Components/Map/Map.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export const Map = function Map({
top: height * 0.5 - 50,
}}
>
<img className="mx-2" src="/assets/images/icons/marker.svg" width="24" height="64" />
<img className="mx-2" src="assets/images/icons/marker.svg" width="24" height="64" />
</div>
<LoadScript googleMapsApiKey={window.public_config.GOOGLE_MAPS_API_KEY} libraries={['places']}>
<GoogleMap
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/Editor/Components/PDF.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export const PDF = React.memo(({ styles, properties, width, height, component })
onClick={() => downloadFile(url, pdfName)}
>
<img
src="/assets/images/icons/download.svg"
src="assets/images/icons/download.svg"
alt="download logo"
style={downloadIconImgStyle}
className="mx-1"
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/Editor/Components/Statistics.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@ export const Statistics = function Statistics({ width, height, properties, style
<div className="d-flex flex-row justify-content-center align-items-baseline">
{secondarySignDisplay !== 'negative' ? (
<img
src="/assets/images/icons/widgets/upstatistics.svg"
src="assets/images/icons/widgets/upstatistics.svg"
style={{ ...marginStyle, marginRight: '6.5px' }}
/>
) : (
<img
src="/assets/images/icons/widgets/downstatistics.svg"
src="assets/images/icons/widgets/downstatistics.svg"
style={{ ...marginStyle, marginRight: '6.5px' }}
/>
)}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/Editor/Components/Table/GlobalFilter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const GlobalFilter = ({
return (
<div className="ms-2 d-flex border px-2 mx-1 btn-light align-items-center" style={{ padding: '0.25rem 0' }}>
<img
src="/assets/images/icons/search.svg"
src="assets/images/icons/search.svg"
alt="search icon"
style={{ width: '15px', height: '15px', marginRight: '0.25rem' }}
/>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/Editor/Components/Table/Table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ export function Table({
<div>
{showFilterButton && (
<span data-tip="Filter data" className="btn btn-light btn-sm p-1 mx-1" onClick={() => showFilters()}>
<img src="/assets/images/icons/filter.svg" width="15" height="15" />
<img src="assets/images/icons/filter.svg" width="15" height="15" />
{filters.length > 0 && (
<a className="badge bg-azure" style={{ width: '4px', height: '4px', marginTop: '5px' }}></a>
)}
Expand All @@ -925,7 +925,7 @@ export function Table({
className="btn btn-light btn-sm p-1"
onClick={() => exportData('csv', true)}
>
<img src="/assets/images/icons/download.svg" width="15" height="15" />
<img src="assets/images/icons/download.svg" width="15" height="15" />
</span>
)}
</div>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/Editor/ConfigHandle.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const ConfigHandle = function ConfigHandle({
>
<img
style={{ cursor: 'pointer', marginRight: '5px', verticalAlign: 'middle' }}
src="/assets/images/icons/settings.svg"
src="assets/images/icons/settings.svg"
width="12"
height="12"
draggable="false"
Expand All @@ -41,7 +41,7 @@ export const ConfigHandle = function ConfigHandle({
<div className="delete-part">
<img
style={{ cursor: 'pointer', marginLeft: '5px' }}
src="/assets/images/icons/trash-light.svg"
src="assets/images/icons/trash-light.svg"
width="12"
role="button"
height="12"
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/Editor/DataSourceManager/DataSourceManager.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ class DataSourceManager extends React.Component {
autoFocus
/>
<span className="input-icon-addon">
<img src="/assets/images/icons/edit-source.svg" width="12" height="12" />
<img src="assets/images/icons/edit-source.svg" width="12" height="12" />
</span>
</div>
</div>
Expand All @@ -550,7 +550,7 @@ class DataSourceManager extends React.Component {
className={`close-btn mx-4 mt-3 ${this.props.darkMode ? 'dark' : ''}`}
onClick={() => this.hideModal()}
>
<img src="/assets/images/icons/close.svg" width="12" height="12" />
<img src="assets/images/icons/close.svg" width="12" height="12" />
</span>
</Modal.Header>

Expand Down Expand Up @@ -708,7 +708,7 @@ const EmptyStateContainer = ({
<div className="empty">
{queryString && !suggestionUI && <h3>No results for &quot;{queryString} &quot;</h3>}
<center className={`empty-results ${suggestionUI ? 'suggestionUI-results' : ''}`}>
<img src="/assets/images/icons/no-results.svg" width="150" height="150" />
<img src="assets/images/icons/no-results.svg" width="150" height="150" />
{status ? (
<div>
<p className="text-success mt-2">Thank you, we&apos;ve taken a note of that!</p>
Expand Down
Loading

0 comments on commit 98bb751

Please sign in to comment.