Skip to content

Commit

Permalink
EPMRPP-87016 || Plugin icon is not displayed (#3609)
Browse files Browse the repository at this point in the history
and users endpoint fix
  • Loading branch information
Vadim73i authored Oct 17, 2023
1 parent 720b07f commit e1eec39
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/src/common/urls.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ export const URLS = {
})}`,
logSearch: (activeProject, itemId) => `${urlBase}${activeProject}/log/search/${itemId}`,
bulkLastLogs: (activeProject) => `${urlBase}${activeProject}/log/under`,
user: () => `${urlBase}user`,
users: () => `${urlCommonBase}users`,
userRegistration: () => `${urlCommonBase}users/registration`,
userValidateRegistrationInfo: () => `${urlCommonBase}users/registration/info`,
userPasswordReset: () => `${urlCommonBase}users/password/reset`,
Expand Down
12 changes: 10 additions & 2 deletions app/src/components/integrations/elements/pluginIcon/pluginIcon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ import { URLS } from 'common/urls';
import { activeProjectSelector } from 'controllers/user';
import { COMMAND_GET_FILE } from 'controllers/plugins/uiExtensions/constants';
import { globalIntegrationsSelector } from 'controllers/plugins/selectors';
import { filterIntegrationsByName, isPluginSupportsCommonCommand } from 'controllers/plugins/utils';
import {
filterIntegrationsByName,
isPluginSupportsAllowedCommand,
isPluginSupportsCommonCommand,
} from 'controllers/plugins/utils';
import { PLUGIN_DEFAULT_IMAGE, PLUGIN_IMAGES_MAP } from 'components/integrations/constants';
import { Image } from 'components/main/image';

Expand All @@ -36,6 +40,10 @@ export const PluginIcon = ({ pluginData, className, ...rest }) => {

if (isDynamicIconAvailable && enabled) {
const isCommonCommandSupported = isPluginSupportsCommonCommand(pluginData, COMMAND_GET_FILE);
const isAllowedCommandSupported = isPluginSupportsAllowedCommand(
pluginData,
COMMAND_GET_FILE,
);

if (isCommonCommandSupported) {
return {
Expand All @@ -45,7 +53,7 @@ export const PluginIcon = ({ pluginData, className, ...rest }) => {
}

const integration = filterIntegrationsByName(globalIntegrations, name)[0];
if (integration) {
if (integration && isAllowedCommandSupported) {
return {
url: URLS.projectIntegrationByIdCommand(projectId, integration.id, COMMAND_GET_FILE),
requestParams: commandParams,
Expand Down
7 changes: 7 additions & 0 deletions app/src/controllers/plugins/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,10 @@ export const isPluginSupportsCommonCommand = ({ enabled, details }, command) =>
details.commonCommands &&
details.commonCommands.length &&
details.commonCommands.includes(command);

export const isPluginSupportsAllowedCommand = ({ enabled, details }, command) =>
enabled &&
details &&
details.allowedCommands &&
details.allowedCommands.length &&
details.allowedCommands.includes(command);
2 changes: 1 addition & 1 deletion app/src/controllers/user/sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ function* unassignFromProject({ payload: project }) {
function* fetchUserWorker() {
let user;
try {
user = yield call(fetch, URLS.user());
user = yield call(fetch, URLS.users());
yield put(fetchUserSuccessAction(user));
} catch (err) {
yield put(fetchUserErrorAction());
Expand Down
2 changes: 1 addition & 1 deletion app/src/pages/admin/allUsersPage/allUsersPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export class AllUsersPage extends Component {
confirmDeleteItems = (items) => {
const ids = items.map((item) => item.id);
this.props.showScreenLockAction();
fetch(URLS.user(), {
fetch(URLS.users(), {
method: 'delete',
data: {
ids,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export class ActionPanel extends Component {
};

addUser = (values) => {
fetch(URLS.user(), {
fetch(URLS.users(), {
method: 'post',
data: {
accountRole: values.accountRole,
Expand Down

0 comments on commit e1eec39

Please sign in to comment.