adapt search for endpoint

This commit is contained in:
Valentin CZERYBA 2023-10-30 23:41:58 +01:00
parent 52eff81bf1
commit e590b3f823
2 changed files with 8 additions and 10 deletions

View File

@ -31,19 +31,19 @@ function buildParam(e, id){
if(id == "inputRoles"){ if(id == "inputRoles"){
var status = e.target.value; var status = e.target.value;
if(status != "-2"){ if(status != "-2"){
param = param + "key=status&value="+status+"&"; param = param + "status="+status+"&";
} }
if(getId != "All"){ if(getId != "All"){
param = param + "key=roles&value="+getId; param = param + "roles="+getId;
} }
} }
if(id == "inputStatus"){ if(id == "inputStatus"){
var roles = e.target.value; var roles = e.target.value;
if(getId != "-2"){ if(getId != "-2"){
param = param + "key=status&value="+getId+"&"; param = param + "status="+getId+"&";
} }
if(roles != "All"){ if(roles != "All"){
param = param + "key=roles&value="+roles+"&"; param = param + "roles="+roles+"&";
} }
} }
} else { } else {
@ -54,13 +54,11 @@ function buildParam(e, id){
if(search.length > 0){ if(search.length > 0){
if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(search)){ if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(search)){
param = param + "email="+search+"&"; param = param + "email="+search+"&";
} else if(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(search)){
param = param + "uuid="+search+"&";
} else { } else {
param = param + "search="+search+"&"; param = param + "id="+search+"&";
} }
} else { } else {
listParam.push("email"); listParam.push("uuid"); listParam.push("search"); listParam.push("email"); listParam.push("id");
} }
for (var i=0; i<listParam.length; i++){ for (var i=0; i<listParam.length; i++){

View File

@ -75,7 +75,7 @@ if (pageCurrent.length > 0){
param["skip"] = param["skip"] - 1; param["skip"] = param["skip"] - 1;
} }
var listQuery = ["search", "uuid", "roles", "status", "email"]; var listQuery = ["search", "id", "roles", "status", "email"];
for (var i=0; i<listQuery.length; i++){ for (var i=0; i<listQuery.length; i++){
var query = getQuery(listQuery[i]); var query = getQuery(listQuery[i]);
if(query.length > 0){ if(query.length > 0){
@ -83,7 +83,7 @@ for (var i=0; i<listQuery.length; i++){
} }
} }
instance.get("users", {withCredentials: true, params :param}).then(function(response){ instance.get("users", {withCredentials: true, params:param}).then(function(response){
var listData = response.data; var listData = response.data;
if(!Array.isArray(listData)){ if(!Array.isArray(listData)){
var listData = [] var listData = []