The new accumulator is typically meaningless unless a value is added 29 | * via {@link #add(Object, Object)}. 30 | * 31 | *
The accumulator is the state of a running aggregation. When a program has multiple 32 | * aggregates in progress (such as per key and window), the state (per key and window) 33 | * is the size of the accumulator. 34 | * 35 | * @return A new accumulator, corresponding to an empty aggregate. 36 | */ 37 | @Override 38 | public LogContentAcc createAccumulator() { 39 | return new LogContentAcc(); 40 | } 41 | 42 | /** 43 | * Adds the given input value to the given accumulator, returning the 44 | * new accumulator value. 45 | * 46 | *
For efficiency, the input accumulator may be modified and returned. 47 | * 48 | * @param value The value to add 49 | * @param accumulator The accumulator to add the value to 50 | */ 51 | @Override 52 | public LogContentAcc add(LogContent value, LogContentAcc accumulator) { 53 | 54 | if (null != value) { 55 | accumulator.access += 1; 56 | accumulator.cost += value.cost; 57 | if (value.type == Const.ERROR) { 58 | accumulator.exception += 1; 59 | accumulator.traceIds.add(value.traceId); 60 | } 61 | } 62 | 63 | return accumulator; 64 | } 65 | 66 | /** 67 | * Gets the result of the aggregation from the accumulator. 68 | * 69 | * @param accumulator The accumulator of the aggregation 70 | * @return The final aggregation result. 71 | */ 72 | @Override 73 | public LogContentAcc getResult(LogContentAcc accumulator) { 74 | 75 | return accumulator; 76 | } 77 | 78 | /** 79 | * Merges two accumulators, returning an accumulator with the merged state. 80 | * 81 | *
This function may reuse any of the given accumulators as the target for the merge
82 | * and return that. The assumption is that the given accumulators will not be used any
83 | * more after having been passed to this function.
84 | *
85 | * @param a An accumulator to merge
86 | * @param b Another accumulator to merge
87 | * @return The accumulator with the merged state
88 | */
89 | @Override
90 | public LogContentAcc merge(LogContentAcc a, LogContentAcc b) {
91 | return null;
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/mmc-lidea-stream/src/main/java/com/mmc/lidea/stream/flink/LogContentErrorFilter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2010-2020 Founder Ltd. All Rights Reserved.
3 | *
4 | * This software is the confidential and proprietary information of
5 | * Founder. You shall not disclose such Confidential Information
6 | * and shall use it only in accordance with the terms of the agreements
7 | * you entered into with Founder.
8 | *
9 | */
10 | package com.mmc.lidea.stream.flink;
11 |
12 | import com.mmc.lidea.common.context.Const;
13 | import com.mmc.lidea.stream.model.LogContent;
14 | import com.mmc.lidea.stream.util.LogContentUtil;
15 |
16 | /**
17 | * @author Joey
18 | * @date 2019/8/4 16:45
19 | */
20 | public class LogContentErrorFilter implements org.apache.flink.api.common.functions.FilterFunction IMPORTANT: The system assumes that the function does not
28 | * modify the elements on which the predicate is applied. Violating this assumption
29 | * can lead to incorrect results.
30 | *
31 | * @param element The value to be filtered.
32 | * @return True for values that should be retained, false for values to be filtered out.
33 | * @throws Exception This method may throw exceptions. Throwing an exception will cause the operation
34 | * to fail and may trigger recovery.
35 | */
36 | @Override
37 | public boolean filter(String element) throws Exception {
38 |
39 | LogContent content = LogContentUtil.valueOf(element);
40 | if (null == content)
41 | return false;
42 |
43 | // 只能故障数据通过
44 | // 必须要有traceId
45 | return (content.type == Const.ERROR) && (content.traceId != null);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/mmc-lidea-stream/src/main/java/com/mmc/lidea/stream/flink/LogContentFilter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2010-2020 Founder Ltd. All Rights Reserved.
3 | *
4 | * This software is the confidential and proprietary information of
5 | * Founder. You shall not disclose such Confidential Information
6 | * and shall use it only in accordance with the terms of the agreements
7 | * you entered into with Founder.
8 | *
9 | */
10 | package com.mmc.lidea.stream.flink;
11 |
12 | /**
13 | * @author Joey
14 | * @date 2019/8/1 19:44
15 | */
16 | public class LogContentFilter implements org.apache.flink.api.common.functions.FilterFunction IMPORTANT: The system assumes that the function does not
24 | * modify the elements on which the predicate is applied. Violating this assumption
25 | * can lead to incorrect results.
26 | *
27 | * @param value The value to be filtered.
28 | * @return True for values that should be retained, false for values to be filtered out.
29 | * @throws Exception This method may throw exceptions. Throwing an exception will cause the operation
30 | * to fail and may trigger recovery.
31 | */
32 | @Override
33 | public boolean filter(String value) throws Exception {
34 | return value.split("\\|").length > 12; // filt the not suitable record, default is 13.
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/mmc-lidea-stream/src/main/java/com/mmc/lidea/stream/flink/LogContentSplitter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2010-2020 Founder Ltd. All Rights Reserved.
3 | *
4 | * This software is the confidential and proprietary information of
5 | * Founder. You shall not disclose such Confidential Information
6 | * and shall use it only in accordance with the terms of the agreements
7 | * you entered into with Founder.
8 | *
9 | */
10 | package com.mmc.lidea.stream.flink;
11 |
12 | import com.mmc.lidea.stream.model.LogContent;
13 | import com.mmc.lidea.stream.util.LogContentUtil;
14 | import org.apache.flink.api.common.functions.MapFunction;
15 |
16 | /**
17 | * @author Joey
18 | * @date 2019/8/1 19:31
19 | */
20 | public class LogContentSplitter implements MapFunction The returned watermark will be emitted only if it is non-null and its timestamp
31 | * is larger than that of the previously emitted watermark (to preserve the contract of
32 | * ascending watermarks). If a null value is returned, or the timestamp of the returned
33 | * watermark is smaller than that of the last emitted one, then no new watermark will
34 | * be generated.
35 | *
36 | * For an example how to use this method, see the documentation of
37 | * {@link AssignerWithPunctuatedWatermarks this class}.
38 | *
39 | * @param lastElement
40 | * @param extractedTimestamp
41 | * @return {@code Null}, if no watermark should be emitted, or the next watermark to emit.
42 | */
43 | @Nullable
44 | @Override
45 | public Watermark checkAndGetNextWatermark(String lastElement, long extractedTimestamp) {
46 |
47 | if (null != lastElement && lastElement.contains("|")) {
48 |
49 | String[] parts = lastElement.split("\\|");
50 | // long timestamp = Long.parseLong(parts[0]);
51 | long timestamp = TimeUtil.stringToLong(parts[0], TimeUtil.yyyyMMddHHmmssSSS);
52 | return new Watermark(timestamp);
53 | }
54 | return new Watermark(extractedTimestamp);
55 | }
56 |
57 | /**
58 | * Assigns a timestamp to an element, in milliseconds since the Epoch.
59 | *
60 | * The method is passed the previously assigned timestamp of the element.
61 | * That previous timestamp may have been assigned from a previous assigner,
62 | * by ingestion time. If the element did not carry a timestamp before, this value is
63 | * {@code Long.MIN_VALUE}.
64 | *
65 | * @param element The element that the timestamp will be assigned to.
66 | * @param previousElementTimestamp The previous internal timestamp of the element,
67 | * or a negative value, if no timestamp has been assigned yet.
68 | * @return The new timestamp.
69 | */
70 | @Override
71 | public long extractTimestamp(String element, long previousElementTimestamp) {
72 | if (element != null && element.contains("|")) {
73 | String[] parts = element.split("\\|");
74 | // long timestamp = Long.parseLong(parts[0]);
75 | long timestamp = TimeUtil.stringToLong(parts[0], TimeUtil.yyyyMMddHHmmssSSS);
76 |
77 | return timestamp;
78 | }
79 | return previousElementTimestamp;
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/mmc-lidea-stream/src/main/java/com/mmc/lidea/stream/job/LideaAppJob.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2010-2020 Founder Ltd. All Rights Reserved.
3 | *
4 | * This software is the confidential and proprietary information of
5 | * Founder. You shall not disclose such Confidential Information
6 | * and shall use it only in accordance with the terms of the agreements
7 | * you entered into with Founder.
8 | *
9 | */
10 | package com.mmc.lidea.stream.job;
11 |
12 | import com.mmc.lidea.common.context.KafkaConst;
13 | import com.mmc.lidea.stream.Bootstrap;
14 | import com.mmc.lidea.stream.flink.LideaAppSinkFun;
15 | import com.mmc.lidea.stream.flink.LogContentFilter;
16 | import com.mmc.lidea.stream.flink.LogContentSplitter;
17 | import com.mmc.lidea.stream.flink.MessageWaterEmitter;
18 | import com.mmc.lidea.stream.model.LogContent;
19 | import com.mmc.lidea.stream.util.LogAppNameUtil;
20 | import org.apache.flink.api.common.serialization.SimpleStringSchema;
21 | import org.apache.flink.api.java.utils.ParameterTool;
22 | import org.apache.flink.streaming.api.TimeCharacteristic;
23 | import org.apache.flink.streaming.api.datastream.DataStream;
24 | import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
25 | import org.apache.flink.streaming.api.windowing.time.Time;
26 | import org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer010;
27 |
28 | import java.io.InputStream;
29 | import java.util.Properties;
30 |
31 | /**
32 | * @author Joey
33 | * @date 2019/8/4 16:39
34 | */
35 | public class LideaAppJob {
36 |
37 |
38 | public static void main(String[] args) throws Exception {
39 |
40 |
41 | final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
42 | env.enableCheckpointing(5000); // 非常关键,一定要设置启动检查点!!
43 | env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime);
44 | env.setParallelism(1); // 这个不需要太多资源
45 |
46 | String confName = "lidea.properties";
47 | InputStream in = Bootstrap.class.getClassLoader().getResourceAsStream(confName);
48 | ParameterTool parameterTool = ParameterTool.fromPropertiesFile(in);
49 | env.getConfig().setGlobalJobParameters(parameterTool);
50 |
51 | Properties props = new Properties();
52 | props.setProperty("bootstrap.servers", parameterTool.get("kafka.bootstrap.servers", "localhost:9092"));
53 | props.setProperty("group.id", "lidea-app-group");
54 |
55 | FlinkKafkaConsumer010
21 | * String str = "aaa{} bbb{} ccc{}";
22 | * System.out.println(StringUtil.format(str, "1", "2", "3"));
23 | * @param src 源字符串
24 | * @param param 跟源字符串{}匹配的个数字符串
25 | * @return
26 | */
27 | public static String format(String src, Object... param) {
28 | int i = 0;
29 | int index = 0;
30 | StringBuffer sb = new StringBuffer(src);
31 | while (-1 != (index = sb.indexOf("{}"))) {
32 | sb.replace(index, index + 2, String.valueOf(param[i++]));
33 | }
34 | return sb.toString();
35 | }
36 |
37 | public static String formatNullForEmpty(String src, Object... param) {
38 | int i = 0;
39 | int index = 0;
40 | StringBuffer sb = new StringBuffer(src);
41 | while (-1 != (index = sb.indexOf("{}"))) {
42 | Object obj = param[i++];
43 | sb.replace(index, index + 2, String.valueOf(null == obj ? "" : obj));
44 | }
45 | return sb.toString();
46 | }
47 |
48 | public static boolean equals(String str1,String str2) {
49 | return (null == str1 && null == str2) || (null != str1 && str1.equals(str2));
50 | }
51 |
52 | public static void main(String[] args) {
53 | String str = "aaa{} bbb{} ccc{}";
54 | System.out.println(StringUtil.format(str, "1", "2", "3"));
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/mmc-lidea-util/src/main/java/com/mmc/lidea/util/TimeUtil.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2010-2020 Founder Ltd. All Rights Reserved.
3 | *
4 | * This software is the confidential and proprietary information of
5 | * Founder. You shall not disclose such Confidential Information
6 | * and shall use it only in accordance with the terms of the agreements
7 | * you entered into with Founder.
8 | *
9 | */
10 | package com.mmc.lidea.util;
11 |
12 | import java.time.Instant;
13 | import java.time.LocalDateTime;
14 | import java.time.ZoneId;
15 | import java.time.ZoneOffset;
16 | import java.time.format.DateTimeFormatter;
17 |
18 | /**
19 | * @author Joey
20 | * @date 2019/7/20 20:19
21 | */
22 | public class TimeUtil {
23 |
24 | public static final String yyyyMMddHHmmss = "yyyy-MM-dd HH:mm:ss";
25 | public static final String yyyyMMddHHmmssSSS = "yyyy-MM-dd HH:mm:ss.SSS";
26 |
27 | /**
28 | * 时间戳转字符串.
29 | *
30 | * @param time
31 | * @return
32 | */
33 | public static String timestampToString(Long time) {
34 | DateTimeFormatter ftf = DateTimeFormatter.ofPattern(yyyyMMddHHmmss);
35 | return ftf.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneId.systemDefault()));
36 | }
37 |
38 | /**
39 | * 时间戳转字符串.
40 | *
41 | * @param time
42 | * @param pattern
43 | * @return
44 | */
45 | public static String timestampToString(Long time, String pattern) {
46 | DateTimeFormatter ftf = DateTimeFormatter.ofPattern(pattern);
47 | return ftf.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneId.systemDefault()));
48 | }
49 |
50 | /**
51 | * 字符串转时间戳.
52 | *
53 | * @param ltime
54 | * @return
55 | */
56 | public static long stringToLong(String ltime) {
57 | DateTimeFormatter ftf = DateTimeFormatter.ofPattern(yyyyMMddHHmmss);
58 | LocalDateTime parse = LocalDateTime.parse(ltime, ftf);
59 | return LocalDateTime.from(parse).atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
60 | }
61 |
62 | /**
63 | * 字符串转时间戳.
64 | *
65 | * @param ltime
66 | * @param pattern
67 | * @return
68 | */
69 | public static long stringToLong(String ltime, String pattern) {
70 | DateTimeFormatter ftf = DateTimeFormatter.ofPattern(pattern);
71 | LocalDateTime parse = LocalDateTime.parse(ltime, ftf);
72 | return LocalDateTime.from(parse).atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
73 | }
74 |
75 | /**
76 | * 翻转时间.
77 | *
78 | * @param currentTimeMillis
79 | * @return
80 | */
81 | public static long reverseTimeMillis(long currentTimeMillis) {
82 | return Long.MAX_VALUE - currentTimeMillis;
83 | }
84 |
85 | /**
86 | * 时间转字符串.
87 | *
88 | * @param now
89 | * @return
90 | */
91 | public static String dateToString(LocalDateTime now) {
92 | DateTimeFormatter ftf = DateTimeFormatter.ofPattern(yyyyMMddHHmmss);
93 | return ftf.format(now);
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/mmc-lidea-util/src/test/java/com/mmc/lidea/util/TimeUtilTest.java:
--------------------------------------------------------------------------------
1 | package com.mmc.lidea.util;
2 |
3 | import org.junit.Assert;
4 | import org.junit.Test;
5 |
6 | public class TimeUtilTest {
7 |
8 | @Test
9 | public void test() {
10 |
11 |
12 | long time = System.currentTimeMillis();
13 |
14 | String stime = TimeUtil.timestampToString(time, TimeUtil.yyyyMMddHHmmssSSS);
15 | long ntime = TimeUtil.stringToLong(stime, TimeUtil.yyyyMMddHHmmssSSS);
16 |
17 | System.out.println(StringUtil.format("{} {} {}", time, stime, ntime));
18 | Assert.assertEquals(time, ntime);
19 |
20 | }
21 |
22 | @Test
23 | public void testEqual() {
24 |
25 |
26 | long timestamp = 1565057370000L;
27 |
28 | String timestr = "2019-08-06 10:09:30";
29 |
30 | long ntime = TimeUtil.stringToLong(timestr);
31 | Assert.assertEquals(timestamp, ntime);
32 |
33 | String ntimestr = TimeUtil.timestampToString(timestamp);
34 | Assert.assertEquals(timestr, ntimestr);
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/mmc-lidea-web/.gitignore:
--------------------------------------------------------------------------------
1 | HELP.md
2 | target/
3 | !.mvn/wrapper/maven-wrapper.jar
4 | !**/src/main/**
5 | !**/src/test/**
6 |
7 | ### STS ###
8 | .apt_generated
9 | .classpath
10 | .factorypath
11 | .project
12 | .settings
13 | .springBeans
14 | .sts4-cache
15 |
16 | ### IntelliJ IDEA ###
17 | .idea
18 | *.iws
19 | *.iml
20 | *.ipr
21 |
22 | ### NetBeans ###
23 | /nbproject/private/
24 | /nbbuild/
25 | /dist/
26 | /nbdist/
27 | /.nb-gradle/
28 | build/
29 |
30 | ### VS Code ###
31 | .vscode/
32 |
--------------------------------------------------------------------------------
/mmc-lidea-web/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VIPJoey/Lidea/1fdd0c2bd59a77cbbba7efe0a1255006a9aca0a5/mmc-lidea-web/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/mmc-lidea-web/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip
2 |
--------------------------------------------------------------------------------
/mmc-lidea-web/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | > extractor = new LideaLogResultsExtractor();
63 | List
> {
28 |
29 |
30 | /**
31 | * Implementations must implement this method to process the entire {@link ResultScanner}.
32 | *
33 | * @param results {@link ResultScanner} to extract data from. Implementations should not close this; it will be closed
34 | * automatically by the calling {@link HbaseTemplate}
35 | * @return an arbitrary result object, or null if none (the extractor will typically be stateful in the latter case).
36 | * @throws Exception if an Hbase exception is encountered
37 | */
38 | @Override
39 | public List
> {
30 |
31 | /**
32 | * Implementations must implement this method to process the entire {@link ResultScanner}.
33 | *
34 | * @param results {@link ResultScanner} to extract data from. Implementations should not close this; it will be closed
35 | * automatically by the calling {@link HbaseTemplate}
36 | * @return an arbitrary result object, or null if none (the extractor will typically be stateful in the latter case).
37 | * @throws Exception if an Hbase exception is encountered
38 | */
39 | @Override
40 | public List
> {
27 |
28 |
29 | /**
30 | * Implementations must implement this method to process the entire {@link ResultScanner}.
31 | *
32 | * @param results {@link ResultScanner} to extract data from. Implementations should not close this; it will be closed
33 | * automatically by the calling {@link HbaseTemplate}
34 | * @return an arbitrary result object, or null if none (the extractor will typically be stateful in the latter case).
35 | * @throws Exception if an Hbase exception is encountered
36 | */
37 | @Override
38 | public List
> {
28 |
29 |
30 | /**
31 | * Implementations must implement this method to process the entire {@link ResultScanner}.
32 | *
33 | * @param results {@link ResultScanner} to extract data from. Implementations should not close this; it will be closed
34 | * automatically by the calling {@link HbaseTemplate}
35 | * @return an arbitrary result object, or null if none (the extractor will typically be stateful in the latter case).
36 | * @throws Exception if an Hbase exception is encountered
37 | */
38 | @Override
39 | public List
3 | * 请放在jq后加载.
4 | */
5 |
6 | var Nora = window.Nora || {
7 | /**
8 | * 返回整响应结果.
9 | * @param url
10 | * @param prams
11 | * @param successFun
12 | * @param failFun
13 | */
14 | "Ajax": function(url, prams, successFun, failFun) {
15 | $.ajax({
16 | type : "POST",
17 | url : url,
18 | data: prams,
19 | success : function(result){
20 | if (typeof(successFun) == "function") {
21 | successFun(result);
22 | }
23 | },
24 | error: function(xhr, msg, e) {
25 | if (typeof(failFun) == "function") {
26 | failFun(xhr, msg, e);
27 | } else {
28 | alert("Nora.request函数调用出错:" + msg + " " + e);
29 | }
30 | }
31 | });
32 | },
33 | /**
34 | * 只返回数据部分.
35 | * @param url
36 | * @param prams
37 | * @param successFun
38 | * @param failFun
39 | */
40 | "Request": function(url, prams, successFun, failFun) {
41 | $.ajax({
42 | type : "POST",
43 | url : url,
44 | data: prams,
45 | success : function(result){
46 | if (typeof(successFun) == "function") {
47 | successFun(result.data);
48 | }
49 | },
50 | error: function(xhr, msg, e) {
51 | if (typeof(failFun) == "function") {
52 | failFun(xhr, msg, e);
53 | } else {
54 | alert("Nora.request函数调用出错:" + msg + " " + e);
55 | }
56 | }
57 | });
58 | },
59 | "Util": {
60 | "StringUtil": {
61 | "format": function(source, args) {
62 | var result = source;
63 | if (arguments.length > 1) {
64 | for (var i = 1; i < arguments.length; i++) {
65 | if (arguments[i] != undefined) {
66 | result = result.replace("{}", arguments[i]);
67 | }
68 | }
69 | }
70 | return result;
71 | }
72 | },
73 | "DateUtil": {
74 | "format": function(source, pattern) {
75 | var o = {
76 | "M+": source.getMonth() + 1, //月份
77 | "d+": source.getDate(), //日
78 | "h+": source.getHours(), //小时
79 | "m+": source.getMinutes(), //分
80 | "s+": source.getSeconds(), //秒
81 | "q+": Math.floor((source.getMonth() + 3) / 3), //季度
82 | "S": source.getMilliseconds() //毫秒
83 | };
84 | if (/(y+)/.test(pattern)) pattern = pattern.replace(RegExp.$1, (source.getFullYear() + "").substr(4 - RegExp.$1.length));
85 | for (var k in o)
86 | if (new RegExp("(" + k + ")").test(pattern))
87 | pattern = pattern.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
88 | return pattern;
89 | }
90 | },
91 | "TemplateUtil": {
92 | "formate": function(dta, tmpl) {
93 | var format = {
94 | name: function(x) {
95 | return x
96 | }
97 | };
98 | return tmpl.replace(/{(\w+)}/g, function(m1, m2) {
99 | if (!m2)
100 | return "";
101 | return (format && format[m2]) ? format[m2](dta[m2]) : dta[m2];
102 | });
103 | }
104 | }
105 | }
106 | };
107 |
--------------------------------------------------------------------------------
/mmc-lidea-web/src/main/resources/static/v1/js/app.js:
--------------------------------------------------------------------------------
1 |
2 | function bindDataToGallery(resp) {
3 |
4 | for (let i = 0; i < resp.data.length; i++) {
5 |
6 | let d = resp.data[i];
7 |
8 | let tpl = $("#divTpl").html();
9 | let html = Nora.Util.StringUtil.format(tpl, d.appName, d.appName);
10 |
11 | $("#divContainer").append(html);
12 | }
13 | // 防止控件bug抖动,加样本填充
14 | for (let i = resp.data.length; i < 2; i++) {
15 |
16 | let tpl = $("#divTpl").html();
17 | let html = Nora.Util.StringUtil.format(tpl, "demo" + i, "demo" + i);
18 |
19 | $("#divContainer").append(html);
20 | }
21 |
22 | let mid = resp.data.length / 2;
23 |
24 | initContainer();
25 | setJump();
26 | setDrag();
27 | bindEvent();
28 |
29 | showImgAt(mid);
30 |
31 | }
32 |
33 | function openServicePage(e) {
34 |
35 | let appName = $(e).attr("data-name");
36 | $("#txtAppName").val(appName);
37 |
38 | window.location.href = "/lidea/serviceList?appName=" + appName;
39 | //$("#frmMethodList").submit();
40 | }
41 |
42 |
--------------------------------------------------------------------------------
/mmc-lidea-web/src/main/resources/static/v1/js/errorList.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | function bindDataToGrid(resp) {
4 |
5 | let tpl = $("#tplRow").html();
6 |
7 | for (let i = 0; i < resp.data.length; i++) {
8 | let d = resp.data[i];
9 | let html = Nora.Util.StringUtil.format(tpl,
10 | d.time,
11 | d.serviceName,
12 | d.methodName,
13 | wrap(d.traceId),
14 | d.localIp,
15 | d.remoteIp,
16 | d.cost,
17 | d.args,
18 | d.response,
19 | d.msg,
20 | d.customMsg
21 |
22 | );
23 | $("#tbList tbody").append("" + html + " ");
24 | }
25 |
26 | $("#tbList").basictable();
27 | }
28 |
29 | function wrap(src) {
30 |
31 | return (null == src) ? "" : src;
32 | }
--------------------------------------------------------------------------------
/mmc-lidea-web/src/main/resources/static/v1/js/jquery.basictable.min.js:
--------------------------------------------------------------------------------
1 | /*
2 | * jQuery Basic Table
3 | * Author: Jerry Low
4 | */(function(e){e.fn.basictable=function(t){var n=function(t,n){var i=[];n.tableWrap&&t.wrap('');var s="";t.find("thead tr th").length?s="thead th":t.find("tbody tr th").length?s="tbody tr th":t.find("th").length?s="tr:first th":s="tr:first td",e.each(t.find(s),function(){var t=e(this),n=parseInt(t.attr("colspan"),10)||1,r=t.closest("tr").index();i[r]||(i[r]=[]);for(var s=0;s
24 |
25 |
43 |
60 |
61 |
26 |
38 |
39 |
40 |
41 |
42 | Time
27 | ServiceName
28 | Method
29 | TraceId
30 | Local
31 | Remote
32 | Cost
33 | Arg
34 | Resp
35 | Msg
36 | Custom
37 |