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

EPMRPP-98423 || Error occurs when clicking on Add integration with di… #4160

Merged
merged 1 commit into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
removePluginAction,
addIntegrationAction,
removeProjectIntegrationsByTypeAction,
enabledPluginSelector,
} from 'controllers/plugins';
import { showModalAction } from 'controllers/modal';
import {
Expand Down Expand Up @@ -115,10 +116,11 @@ const messages = defineMessages({
});

@connect(
(state) => ({
(state, ownProps) => ({
projectId: projectIdSelector(state),
accountRole: userAccountRoleSelector(state),
userRole: activeProjectRoleSelector(state),
isEnabled: enabledPluginSelector(state, ownProps.instanceType),
}),
{
showModalAction,
Expand All @@ -142,6 +144,7 @@ export class InstancesSection extends Component {
removePluginAction: PropTypes.func.isRequired,
accountRole: PropTypes.string.isRequired,
userRole: PropTypes.string.isRequired,
isEnabled: PropTypes.bool.isRequired,
tracking: PropTypes.shape({
trackEvent: PropTypes.func,
getTrackingData: PropTypes.func,
Expand Down Expand Up @@ -297,6 +300,7 @@ export class InstancesSection extends Component {
userRole,
isGlobal,
pluginDetails: { metadata },
isEnabled,
} = this.props;
const isProjectIntegrationsExists = !!projectIntegrations.length;
const disabled = !canUpdateSettings(accountRole, userRole);
Expand All @@ -323,7 +327,7 @@ export class InstancesSection extends Component {
onItemClick={onItemClick}
isGlobal={isGlobal}
/>
{this.multiple && !disabled && (
{this.multiple && !disabled && isEnabled && (
<div className={cx('add-integration-button')}>
<GhostButton icon={PlusIcon} onClick={this.addIntegrationClickHandler}>
{formatMessage(messages.addIntegrationButtonTitle)}
Expand Down Expand Up @@ -357,7 +361,7 @@ export class InstancesSection extends Component {
{formatMessage(messages.noGlobalIntegrationMessage)}
</p>
)}
{(this.multiple || !globalIntegrations.length) && !disabled && isGlobal && (
{(this.multiple || !globalIntegrations.length) && !disabled && isGlobal && isEnabled && (
<div className={cx('add-integration-button')}>
<GhostButton icon={PlusIcon} onClick={this.addIntegrationClickHandler}>
{formatMessage(messages.addIntegrationButtonTitle)}
Expand Down
1 change: 1 addition & 0 deletions app/src/controllers/plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export { isPluginSupportsCommonCommand } from './uiExtensions/utils';
export {
pluginsSelector,
pluginByNameSelector,
enabledPluginSelector,
availablePluginsSelector,
availableGroupedPluginsSelector,
createNamedIntegrationsSelector,
Expand Down
2 changes: 2 additions & 0 deletions app/src/controllers/plugins/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ export const publicPluginsSelector = (state) => {
export const pluginByNameSelector = (state, name) =>
pluginsSelector(state).find((plugin) => plugin.name === name);

export const enabledPluginSelector = (state, name) => pluginByNameSelector(state, name).enabled;

export const notificationPluginsSelector = createSelector(pluginsSelector, (plugins) => {
return plugins.filter((item) => item.groupType === NOTIFICATION_GROUP_TYPE);
});
Expand Down
Loading