update routes
This commit is contained in:
		
							parent
							
								
									c7512e2041
								
							
						
					
					
						commit
						a51028f16b
					
				| 
						 | 
				
			
			@ -53,7 +53,7 @@ Route.post("/api/account/checkLogin", "UsersController.checkLogin");
 | 
			
		|||
Route.get("/api/log/showLog/:name?", async ({ request, response }) => {
 | 
			
		||||
  try {
 | 
			
		||||
    // fghf
 | 
			
		||||
  console.log(request.params().name)
 | 
			
		||||
    console.log(request.params().name);
 | 
			
		||||
    let fileDetect = await LogDetectFile.findBy(
 | 
			
		||||
      "file_name",
 | 
			
		||||
      request.params().name
 | 
			
		||||
| 
						 | 
				
			
			@ -81,10 +81,9 @@ Route.get("/api/log/showLog/:name?", async ({ request, response }) => {
 | 
			
		|||
        i.$original.key === "CATCH_FAULTY"
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    let MODEL_SPECIAL = allValue.filter(
 | 
			
		||||
      (i) =>
 | 
			
		||||
        i.$original.key === "MODEL_SPECIAL"
 | 
			
		||||
    ).map(obj => obj.$original.value);
 | 
			
		||||
    let MODEL_SPECIAL = allValue
 | 
			
		||||
      .filter((i) => i.$original.key === "MODEL_SPECIAL")
 | 
			
		||||
      .map((obj) => obj.$original.value);
 | 
			
		||||
 | 
			
		||||
    let listExcludeErr = allValue
 | 
			
		||||
      .filter((i) => i.$original.key === "EXCLUDE_ERR")
 | 
			
		||||
| 
						 | 
				
			
			@ -92,18 +91,16 @@ Route.get("/api/log/showLog/:name?", async ({ request, response }) => {
 | 
			
		|||
 | 
			
		||||
    let data = content.data.split("\n");
 | 
			
		||||
    data.map((line, index) => {
 | 
			
		||||
      data[index] =
 | 
			
		||||
        (index + 1) +
 | 
			
		||||
        "|-|" +
 | 
			
		||||
        line;
 | 
			
		||||
      data[index] = index + 1 + "|-|" + line;
 | 
			
		||||
      listKeyValues
 | 
			
		||||
        .map((obj) => obj.$original.value)
 | 
			
		||||
        .map(async (value) => {
 | 
			
		||||
          if (line.search(value) !== -1 &&
 | 
			
		||||
          listExcludeErr.filter((err) => line.includes(err))
 | 
			
		||||
            .length === 0) {
 | 
			
		||||
          if (
 | 
			
		||||
            line.search(value) !== -1 &&
 | 
			
		||||
            listExcludeErr.filter((err) => line.includes(err)).length === 0
 | 
			
		||||
          ) {
 | 
			
		||||
            data[index] =
 | 
			
		||||
              data[index].slice(0, data[index].search(value)) +
 | 
			
		||||
              data[index].slice(0, data[index].search(value)) +"|-|" +
 | 
			
		||||
              value +
 | 
			
		||||
              "|-|" +
 | 
			
		||||
              data[index].slice(data[index].search(value) + value.length);
 | 
			
		||||
| 
						 | 
				
			
			@ -113,18 +110,20 @@ Route.get("/api/log/showLog/:name?", async ({ request, response }) => {
 | 
			
		|||
    });
 | 
			
		||||
 | 
			
		||||
    listLine.map((u) => {
 | 
			
		||||
      if (listExcludeErr.filter((err) => data[u - 1].includes(err)).length === 0) {
 | 
			
		||||
        if(MODEL_SPECIAL.filter((i)=>data[u - 1].includes(i)).length>0){
 | 
			
		||||
          modelSpecialDetected.push(data[u - 1])
 | 
			
		||||
        }else{
 | 
			
		||||
          issueSpecialDetected.push(data[u - 1])
 | 
			
		||||
      if (
 | 
			
		||||
        listExcludeErr.filter((err) => data[u - 1].includes(err)).length === 0
 | 
			
		||||
      ) {
 | 
			
		||||
        if (MODEL_SPECIAL.filter((i) => data[u - 1].includes(i)).length > 0) {
 | 
			
		||||
          modelSpecialDetected.push(data[u - 1]);
 | 
			
		||||
        } else {
 | 
			
		||||
          issueSpecialDetected.push(data[u - 1]);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
    let modelSpecial = modelSpecialDetected.length>0?"\n\n<b>Extra items:</b>\n" +  modelSpecialDetected.join("\n") + "\n":"\n"
 | 
			
		||||
    let issueItem = issueSpecialDetected.length>0?"\n<b>Issue found:</b>\n" + issueSpecialDetected.join("\n")+"\n\n":"\n";
 | 
			
		||||
    let modelSpecial =
 | 
			
		||||
      modelSpecialDetected.length > 0 ? modelSpecialDetected.join("\n") : "";
 | 
			
		||||
    let issueItem =
 | 
			
		||||
      issueSpecialDetected.length > 0 ? issueSpecialDetected.join("\n") : "";
 | 
			
		||||
    // response.send(
 | 
			
		||||
    //   "<html>\
 | 
			
		||||
    // <body>\
 | 
			
		||||
| 
						 | 
				
			
			@ -159,7 +158,13 @@ Route.get("/api/log/showLog/:name?", async ({ request, response }) => {
 | 
			
		|||
    // </html>"
 | 
			
		||||
    // );
 | 
			
		||||
 | 
			
		||||
    response.status(200).send({modelSpecial:modelSpecial, issueItem:issueItem, contentFile: data.join("\n")})
 | 
			
		||||
    response
 | 
			
		||||
      .status(200)
 | 
			
		||||
      .send({
 | 
			
		||||
        modelSpecial: modelSpecial,
 | 
			
		||||
        issueItem: issueItem,
 | 
			
		||||
        contentFile: data.join("\n"),
 | 
			
		||||
      });
 | 
			
		||||
  } catch (error) {
 | 
			
		||||
    console.error(error);
 | 
			
		||||
    response.send("<h1>-------------- File not found --------------</h1>");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue