export async function triggerTask()

in ui/helpers/performance.js [18:67]


export async function triggerTask(
  selectedJobFull,
  notify,
  decisionTaskMap,
  currentRepo,
  taskName,
) {
  const { id: decisionTaskId } = decisionTaskMap[selectedJobFull.push_id];

  TaskclusterModel.load(decisionTaskId, selectedJobFull, currentRepo).then(
    (results) => {
      try {
        const action = getAction(results.actions, taskName);

        if (
          action === undefined ||
          !Object.prototype.hasOwnProperty.call(action, 'kind')
        ) {
          return notify(
            `Job was scheduled without taskcluster support for ${taskName}`,
          );
        }

        TaskclusterModel.submit({
          action,
          decisionTaskId,
          taskId: results.originalTaskId,
          task: results.originalTask,
          input: {},
          staticActionVariables: results.staticActionVariables,
          currentRepo,
        }).then(
          () => {
            notify(
              'Request sent to collect gecko profile job via actions.json',
              'success',
            );
          },
          (e) => {
            // The full message is too large to fit in a Treeherder
            // notification box.
            notify(formatTaskclusterError(e), 'danger', { sticky: true });
          },
        );
      } catch (e) {
        notify(formatTaskclusterError(e), 'danger', { sticky: true });
      }
    },
  );
}