Skip to content

Commit

Permalink
Address pr comments
Browse files Browse the repository at this point in the history
Signed-off-by: Lin Wang <[email protected]>
  • Loading branch information
wanglam committed Aug 21, 2024
1 parent 3277af6 commit 25a7fc4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@ export const WorkspaceCreator = (props: WorkspaceCreatorProps) => {
[notifications?.toasts, http, application, workspaceClient]
);

const isFormReadyToRender =
application &&
savedObjects &&
// Default values only worked for component mount, should wait for isOnlyAllowEssential and availableUseCases loaded
isOnlyAllowEssential !== undefined &&
availableUseCases !== undefined;

return (
<EuiPage>
<HeaderControl
Expand All @@ -129,22 +136,18 @@ export const WorkspaceCreator = (props: WorkspaceCreatorProps) => {
color="subdued"
hasShadow={false}
>
{application &&
savedObjects &&
// Default values only worked for component mount, should wait for isOnlyAllowEssential and availableUseCases loaded
isOnlyAllowEssential !== undefined &&
availableUseCases !== undefined && (
<WorkspaceForm
application={application}
savedObjects={savedObjects}
onSubmit={handleWorkspaceFormSubmit}
operationType={WorkspaceOperationType.Create}
permissionEnabled={isPermissionEnabled}
dataSourceManagement={dataSourceManagement}
availableUseCases={availableUseCases}
defaultValues={defaultWorkspaceFormValues}
/>
)}
{isFormReadyToRender && (
<WorkspaceForm
application={application}
savedObjects={savedObjects}
onSubmit={handleWorkspaceFormSubmit}
operationType={WorkspaceOperationType.Create}
permissionEnabled={isPermissionEnabled}
dataSourceManagement={dataSourceManagement}
availableUseCases={availableUseCases}
defaultValues={defaultWorkspaceFormValues}
/>
)}
</EuiPageContent>
</EuiPageBody>
</EuiPage>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const useFormAvailableUseCases = ({
const result = await getIsOnlyAllowEssentialUseCase(savedObjects.client);
updateEssential(result);
} catch (e) {
// Set to false is failed to fetch is only allow essential use case
// Set to false if failed to fetch the "only allow essential use case" setting
updateEssential(false);
}
})();
Expand Down

0 comments on commit 25a7fc4

Please sign in to comment.