import "choerodon-ui/pro/lib/message/style";
import _message from "choerodon-ui/pro/lib/message";
import "choerodon-ui/lib/tooltip/style";
import _Tooltip from "choerodon-ui/lib/tooltip";
import "choerodon-ui/pro/lib/modal/style";
import _Modal from "choerodon-ui/pro/lib/modal";

function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }

function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }

/* eslint-disable jsx-a11y/click-events-have-key-events */

/* eslint-disable jsx-a11y/no-static-element-interactions */
import React from 'react';
import { WritableStream } from 'web-streams-polyfill/ponyfill';
import { Choerodon, Permission, Action } from '@choerodon/boot';
import copy from 'copy-to-clipboard';
import StreamSaver from 'streamsaver';
import { Base64 } from 'js-base64';
import { get } from 'lodash';
import renderDuration from "../../../../../../utils/getDuration";
import { handlePromptError } from "../../../../../../utils";
import { MIDDLE } from "../../../../../../utils/getModalWidth";
import { TabCode } from '@choerodon/master';
import StatusTag from "../StatusTag";
import DepolyLog from "../deployLog";
import StatusDot from "../statusDot";
import CodeQuality from "../codeQuality";
import CodeLog from "../codeLog";
import { usePipelineManageStore } from "../../../../stores";
import MirrorScanning from "../MirrorScanningLog";
import jobTypesMappings from "../../../../stores/jobsTypeMappings";

