<commit_before><template>
    <div v-loading="loading" element-loading-text="请稍等···">
        <Top-bar :domain="domainName" :domain-info="domainInfo"></Top-bar>
        <Aside :sidebar-menus="sidebarMenus" headerHeight="90">
            <div class="job-detail-header">
                <div class="pull-left job-detail-title">
                  <span class="job-span">作业 :  {{jobName}}</span>
                  <el-tag :type="statusTag[jobInfo.status]" class="status-tag">运行状态:{{jobInfo.status}}</el-tag>
                </div>
                <div class="pull-right">
                    <el-button size="small" @click="handleActive(true)" v-if="jobInfo.status === 'STOPPING' || jobInfo.status === 'STOPPED'"><i class="fa fa-play-circle text-btn"></i>启用</el-button>
                    <el-button size="small" @click="handleActive(false)" v-if="jobInfo.status === 'READY' || jobInfo.status === 'RUNNING'"><i class="fa fa-stop-circle text-btn"></i>禁用</el-button>
                    <el-button size="small" @click="" ><i class="fa fa-play-circle-o text-btn"></i>立即执行</el-button>
                    <el-button size="small" @click=""><i class="fa fa-stop-circle-o text-btn"></i>立即终止</el-button>
                    <el-button size="small" @click="handleDelete"><i class="fa fa-trash text-btn"></i>删除</el-button>
                </div>
            </div>
            <router-view></router-view>
        </Aside>
    </div>
</template>

