update routes
This commit is contained in:
parent
c7512e2041
commit
a51028f16b
|
|
@ -52,8 +52,8 @@ Route.post("/api/account/checkLogin", "UsersController.checkLogin");
|
|||
//Log
|
||||
Route.get("/api/log/showLog/:name?", async ({ request, response }) => {
|
||||
try {
|
||||
// fghf
|
||||
console.log(request.params().name)
|
||||
// fghf
|
||||
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);
|
||||
|
|
@ -111,20 +108,22 @@ 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>\
|
||||
|
|
@ -152,14 +151,20 @@ Route.get("/api/log/showLog/:name?", async ({ request, response }) => {
|
|||
// border-color: -internal-light-dark(rgb(118, 118, 118), rgb(133, 133, 133));\
|
||||
// border-image: initial;\
|
||||
// padding: 2px;'><b>"+request.params().name+"</b>" + modelSpecial + issueItem
|
||||
// +
|
||||
// +
|
||||
// data.join("\n") +
|
||||
// "</div>\
|
||||
// </body>\
|
||||
// </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