Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Host overview could reuse the already existing getInstancesOnHost selector #375

Closed
rtorrero opened this issue Apr 19, 2022 · 1 comment
Closed

Comments

@rtorrero
Copy link
Contributor

The Host overview right now collects the sap systems each host belongs to using:

const getSapSystemsByHost = (sapSystems, hostId) => {
  const appInstances = sapSystems
    .flatMap((sapSystem) => sapSystem.application_instances)
    .filter((sapSystem) => sapSystem.host_id === hostId)
    .map((sapSystem) => ({ type: 'sap-systems', instance: sapSystem }));
  const dbInstances = sapSystems
    .flatMap((sapSystem) => sapSystem.database_instances)
    .filter((sapSystem) => sapSystem.host_id === hostId)
    .map((sapSystem) => ({ type: 'databases', instance: sapSystem }));

  return appInstances.concat(dbInstances);
};

we could instead use the getInstancesOnHost from @state/selectors. I did a quick try but it seems that calling useSelector on each host iteration on the list breaks the app after a refresh.

We should improve this.

@rtorrero
Copy link
Contributor Author

This was addressed by @arbulu89

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant