diff --git a/packages/strapi-plugin-content-manager/admin/src/containers/EditPage/index.js b/packages/strapi-plugin-content-manager/admin/src/containers/EditPage/index.js index 4e9eb7afdc..798ea607e6 100644 --- a/packages/strapi-plugin-content-manager/admin/src/containers/EditPage/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/containers/EditPage/index.js @@ -17,6 +17,7 @@ import cn from 'classnames'; // ./node_modules/strapi-helper-plugin/lib/src // or strapi/packages/strapi-helper-plugin/lib/src import BackHeader from 'components/BackHeader'; +import LoadingIndicator from 'components/LoadingIndicator'; import PluginHeader from 'components/PluginHeader'; // Plugin's components @@ -108,7 +109,7 @@ export class EditPage extends React.Component { * @return {[type]} [description] */ getLayout = () => ( - bindLayout.call(this, this.props.editPage.layout) + bindLayout.call(this, get(this.props.editPage, ['layout', this.getModelName()], {})) ) /** @@ -150,6 +151,14 @@ export class EditPage extends React.Component { get(this.props.schema, ['plugins', this.getSource(), this.getModelName()]) : get(this.props.schema, [this.getModelName()]); + getPluginHeaderTitle = () => { + if (this.isCreating()) { + return toString(this.props.editPage.pluginHeaderTitle); + } + + return this.props.match.params.id; + } + /** * Retrieve the model's source * @return {String} @@ -236,6 +245,7 @@ export class EditPage extends React.Component { kind: 'secondary', onClick: this.props.onCancel, type: 'button', + disabled: this.showLoaders(), }, { kind: 'primary', @@ -244,10 +254,17 @@ export class EditPage extends React.Component { type: 'submit', loader: this.props.editPage.showLoader, style: this.props.editPage.showLoader ? { marginRight: '18px' } : {}, + disabled: this.showLoaders(), }, ] ); + showLoaders = () => { + const { editPage: { isLoading, layout } } = this.props; + + return isLoading && !this.isCreating() || isLoading && get(layout, this.getModelName()) === undefined; + } + render() { const { editPage } = this.props; @@ -258,24 +275,28 @@ export class EditPage extends React.Component {