public function dashboard() {
    $build = [];
    $build['content'] = [
      '#type' => 'container',
      '#attributes' => ['class' => ['dashboard-wrapper']],
    ];

    $entity_storage = $this->entityTypeManager()
      ->getStorage('openy_upgrade_log');
    $resolved_count = $entity_storage->getQuery()
      ->condition('status', TRUE)
      ->count()
      ->execute();
    $conflicts_count = $entity_storage->getQuery()
      ->condition('status', TRUE, '!=')
      ->count()
      ->execute();

    $total = $resolved_count + $conflicts_count;
    if ($total === 0) {
      $build['content']['message']['#markup'] = $this->t('Congratulation! You have no conflicts detected.');
    }

    $build['content']['conflict_wrapper'] = [
      '#type' => 'details',
      '#title' => $this->t('Conflicts (@count)', [
        '@count' => $conflicts_count,
      ]),
      '#description' => $this->t('Here you can see list of configs that were changed manually and differ from Open Y. In DIFF modal you can approve this changes or restore Open Y version. <br> Also you can resolve conflict and apply both changes(manual and Open Y).'),
      '#open' => TRUE,
      '#attributes' => ['class' => ['conflicts-wrapper']],
    ];
    $build['content']['conflict_wrapper']['view'] = [
      '#type' => 'view',
      '#name' => 'openy_upgrade_dashboard',
      '#display_id' => 'conflicts',
    ];

    if ($resolved_count >= 1) {
      // Show resolved section only if items exist.
      $build['content']['resolved_wrapper'] = [
        '#type' => 'details',
        '#title' => $this->t('Resolved conflicts (@count)', [
          '@count' => $resolved_count,
        ]),
        '#description' => $this->t('Here you can see list of configs that differ from Open Y, but was approved as resolved.'),
        '#attributes' => ['class' => ['resolved-wrapper']],
      ];
      $build['content']['resolved_wrapper']['view'] = [
        '#type' => 'view',
        '#name' => 'openy_upgrade_dashboard',
        '#display_id' => 'resolved',
      ];
    }

    $build['#attached']['library'][] = 'openy_upgrade_tool/dashboard';

    return $build;
  }
public function dashboard() {
    $build = [];
    $build['content'] = [
      '#type' => 'container',
      '#attributes' => ['class' => ['dashboard-wrapper']],
    ];

    $entity_storage = $this->entityTypeManager()
      ->getStorage('openy_upgrade_log');
    $resolved_count = $entity_storage->getQuery()
      ->condition('status', TRUE)
      ->count()
      ->execute();
    $conflicts_count = $entity_storage->getQuery()
      ->condition('status', TRUE, '!=')
      ->count()
      ->execute();

    $total = $resolved_count + $conflicts_count;
    if ($total === 0) {
      $build['content']['message']['#markup'] = $this->t('Congratulation! You have no conflicts detected.');
    }

    $build['content']['conflict_wrapper'] = [
      '#type' => 'details',
      '#title' => $this->t('Conflicts (@count)', [
        '@count' => $conflicts_count,
      ]),
      '#description' => $this->t('Here you can see list of configs that were changed manually and differ from Open Y. In DIFF modal you can approve this changes or restore Open Y version. <br> Also you can resolve conflict and apply both changes(manual and Open Y).'),
      '#open' => TRUE,
      '#attributes' => ['class' => ['conflicts-wrapper']],
    ];
    $build['content']['conflict_wrapper']['view'] = [
      '#type' => 'view',
      '#name' => 'openy_upgrade_dashboard',
      '#display_id' => 'conflicts',
    ];

    if ($resolved_count >= 1) {
      // Show resolved section only if items exist.
      $build['content']['resolved_wrapper'] = [
        '#type' => 'details',
        '#title' => $this->t('Resolved conflicts (@count)', [
          '@count' => $resolved_count,
        ]),
        '#description' => $this->t('Here you can see list of configs that differ from Open Y, but was approved as resolved.'),
        '#attributes' => ['class' => ['resolved-wrapper']],
      ];
      $build['content']['resolved_wrapper']['view'] = [
        '#type' => 'view',
        '#name' => 'openy_upgrade_dashboard',
        '#display_id' => 'resolved',
      ];
    }

    $build['#attached']['library'][] = 'openy_upgrade_tool/dashboard';

    return $build;
  }
public function dashboard ( ) { $ build = [ ] ; $ build [ 'content' ] = [ '#type' => 'container' , '#attributes' => [ 'class' => [ 'dashboard-wrapper' ] ] , ] ; $ entity_storage = $ this -> entityTypeManager ( ) -> getStorage ( 'openy_upgrade_log' ) ; $ resolved_count = $ entity_storage -> getQuery ( ) -> condition ( 'status' , TRUE ) -> count ( ) -> execute ( ) ; $ conflicts_count = $ entity_storage -> getQuery ( ) -> condition ( 'status' , TRUE , '!=' ) -> count ( ) -> execute ( ) ; $ total = $ resolved_count + $ conflicts_count ; if ( $ total === 0 ) { $ build [ 'content' ] [ 'message' ] [ '#markup' ] = $ this -> t ( 'Congratulation! You have no conflicts detected.' ) ; } $ build [ 'content' ] [ 'conflict_wrapper' ] = [ '#type' => 'details' , '#title' => $ this -> t ( 'Conflicts (@count)' , [ '@count' => $ conflicts_count , ] ) , '#description' => $ this -> t ( 'Here you can see list of configs that were changed manually and differ from Open Y. In DIFF modal you can approve this changes or restore Open Y version. <br> Also you can resolve conflict and apply both changes(manual and Open Y).' ) , '#open' => TRUE , '#attributes' => [ 'class' => [ 'conflicts-wrapper' ] ] , ] ; $ build [ 'content' ] [ 'conflict_wrapper' ] [ 'view' ] = [ '#type' => 'view' , '#name' => 'openy_upgrade_dashboard' , '#display_id' => 'conflicts' , ] ; if ( $ resolved_count >= 1 ) { // Show resolved section only if items exist. $ build [ 'content' ] [ 'resolved_wrapper' ] = [ '#type' => 'details' , '#title' => $ this -> t ( 'Resolved conflicts (@count)' , [ '@count' => $ resolved_count , ] ) , '#description' => $ this -> t ( 'Here you can see list of configs that differ from Open Y, but was approved as resolved.' ) , '#attributes' => [ 'class' => [ 'resolved-wrapper' ] ] , ] ; $ build [ 'content' ] [ 'resolved_wrapper' ] [ 'view' ] = [ '#type' => 'view' , '#name' => 'openy_upgrade_dashboard' , '#display_id' => 'resolved' , ] ; } $ build [ '#attached' ] [ 'library' ] [ ] = 'openy_upgrade_tool/dashboard' ; return $ build ; }
Returns Open Y upgrade tool dashboard.

@return array
Render array with dashboard.

@throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
Returns Open Y upgrade tool dashboard .