Skip to content

Commit

Permalink
EPMRPP-99275 || Impossible to delete Test item (#4186)
Browse files Browse the repository at this point in the history
* EPMRPP-99275 || Impossible to delete Test item

* EPMRPP-99275 || crf - 1
  • Loading branch information
maria-hambardzumian authored Feb 10, 2025
1 parent 718ba89 commit e677111
Showing 1 changed file with 17 additions and 29 deletions.
46 changes: 17 additions & 29 deletions app/src/common/urls.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const urlCommonBase = `${DEFAULT_COMMON_API_URL_PREFIX}/`;
const uatBase = `${UAT_API_URL_PREFIX}/`;
const compositeBase = COMPOSITE_API_URL_PREFIX;
const getQueryParams = (paramsObj) => stringify(paramsObj, { addQueryPrefix: true });
const removeTrailingSlash = (url) => (url.endsWith('/') ? url.slice(0, -1) : url);

export const URLS = {
apiDocs: (apiType) => `${apiType}/api-docs`,
Expand All @@ -44,29 +45,25 @@ export const URLS = {
dashboardConfig: (activeProject, id) => `${urlBase}${activeProject}/dashboard/${id}/config`,
dashboardPreconfigured: (activeProject) => `${urlBase}${activeProject}/dashboard/preconfigured`,

widget: (activeProject, widgetId = '') => {
const widgetIdPart = widgetId ? `/${widgetId}` : '';
return `${urlBase}${activeProject}/widget${widgetIdPart}`;
},
widget: (activeProject, widgetId = '') =>
removeTrailingSlash(`${urlBase}${activeProject}/widget/${widgetId}`),
widgetMultilevel: (activeProject, widgetId, params) =>
`${urlBase}${activeProject}/widget/multilevel/${widgetId}${getQueryParams({
...params,
})}`,
widgetPreview: (activeProject) => `${urlBase}${activeProject}/widget/preview`,

dashboardWidget: (activeProject, dashboardId, widgetId) =>
`${urlBase}${activeProject}/dashboard/${dashboardId}/${widgetId}`,
removeTrailingSlash(`${urlBase}${activeProject}/dashboard/${dashboardId}/${widgetId}`),

addDashboardWidget: (activeProject, dashboardId) =>
`${urlBase}${activeProject}/dashboard/${dashboardId}/add`,

projectWidget: (activeProject, widgetId = '', interval = '') =>
`${urlBase}project/${activeProject}/widget/${widgetId}${getQueryParams({ interval })}`,

filter: (activeProject, id = '') => {
const filterId = id ? `/${id}` : '';
return `${urlBase}${activeProject}/filter${filterId}`;
},
filter: (activeProject, id = '') =>
removeTrailingSlash(`${urlBase}${activeProject}/filter/${id}`),
filters: (activeProject) => `${urlBase}${activeProject}/filter`,
filtersSearch: (activeProject) =>
`${urlBase}${activeProject}/filter?page.sort=name&page.page=1&page.size=50&filter.cnt.name=`,
Expand All @@ -76,7 +73,7 @@ export const URLS = {

debug: (activeProject) => `${urlBase}${activeProject}/launch/mode`,

launch: (activeProject, id) => `${urlBase}${activeProject}/launch/${id}`,
launch: (activeProject, id) => removeTrailingSlash(`${urlBase}${activeProject}/launch/${id}`),
launchStatus: (activeProject, ids) => `${urlBase}${activeProject}/launch/status?ids=${ids}`,
launchByIds: (activeProject, ids) => `${urlBase}${activeProject}/launch?filter.in.id=${ids}`,
launchAttributeKeysSearch: (activeProject) => (searchTerm = '') =>
Expand Down Expand Up @@ -141,10 +138,10 @@ export const URLS = {
searchProjectNames: () => `${urlBase}project/names/search`,
projectDefectType: (activeProject) => `${urlBase}${activeProject}/settings/sub-type`,
projectDeleteDefectType: (activeProject, id) =>
`${urlBase}${activeProject}/settings/sub-type/${id}`,
removeTrailingSlash(`${urlBase}${activeProject}/settings/sub-type/${id}`),
projects: () => `${urlBase}project/list`,
projectPreferences: (activeProject, filterId = '') =>
`${urlBase}project/${activeProject}/preference/${filterId}`,
removeTrailingSlash(`${urlBase}project/${activeProject}/preference/${filterId}`),
projectUsers: (activeProject) => `${urlBase}project/${activeProject}/users`,
projectUserSearchUser: (activeProject) => (searchTerm) =>
`${urlBase}project/${activeProject}/usernames/search${getQueryParams({
Expand Down Expand Up @@ -177,26 +174,19 @@ export const URLS = {
...createFilterQuery(filterEntities),
...sortingEntities,
})}`,
suite: (activeProject, suiteId) => {
const id = suiteId ? `/${suiteId}` : '';
return `${urlBase}${activeProject}/item${id}`;
},
suite: (activeProject, suiteId) =>
removeTrailingSlash(`${urlBase}${activeProject}/item/${suiteId}`),

notification: (activeProject) => `${urlBase}${activeProject}/settings/notification`,
notificationById: (activeProject, notificationId) =>
`${urlBase}${activeProject}/settings/notification/${notificationId}`,

testItems: (activeProject, ids) => {
const queryParams = getQueryParams({ ids });
const querySuffix = queryParams ? `/${queryParams}` : '';
return `${urlBase}${activeProject}/item${querySuffix}`;
},
testItems: (activeProject, ids) =>
removeTrailingSlash(`${urlBase}${activeProject}/item${getQueryParams({ ids })}`),
testItemsWithProviderType: (activeProject, ids) =>
`${urlBase}${activeProject}/item/v2${getQueryParams({ ids })}`,
testItem: (activeProject, id = '') => {
const itemId = id ? `/${id}` : '';
return `${urlBase}${activeProject}/item${itemId}`;
},
testItem: (activeProject, id = '') =>
removeTrailingSlash(`${urlBase}${activeProject}/item/${id}`),
testItemStatistics: (activeProject) => `${urlBase}${activeProject}/item/statistics`,
testItemUpdate: (activeProject, id = '') => `${urlBase}${activeProject}/item/${id}/update`,
testItemsHistory: (activeProject, historyDepth, type, id) =>
Expand Down Expand Up @@ -243,10 +233,8 @@ export const URLS = {
'filter.eq.launch': itemId,
'filter.gte.level': level,
})}`,
logItemActivity: (activeProject, itemId) => {
const id = itemId ? `/${itemId}` : '';
return `${urlBase}${activeProject}/activity/item${id}`;
},
logItemActivity: (activeProject, itemId) =>
removeTrailingSlash(`${urlBase}${activeProject}/activity/item/${itemId}`),
logItemStackTrace: (activeProject, path, pageSize) =>
`${urlBase}${activeProject}/log${getQueryParams({
'filter.under.path': path,
Expand Down

0 comments on commit e677111

Please sign in to comment.