You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@linkis.apache.org by GitBox <gi...@apache.org> on 2022/11/29 06:26:11 UTC

[GitHub] [incubator-linkis] huangKai-2323 commented on a diff in pull request #3869: [feature]New alarm button of management console

huangKai-2323 commented on code in PR #3869:
URL: https://github.com/apache/incubator-linkis/pull/3869#discussion_r1034343750


##########
linkis-public-enhancements/linkis-jobhistory/src/main/java/org/apache/linkis/jobhistory/restful/api/JobhistorySettingApi.java:
##########
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.linkis.jobhistory.restful.api;
+
+import org.apache.linkis.jobhistory.conf.JobhistoryConfiguration;
+import org.apache.linkis.jobhistory.entity.JobHistory;
+import org.apache.linkis.jobhistory.entity.MonitorVO;
+import org.apache.linkis.jobhistory.service.JobHistoryQueryService;
+import org.apache.linkis.protocol.utils.TaskUtils;
+import org.apache.linkis.server.BDPJettyServerHelper;
+import org.apache.linkis.server.Message;
+import org.apache.linkis.server.utils.ModuleUserUtils;
+
+import org.apache.commons.lang3.StringUtils;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Api(tags = "query api")
+@RestController
+@RequestMapping(path = "/jobhistory/setting")
+public class JobhistorySettingApi {
+
+  @Autowired private JobHistoryQueryService jobHistoryQueryService;
+
+  private Logger log = LoggerFactory.getLogger(this.getClass());
+
+  /** Method list should not contain subjob, which may cause performance problems. */
+  @ApiOperation(value = "addObserveInfo", notes = "add Observe Info", response = Message.class)
+  @RequestMapping(path = "/addObserveInfo", method = RequestMethod.POST)
+  public Message addObserveInfo(HttpServletRequest req, @RequestBody MonitorVO monitor) {
+    String username = ModuleUserUtils.getOperationUser(req, "isNotice");
+    if (null == monitor.getTaskId()) {
+      return Message.error("TaskId can't be empty ");
+    }
+    if (StringUtils.isBlank(monitor.getMonitorStatus())) {
+      return Message.error("MonitorStatus can't be empty ");
+    }
+    if (StringUtils.isBlank(monitor.getReceiver())) {
+      return Message.error("Receiver can't be empty");
+    }
+    if (null == monitor.getExtra()) {
+      return Message.error("Extra can't be empty ");
+    } else {
+      Map<String, String> extra = monitor.getExtra();
+      if (StringUtils.isBlank(extra.getOrDefault("title", "")))
+        return Message.error("title can't be empty ");
+      if (StringUtils.isBlank(extra.getOrDefault("detail", "")))
+        return Message.error("detail can't be empty ");
+    }
+    if (StringUtils.isBlank(monitor.getMonitorLevel())) {
+      return Message.error("MonitorLevel can't be empty ");
+    }
+    // 根据id获取jobInfo

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@linkis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@linkis.apache.org
For additional commands, e-mail: notifications-help@linkis.apache.org