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-87016 || Gitlab plugin icon is not displayed and users endpoint fix #3609

Merged
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
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
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
Loading