Fixed sandbox. Multiple tabs work now.

WiP on selectable mosaico templates.

TODO: Make files always point to trusted URL, such that we don't have to rebase them. They are public anyway. The same goes for mosaico endpoints: /mosaico/templates and /mosaico/img
This commit is contained in:
Tomas Bures 2018-05-09 04:07:01 +02:00
parent a4ee1534cc
commit 7788b0bc67
79 changed files with 724 additions and 390 deletions

View file

@ -11,6 +11,7 @@ import interoperableErrors from '../../../shared/interoperable-errors';
import {DeleteModalDialog} from "../lib/modals";
import mailtrainConfig from 'mailtrainConfig';
import {getGlobalNamespaceId} from "../../../shared/namespaces";
import {getUrl} from "../lib/urls";
@translate()
@withForm
@ -57,7 +58,7 @@ export default class CUD extends Component {
@withAsyncErrorHandler
async loadTreeData() {
const response = await axios.get('/rest/namespaces-tree');
const response = await axios.get(getUrl('rest/namespaces-tree'));
const data = response.data;
for (const root of data) {
root.expanded = true;
@ -112,10 +113,10 @@ export default class CUD extends Component {
let sendMethod, url;
if (this.props.entity) {
sendMethod = FormSendMethod.PUT;
url = `/rest/namespaces/${this.props.entity.id}`
url = `rest/namespaces/${this.props.entity.id}`
} else {
sendMethod = FormSendMethod.POST;
url = '/rest/namespaces'
url = 'rest/namespaces'
}
try {
@ -182,7 +183,7 @@ export default class CUD extends Component {
<DeleteModalDialog
stateOwner={this}
visible={this.props.action === 'delete'}
deleteUrl={`/rest/namespaces/${this.props.entity.id}`}
deleteUrl={`rest/namespaces/${this.props.entity.id}`}
cudUrl={`/namespaces/${this.props.entity.id}/edit`}
listUrl="/namespaces"
deletingMsg={t('Deleting namespace ...')}

View file

@ -7,6 +7,7 @@ import { TreeTable } from '../lib/tree';
import { withErrorHandling, withAsyncErrorHandler } from '../lib/error-handling';
import axios from '../lib/axios';
import {Icon} from "../lib/bootstrap-components";
import {checkPermissions} from "../lib/permissions";
@translate()
@withErrorHandling
@ -21,14 +22,12 @@ export default class List extends Component {
@withAsyncErrorHandler
async fetchPermissions() {
const request = {
const result = await checkPermissions({
createNamespace: {
entityTypeId: 'namespace',
requiredOperations: ['createNamespace']
}
};
const result = await axios.post('/rest/permissions-check', request);
});
this.setState({
createPermitted: result.data.createNamespace
@ -72,7 +71,7 @@ export default class List extends Component {
<Title>{t('Namespaces')}</Title>
<TreeTable withHeader withDescription dataUrl="/rest/namespaces-tree" actions={actions} />
<TreeTable withHeader withDescription dataUrl="rest/namespaces-tree" actions={actions} />
</div>
);
}

View file

@ -15,7 +15,7 @@ function getMenus(t) {
':namespaceId([0-9]+)': {
title: resolved => t('Namespace "{{name}}"', {name: resolved.namespace.name}),
resolve: {
namespace: params => `/rest/namespaces/${params.namespaceId}`
namespace: params => `rest/namespaces/${params.namespaceId}`
},
link: params => `/namespaces/${params.namespaceId}/edit`,
navs: {