diff --git a/splunk_add_on_ucc_framework/ucc_ui_lib/src/main/webapp/components/BaseFormView.jsx b/splunk_add_on_ucc_framework/ucc_ui_lib/src/main/webapp/components/BaseFormView.jsx index e0a547287..5f620993e 100644 --- a/splunk_add_on_ucc_framework/ucc_ui_lib/src/main/webapp/components/BaseFormView.jsx +++ b/splunk_add_on_ucc_framework/ucc_ui_lib/src/main/webapp/components/BaseFormView.jsx @@ -5,7 +5,7 @@ import update from 'immutability-helper'; import Message from '@splunk/react-ui/Message'; import ControlWrapper from './ControlWrapper'; -import { getUnifiedConfigs } from '../util/util'; +import { getUnifiedConfigs, generateToast } from '../util/util'; import Validator, { SaveValidator } from '../util/Validator'; import { MODE_CLONE, MODE_CREATE, MODE_EDIT, MODE_CONFIG } from '../constants/modes'; import { PAGE_INPUT } from '../constants/pages'; @@ -247,6 +247,11 @@ class BaseFormView extends PureComponent { if (this.hook && typeof this.hook.onSaveSuccess === 'function') { this.hook.onSaveSuccess(); } + if (this.props.mode === MODE_EDIT || this.props.mode === MODE_CONFIG) { + generateToast(`Updated ${val.name}`, 'success'); + } else { + generateToast(`Created ${val.name}`, 'success'); + } this.props.handleFormSubmit(/* isSubmititng */false,/* closeEntity */ true); }); } diff --git a/splunk_add_on_ucc_framework/ucc_ui_lib/src/main/webapp/components/ConfigurationTable.jsx b/splunk_add_on_ucc_framework/ucc_ui_lib/src/main/webapp/components/ConfigurationTable.jsx index f2ace4568..2424ff174 100644 --- a/splunk_add_on_ucc_framework/ucc_ui_lib/src/main/webapp/components/ConfigurationTable.jsx +++ b/splunk_add_on_ucc_framework/ucc_ui_lib/src/main/webapp/components/ConfigurationTable.jsx @@ -44,7 +44,7 @@ function ConfigurationTable({ serviceName, serviceTitle }) { serviceName={serviceName} handleRequestModalOpen={() => handleRequestOpen()} /> - + {generateModalDialog()} diff --git a/splunk_add_on_ucc_framework/ucc_ui_lib/src/main/webapp/components/DeleteModal.jsx b/splunk_add_on_ucc_framework/ucc_ui_lib/src/main/webapp/components/DeleteModal.jsx index ac42672a5..dc9ddbdca 100644 --- a/splunk_add_on_ucc_framework/ucc_ui_lib/src/main/webapp/components/DeleteModal.jsx +++ b/splunk_add_on_ucc_framework/ucc_ui_lib/src/main/webapp/components/DeleteModal.jsx @@ -7,6 +7,7 @@ import styled from 'styled-components'; import WaitSpinner from '@splunk/react-ui/WaitSpinner'; import update from 'immutability-helper'; import { _ } from '@splunk/ui-utils/i18n'; +import { generateToast } from '../util/util'; import { axiosCallWrapper } from '../util/axiosCallWrapper'; import TableContext from '../context/TableContext'; @@ -55,6 +56,7 @@ class DeleteModal extends Component { ); this.setState({ isDeleting: false }); this.handleRequestClose(); + generateToast(`Deleted ${this.props.stanzaName}`, 'success'); }); } ); diff --git a/splunk_add_on_ucc_framework/ucc_ui_lib/src/main/webapp/components/table/TableWrapper.jsx b/splunk_add_on_ucc_framework/ucc_ui_lib/src/main/webapp/components/table/TableWrapper.jsx index be6183782..63e078d45 100644 --- a/splunk_add_on_ucc_framework/ucc_ui_lib/src/main/webapp/components/table/TableWrapper.jsx +++ b/splunk_add_on_ucc_framework/ucc_ui_lib/src/main/webapp/components/table/TableWrapper.jsx @@ -132,6 +132,11 @@ function TableWrapper({ page, serviceName, handleRequestModalOpen, handleOpenPag }, }); }); + if (response.data.entry[0].content.disabled === true) { + generateToast(`Disabled ${response.data.entry[0].name}`, "success"); + } else { + generateToast(`Enabled ${response.data.entry[0].name}`, "success"); + } }); }; diff --git a/splunk_add_on_ucc_framework/ucc_ui_lib/src/main/webapp/pages/Input/InputPage.jsx b/splunk_add_on_ucc_framework/ucc_ui_lib/src/main/webapp/pages/Input/InputPage.jsx index bcfd07588..0599635d7 100644 --- a/splunk_add_on_ucc_framework/ucc_ui_lib/src/main/webapp/pages/Input/InputPage.jsx +++ b/splunk_add_on_ucc_framework/ucc_ui_lib/src/main/webapp/pages/Input/InputPage.jsx @@ -215,7 +215,7 @@ function InputPage() { page={PAGE_INPUT} handleOpenPageStyleDialog={handleOpenPageStyleDialog} /> - + {!entity.isInputPageStyle && entity.open ? generateModalDialog() : null} diff --git a/splunk_add_on_ucc_framework/ucc_ui_lib/src/main/webapp/util/axiosCallWrapper.js b/splunk_add_on_ucc_framework/ucc_ui_lib/src/main/webapp/util/axiosCallWrapper.js index 9f7879c58..7b81ff342 100644 --- a/splunk_add_on_ucc_framework/ucc_ui_lib/src/main/webapp/util/axiosCallWrapper.js +++ b/splunk_add_on_ucc_framework/ucc_ui_lib/src/main/webapp/util/axiosCallWrapper.js @@ -74,7 +74,7 @@ const axiosCallWrapper = ({ // Something happened in setting up the request that triggered an Error message = `Error making ${method} request to ${endpointUrl}`; } - generateToast(message); + generateToast(message, "error"); callbackOnError(error); return Promise.reject(error); }) diff --git a/splunk_add_on_ucc_framework/ucc_ui_lib/src/main/webapp/util/util.js b/splunk_add_on_ucc_framework/ucc_ui_lib/src/main/webapp/util/util.js index c5bb1c06b..9d4915e14 100644 --- a/splunk_add_on_ucc_framework/ucc_ui_lib/src/main/webapp/util/util.js +++ b/splunk_add_on_ucc_framework/ucc_ui_lib/src/main/webapp/util/util.js @@ -35,9 +35,23 @@ export function getUnifiedConfigs() { } const createToast = makeCreateToast(Toaster); -export const generateToast = (message, action = undefined) => { +export const generateToast = (message, messageType, action = undefined) => { + let toastType; + switch (messageType) { + case 'success': + toastType = TOAST_TYPES.SUCCESS; + break; + case 'error': + toastType = TOAST_TYPES.ERROR; + break; + case 'warning': + toastType = TOAST_TYPES.ERROR; + break; + default: + toastType = TOAST_TYPES.INFO; + } createToast({ - type: TOAST_TYPES.ERROR, + type: toastType, message, autoDismiss: true, dismissOnActionClick: true,