Browse Source

modify Monitor (#6100)

modify Queue
modify Scheduler
modify Tenant

Co-authored-by: Junjie Ma <manmxhn@163.com>
2.0.7-release
Junjie Ma 3 years ago committed by GitHub
parent
commit
b1026292bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/MonitorController.java
  2. 14
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/QueueController.java
  3. 30
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/SchedulerController.java
  4. 19
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/TenantController.java
  5. 14
      dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js
  6. 8
      dolphinscheduler-ui/src/js/conf/home/store/monitor/actions.js
  7. 22
      dolphinscheduler-ui/src/js/conf/home/store/security/actions.js

8
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/MonitorController.java

@ -61,7 +61,7 @@ public class MonitorController extends BaseController {
* @return master list
*/
@ApiOperation(value = "listMaster", notes = "MASTER_LIST_NOTES")
@GetMapping(value = "/master/list")
@GetMapping(value = "/masters")
@ResponseStatus(HttpStatus.OK)
@ApiException(LIST_MASTERS_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
@ -77,7 +77,7 @@ public class MonitorController extends BaseController {
* @return worker information list
*/
@ApiOperation(value = "listWorker", notes = "WORKER_LIST_NOTES")
@GetMapping(value = "/worker/list")
@GetMapping(value = "/workers")
@ResponseStatus(HttpStatus.OK)
@ApiException(LIST_WORKERS_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
@ -93,7 +93,7 @@ public class MonitorController extends BaseController {
* @return data base state
*/
@ApiOperation(value = "queryDatabaseState", notes = "QUERY_DATABASE_STATE_NOTES")
@GetMapping(value = "/database")
@GetMapping(value = "/databases")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_DATABASE_STATE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
@ -109,7 +109,7 @@ public class MonitorController extends BaseController {
* @return zookeeper information list
*/
@ApiOperation(value = "queryZookeeperState", notes = "QUERY_ZOOKEEPER_STATE_NOTES")
@GetMapping(value = "/zookeeper/list")
@GetMapping(value = "/zookeepers")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_ZOOKEEPER_STATE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")

14
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/QueueController.java

@ -35,7 +35,9 @@ import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@ -53,7 +55,7 @@ import springfox.documentation.annotations.ApiIgnore;
*/
@Api(tags = "QUEUE_TAG")
@RestController
@RequestMapping("/queue")
@RequestMapping("/queues")
public class QueueController extends BaseController {
@Autowired
@ -91,7 +93,7 @@ public class QueueController extends BaseController {
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20")
})
@GetMapping(value = "/list-paging")
@GetMapping()
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_QUEUE_LIST_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
@ -122,7 +124,7 @@ public class QueueController extends BaseController {
@ApiImplicitParam(name = "queue", value = "YARN_QUEUE_NAME", required = true, dataType = "String"),
@ApiImplicitParam(name = "queueName", value = "QUEUE_NAME", required = true, dataType = "String")
})
@PostMapping(value = "/create")
@PostMapping()
@ResponseStatus(HttpStatus.CREATED)
@ApiException(CREATE_QUEUE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
@ -148,12 +150,12 @@ public class QueueController extends BaseController {
@ApiImplicitParam(name = "queue", value = "YARN_QUEUE_NAME", required = true, dataType = "String"),
@ApiImplicitParam(name = "queueName", value = "QUEUE_NAME", required = true, dataType = "String")
})
@PostMapping(value = "/update")
@PutMapping(value = "/{id}")
@ResponseStatus(HttpStatus.CREATED)
@ApiException(UPDATE_QUEUE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result updateQueue(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int id,
@PathVariable(value = "id") int id,
@RequestParam(value = "queue") String queue,
@RequestParam(value = "queueName") String queueName) {
Map<String, Object> result = queueService.updateQueue(loginUser, id, queue, queueName);
@ -173,7 +175,7 @@ public class QueueController extends BaseController {
@ApiImplicitParam(name = "queue", value = "YARN_QUEUE_NAME", required = true, dataType = "String"),
@ApiImplicitParam(name = "queueName", value = "QUEUE_NAME", required = true, dataType = "String")
})
@PostMapping(value = "/verify-queue")
@PostMapping(value = "/verify")
@ResponseStatus(HttpStatus.OK)
@ApiException(VERIFY_QUEUE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")

30
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/SchedulerController.java

@ -42,9 +42,11 @@ import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@ -63,7 +65,7 @@ import springfox.documentation.annotations.ApiIgnore;
*/
@Api(tags = "SCHEDULER_TAG")
@RestController
@RequestMapping("/projects/{projectCode}/schedule")
@RequestMapping("/projects/{projectCode}/schedules")
public class SchedulerController extends BaseController {
public static final String DEFAULT_WARNING_TYPE = "NONE";
@ -99,7 +101,7 @@ public class SchedulerController extends BaseController {
@ApiImplicitParam(name = "workerGroupId", value = "WORKER_GROUP_ID", dataType = "Int", example = "100"),
@ApiImplicitParam(name = "processInstancePriority", value = "PROCESS_INSTANCE_PRIORITY", type = "Priority"),
})
@PostMapping("/create")
@PostMapping()
@ResponseStatus(HttpStatus.CREATED)
@ApiException(CREATE_SCHEDULE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
@ -142,12 +144,12 @@ public class SchedulerController extends BaseController {
@ApiImplicitParam(name = "workerGroupId", value = "WORKER_GROUP_ID", dataType = "Int", example = "100"),
@ApiImplicitParam(name = "processInstancePriority", value = "PROCESS_INSTANCE_PRIORITY", type = "Priority"),
})
@PostMapping("/update")
@PutMapping("/{id}")
@ApiException(UPDATE_SCHEDULE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result updateSchedule(@ApiIgnore @RequestAttribute(value = SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "id") Integer id,
@PathVariable(value = "id") Integer id,
@RequestParam(value = "schedule") String schedule,
@RequestParam(value = "warningType", required = false, defaultValue = DEFAULT_WARNING_TYPE) WarningType warningType,
@RequestParam(value = "warningGroupId", required = false) int warningGroupId,
@ -172,12 +174,12 @@ public class SchedulerController extends BaseController {
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "SCHEDULE_ID", required = true, dataType = "Int", example = "100")
})
@PostMapping("/online")
@PostMapping("/{id}/online")
@ApiException(PUBLISH_SCHEDULE_ONLINE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result online(@ApiIgnore @RequestAttribute(value = SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam("id") Integer id) {
@PathVariable("id") Integer id) {
Map<String, Object> result = schedulerService.setScheduleState(loginUser, projectCode, id, ReleaseState.ONLINE);
return returnDataList(result);
}
@ -194,12 +196,12 @@ public class SchedulerController extends BaseController {
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "SCHEDULE_ID", required = true, dataType = "Int", example = "100")
})
@PostMapping("/offline")
@PostMapping("/{id}/offline")
@ApiException(OFFLINE_SCHEDULE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result offline(@ApiIgnore @RequestAttribute(value = SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam("id") Integer id) {
@PathVariable("id") Integer id) {
Map<String, Object> result = schedulerService.setScheduleState(loginUser, projectCode, id, ReleaseState.OFFLINE);
return returnDataList(result);
@ -224,7 +226,7 @@ public class SchedulerController extends BaseController {
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", dataType = "Int", example = "100")
})
@GetMapping("/list-paging")
@GetMapping()
@ApiException(QUERY_SCHEDULE_LIST_PAGING_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryScheduleListPaging(@ApiIgnore @RequestAttribute(value = SESSION_USER) User loginUser,
@ -248,22 +250,22 @@ public class SchedulerController extends BaseController {
*
* @param loginUser login user
* @param projectCode project code
* @param scheduleId scheule id
* @param id scheule id
* @return delete result code
*/
@ApiOperation(value = "deleteScheduleById", notes = "OFFLINE_SCHEDULE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "scheduleId", value = "SCHEDULE_ID", required = true, dataType = "Int", example = "100")
@ApiImplicitParam(name = "id", value = "SCHEDULE_ID", required = true, dataType = "Int", example = "100")
})
@GetMapping(value = "/delete")
@DeleteMapping(value = "/{id}")
@ResponseStatus(HttpStatus.OK)
@ApiException(DELETE_SCHEDULE_CRON_BY_ID_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result deleteScheduleById(@RequestAttribute(value = SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam("scheduleId") Integer scheduleId
@RequestParam("id") Integer id
) {
Map<String, Object> result = schedulerService.deleteScheduleById(loginUser, projectCode, scheduleId);
Map<String, Object> result = schedulerService.deleteScheduleById(loginUser, projectCode, id);
return returnDataList(result);
}

19
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/TenantController.java

@ -36,8 +36,11 @@ import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@ -55,7 +58,7 @@ import springfox.documentation.annotations.ApiIgnore;
*/
@Api(tags = "TENANT_TAG")
@RestController
@RequestMapping("/tenant")
@RequestMapping("/tenants")
public class TenantController extends BaseController {
@Autowired
@ -76,7 +79,7 @@ public class TenantController extends BaseController {
@ApiImplicitParam(name = "queueId", value = "QUEUE_ID", required = true, dataType = "Int", example = "100"),
@ApiImplicitParam(name = "description", value = "TENANT_DESC", dataType = "String")
})
@PostMapping(value = "/create")
@PostMapping()
@ResponseStatus(HttpStatus.CREATED)
@ApiException(CREATE_TENANT_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
@ -104,7 +107,7 @@ public class TenantController extends BaseController {
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20")
})
@GetMapping(value = "/list-paging")
@GetMapping()
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_TENANT_LIST_PAGING_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
@ -158,12 +161,12 @@ public class TenantController extends BaseController {
@ApiImplicitParam(name = "description", value = "TENANT_DESC", type = "String")
})
@PostMapping(value = "/update")
@PutMapping(value = "/{id}")
@ResponseStatus(HttpStatus.OK)
@ApiException(UPDATE_TENANT_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result updateTenant(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int id,
@PathVariable(value = "id") int id,
@RequestParam(value = "tenantCode") String tenantCode,
@RequestParam(value = "queueId") int queueId,
@RequestParam(value = "description", required = false) String description) throws Exception {
@ -184,12 +187,12 @@ public class TenantController extends BaseController {
@ApiImplicitParam(name = "id", value = "TENANT_ID", required = true, dataType = "Int", example = "100")
})
@PostMapping(value = "/delete")
@DeleteMapping(value = "/{id}")
@ResponseStatus(HttpStatus.OK)
@ApiException(DELETE_TENANT_BY_ID_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result deleteTenantById(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int id) throws Exception {
@PathVariable(value = "id") int id) throws Exception {
Map<String, Object> result = tenantService.deleteTenantById(loginUser, id);
return returnDataList(result);
}
@ -205,7 +208,7 @@ public class TenantController extends BaseController {
@ApiImplicitParams({
@ApiImplicitParam(name = "tenantCode", value = "TENANT_CODE", required = true, dataType = "String")
})
@GetMapping(value = "/verify-tenant-code")
@GetMapping(value = "/verify-code")
@ResponseStatus(HttpStatus.OK)
@ApiException(VERIFY_OS_TENANT_CODE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")

14
dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js

@ -549,7 +549,7 @@ export default {
*/
createSchedule ({ state }, payload) {
return new Promise((resolve, reject) => {
io.post(`projects/${state.projectCode}/schedule/create`, payload, res => {
io.post(`projects/${state.projectCode}/schedules`, payload, res => {
resolve(res)
}).catch(e => {
reject(e)
@ -561,7 +561,7 @@ export default {
*/
previewSchedule ({ state }, payload) {
return new Promise((resolve, reject) => {
io.post(`projects/${state.projectCode}/schedule/preview`, payload, res => {
io.post(`projects/${state.projectCode}/schedules/preview`, payload, res => {
resolve(res.data)
// alert(res.data)
}).catch(e => {
@ -574,7 +574,7 @@ export default {
*/
getScheduleList ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get(`projects/${state.projectCode}/schedule/list-paging`, payload, res => {
io.get(`projects/${state.projectCode}/schedules`, payload, res => {
resolve(res)
}).catch(e => {
reject(e)
@ -586,7 +586,7 @@ export default {
*/
scheduleOffline ({ state }, payload) {
return new Promise((resolve, reject) => {
io.post(`projects/${state.projectCode}/schedule/offline`, payload, res => {
io.post(`projects/${state.projectCode}/schedules/${payload.id}/offline`, payload, res => {
resolve(res)
}).catch(e => {
reject(e)
@ -598,7 +598,7 @@ export default {
*/
scheduleOnline ({ state }, payload) {
return new Promise((resolve, reject) => {
io.post(`projects/${state.projectCode}/schedule/online`, payload, res => {
io.post(`projects/${state.projectCode}/schedules/${payload.id}/online`, payload, res => {
resolve(res)
}).catch(e => {
reject(e)
@ -610,7 +610,7 @@ export default {
*/
updateSchedule ({ state }, payload) {
return new Promise((resolve, reject) => {
io.post(`projects/${state.projectCode}/schedule/update`, payload, res => {
io.put(`projects/${state.projectCode}/schedules/${payload.id}`, payload, res => {
resolve(res)
}).catch(e => {
reject(e)
@ -821,7 +821,7 @@ export default {
*/
deleteTiming ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get(`projects/${state.projectCode}/schedule/delete`, payload, res => {
io.delete(`projects/${state.projectCode}/schedules/${payload.scheduleId}`, payload, res => {
resolve(res)
}).catch(e => {
reject(e)

8
dolphinscheduler-ui/src/js/conf/home/store/monitor/actions.js

@ -20,7 +20,7 @@ import io from '@/module/io'
export default {
getMasterData ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get('monitor/master/list', payload, res => {
io.get('monitor/masters', payload, res => {
resolve(res.data)
}).catch(e => {
reject(e)
@ -29,7 +29,7 @@ export default {
},
getWorkerData ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get('monitor/worker/list', payload, res => {
io.get('monitor/workers', payload, res => {
resolve(res.data)
}).catch(e => {
reject(e)
@ -38,7 +38,7 @@ export default {
},
getDatabaseData ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get('monitor/database', payload, res => {
io.get('monitor/databases', payload, res => {
resolve(res.data)
}).catch(e => {
reject(e)
@ -47,7 +47,7 @@ export default {
},
getZookeeperData ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get('monitor/zookeeper/list', payload, res => {
io.get('monitor/zookeepers', payload, res => {
resolve(res.data)
}).catch(e => {
reject(e)

22
dolphinscheduler-ui/src/js/conf/home/store/security/actions.js

@ -36,7 +36,7 @@ export default {
param: {
tenantCode: payload.tenantCode
},
api: 'tenant/verify-tenant-code'
api: 'tenants/verify-code'
},
alertgroup: {
param: {
@ -272,7 +272,7 @@ export default {
*/
getTenantListP ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get('tenant/list-paging', payload, res => {
io.get('tenants', payload, res => {
resolve(res.data)
}).catch(e => {
reject(e)
@ -284,7 +284,7 @@ export default {
*/
getTenantList ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get('tenant/list', payload, res => {
io.get('tenants/list', payload, res => {
const list = res.data
list.unshift({
id: -1,
@ -302,7 +302,7 @@ export default {
*/
getQueueList ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get('queue/list', payload, res => {
io.get('queues/list', payload, res => {
resolve(res.data)
}).catch(e => {
reject(e)
@ -314,7 +314,7 @@ export default {
*/
createQueue ({ state }, payload) {
return new Promise((resolve, reject) => {
io.post('tenant/create', payload, res => {
io.post('tenants', payload, res => {
resolve(res)
}).catch(e => {
reject(e)
@ -326,7 +326,7 @@ export default {
*/
updateQueue ({ state }, payload) {
return new Promise((resolve, reject) => {
io.post('tenant/update', payload, res => {
io.put(`tenants/${payload.id}`, payload, res => {
resolve(res)
}).catch(e => {
reject(e)
@ -338,7 +338,7 @@ export default {
*/
deleteQueue ({ state }, payload) {
return new Promise((resolve, reject) => {
io.post('tenant/delete', payload, res => {
io.delete(`tenants/${payload.id}`, payload, res => {
resolve(res)
}).catch(e => {
reject(e)
@ -518,7 +518,7 @@ export default {
*/
getQueueListP ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get('queue/list-paging', payload, res => {
io.get('queues', payload, res => {
resolve(res.data)
}).catch(e => {
reject(e)
@ -530,7 +530,7 @@ export default {
*/
createQueueQ ({ state }, payload) {
return new Promise((resolve, reject) => {
io.post('queue/create', payload, res => {
io.post('queues', payload, res => {
resolve(res)
}).catch(e => {
reject(e)
@ -542,7 +542,7 @@ export default {
*/
updateQueueQ ({ state }, payload) {
return new Promise((resolve, reject) => {
io.post('queue/update', payload, res => {
io.put(`queues/${payload.id}`, payload, res => {
resolve(res)
}).catch(e => {
reject(e)
@ -554,7 +554,7 @@ export default {
*/
verifyQueueQ ({ state }, payload) {
return new Promise((resolve, reject) => {
io.post('queue/verify-queue', payload, res => {
io.post('queues/verify', payload, res => {
resolve(res)
}).catch(e => {
reject(e)

Loading…
Cancel
Save