<script>
export default {
  data() {
    return {
      loading: false,
      domainName: this.$route.params.domain,
      jobName: this.$route.params.jobName,
      sidebarMenus: [
        { index: 'job_setting', title: '作业设置', icon: 'fa fa-gear', name: 'job_setting', params: { domain: this.$route.params.domain, jobName: this.$route.params.jobName } },
        { index: 'job_sharding', title: '分片情况', icon: 'fa fa-server', name: 'job_sharding', params: { domain: this.$route.params.domain, jobName: this.$route.params.jobName } },
        { index: 'job_execution', title: '运行状态', icon: 'fa fa-dot-circle-o', name: 'job_execution', params: { domain: this.$route.params.domain, jobName: this.$route.params.jobName } },
        { index: 'job_statistics', title: '作业统计', icon: 'fa fa-bar-chart', name: 'job_statistics', params: { domain: this.$route.params.domain, jobName: this.$route.params.jobName } },
        { index: 'job_alarm_center', title: '告警中心', icon: 'fa fa-bell', name: 'job_abnormal_jobs', params: { domain: this.$route.params.domain, jobName: this.$route.params.jobName } },
      ],
      domainInfo: {},
      jobInfo: {},
      statusTag: {
        READY: 'primary',
        RUNNING: 'success',
        STOPPING: 'warning',
        STOPPED: '',
      },
    };
  },
  methods: {
    handleDelete() {
      this.$message.confirmMessage(`确认删除作业 ${this.jobName} 吗?`, () => {
        this.$http.delete(`/console/namespaces/${this.domainName}/jobs/${this.jobName}`).then(() => {
          this.$router.push({ name: 'job_overview', params: { domain: this.domainName } });
          this.$message.successNotify('删除作业操作成功');
        })
        .catch(() => { this.$http.buildErrorHandler('删除作业请求失败！'); });
      });
    },
    handleActive(enabled) {
      let dependUrl = '';
      let operation = '';
      let text = '';
      let activeRequest = '';
      if (enabled) {
        dependUrl = `/console/namespaces/${this.domainName}/jobs/${this.jobName}/dependency`;
        operation = '启用';
        text = '禁用';
        activeRequest = 'enable';
      } else {
        dependUrl = `/console/namespaces/${this.domainName}/jobs/${this.jobName}/beDependedJobs`;<commit_msg>#310 作业立即执行，立即终止联调<commit_after><template>
    <div v-loading="loading" element-loading-text="请稍等···">
        <Top-bar :domain="domainName" :domain-info="domainInfo"></Top-bar>
        <Aside :sidebar-menus="sidebarMenus" headerHeight="90">
            <div class="job-detail-header">
                <div class="pull-left job-detail-title">
                  <span class="job-span">作业 :  {{jobName}}</span>
                  <el-tag :type="statusTag[jobInfo.status]" class="status-tag">运行状态:{{jobInfo.status}}</el-tag>
                </div>
                <div class="pull-right">
                    <el-button size="small" @click="handleActive(true)" v-if="jobInfo.status === 'STOPPING' || jobInfo.status === 'STOPPED'"><i class="fa fa-play-circle text-btn"></i>启用</el-button>
                    <el-button size="small" @click="handleActive(false)" v-if="jobInfo.status === 'READY' || jobInfo.status === 'RUNNING'"><i class="fa fa-stop-circle text-btn"></i>禁用</el-button>
                    <el-button size="small" @click="handleOperate('runAtOnce')" ><i class="fa fa-play-circle-o text-btn"></i>立即执行</el-button>
                    <el-button size="small" @click="handleOperate('stopAtOnce')"><i class="fa fa-stop-circle-o text-btn"></i>立即终止</el-button>
                    <el-button size="small" @click="handleDelete"><i class="fa fa-trash text-btn"></i>删除</el-button>
                </div>
            </div>
            <router-view></router-view>
        </Aside>
    </div>
</template>

<script>
export default {
  data() {
    return {
      loading: false,
      domainName: this.$route.params.domain,
      jobName: this.$route.params.jobName,
      sidebarMenus: [
        { index: 'job_setting', title: '作业设置', icon: 'fa fa-gear', name: 'job_setting', params: { domain: this.$route.params.domain, jobName: this.$route.params.jobName } },
        { index: 'job_sharding', title: '分片情况', icon: 'fa fa-server', name: 'job_sharding', params: { domain: this.$route.params.domain, jobName: this.$route.params.jobName } },
        { index: 'job_execution', title: '运行状态', icon: 'fa fa-dot-circle-o', name: 'job_execution', params: { domain: this.$route.params.domain, jobName: this.$route.params.jobName } },
        { index: 'job_statistics', title: '作业统计', icon: 'fa fa-bar-chart', name: 'job_statistics', params: { domain: this.$route.params.domain, jobName: this.$route.params.jobName } },
        { index: 'job_alarm_center', title: '告警中心', icon: 'fa fa-bell', name: 'job_abnormal_jobs', params: { domain: this.$route.params.domain, jobName: this.$route.params.jobName } },
      ],
      domainInfo: {},
      jobInfo: {},
      statusTag: {
        READY: 'primary',
        RUNNING: 'success',
        STOPPING: 'warning',
        STOPPED: '',
      },
    };
  },
  methods: {
    handleOperate(operation) {
      this.$http.post(`/console/namespaces/${this.domainName}/jobs/${this.jobName}/config/${operation}`, '').then(() => {
        this.$message.successNotify('操作成功');
        this.getJobInfo();
      })
      .catch(() => { this.$http.buildErrorHandler(`${operation}请求失败！`); });
    },
    handleDelete() {
      this.$message.confirmMessage(`确认删除作业 ${this.jobName} 吗?`, () => {
        this.$http.delete(`/console/namespaces/${this.domainName}/jobs/${this.jobName}`).then(() => {
          this.$router.push({ name: 'job_overview', params: { domain: this.domainName } });
          this.$message.successNotify('删除作业操作成功');
        })
        .catch(() => { this.$http.buildErrorHandler('删除作业请求失败！'); });
      });
    },
    handleActive(enabled) {
      let dependUrl = '';
      let operation = '';
      let text = '';
      let activeRequest = '';
      if (enabled) {
        dependUrl = `/console/namespaces/${this.domainName}/jobs/${this.jobName}/dependency`;
        operation = '启用';
        text = '禁用';
        activeRequest = 'enable';
      } else {
        dependUrl = `/console/namespaces/${this.domainName}/jobs/${this.jobName}/beDependedJobs`;
{'fraction_non_alphanumeric': 0.19450650545406756, 'fraction_numerical': 0.0009199632014719411, 'mean_word_length': 2.7469226981782375, 'pattern_counts': {'":': 0, '<': 85, '<?xml version=': 0, '>': 93, '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': '6811959', 'n_tokens_mistral': 2529, 'n_tokens_neox': 2566, 'n_words': 403}