Skip to content

Commit

Permalink
feat: add node multi entity select (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kav91 committed May 5, 2021
1 parent bdcc121 commit 54250a0
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions nerdlets/observability-maps-nerdlet/components/node/manage.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export default class ManageNodes extends React.PureComponent {

action = async (action, mapConfig, updateDataContextState, entity, node) => {
let { selectedAccount, selectedNodeType, customNodeName } = this.state;
this.setState({ open: false });

if (entity) selectedNodeType = 'entity';
if (node) selectedNodeType = 'node';
Expand Down Expand Up @@ -121,11 +120,15 @@ export default class ManageNodes extends React.PureComponent {
}

updateDataContextState({ mapConfig }, ['saveMap']);
this.setState({
selectedNodeType: null,
searchedEntities: [],
customNodeName: ''
});
const stateUpdate = {
[`${entity.name} [${entity.domain}]`]: action === 'add'
};

if (selectedNodeType === 'custom') {
stateUpdate.customNodeName = '';
}

this.setState(stateUpdate);
};

fetchEntities = async cursor => {
Expand Down Expand Up @@ -363,12 +366,19 @@ export default class ManageNodes extends React.PureComponent {
: false
)
.map((entity, i) => {
// check artifical status
const stateStatus = this.state[
`${entity.name} [${entity.domain}]`
];

// keep both for backwards compatibility
const exists =
stateStatus ||
mapConfig.nodeData[entity.name] ||
mapConfig.nodeData[
`${entity.name} [${entity.domain}]`
];

return (
<Table.Row key={i}>
<Table.Cell>{entity.name}</Table.Cell>
Expand Down

0 comments on commit 54250a0

Please sign in to comment.