<commit_before>import get from './get';
import { taskflowActions } from './Constants';
import Theme               from 'HPCCloudStyle/Theme.mcss';

export function getActions(actionsList, disabled) {
  return actionsList.map((action) => Object.assign(
    taskflowActions[action],
    {
      disabled: !!disabled[action],
      icon: !!disabled[action] ? Theme.loadingIcon : null,
    }));
}

export function getDisabledButtons(network, taskflow = {}) {
  const disabledButtons = {};
  const actions = get(taskflow, 'actions');
  const taskflowId = get(taskflow, 'flow._id');
  const clusterId = get(taskflow, 'flow.meta.cluster._id');

  if (!actions) {
    return disabledButtons;
  }

  actions.forEach((el) => {
    switch (el) {
      case 'terminate':
        disabledButtons.terminate =
          !!get(network, `pending.terminate_taskflow_${taskflowId}`) ||
          !!get(network, `success.terminate_taskflow_${taskflowId}`);
        break;
      case 'terminateInstance':
        console.log(clusterId);
        disabledButtons.terminateInstance =
          !!get(network, `pending.terminate_cluster_${clusterId}`) ||
          !!get(network, `success.terminate_cluster_${clusterId}`);
        break;
      default:
        break;
    }
  });

  console.log(actions, taskflowId, clusterId, actions);
  return disabledButtons;
}<commit_msg>removed console.log that should have been removed earlier<commit_after>import get from './get';
import { taskflowActions } from './Constants';
import Theme               from 'HPCCloudStyle/Theme.mcss';

export function getActions(actionsList, disabled) {
  return actionsList.map((action) => Object.assign(
    taskflowActions[action],
    {
      disabled: !!disabled[action],
      icon: !!disabled[action] ? Theme.loadingIcon : null,
    }));
}

export function getDisabledButtons(network, taskflow = {}) {
  const disabledButtons = {};
  const actions = get(taskflow, 'actions');
  const taskflowId = get(taskflow, 'flow._id');
  const clusterId = get(taskflow, 'flow.meta.cluster._id');

  if (!actions) {
    return disabledButtons;
  }

  actions.forEach((el) => {
    switch (el) {
      case 'terminate':
        disabledButtons.terminate =
          !!get(network, `pending.terminate_taskflow_${taskflowId}`) ||
          !!get(network, `success.terminate_taskflow_${taskflowId}`);
        break;
      case 'terminateInstance':
        console.log(clusterId);
        disabledButtons.terminateInstance =
          !!get(network, `pending.terminate_cluster_${clusterId}`) ||
          !!get(network, `success.terminate_cluster_${clusterId}`);
        break;
      default:
        break;
    }
  });

  return disabledButtons;
}
{'fraction_non_alphanumeric': 0.1382899628252788, 'fraction_numerical': 0.0, 'mean_word_length': 3.3403225806451613, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2246567', 'n_tokens_mistral': 779, 'n_tokens_neox': 792, 'n_words': 155}