Skip to content

Commit

Permalink
Lookup the policy directly versus searching for it
Browse files Browse the repository at this point in the history
  • Loading branch information
John Schulz committed Apr 6, 2021
1 parent 08d399a commit 18fca79
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,10 @@ export const AgentListPage: React.FunctionComponent<{}> = () => {

const isAgentSelectable = (agent: Agent) => {
if (!agent.active) return false;
if (!agent.policy_id) return true;

const agentPolicy = agentPolicies.find((p) => p.id === agent.policy_id);
const isManaged = agent.policy_id && agentPolicy?.is_managed === true;
const agentPolicy = agentPoliciesIndexedById[agent.policy_id];
const isManaged = agentPolicy?.is_managed === true;
return !isManaged;
};

Expand Down

0 comments on commit 18fca79

Please sign in to comment.