[7.2] Fix: Fullscreen sizing on old workpads (#37289) (#37292)

* fix: provide css value for workpads

old workpads were missing this value, this fixes scaling in fullscreen mode

* fix: make workpadCss a required prop

this will cause warnings in the future if the value is missing. also remove the unused css prop.
This commit is contained in:
Joe Fleming 2019-05-28 16:52:51 -07:00 committed by GitHub
parent ee5278cace
commit 11cdfa16fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View file

@ -25,13 +25,12 @@ export class Workpad extends React.PureComponent {
isFullscreen: PropTypes.bool.isRequired,
width: PropTypes.number.isRequired,
height: PropTypes.number.isRequired,
workpadCss: PropTypes.string,
workpadCss: PropTypes.string.required,
undoHistory: PropTypes.func.isRequired,
redoHistory: PropTypes.func.isRequired,
nextPage: PropTypes.func.isRequired,
previousPage: PropTypes.func.isRequired,
fetchAllRenderables: PropTypes.func.isRequired,
css: PropTypes.object,
registerLayout: PropTypes.func.isRequired,
unregisterLayout: PropTypes.func.isRequired,
};

View file

@ -6,7 +6,7 @@
import { get, omit } from 'lodash';
import { safeElementFromExpression, fromExpression } from '@kbn/interpreter/common';
import { DEFAULT_WORKPAD_CSS } from '../../../common/lib/constants';
import { append } from '../../lib/modify_path';
import { getAssets } from './assets';
@ -19,7 +19,11 @@ const appendAst = element => ({
// workpad getters
export function getWorkpad(state) {
return get(state, workpadRoot);
return {
// shim old workpads with new properties
css: DEFAULT_WORKPAD_CSS,
...get(state, workpadRoot),
};
}
// should we split `workpad.js` to eg. `workpad.js` (full) and `persistentWorkpadStructure.js` (persistent.workpad)?