<commit_before>import { PropTypes } from 'react';
import { connect } from 'react-redux';
//
import { Advanced, Managers } from 'czechidm-core';
import { SystemManager } from '../../redux';

const manager = new SystemManager();

/**
 * Target system basic information (info card)
 *
 * @author <NAME>
 */
export class SystemInfo extends Advanced.AbstractEntityInfo {

  constructor(props, context) {
    super(props, context);
  }

  getManager() {
    return manager;
  }

  showLink() {
    if (!super.showLink()) {
      return false;
    }
    if (!Managers.SecurityManager.hasAccess({ 'type': 'HAS_ANY_AUTHORITY', 'authorities': ['SYSTEM_READ']})) {
      return false;
    }
    return true;
  }

  /**
   * Get link to detail (`url`).
   *
   * @return {string}
   */
  getLink() {
    return `/system/${encodeURIComponent(this.getEntityId())}/detail`;
  }

  /**
   * Returns entity icon (null by default - icon will not be rendered)
   *
   * @param  {object} entity
   */
  getEntityIcon() {
    return 'link';
  }

  /**
   * Returns popovers title
   *
   * @param  {object} entity
   */
  getPopoverTitle() {
    return this.i18n('acc:entity.System._type');
  }

  /**
   * Returns popover info content
   *
   * @param  {array} table data
   */
  getPopoverContent(entity) {
    return [
      {
        label: this.i18n('entity.name'),
        value: this.getManager().getNiceLabel(entity)
      },
      {
        label: this.i18n('acc:entity.System.queue.label'),
        value: (entity.queue ? this.i18n('label.yes') : this.i18n('label.no'))
      },
      {
        label: this.i18n('acc:entity.System.readonly.label'),
        value: (entity.readonly ? this.i18n('label.yes') : this.i18n('label.no'))
      },
      {
        label: this.i18n('acc:entity.System.disabled.short'),
        value: (entity.disabledProvisioning ? this.i18n('acc:entity.System.disabledProvisioning.label') : this.i18n('acc:entity.System.disabled.label'))
      }
    ];
  }
}<commit_msg>FE: fix: system info component shows wrong inactive state<commit_after>import { PropTypes } from 'react';
import { connect } from 'react-redux';
//
import { Advanced, Managers } from 'czechidm-core';
import { SystemManager } from '../../redux';

const manager = new SystemManager();

/**
 * Target system basic information (info card)
 *
 * @author <NAME>
 */
export class SystemInfo extends Advanced.AbstractEntityInfo {

  constructor(props, context) {
    super(props, context);
  }

  getManager() {
    return manager;
  }

  showLink() {
    if (!super.showLink()) {
      return false;
    }
    if (!Managers.SecurityManager.hasAccess({ 'type': 'HAS_ANY_AUTHORITY', 'authorities': ['SYSTEM_READ']})) {
      return false;
    }
    return true;
  }

  /**
   * Get link to detail (`url`).
   *
   * @return {string}
   */
  getLink() {
    return `/system/${encodeURIComponent(this.getEntityId())}/detail`;
  }

  /**
   * Returns entity icon (null by default - icon will not be rendered)
   *
   * @param  {object} entity
   */
  getEntityIcon() {
    return 'link';
  }

  /**
   * Returns popovers title
   *
   * @param  {object} entity
   */
  getPopoverTitle() {
    return this.i18n('acc:entity.System._type');
  }

  /**
   * Returns popover info content
   *
   * @param  {array} table data
   */
  getPopoverContent(entity) {
    let disabledValue = this.i18n('label.no');
    if (entity.disabledProvisioning) {
      disabledValue = this.i18n('acc:entity.System.disabledProvisioning.label');
    } else if (entity.disabled) {
      disabledValue = this.i18n('acc:entity.System.disabled.label');
    }
    //
    return [
      {
        label: this.i18n('entity.name'),
        value: this.getManager().getNiceLabel(entity)
      },
      {
        label: this.i18n('acc:entity.System.queue.label'),
        value: (entity.queue ? this.i18n('label.yes') : this.i18n('label.no'))
      },
      {
        label: this.i18n('acc:entity.System.readonly.label'),
        value: (entity.readonly ? this.i18n('label.yes') : this.i18n('label.no'))
      },
      {
        label: this.i18n('acc:entity.System.disabled.short'),
        value: disabledValue
      }
    ];
  }
}
{'fraction_non_alphanumeric': 0.15991368976264686, 'fraction_numerical': 0.011028530328458403, 'mean_word_length': 2.685512367491166, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5219211', 'n_tokens_mistral': 1403, 'n_tokens_neox': 1365, 'n_words': 266}