mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-22 14:47:56 +01:00
Add base configuration support for publish dialog
This commit is contained in:
parent
4c71ccd25a
commit
5e68914686
@ -83,7 +83,7 @@ const FR = {
|
|||||||
CTRL: 'Ctrl',
|
CTRL: 'Ctrl',
|
||||||
SPACE_BAR: 'Space Bar',
|
SPACE_BAR: 'Space Bar',
|
||||||
K_INSERT: 'Insert',
|
K_INSERT: 'Insert',
|
||||||
MOUSE_CLICK: 'Mouse Click',
|
MOUSE_CLICK: 'Clic de Souris',
|
||||||
K_DELETE: 'Delete',
|
K_DELETE: 'Delete',
|
||||||
BACKSPACE: 'Backspace',
|
BACKSPACE: 'Backspace',
|
||||||
};
|
};
|
||||||
|
@ -15,7 +15,7 @@ interface Config {
|
|||||||
class _AppConfig {
|
class _AppConfig {
|
||||||
|
|
||||||
private defaultInstance: Config = {
|
private defaultInstance: Config = {
|
||||||
apiBaseUrl: '/',
|
apiBaseUrl: `${window.location.protocol}//${window.location.hostname}:${window.location.port}`,
|
||||||
clientType: 'mock',
|
clientType: 'mock',
|
||||||
recaptcha2Enabled: true,
|
recaptcha2Enabled: true,
|
||||||
recaptcha2SiteKey: '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI'
|
recaptcha2SiteKey: '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI'
|
||||||
@ -57,7 +57,7 @@ class _AppConfig {
|
|||||||
const config = this.getInstance();
|
const config = this.getInstance();
|
||||||
let result: Client;
|
let result: Client;
|
||||||
if (config.clientType == 'rest') {
|
if (config.clientType == 'rest') {
|
||||||
result = new RestClient(config.apiBaseUrl);
|
result = new RestClient(this.getBaseUrl());
|
||||||
console.log('Service using rest client. ' + JSON.stringify(config));
|
console.log('Service using rest client. ' + JSON.stringify(config));
|
||||||
} else {
|
} else {
|
||||||
console.log('Warning:Service using mockservice client');
|
console.log('Warning:Service using mockservice client');
|
||||||
@ -67,6 +67,11 @@ class _AppConfig {
|
|||||||
// Wrap with a cache decorator ...
|
// Wrap with a cache decorator ...
|
||||||
return new CacheDecoratorClient(result);
|
return new CacheDecoratorClient(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getBaseUrl(): string {
|
||||||
|
const config = this.getInstance();
|
||||||
|
return config.apiBaseUrl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const AppConfig = new _AppConfig();
|
const AppConfig = new _AppConfig();
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ import TabPanel from '@mui/lab/TabPanel';
|
|||||||
import Typography from '@mui/material/Typography';
|
import Typography from '@mui/material/Typography';
|
||||||
import TextareaAutosize from '@mui/material/TextareaAutosize';
|
import TextareaAutosize from '@mui/material/TextareaAutosize';
|
||||||
import Box from '@mui/system/Box';
|
import Box from '@mui/system/Box';
|
||||||
|
import AppConfig from '../../../../classes/app-config';
|
||||||
|
|
||||||
const PublishDialog = ({ mapId, onClose }: SimpleDialogProps): React.ReactElement => {
|
const PublishDialog = ({ mapId, onClose }: SimpleDialogProps): React.ReactElement => {
|
||||||
const { map } = fetchMapById(mapId);
|
const { map } = fetchMapById(mapId);
|
||||||
@ -28,7 +29,6 @@ const PublishDialog = ({ mapId, onClose }: SimpleDialogProps): React.ReactElemen
|
|||||||
const [activeTab, setActiveTab] = React.useState('1');
|
const [activeTab, setActiveTab] = React.useState('1');
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
|
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const mutation = useMutation<void, ErrorInfo, boolean>(
|
const mutation = useMutation<void, ErrorInfo, boolean>(
|
||||||
(model: boolean) => {
|
(model: boolean) => {
|
||||||
@ -60,10 +60,11 @@ const PublishDialog = ({ mapId, onClose }: SimpleDialogProps): React.ReactElemen
|
|||||||
setModel(checked);
|
setModel(checked);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleTabChange = (event, newValue) => {
|
const handleTabChange = (event: React.ChangeEvent<HTMLInputElement>, newValue: string) => {
|
||||||
setActiveTab(newValue);
|
setActiveTab(newValue);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const baseUrl = AppConfig.getBaseUrl();
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<BaseDialog
|
<BaseDialog
|
||||||
@ -130,7 +131,7 @@ const PublishDialog = ({ mapId, onClose }: SimpleDialogProps): React.ReactElemen
|
|||||||
readOnly={true}
|
readOnly={true}
|
||||||
spellCheck={false}
|
spellCheck={false}
|
||||||
maxRows={6}
|
maxRows={6}
|
||||||
defaultValue={`<iframe style="width:600px;height:400px;border:1px solid black" src="https://app.wisemapping.com/c/maps/${mapId}/embed?zoom=1.0"></iframe>`}
|
defaultValue={`<iframe style="width:600px;height:400px;border:1px solid black" src="${baseUrl}/c/maps/${mapId}/embed?zoom=1.0"></iframe>`}
|
||||||
/>
|
/>
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
<TabPanel value="1">
|
<TabPanel value="1">
|
||||||
@ -145,7 +146,7 @@ const PublishDialog = ({ mapId, onClose }: SimpleDialogProps): React.ReactElemen
|
|||||||
readOnly={true}
|
readOnly={true}
|
||||||
spellCheck={false}
|
spellCheck={false}
|
||||||
maxRows={1}
|
maxRows={1}
|
||||||
defaultValue={`https://app.wisemapping.com/c/maps/${mapId}/public`}
|
defaultValue={`${baseUrl}/c/maps/${mapId}/public`}
|
||||||
/>
|
/>
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
</TabContext>
|
</TabContext>
|
||||||
|
Loading…
Reference in New Issue
Block a user