]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-13998 Access to background task fail when not an main branch
authorWouter Admiraal <wouter.admiraal@sonarsource.com>
Fri, 26 Feb 2021 08:56:41 +0000 (09:56 +0100)
committersonartech <sonartech@sonarsource.com>
Wed, 3 Mar 2021 20:12:51 +0000 (20:12 +0000)
server/sonar-web/src/main/js/api/ce.ts
server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.tsx

index 878aac630ea8d1ab99a74fb9c62309647b3babd8..ae1b198a420c8ff174a1692036816ee652f4c8b0 100644 (file)
@@ -43,13 +43,9 @@ export function getActivity(data: RequestData): Promise<{ tasks: Task[] }> {
 }
 
 export function getStatus(
-  componentId?: string
+  component?: string
 ): Promise<{ failing: number; inProgress: number; pending: number; pendingTime?: number }> {
-  const data = {};
-  if (componentId) {
-    Object.assign(data, { componentId });
-  }
-  return getJSON('/api/ce/activity_status', data);
+  return getJSON('/api/ce/activity_status', { component });
 }
 
 export function getTask(id: string, additionalFields?: string[]): Promise<Task> {
index 4feb2ce54ef390c06747d991d49f25a298359ff6..1f4fb93aea81b9f7e7c7074f2534738e380a9cc4 100644 (file)
@@ -113,10 +113,10 @@ export default class BackgroundTasksApp extends React.PureComponent<Props, State
     const parameters = mapFiltersToParameters(filters);
 
     if (this.props.component) {
-      parameters.componentId = this.props.component.id;
+      parameters.component = this.props.component.key;
     }
 
-    Promise.all([getActivity(parameters), getStatus(parameters.componentId)]).then(
+    Promise.all([getActivity(parameters), getStatus(parameters.component)]).then(
       ([{ tasks }, status]) => {
         if (this.mounted) {
           this.setState({