diff --git a/src/common/data-managers/notifications-factory.js b/src/common/data-managers/notifications-factory.js index ece1e8b..a032db0 100644 --- a/src/common/data-managers/notifications-factory.js +++ b/src/common/data-managers/notifications-factory.js @@ -138,6 +138,14 @@ class NotificationsFactory { }; } + static ACTION_INFO() { + return { + title: 'Action successfully requested', + level: 'info' + }; + } + + } export default NotificationsFactory; diff --git a/src/ic/ic-action.js b/src/ic/ic-action.js index 33fe9a8..c2e4455 100644 --- a/src/ic/ic-action.js +++ b/src/ic/ic-action.js @@ -18,6 +18,8 @@ import React from 'react'; import { Button, DropdownButton, Dropdown, InputGroup, FormControl } from 'react-bootstrap'; import AppDispatcher from "../common/app-dispatcher"; +import NotificationsFactory from "../common/data-managers/notifications-factory"; +import NotificationsDataManager from "../common/data-managers/notifications-data-manager"; class ICAction extends React.Component { constructor(props) { @@ -92,13 +94,26 @@ class ICAction extends React.Component { if (newAction.action === "delete"){ // prepare parameters for delete incl. correct IC id newAction["parameters"] = {}; - newAction.parameters["uuid"] = ic.id; - icID = ic.manager; // send delete action to manager of IC + newAction.parameters["uuid"] = ic.uuid; + // get the ID of the manager IC + let managerIC = null; + for (let i of this.props.ics){ + if (i.uuid === ic.manager){ + managerIC = i; + } + } + if (managerIC == null){ + console.log("DELETE action", newAction); + NotificationsDataManager.addNotification(NotificationsFactory.DELETE_ERROR("Could not find manager IC with UUID " + ic.manager)); + continue; + } + + icID = managerIC.id; // send delete action to manager of IC } AppDispatcher.dispatch({ type: 'ics/start-action', - icid: ic.id, + icid: icID, action: newAction, result: null, token: this.props.token diff --git a/src/ic/ic-store.js b/src/ic/ic-store.js index d2e00de..39b1c8c 100644 --- a/src/ic/ic-store.js +++ b/src/ic/ic-store.js @@ -72,6 +72,10 @@ class InfrastructureComponentStore extends ArrayStore { ICsDataManager.doActions(action.icid, action.action, action.token, action.result); return state; + case 'ics/action-started': + NotificationsDataManager.addNotification(NotificationsFactory.ACTION_INFO()); + return state; + case 'ics/action-error': console.log(action.error); return state;