fix: 검색필터 수정

main
jschoi 8 months ago
parent 0a67d370f6
commit 6365611181

@ -1,3 +1,3 @@
NODE_ENV = "dev"
VITE_APP_API_SERVER_URL = "http://localhost:80"
VITE_APP_API_SERVER_URL = "http://localhost:8080"
VITE_ROOT_PATH = ""

@ -32,17 +32,15 @@ const tableHeader = [
{ label: "Action", width: "10%", style: "word-break: keep-all;" },
];
type SearchType = "전체" | "제목" | "작성자";
type SearchType = "전체" | "제목";
const searchOptions = [
{ label: "전체", value: "전체" as SearchType },
{ label: "제목", value: "제목" as SearchType },
{ label: "작성자", value: "작성자" as SearchType },
];
const SEARCH_TYPE_MAP: Record<SearchType | "", "ALL" | "TITLE" | "AUTHOR"> = {
const SEARCH_TYPE_MAP: Record<SearchType | "", "ALL" | "TITLE"> = {
"": "ALL",
전체: "ALL",
제목: "TITLE",
작성자: "AUTHOR",
};
const pageSizeOptions = [
@ -282,11 +280,7 @@ function includes(hay: any, needle: string) {
if (!hay) return false;
return String(hay).toLowerCase().includes(needle.toLowerCase());
}
function matchBySearchType(
rowRaw: any,
mapped: "ALL" | "TITLE" | "AUTHOR",
kw: string,
) {
function matchBySearchType(rowRaw: any, mapped: "ALL" | "TITLE", kw: string) {
if (!kw) return true;
//
@ -298,22 +292,11 @@ function matchBySearchType(
rowRaw.pipeline?.displayName,
rowRaw.pipeline?.name,
];
//
const authorFields = [
rowRaw.username,
rowRaw.userName,
rowRaw.owner,
rowRaw.createdBy,
rowRaw.user?.name,
rowRaw.user?.username,
];
if (mapped === "TITLE") {
return titleFields.some((v) => includes(v, kw));
}
if (mapped === "AUTHOR") {
return authorFields.some((v) => includes(v, kw));
}
// ALL: / + ,
const extraFields = [
rowRaw.description,
@ -321,9 +304,7 @@ function matchBySearchType(
rowRaw.tags,
rowRaw.tagString,
];
return [...titleFields, ...authorFields, ...extraFields].some((v) =>
includes(v, kw),
);
return [...titleFields, ...extraFields].some((v) => includes(v, kw));
}
async function fetchList() {

@ -36,7 +36,6 @@ const tableHeader = [
const searchOptions = [
{ label: "전체", value: "전체" as SearchType },
{ label: "제목", value: "제목" as SearchType },
{ label: "사용자", value: "작성자" as SearchType },
];
const pageSizeOptions = [

Loading…
Cancel
Save