Browse Source

[Improvement][UI] Support to display extra columns such as 'Worker Group' and 'Environment Name' on the page of cron manage. (#13267)

calvin 2 years ago
parent
commit
a235d3cd6a

+ 6 - 0
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/ScheduleVo.java

@@ -130,6 +130,11 @@ public class ScheduleVo {
      */
     private Long environmentCode;
 
+    /**
+     * environment name
+     */
+    private String environmentName;
+
     public ScheduleVo(Schedule schedule) {
         this.setId(schedule.getId());
         this.setCrontab(schedule.getCrontab());
@@ -150,5 +155,6 @@ public class ScheduleVo {
         this.setEnvironmentCode(schedule.getEnvironmentCode());
         this.setStartTime(DateUtils.dateToString(schedule.getStartTime(), ZoneId.systemDefault().getId()));
         this.setEndTime(DateUtils.dateToString(schedule.getEndTime(), ZoneId.systemDefault().getId()));
+        this.setEnvironmentName(schedule.getEnvironmentName());
     }
 }

+ 6 - 0
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/Schedule.java

@@ -137,4 +137,10 @@ public class Schedule {
      * environment code
      */
     private Long environmentCode;
+
+    /**
+     * environment name
+     */
+    @TableField(exist = false)
+    private String environmentName;
 }

+ 2 - 1
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.xml

@@ -29,7 +29,7 @@
         ${alias}.update_time
     </sql>
     <select id="queryByProcessDefineCodePaging" resultType="org.apache.dolphinscheduler.dao.entity.Schedule">
-        select p_f.name as process_definition_name, p.name as project_name,u.user_name,
+        select p_f.name as process_definition_name, p.name as project_name,u.user_name,e.name as environment_name,
         <include refid="baseSqlV2">
             <property name="alias" value="s"/>
         </include>
@@ -37,6 +37,7 @@
         join t_ds_process_definition p_f on s.process_definition_code = p_f.code
         join t_ds_project as p on p_f.project_code = p.code
         join t_ds_user as u on s.user_id = u.id
+        join t_ds_environment as e on s.environment_code = e.code
         where 1=1
         <if test="processDefinitionCode != 0">
             and s.process_definition_code = #{processDefinitionCode}

+ 10 - 0
dolphinscheduler-ui/src/views/projects/workflow/definition/timing/use-table.ts

@@ -123,6 +123,16 @@ export function useTable() {
             ? t('project.workflow.up_line')
             : t('project.workflow.down_line')
       },
+      {
+        title: t('project.workflow.worker_group'),
+        key: 'workerGroup',
+        width: 140
+      },
+      {
+        title: t('project.workflow.environment_name'),
+        key: 'environmentName',
+        width: 160
+      },
       {
         title: t('project.workflow.create_time'),
         key: 'createTime',