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

Fixed Snackbar title on toggle of extensions #10927

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions ui/components/extensions/adapters/adapters.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,22 @@ const Adapters = ({ updateProgress, classes }) => {
const handleAdapterDeployment = (payload, msg, selectedAdapter, adapterId) => {
updateProgress({ showProgress: true });

const isEnableAction = payload.status === 'ENABLED';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Define (if it does not exist already) a constant inside constants.js and use that here as well on line 74 (you would have to use toLowerCase() or toUpperCase() depending on what you define the value for that constant)


changeAdapterState((response, errors) => {
updateProgress({ showProgress: false });

if (!isNil(errors)) {
// Toggle the switch to it's previous state if the request fails.
// Toggle the switch to its previous state if the request fails.
setAvailableAdapters({
...availableAdapters,
[adapterId]: { ...selectedAdapter, enabled: !selectedAdapter.enabled },
});
handleError(msg);
} else {
const actionText = isEnableAction ? 'enabled' : 'disabled';
notify({
message: `Adapter ${response.adapterStatus.toLowerCase()}`,
message: `Adapter ${selectedAdapter.name} ${actionText}`,
event_type: EVENT_TYPES.SUCCESS,
});
}
Expand Down
Loading