Skip to content

Commit

Permalink
Dev 1.1.17 code view fix (#344)
Browse files Browse the repository at this point in the history
* code view  fix

* code view  fix
  • Loading branch information
v-kkhuang authored Nov 10, 2023
1 parent 384ece2 commit 610be6b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package org.apache.linkis.ecm.restful;

import org.apache.linkis.common.conf.Configuration;
import org.apache.linkis.ecm.server.conf.ECMConfiguration;
import org.apache.linkis.ecm.server.util.ECMUtils;
import org.apache.linkis.server.Message;
import org.apache.linkis.server.utils.ModuleUserUtils;
Expand Down Expand Up @@ -56,16 +55,34 @@
public class ECMRestfulApi {

private final Logger logger = LoggerFactory.getLogger(ECMRestfulApi.class);
private final String[] adminOperations =
ECMConfiguration.ECM_ADMIN_OPERATIONS().getValue().split(",");

/**
* * Reason for using the get method: Added gateway forwarding rules, which only support get
* requests
*
* @param req
* @param response
* @param emInstance
* @param instance
* @param logDirSuffix
* @param logType
* @throws IOException
*/
@ApiOperation(
value = "downloadEngineLog",
notes = "download engine log",
response = Message.class)
@ApiImplicitParams({
@ApiImplicitParam(name = "emInstance", required = true, dataType = "String"),
@ApiImplicitParam(name = "instance", required = true, dataType = "String"),
@ApiImplicitParam(
name = "emInstance",
required = true,
dataType = "String",
example = "xxx0002:9102"),
@ApiImplicitParam(
name = "instance",
required = true,
dataType = "String",
example = "xxx0002:35873"),
@ApiImplicitParam(name = "logDirSuffix", required = true, dataType = "String"),
@ApiImplicitParam(name = "logType", required = true, dataType = "String")
})
Expand Down Expand Up @@ -126,7 +143,7 @@ public Message downloadEngineLog(
response.setCharacterEncoding(Consts.UTF_8.toString());
java.nio.file.Path source = Paths.get(inputFile.getPath());
response.addHeader("Content-Type", Files.probeContentType(source));
// filename eg:bdpdws110002_11529_stdout.txt
// filename eg:xxx002_11529_stdout.txt
response.addHeader(
"Content-Disposition",
"attachment;filename=" + instance.replace(":", "_") + "_" + logType + ".txt");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,4 @@ object ECMConfiguration {
val ECM_PROCESS_SCRIPT_KILL: Boolean =
CommonVars[Boolean]("wds.linkis.ecm.script.kill.engineconn", true).getValue

val ECM_ADMIN_OPERATIONS = CommonVars("wds.linkis.governance.admin.operations", "")

}
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ private Message executeECMOperation(
@ApiImplicitParam(name = "tenant", dataType = "String", defaultValue = "tenant"),
})
@ApiOperationSupport(ignoreParameters = {"jsonNode"})
@RequestMapping(path = "/taskprediction", method = RequestMethod.GET)
@RequestMapping(path = "/task-prediction", method = RequestMethod.GET)
public Message taskprediction(
HttpServletRequest req,
@RequestParam(value = "username", required = false) String username,
Expand All @@ -542,9 +542,9 @@ public Message taskprediction(
@RequestParam(value = "queueName", required = false) String queueName,
@RequestParam(value = "tenant", required = false) String tenant)
throws PersistenceErrorException, RMErrorException {
String tokenName = ModuleUserUtils.getOperationUser(req, "taskprediction");
String loginUser = ModuleUserUtils.getOperationUser(req, "taskprediction");
if (StringUtils.isBlank(username)) {
username = tokenName;
username = loginUser;
}
if (StringUtils.isBlank(engineType)) {
return Message.error("parameters:engineType can't be null (请求参数【engineType】不能为空)");
Expand Down

0 comments on commit 610be6b

Please sign in to comment.