EmbeddedEnterprises/ng6-golden-layout

Pre rendering handler is missing

nitin- opened this issue · 3 comments

I have provided certain configuration and I want to decide at the run time whether a component should be rendered or not by looking at value provided in componentState key.

content:[
                  {
                    type: 'component',
                    componentName: 'Test1',
                    title: 'Test1',
                    componentState: { role: 'Admin' }
                  },
                  {
                    type: 'component',
                    componentName: 'app-editor',
                    title: 'Editor',
                    componentState: { role: 'ALL' }
                  }
]

A glimpse of my configuration , I want admin should only open Test1.

This is something you need to handle either within your components, or filter the state before passing it into goldenlayout.

once the component will be opened , then how can I close it based on certain condition

So, you have three ways of archiving this, neither does not include a prerendering handler.

  1. You can only insert the "Test1" component, if you are an admin, which you have to determine out of your application context.
  2. Your component can close itself, if you are not an admin.
  3. Your component can show an error message, that this is only available for admins.

Introducing a pre-rendering handler would not be helpful at this point. Right now, I do not have any ideas, how this should be useful in other cases.