You are here

public function SensorGitDirtyTree::resultVerbose in Monitoring 7

Provide additional info about sensor call.

Parameters

SensorResultInterface $result: Sensor result.

Return value

string Sensor call verbose info.

Overrides SensorExtendedInfoInterface::resultVerbose

File

lib/Drupal/monitoring/Sensor/Sensors/SensorGitDirtyTree.php, line 161
Contains \Drupal\monitoring\Sensor\Sensors\SensorGitDirtyTree.

Class

SensorGitDirtyTree
Monitors the git repository for dirty files.

Namespace

Drupal\monitoring\Sensor\Sensors

Code

public function resultVerbose(SensorResultInterface $result) {
  $output = array();
  $branch_control = $this->info
    ->getSetting('check_branch');
  if ($branch_control) {
    $output['check_branch'] = array(
      '#type' => 'fieldset',
      '#title' => t('Check branch'),
      '#attributes' => array(),
    );
    $output['check_branch']['cmd'] = array(
      '#type' => 'item',
      '#title' => t('Command'),
      '#markup' => $this
        ->buildCommand('actual_branch_cmd'),
    );
    $output['check_branch']['output'] = array(
      '#type' => 'item',
      '#title' => t('Output'),
      '#markup' => $this->actualBranch,
      '#description' => t('Shows the current branch.'),
      '#description_display' => 'after',
    );
  }
  $output['ahead'] = array(
    '#type' => 'fieldset',
    '#title' => t('Ahead'),
    '#attributes' => array(),
  );
  $output['ahead']['cmd'] = array(
    '#type' => 'item',
    '#title' => t('Command'),
    '#markup' => $this
      ->buildCommand('ahead_cmd'),
  );
  $output['ahead']['output'] = array(
    '#type' => 'item',
    '#title' => t('Output'),
    '#markup' => '<pre>' . implode("\n", $this->distance) . '</pre>',
    '#description' => t('Shows local commits that have not been pushed.'),
    '#description_display' => 'after',
  );
  $output['status'] = array(
    '#type' => 'fieldset',
    '#title' => t('Status'),
    '#attributes' => array(),
  );
  $output['status']['cmd'] = array(
    '#type' => 'item',
    '#title' => t('Command'),
    '#markup' => $this
      ->buildCommand('status_cmd'),
  );
  $output['status']['output'] = array(
    '#type' => 'item',
    '#title' => t('Output'),
    '#markup' => '<pre>' . implode("\n", $this->status) . '</pre>',
    '#description' => t('Shows uncommitted, changed and deleted files.'),
    '#description_display' => 'after',
  );
  $output['submodules'] = array(
    '#type' => 'fieldset',
    '#title' => t('Submodules'),
    '#attributes' => array(),
  );
  $output['submodules']['cmd'] = array(
    '#type' => 'item',
    '#title' => t('Command'),
    '#markup' => $this
      ->buildCommand('submodules_cmd'),
  );
  $output['submodules']['output'] = array(
    '#type' => 'item',
    '#title' => t('Output'),
    '#markup' => '<pre>' . implode("\n", $this->submodules) . '</pre>',
    '#description' => t('Run "git submodule init" to initialize missing submodules ("-" prefix) or "git submodule update" to update submodules to the correct commit ("+" prefix).'),
    '#description_display' => 'after',
  );
  return $output;
}