Liferay.Loader.define("portal-workflow-metrics-web@2.0.42/js/components/performance-by-step-page/PerformanceByStepPageTable.es", ['module', 'exports', 'require', '@frontend-taglib-clay$clayui/table', 'frontend-js-react-web$react', '../../shared/components/list/ListHeadItem.es', '../../shared/util/duration.es', '../../shared/util/util.es'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.Table = void 0;

    var _table = _interopRequireDefault(require("@frontend-taglib-clay$clayui/table"));

    var _react = _interopRequireDefault(require("frontend-js-react-web$react"));

    var _ListHeadItem = _interopRequireDefault(require("../../shared/components/list/ListHeadItem.es"));

    var _duration = require("../../shared/util/duration.es");

    var _util = require("../../shared/util/util.es");

    function _interopRequireDefault(obj) {
      return obj && obj.__esModule ? obj : { "default": obj };
    }

    function _extends() {
      _extends = Object.assign || function (target) {
        for (var i = 1; i < arguments.length; i++) {
          var source = arguments[i];for (var key in source) {
            if (Object.prototype.hasOwnProperty.call(source, key)) {
              target[key] = source[key];
            }
          }
        }return target;
      };return _extends.apply(this, arguments);
    }

    var Item = function Item(_ref) {
      var breachedInstanceCount = _ref.breachedInstanceCount,
          breachedInstancePercentage = _ref.breachedInstancePercentage,
          durationAvg = _ref.durationAvg,
          label = _ref.node.label;
      var formattedDuration = (0, _duration.formatDuration)(durationAvg);
      var formattedPercentage = (0, _util.getFormattedPercentage)(breachedInstancePercentage, 100);
      return _react["default"].createElement(_table["default"].Row, null, _react["default"].createElement(_table["default"].Cell, {
        className: "table-title",
        "data-testid": "stepName"
      }, label), _react["default"].createElement(_table["default"].Cell, {
        className: "text-right",
        "data-testid": "stepSla"
      }, (0, _util.isValidNumber)(breachedInstanceCount) ? breachedInstanceCount : 0, ' ', "(", formattedPercentage, ")"), _react["default"].createElement(_table["default"].Cell, {
        className: "text-right",
        "data-testid": "durationTaskAvg"
      }, formattedDuration));
    };

    var Table = function Table(_ref2) {
      var items = _ref2.items;
      return _react["default"].createElement(_table["default"], null, _react["default"].createElement(_table["default"].Head, null, _react["default"].createElement(_table["default"].Row, null, _react["default"].createElement(_table["default"].Cell, {
        headingCell: true,
        style: {
          width: '60%'
        }
      }, Liferay.Language.get('step-name')), _react["default"].createElement(_table["default"].Cell, {
        className: "text-right",
        headingCell: true,
        style: {
          width: '20%'
        }
      }, _react["default"].createElement(_ListHeadItem["default"], {
        name: "breachedInstancePercentage",
        title: Liferay.Language.get('sla-breached-percent')
      })), _react["default"].createElement(_table["default"].Cell, {
        className: "text-right",
        headingCell: true,
        style: {
          width: '20%'
        }
      }, _react["default"].createElement(_ListHeadItem["default"], {
        name: "durationAvg",
        title: Liferay.Language.get('average-completion-time')
      })))), _react["default"].createElement(_table["default"].Body, null, items.map(function (item, index) {
        return _react["default"].createElement(Table.Item, _extends({}, item, {
          key: index
        }));
      })));
    };

    exports.Table = Table;
    Table.Item = Item;
    //# sourceMappingURL=PerformanceByStepPageTable.es.js.map
  }
});
//# sourceMappingURL=PerformanceByStepPageTable.es.js.map