diff --git a/aws_access/templates/aws_access/accessRequest.html b/aws_access/templates/aws_access/accessRequest.html
index a9dc9c0..820cb2c 100644
--- a/aws_access/templates/aws_access/accessRequest.html
+++ b/aws_access/templates/aws_access/accessRequest.html
@@ -103,7 +103,7 @@
awsHandleDisableMode();
updateSelectedAWSGroup();
handleAWSGroupSelectionView();
- $('#max-groups-selected-warning').hide();
+ $('#max-aws-group-selected-warning').hide();
};
const selectAllAWSGroup = () => {
@@ -144,7 +144,7 @@
removeGroupSelectionSpanElem(rightElem, $("#aws-group-table").find(`tr[group="${$(rightElem).attr('group')}"]`));
}
updateSelectedAWSGroup();
- $('#max-groups-selected-warning').hide();
+ $('#max-aws-group-selected-warning').hide();
};
const findAWSSelectedListLength = () => {
@@ -159,7 +159,7 @@
if(awsDisabled) return;
if(!$(elem).find('input').prop('checked')) {
if(findAWSSelectedListLength() === AWS_GROUP_SELECTION_LIMIT) {
- $('#max-groups-selected-warning').show();
+ $('#max-aws-group-selected-warning').show();
return;
}
addAWSGroupSelection(elem);
@@ -168,9 +168,9 @@
}
updateSelectedAWSGroup();
if(findAWSSelectedListLength() === AWS_GROUP_SELECTION_LIMIT) {
- $('#max-groups-selected-warning').show();
+ $('#max-aws-group-selected-warning').show();
} else {
- $('#max-groups-selected-warning').hide();
+ $('#max-aws-group-selected-warning').hide();
}
};
@@ -222,7 +222,7 @@
error: function (XMLHttpRequest, textStatus, errorThrown) {
if(XMLHttpRequest.responseJSON) {
const msg = XMLHttpRequest.responseJSON;
- showNotificiation("failed", msg["error"]);
+ showNotification("failed", msg["error"]);
}
$('#awsAccount').prop("disabled",false);
$('#awsSearch').prop("disabled", false);
@@ -231,6 +231,12 @@
}).done(function(data, statusText, xhr){
$("#aws-group-table").empty();
+ if(data["search_error"]) {
+ showNotification("failed", data["search_error"], "No exact match found");
+ }
+
+ if(data["AWSGroups"] && data["AWSGroups"].length === 0) return;
+
let rows = $.map(data["AWSGroups"], function(group, idx){
return `
@@ -260,9 +266,6 @@
$("#awsPaginationNav").addClass("hidden");
}
- if(data["search_error"]) {
- showNotification("failed", data["search_error"], "No exact match found");
- }
$("#awsGroupsScrollBar").scrollTop(0)
$('#aws-group-table').append(rows.join(""));
@@ -286,7 +289,7 @@
-
+
{% get_error_panel_with_message "Max number of groups selected" "Deselect some selections or Submit request to select more groups." %}
diff --git a/gcp/templates/gcp_access/accessRequest.html b/gcp/templates/gcp_access/accessRequest.html
index f0cbaeb..c439749 100644
--- a/gcp/templates/gcp_access/accessRequest.html
+++ b/gcp/templates/gcp_access/accessRequest.html
@@ -82,7 +82,7 @@
handleGCPGroupSelectionView();
};
- const removeGroupSelectionSpanElem = (rightElem, leftElem) => {
+ const removeGcpGroupSelectionSpanElem = (rightElem, leftElem) => {
rightElem.remove();
selectGCPGroupCheckbox(leftElem, false);
@@ -99,7 +99,7 @@
$(groups[iter]).remove();
$("#selectAllGCPGroup").prop("checked", false);
} else {
- removeGroupSelectionSpanElem(groups[iter], $("#gcp-group-table").find(`tr[group="${$(groups[iter]).attr('group')}"]`));
+ removeGcpGroupSelectionSpanElem(groups[iter], $("#gcp-group-table").find(`tr[group="${$(groups[iter]).attr('group')}"]`));
}
}
gcpHandleDisableMode();
@@ -131,7 +131,7 @@
const removeGCPGroupSelection = (elem) => {
$("#selectAllGCPGroup").prop("checked", false);
- removeGroupSelectionSpanElem($("#gcp-group-selection-table").find(`tr[group="${$(elem).attr('group')}"]`),elem);
+ removeGcpGroupSelectionSpanElem($("#gcp-group-selection-table").find(`tr[group="${$(elem).attr('group')}"]`),elem);
};
const removeGCPGroupSelectionUI = (elem) => {
@@ -143,7 +143,7 @@
$(rightElem).remove();
handleGCPGroupSelectionView();
} else {
- removeGroupSelectionSpanElem(rightElem, $("#gcp-group-table").find(`tr[group="${$(rightElem).attr('group')}"]`));
+ removeGcpGroupSelectionSpanElem(rightElem, $("#gcp-group-table").find(`tr[group="${$(rightElem).attr('group')}"]`));
}
updateSelectedGCPGroup();
$('#max-gcp-group-selected-warning').hide();
@@ -232,6 +232,12 @@
}
}).done(function(data, statusText, xhr){
$("#gcp-group-table").empty();
+ if(data["search_error"]) {
+ showNotification("failed", data["search_error"], "No exact match found");
+ }
+
+ if(data["gcp_groups"] && data["gcp_groups"].length === 0) return;
+
let rows = $.map(data["gcp_groups"], function(group, idx){
return `
@@ -257,9 +263,6 @@
$("#gcp_prev_page").attr("onclick", `gcpGroupPageChange('None')`);
}
- if(data["search_error"]) {
- showNotification("failed", data["search_error"], "No exact match found");
- }
$("#gcpGroupsScrollBar").scrollTop(0);
$('#gcp-group-table').append(rows.join(""));
diff --git a/github_access/templates/github_access/access_request_form.html b/github_access/templates/github_access/access_request_form.html
index 7fb4948..2aeec8b 100644
--- a/github_access/templates/github_access/access_request_form.html
+++ b/github_access/templates/github_access/access_request_form.html
@@ -201,6 +201,13 @@
}
}).done(function(data, statusText, xhr){
$("#github-repo-table tr").remove();
+
+ if(data["search_error"]) {
+ showNotification("failed", data["search_error"])
+ }
+
+ if(data["githubRepoList"] && data["githubRepoList"].length === 0) return;
+
let rows = data["githubRepoList"].map(function(repo, idx){
const repo_id = repo["orgName"]+"/"+repo["repoName"]
return ` |
@@ -233,10 +240,6 @@
$("#githubPaginationNav").addClass("hidden")
}
- if(data["search_error"]) {
- showNotification("failed", data["search_error"])
- }
-
$("#githubScrollBar").scrollTop(0)
$("#selectAllGithubRepo").prop("disabled", false);
diff --git a/github_access/views.py b/github_access/views.py
index a27ba29..112002f 100644
--- a/github_access/views.py
+++ b/github_access/views.py
@@ -25,7 +25,7 @@ def get_github_repos(request):
if not selected_repos:
response["githubRepoList"] = all_repos
response["search_error"] = ("Please try adjusting your search",
- "to find what you're looking for.")
+ " to find what you're looking for.")
return response
except Exception:
diff --git a/opsgenie_access/templates/opsgenie_access/access_request_form.html b/opsgenie_access/templates/opsgenie_access/access_request_form.html
index 99e3a5b..addfb3e 100644
--- a/opsgenie_access/templates/opsgenie_access/access_request_form.html
+++ b/opsgenie_access/templates/opsgenie_access/access_request_form.html
@@ -102,7 +102,7 @@
opsgenieHandleDisableMode();
updateSelectedOpsgenieTeam();
handleOpsgenieTeamSelectionView();
- $('#max-team-selected-warning').hide();
+ $('#max-opsgenie-team-selected-warning').hide();
};
const selectAllOpsgenieTeam = () => {
@@ -143,7 +143,7 @@
removeOpsgenieTeamSelectionSpanElem(rightElem, $("#opsgenie-team-table").find(`tr[team_name="${$(rightElem).attr('team_name')}"]`));
}
updateSelectedOpsgenieTeam();
- $('#max-team-selected-warning').hide();
+ $('#max-opsgenie-team-selected-warning').hide();
};
const findOpsgenieSelectedListLength = () => {
@@ -158,7 +158,7 @@
if(opsgenieDisabled) return;
if(!$(elem).find('input').prop('checked')) {
if(findOpsgenieSelectedListLength() === OPSGENIE_TEAM_SELECTION_LIMIT) {
- $('#max-team-selected-warning').show();
+ $('#max-opsgenie-team-selected-warning').show();
return;
}
addOpsgenieTeamSelection(elem);
@@ -167,9 +167,9 @@
}
updateSelectedOpsgenieTeam();
if(findOpsgenieSelectedListLength() === OPSGENIE_TEAM_SELECTION_LIMIT) {
- $('#max-team-selected-warning').show();
+ $('#max-opsgenie-team-selected-warning').show();
} else {
- $('#max-team-selected-warning').hide();
+ $('#max-opsgenie-team-selected-warning').hide();
}
};
@@ -191,11 +191,17 @@
data: {"search": search, "page": page},
error: function (XMLHttpRequest, textStatus, errorThrown) {
const msg = XMLHttpRequest.responseJSON;
- alert(msg["error"]);
- showNotificiation("failed", msg["error"]);
+ showNotification("failed", msg["error"]);
}
}).done(function(data, statusText, xhr){
$("#opsgenie-team-table tr").remove();
+
+ if(data["search_error"]) {
+ showNotification("failed", data["search_error"])
+ }
+
+ if(data["teamsList"] && data["teamsList"].length === 0) return;
+
let rows = data["teamsList"].map(function(team_name, idx){
return `
@@ -227,11 +233,6 @@
$("#opsgeniePaginationNav").addClass("hidden")
}
- if(data["search_error"]) {
- alert(data["search_error"])
- showNotificiation("failed", data["search_error"])
- }
-
$("#opsGenieTeamsScrollBar").scrollTop(0)
$("#selectAllOpsgenieTeam").prop("disabled", false)
$("#opsgeniesearch").prop("disabled", false)
@@ -272,7 +273,7 @@
-
+
{% get_error_panel_with_message "Max number of teams selected" "Deselect some selections or Submit request to select more teams." %}
diff --git a/opsgenie_access/views.py b/opsgenie_access/views.py
index 216c7ad..c151bba 100644
--- a/opsgenie_access/views.py
+++ b/opsgenie_access/views.py
@@ -31,7 +31,7 @@ def get_opsgenie_team(request):
if not teams:
response["teamsList"] = all_teams
response["search_error"] = ("Please try adjusting your search",
- "to find what you're looking for.")
+ " to find what you're looking for.")
return response
except Exception:
diff --git a/ssh/templates/ssh/access_request_form.html b/ssh/templates/ssh/access_request_form.html
index 224c9eb..a334d15 100644
--- a/ssh/templates/ssh/access_request_form.html
+++ b/ssh/templates/ssh/access_request_form.html
@@ -102,7 +102,7 @@
SSHMachineHandleDisableMode();
updateSelectedSSHMachine();
handleSSHMachineSelectionView();
- $('#max-machines-selected-warning').hide();
+ $('#max-ssh-machine-selected-warning').hide();
};
const selectAllSSHMachines = () => {
@@ -144,7 +144,7 @@
removeSSHMachineSelectionSpanElem(rightElem, $("#ssh-machine-table").find(`tr[machine_ip="${$(rightElem).attr('machine_ip')}"]`));
}
updateSelectedSSHMachine();
- $('#max-machines-selected-warning').hide();
+ $('#max-ssh-machine-selected-warning').hide();
};
const findSshSelectedListLength = () => {
@@ -159,7 +159,7 @@
if(sshDisabled) return;
if(!$(elem).find('input').prop('checked')) {
if(findSshSelectedListLength() === SSH_MACHINE_SELECTION_LIMIT) {
- $('#max-machines-selected-warning').show();
+ $('#max-ssh-machine-selected-warning').show();
return;
}
addSSHMachineSelection(elem);
@@ -168,9 +168,9 @@
}
updateSelectedSSHMachine();
if(findSshSelectedListLength() === SSH_MACHINE_SELECTION_LIMIT) {
- $('#max-machines-selected-warning').show();
+ $('#max-ssh-machine-selected-warning').show();
} else {
- $('#max-machines-selected-warning').hide();
+ $('#max-ssh-machine-selected-warning').hide();
}
};
@@ -206,11 +206,17 @@
data: {"search": search, "page": page},
error: function (XMLHttpRequest, textStatus, errorThrown) {
const msg = XMLHttpRequest.responseJSON;
- alert(msg["error"]);
- showNotificiation("failed", msg["error"]);
+ showNotification("failed", msg["error"]);
}
}).done(function(data, statusText, xhr){
$("#ssh-machine-table tr").remove();
+
+ if(data["search_error"]) {
+ showNotification("failed", data["search_error"])
+ }
+
+ if(data["machineList"] && data["machineList"].length === 0) return;
+
let rows = data["machineList"].map(function(machine){
return `
@@ -242,11 +248,6 @@
$("#sshPaginationNav").addClass("hidden")
}
- if(data["search_error"]) {
- alert(data["search_error"])
- showNotificiation("failed", data["search_error"])
- }
-
$("#sshGroupsScrollBar").scrollTop(0)
$("#selectAllSSHMachine").prop("disabled", false);
$("#sshSearch").prop("disabled", false);
@@ -295,7 +296,7 @@
-
+
{% get_error_panel_with_message "Max number of ssh machines selected" "Deselect some selections or Submit request to select more machines." %}
diff --git a/ssh/views.py b/ssh/views.py
index 32fe360..e6f71c2 100644
--- a/ssh/views.py
+++ b/ssh/views.py
@@ -34,7 +34,7 @@ def get_ssh_machines(request):
if not machine_list:
response["machineList"] = all_machines
response["search_error"] = ("Please try adjusting your search",
- "to find what you're looking for.")
+ " to find what you're looking for.")
return response
| | |