APP/인증 관리 화면에서 API 추가시 중복 ID가 들어가, 수정시 에러 발생하는 부분을 수정함.
This commit is contained in:
@@ -293,21 +293,30 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
var rows = $("#selectedApiGrid").jqGrid('getRowData');
|
var rows = $("#selectedApiGrid").jqGrid('getRowData');
|
||||||
console.log(returnValue);
|
|
||||||
|
|
||||||
const apiId = returnValue.apiId;
|
var existingApiIds = new Set(rows.map(function(row) {
|
||||||
var apiIdExists = rows.some(function (row) {
|
return String(row.apiId);
|
||||||
return row.apiId === apiId;
|
}));
|
||||||
});
|
|
||||||
|
var newItems = Array.isArray(returnValue) ? returnValue : [returnValue];
|
||||||
|
|
||||||
if (apiIdExists) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var ids = $("#selectedApiGrid").jqGrid('getDataIDs');
|
var ids = $("#selectedApiGrid").jqGrid('getDataIDs');
|
||||||
var lastId = ids.length > 0 ? Math.max.apply(Math, ids) : 0;
|
var currentIdSeq = ids.length > 0 ? Math.max(...ids.map(Number)) : 0;
|
||||||
var newId = lastId + 1;
|
|
||||||
$("#selectedApiGrid").jqGrid('addRowData', newId, returnValue, "last");
|
$.each(newItems, function(index, item) {
|
||||||
});
|
var checkId = String(item.apiId);
|
||||||
|
|
||||||
|
if (!existingApiIds.has(checkId)) {
|
||||||
|
currentIdSeq++;
|
||||||
|
$("#selectedApiGrid").jqGrid('addRowData', currentIdSeq, item, "last");
|
||||||
|
|
||||||
|
existingApiIds.add(checkId);
|
||||||
|
} else {
|
||||||
|
//console.log("중복 제외됨: " + item.apiId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
alert("중복건 수를 제외한 API가 추가되었습니다.");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#btn_popup_api_group").click(function () {
|
$("#btn_popup_api_group").click(function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user