Some cleanup/small fixes.

This commit is contained in:
Tomas Bures 2019-08-23 13:50:43 +02:00
parent 5abf100776
commit 427f0ec2c2
7 changed files with 16 additions and 21 deletions

View file

@ -818,7 +818,7 @@ class TreeTableSelect extends Component {
dataUrl: PropTypes.string,
data: PropTypes.array,
help: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
format: PropTypes.string,
format: PropTypes.string
}
async onSelectionChangedAsync(sel) {

View file

@ -4,6 +4,7 @@ import React, {Component} from 'react';
import {withTranslation} from './i18n';
import {TreeTableSelect} from './form';
import {withComponentMixins} from "./decorator-helpers";
import mailtrainConfig from 'mailtrainConfig';
@withComponentMixins([

View file

@ -193,8 +193,8 @@ export function getRoutes(structure, parentRoute) {
structure: entry.structure,
panelComponent: entry.panelComponent,
panelRender: entry.panelRender,
primaryMenuComponent: entry.primaryMenuComponent || primaryMenuComponent,
secondaryMenuComponent: entry.secondaryMenuComponent || secondaryMenuComponent,
primaryMenuComponent: (entry.primaryMenuComponent || entry.primaryMenuComponent === null) ? entry.primaryMenuComponent : primaryMenuComponent,
secondaryMenuComponent: (entry.secondaryMenuComponent || entry.secondaryMenuComponent === null) ? entry.secondaryMenuComponent : secondaryMenuComponent,
title: entry.title,
link: entry.link,
panelInFullScreen: entry.panelInFullScreen,

View file

@ -155,7 +155,7 @@ class Table extends Component {
for (const row of response.data) {
const key = row[this.props.selectionKeyIndex];
if (oldSelectionMap.has(key)) {
this.selectionMap.set(key, row)
this.selectionMap.set(key, row);
}
}

View file

@ -32,6 +32,8 @@ export class UntrustedContentHost extends Component {
this.rpcCounter = 0;
this.rpcResolves = new Map();
this.unmounted = false;
}
static propTypes = {
@ -111,7 +113,7 @@ export class UntrustedContentHost extends Component {
this.accessToken = result.data;
if (!this.state.hasAccessToken) {
if (!this.state.hasAccessToken && !this.unmounted) {
this.setState({
hasAccessToken: true
})
@ -152,6 +154,7 @@ export class UntrustedContentHost extends Component {
}
componentWillUnmount() {
this.unmounted = true;
clearTimeout(this.refreshAccessTokenTimeout);
window.removeEventListener('message', this.receiveMessageHandler, false);
}

View file

@ -7,15 +7,15 @@ import i18n from './i18n';
let restrictedAccessToken = anonymousRestrictedAccessToken;
function setRestrictedAccessToken(token) {
export function setRestrictedAccessToken(token) {
restrictedAccessToken = token;
}
function getTrustedUrl(path) {
export function getTrustedUrl(path) {
return mailtrainConfig.trustedUrlBase + (path || '');
}
function getSandboxUrl(path, customRestrictedAccessToken, opts) {
export function getSandboxUrl(path, customRestrictedAccessToken, opts) {
const localRestrictedAccessToken = customRestrictedAccessToken || restrictedAccessToken;
const url = new URL(localRestrictedAccessToken + '/' + (path || ''), mailtrainConfig.sandboxUrlBase);
@ -26,7 +26,7 @@ function getSandboxUrl(path, customRestrictedAccessToken, opts) {
return url.toString();
}
function getPublicUrl(path, opts) {
export function getPublicUrl(path, opts) {
const url = new URL(path || '', mailtrainConfig.publicUrlBase);
if (opts && opts.withLocale) {
@ -36,7 +36,7 @@ function getPublicUrl(path, opts) {
return url.toString();
}
function getUrl(path) {
export function getUrl(path) {
if (mailtrainConfig.appType === AppType.TRUSTED) {
return getTrustedUrl(path);
} else if (mailtrainConfig.appType === AppType.SANDBOXED) {
@ -46,7 +46,7 @@ function getUrl(path) {
}
}
function getBaseDir() {
export function getBaseDir() {
if (mailtrainConfig.appType === AppType.TRUSTED) {
return mailtrainConfig.trustedUrlBaseDir;
} else if (mailtrainConfig.appType === AppType.SANDBOXED) {
@ -55,12 +55,3 @@ function getBaseDir() {
return mailtrainConfig.publicUrlBaseDir;
}
}
export {
getTrustedUrl,
getSandboxUrl,
getPublicUrl,
getUrl,
getBaseDir,
setRestrictedAccessToken
}