var DetailItem = function DetailItem(props) {
  var _usePipelineManageSto = usePipelineManageStore(),
      _usePipelineManageSto2 = _usePipelineManageSto.detailStore,
      retryJob = _usePipelineManageSto2.retryJob,
      getDetailData = _usePipelineManageSto2.getDetailData,
      retryCdJob = _usePipelineManageSto2.retryCdJob,
      executeCustomJob = _usePipelineManageSto2.executeCustomJob,
      projectId = _usePipelineManageSto.projectId;

  var jobDurationSeconds = props.jobDurationSeconds,
      jobStatus = props.jobStatus,
      startedDate = props.startedDate,
      finishedDate = props.finishedDate,
      itemType = props.itemType,
      gitlabJobId = props.gitlabJobId,
      devopsJobId = props.devopsJobId,
      jobName = props.jobName,
      handleRefresh = props.handleRefresh,
      cdAuto = props.cdAuto,
      audit = props.audit,
      stageId = props.stageId,
      cdRecordId = props.cdRecordId,
      stageRecordId = props.stageRecordId,
      jobRecordId = props.jobRecordId,
      history = props.history,
      search = props.location.search,
      countersigned = props.countersigned,
      chartVersion = props.chartVersion,
      cdHostDeployConfigVO = props.cdHostDeployConfigVO,
      sonarScannerType = props.sonarScannerType,
      codeCoverage = props.codeCoverage,
      apiTestTaskRecordVO = props.apiTestTaskRecordVO,
      externalApprovalJobVO = props.externalApprovalJobVO,
      viewId = props.viewId,
      downloadMavenJarVO = props.downloadMavenJarVO,
      downloadNpm = props.downloadNpm,
      downloadImage = props.downloadImage,
      gitlabPipelineId = props.gitlabPipelineId,
      imageScan = props.imageScan;

  var _ref = getDetailData && getDetailData.ciCdPipelineVO,
      gitlabProjectId = _ref.gitlabProjectId,
      appServiceId = _ref.appServiceId;

  function openDescModal(typeItem) {
    _Modal.open({
      title: '查看日志',
      key: _Modal.key(),
      style: {
        width: 'calc(100vw - 3.52rem)'
      },
      children: /*#__PURE__*/React.createElement(CodeLog, {
        type: typeItem,
        gitlabProjectId: gitlabProjectId,
        projectId: projectId,
        gitlabJobId: gitlabJobId,
        cdRecordId: cdRecordId,
        stageRecordId: stageRecordId,
        jobRecordId: jobRecordId,
        viewId: viewId
      }),
      drawer: true,
      okText: '关闭',
      footer: function footer(okbtn) {
        return /*#__PURE__*/React.createElement(React.Fragment, null, okbtn);
      }
    });
  }

  function openCodequalityModal() {
    _Modal.open({
      title: '代码质量',
      key: _Modal.key(),
      style: {
        width: 'calc(100vw - 3.52rem)'
      },
      children: /*#__PURE__*/React.createElement(CodeQuality, {
        appServiceId: appServiceId
      }),
      drawer: true,
      okText: '关闭',
      footer: function footer(okbtn) {
        return /*#__PURE__*/React.createElement(React.Fragment, null, okbtn);
      }
    });
  }

  function handleJobRetry() {
    return _handleJobRetry.apply(this, arguments);
  }

  function _handleJobRetry() {
    _handleJobRetry = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
      var res;
      return regeneratorRuntime.wrap(function _callee2$(_context2) {
        while (1) {
          switch (_context2.prev = _context2.next) {
            case 0:
              _context2.prev = 0;
              _context2.next = 3;
              return retryJob(projectId, gitlabProjectId, gitlabJobId);

            case 3:
              res = _context2.sent;

              if (!handlePromptError(res)) {
                _context2.next = 7;
                break;
              }

              handleRefresh();
              return _context2.abrupt("return", true);

            case 7:
              return _context2.abrupt("return", false);

            case 10:
              _context2.prev = 10;
              _context2.t0 = _context2["catch"](0);
              Choerodon.handleResponseError(_context2.t0);
              return _context2.abrupt("return", false);

            case 14:
            case "end":
              return _context2.stop();
          }
        }
      }, _callee2, null, [[0, 10]]);
    }));
    return _handleJobRetry.apply(this, arguments);
  }

  function handleCdJobRetry() {
    return _handleCdJobRetry.apply(this, arguments);
  }

  function _handleCdJobRetry() {
    _handleCdJobRetry = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
      var res;
      return regeneratorRuntime.wrap(function _callee3$(_context3) {
        while (1) {
          switch (_context3.prev = _context3.next) {
            case 0:
              _context3.prev = 0;
              _context3.next = 3;
              return retryCdJob(projectId, cdRecordId);

            case 3:
              res = _context3.sent;

              if (!handlePromptError(res)) {
                _context3.next = 7;
                break;
              }

              handleRefresh();
              return _context3.abrupt("return", true);

            case 7:
              return _context3.abrupt("return", false);

            case 10:
              _context3.prev = 10;
              _context3.t0 = _context3["catch"](0);
              Choerodon.handleResponseError(_context3.t0);
              return _context3.abrupt("return", false);

            case 14:
            case "end":
              return _context3.stop();
          }
        }
      }, _callee3, null, [[0, 10]]);
    }));
    return _handleCdJobRetry.apply(this, arguments);
  }

  var renderCdAuto = function renderCdAuto() {
    var _ref2 = cdAuto || {},
        envName = _ref2.envName,
        cdJobAppServiceName = _ref2.appServiceName,
        cdJobAppServiceVersion = _ref2.appServiceVersion,
        instanceName = _ref2.instanceName,
        envId = _ref2.envId,
        instanceId = _ref2.instanceId;

    function linkTo() {
      if (instanceId && instanceName) {
        history.push({
          pathname: '/devops/resource',
          search: "".concat(search, "&activeKey=").concat(TabCode.get('/devops/resource').tabCodes[0]),
          state: {
            instanceId: instanceId,
            appServiceId: appServiceId,
            envId: envId
          }
        });
      } else {
        history.push("/devops/resource".concat(search));
      }
    }

    return /*#__PURE__*/React.createElement("main", null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, "\u90E8\u7F72\u73AF\u5883:"), /*#__PURE__*/React.createElement("span", null, envName || '-')), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, "\u5E94\u7528\u670D\u52A1:"), /*#__PURE__*/React.createElement("span", null, cdJobAppServiceName || '-')), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, "\u670D\u52A1\u7248\u672C:"), /*#__PURE__*/React.createElement(_Tooltip, {
      title: cdJobAppServiceVersion
    }, /*#__PURE__*/React.createElement("span", null, cdJobAppServiceVersion || '-'))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, "\u751F\u6210\u5B9E\u4F8B:"), /*#__PURE__*/React.createElement(_Tooltip, {
      title: instanceName
    }, /*#__PURE__*/React.createElement("span", {
      style: {
        color: '#3F51B5',
        cursor: 'pointer'
      },
      onClick: linkTo
    }, jobStatus !== 'created' && instanceName || '-'))));
  };

  var renderCdAudit = function renderCdAudit() {
    var _ref3 = audit || {},
        appointUsers = _ref3.appointUsers,
        reviewedUsers = _ref3.reviewedUsers,
        auditJobStatus = _ref3.status;

    var appontUserString = appointUsers && appointUsers.map(function (x) {
      return x.realName;
    }).join('，');
    var reviewedUserStirng = reviewedUsers && reviewedUsers.map(function (x) {
      return x.realName;
    }).join('，');
    var countersignedText = countersigned ? '会签' : '或签';
    var countersignedNullText = countersigned === null ? '-' : countersignedText;
    return /*#__PURE__*/React.createElement("main", null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, "\u5BA1\u6838\u6A21\u5F0F:"), /*#__PURE__*/React.createElement("span", null, countersignedNullText)), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, "\u6307\u5B9A\u5BA1\u6838\u4EBA\u5458:"), /*#__PURE__*/React.createElement(_Tooltip, {
      title: appontUserString
    }, /*#__PURE__*/React.createElement("span", null, appontUserString || '-'))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, "\u5DF2\u5BA1\u6838\u4EBA\u5458:"), /*#__PURE__*/React.createElement(_Tooltip, {
      title: reviewedUserStirng
    }, /*#__PURE__*/React.createElement("span", null, reviewedUserStirng || '-'))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, "\u5BA1\u6838\u72B6\u6001:"), /*#__PURE__*/React.createElement(StatusTag, {
      status: auditJobStatus
    })));
  };

  var renderChart = function renderChart() {
    return /*#__PURE__*/React.createElement("main", null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, "\u751F\u6210\u7248\u672C:"), /*#__PURE__*/React.createElement(_Tooltip, {
      title: chartVersion
    }, /*#__PURE__*/React.createElement("span", null, chartVersion || '-'))));
  };

  var renderCdHost = function renderCdHost() {
    var hostDeployType = cdHostDeployConfigVO.hostDeployType,
        imageDeploy = cdHostDeployConfigVO.imageDeploy,
        jarDeploy = cdHostDeployConfigVO.jarDeploy;
    var hostTypeName = '';
    var hostSource = '';
    var hostTaskName = '';

    switch (hostDeployType) {
      case 'image':
        hostTypeName = '镜像部署';
        hostSource = imageDeploy.deploySource === 'pipelineDeploy' ? '流水线制品部署' : '匹配制品部署';
        hostTaskName = imageDeploy.pipelineTask;
        break;

      case 'jar':
        hostTypeName = 'jar部署';
        hostSource = jarDeploy.deploySource === 'pipelineDeploy' ? '流水线制品部署' : '匹配制品部署';
        hostTaskName = jarDeploy.pipelineTask;
        break;

      case 'customize':
        hostTypeName = '自定义命令';
        hostSource = '-';
        hostTaskName = '-';
        break;

      default:
        hostTypeName = '-';
        break;
    }

    return /*#__PURE__*/React.createElement("main", null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, "\u90E8\u7F72\u6A21\u5F0F:"), /*#__PURE__*/React.createElement("span", null, hostTypeName)), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, "\u90E8\u7F72\u6765\u6E90:"), /*#__PURE__*/React.createElement("span", null, hostSource)), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, "\u6784\u5EFA\u4EFB\u52A1\u540D\u79F0:"), /*#__PURE__*/React.createElement("span", null, hostTaskName)));
  };

  function calcValue(successCount, failCount) {
    var sum = failCount + successCount;

    if (sum) {
      var value = successCount / sum * 100;
      return "".concat(Number(value.toFixed(2)), "%");
    }

    return '-';
  }

  var renderApiTest = function renderApiTest() {
    var _ref4 = apiTestTaskRecordVO || {},
        successCount = _ref4.successCount,
        failCount = _ref4.failCount,
        deployJobName = _ref4.deployJobName,
        performThreshold = _ref4.performThreshold;

    return /*#__PURE__*/React.createElement("main", null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, "\u9608\u503C:"), /*#__PURE__*/React.createElement("span", null, performThreshold ? "".concat(performThreshold, "%") : '未设置')), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, "\u901A\u8FC7\u7387:"), /*#__PURE__*/React.createElement("span", null, successCount || successCount === 0 ? calcValue(successCount, failCount) : '-')), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, "\u6210\u529F\u6570\u91CF:"), /*#__PURE__*/React.createElement("span", null, successCount === 0 ? '0' : successCount || '-')), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, "\u5931\u8D25\u6570\u91CF:"), /*#__PURE__*/React.createElement("span", null, failCount === 0 ? '0' : failCount || '-')), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, "\u5173\u8054\u90E8\u7F72\u4EFB\u52A1:"), /*#__PURE__*/React.createElement("span", null, deployJobName || '-')));
  };

  var renderSonar = function renderSonar() {
    return /*#__PURE__*/React.createElement("main", null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, "\u68C0\u67E5\u7C7B\u578B:"), /*#__PURE__*/React.createElement("span", null, sonarScannerType)), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, "\u5355\u6D4B\u8986\u76D6\u7387:"), /*#__PURE__*/React.createElement("span", null, codeCoverage ? "".concat(codeCoverage, "%") : '-')));
  };

  function getRetryBtnDisabled() {
    var successAndFailed = jobStatus === 'success' || jobStatus === 'failed';

    if ((itemType === null || itemType === void 0 ? void 0 : itemType.indexOf('cd')) !== -1 && jobStatus === 'success') {
      return true;
    }

    return !(successAndFailed || jobStatus === 'canceled');
  }

  function goToApiTest() {
    var id = apiTestTaskRecordVO.get('id'); // 记录id

    var taskId = apiTestTaskRecordVO.get('taskId'); // 任务id

    if (id && taskId) {
      history.push({
        pathname: '/testManager/test-task',
        search: search,
        state: {
          taskId: taskId,
          recordId: id,
          type: 'task'
        }
      });
    } else {
      history.push("/testManager/test-task".concat(search));
    }
  }

  var renderCdExternalApproval = function renderCdExternalApproval() {
    return /*#__PURE__*/React.createElement("main", null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, "\u5916\u90E8\u5730\u5740:"), /*#__PURE__*/React.createElement(_Tooltip, {
      title: externalApprovalJobVO === null || externalApprovalJobVO === void 0 ? void 0 : externalApprovalJobVO.triggerUrl
    }, /*#__PURE__*/React.createElement("span", null, (externalApprovalJobVO === null || externalApprovalJobVO === void 0 ? void 0 : externalApprovalJobVO.triggerUrl) || '-'))));
  };

  var renderItemDetail = function renderItemDetail() {
    var funcMap = new Map([['cdDeploy', renderCdAuto], ['cdAudit', renderCdAudit], ['chart', renderChart], ['cdHost', renderCdHost], ['sonar', renderSonar], ['cdApiTest', renderApiTest], ['cdExternalApproval', renderCdExternalApproval]]);
    return funcMap.get(itemType) && funcMap.get(itemType)();
  };

  var renderCheckLogFun = function renderCheckLogFun() {
    openDescModal(itemType);
  };

  var logCheckDisabeldCondition = jobStatus === 'created';
  var renderRetryBtnFn = ['cdDeploy', 'cdHost', 'cdAudit', 'cdExternalApproval'].includes(itemType) ? handleCdJobRetry : handleJobRetry;

  var handleFileDownLoad = /*#__PURE__*/function () {
    var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(url, username, password, filename) {
      var tempHeader;
      return regeneratorRuntime.wrap(function _callee$(_context) {
        while (1) {
          switch (_context.prev = _context.next) {
            case 0:
              tempHeader = new Headers();
              tempHeader.append('Authorization', "Basic ".concat(Base64.encode("".concat(username, ":").concat(password))));
              fetch("".concat(url), {
                method: 'GET',
                headers: tempHeader,
                mode: 'cors'
              }).then(function (response) {
                if (!window.WritableStream) {
                  StreamSaver.WritableStream = WritableStream;
                  window.WritableStream = WritableStream;
                }

                var fileStream = StreamSaver.createWriteStream(filename, {
                  writableStrategy: true,
                  readableStrategy: true
                });
                var readableStream = response.body;

                if (window.WritableStream && (readableStream === null || readableStream === void 0 ? void 0 : readableStream.pipeTo)) {
                  return readableStream.pipeTo(fileStream).then(function () {
                    _message.success('下载成功');
                  });
                }

                var writer = fileStream.getWriter();
                window.writer = writer;
                var reader = response.body.getReader();

                var pump = function pump() {
                  return reader.read().then(function (res) {
                    return res.done ? writer.close() : writer.write(res.value).then(pump);
                  });
                };

                pump(); // message.success('下载成功');

                return true;
              })["catch"](function (error) {
                throw new Error(error);
              });

            case 3:
            case "end":
              return _context.stop();
          }
        }
      }, _callee);
    }));

    return function handleFileDownLoad(_x, _x2, _x3, _x4) {
      return _ref5.apply(this, arguments);
    };
  }();

  var handleJarDownload = function handleJarDownload() {
    var jarUrl = get(downloadMavenJarVO, 'downloaJar');
    var server = get(downloadMavenJarVO, 'server');
    var password = get(server, 'password');
    var username = get(server, 'username');

    _Modal.open({
      title: '下载jar包',
      children: '确定要下载此次构建任务产生的jar包吗？',
      okText: '下载',
      cancelProps: {
        color: 'dark'
      },
      onOk: function onOk() {
        return handleFileDownLoad(jarUrl, username, password, jarUrl.split('/')[jarUrl.split('/').length - 1]);
      }
    });
  };

  var handleImageCopy = function handleImageCopy() {
    copy(downloadImage);

    _message.success('复制成功');
  };

  var openMirrorScanningLog = function openMirrorScanningLog() {
    _Modal.open({
      title: '查看镜像扫描报告',
      key: _Modal.key(),
      children: /*#__PURE__*/React.createElement(MirrorScanning, {
        gitlabPipelineId: gitlabPipelineId
      }),
      style: {
        width: MIDDLE
      },
      drawer: true,
      okCancel: false,
      okText: '关闭'
    });
  }; // 自定义任务manual状态时的执行操作


  function handleExecute() {
    return _handleExecute.apply(this, arguments);
  }

  function _handleExecute() {
    _handleExecute = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
      var res;
      return regeneratorRuntime.wrap(function _callee4$(_context4) {
        while (1) {
          switch (_context4.prev = _context4.next) {
            case 0:
              _context4.prev = 0;
              _context4.next = 3;
              return executeCustomJob(projectId, gitlabProjectId, gitlabJobId);

            case 3:
              res = _context4.sent;

              if (!handlePromptError(res)) {
                _context4.next = 7;
                break;
              }

              handleRefresh();
              return _context4.abrupt("return", true);

            case 7:
              return _context4.abrupt("return", false);

            case 10:
              _context4.prev = 10;
              _context4.t0 = _context4["catch"](0);
              Choerodon.handleResponseError(_context4.t0);
              return _context4.abrupt("return", false);

            case 14:
            case "end":
              return _context4.stop();
          }
        }
      }, _callee4, null, [[0, 10]]);
    }));
    return _handleExecute.apply(this, arguments);
  }

  var renderFooterBtns = function renderFooterBtns() {
    var data = [];

    if (!['cdAudit', 'cdApiTest'].includes(itemType)) {
      if (!logCheckDisabeldCondition) {
        data.push({
          service: ['choerodon.code.project.develop.ci-pipeline.ps.job.log'],
          text: '查看日志',
          action: renderCheckLogFun
        });
      }

      if (!getRetryBtnDisabled()) {
        data.push({
          service: ['choerodon.code.project.develop.ci-pipeline.ps.job.retry'],
          text: '重试',
          action: renderRetryBtnFn
        });
      }
    }

    if (itemType === 'build') {
      downloadMavenJarVO && data.push({
        service: [''],
        text: 'jar包下载',
        action: handleJarDownload
      });

      if (imageScan && jobStatus === 'success') {
        data.push({
          service: ['choerodon.code.project.develop.ci-pipeline.ps.job.imageReport'],
          text: '查看镜像扫描报告',
          action: openMirrorScanningLog
        });
      } // 目前先不做npm代码保留着
      // if (downloadNpm) {
      //   data.push({
      //     service: [],
      //     text: 'npm下载',
      //     action: handleNpmDownload,
      //     // disabled: getRetryBtnDisabled(),
      //   });
      // }


      downloadImage && data.push({
        service: [],
        text: '复制镜像下载命令',
        action: handleImageCopy
      });
    }

    if (itemType === 'sonar') {
      data.push({
        service: ['choerodon.code.project.develop.ci-pipeline.ps.job.sonarqube'],
        text: '查看代码质量报告',
        action: openCodequalityModal
      });
    }

    if (itemType === 'cdApiTest' && jobStatus === 'created') {
      data.push({
        text: '查看详情',
        service: [],
        action: goToApiTest
      });
    }

    if (itemType === 'custom' && jobStatus === 'manual') {
      data.push({
        text: '执行',
        service: ['choerodon.code.project.develop.ci-pipeline.ps.job.execute'],
        action: handleExecute
      });
    }

    return data.length ? /*#__PURE__*/React.createElement(Action, {
      data: data
    }) : '';
  };

  return /*#__PURE__*/React.createElement("div", {
    className: "c7n-piplineManage-detail-column-item"
  }, /*#__PURE__*/React.createElement("header", null, /*#__PURE__*/React.createElement(StatusDot, {
    size: 13,
    status: jobStatus,
    style: {
      lineHeight: '22px'
    }
  }), /*#__PURE__*/React.createElement("div", {
    className: "c7n-piplineManage-detail-column-item-sub"
  }, /*#__PURE__*/React.createElement(_Tooltip, {
    title: jobName
  }, /*#__PURE__*/React.createElement("span", null, itemType && "\u3010".concat(jobTypesMappings[itemType], "\u3011"), jobName)), startedDate && finishedDate && /*#__PURE__*/React.createElement(_Tooltip, {
    title: "".concat(startedDate, "-").concat(finishedDate)
  }, /*#__PURE__*/React.createElement("span", null, startedDate, "-", finishedDate)))), renderItemDetail(), /*#__PURE__*/React.createElement("footer", null, renderFooterBtns(), /*#__PURE__*/React.createElement("span", {
    className: "c7n-piplineManage-detail-column-item-time"
  }, /*#__PURE__*/React.createElement("span", null, "\u4EFB\u52A1\u8017\u65F6\uFF1A"), /*#__PURE__*/React.createElement("span", null, jobDurationSeconds ? "".concat(renderDuration({
    value: jobDurationSeconds
  })) : '-'))));
};

export default DetailItem;