Skip to content

Request access for modules fixes #100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: ui-improvements
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions aws_access/templates/aws_access/accessRequest.html
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
awsHandleDisableMode();
updateSelectedAWSGroup();
handleAWSGroupSelectionView();
$('#max-groups-selected-warning').hide();
$('#max-aws-group-selected-warning').hide();
};

const selectAllAWSGroup = () => {
Expand Down Expand Up @@ -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 = () => {
Expand All @@ -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);
Expand All @@ -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();
}
};

Expand Down Expand Up @@ -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);
Expand All @@ -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 `<tr onclick="handleAWSGroupSelection(this)" class="(${(awsSelectedList[group] || awsDisabled)? "bg-gray-50": "hover:bg-blue-50 hover:text-blue-700"}" group="${group}" >
<td class="relative w-12 px-6 sm:w-16 sm:px-8">
Expand Down Expand Up @@ -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(""));
Expand All @@ -286,7 +289,7 @@
</div>
</div>

<div id="max-groups-selected-warning" class="hidden">
<div id="max-aws-group-selected-warning" class="hidden">
{% get_error_panel_with_message "Max number of groups selected" "Deselect some selections or Submit request to select more groups." %}
</div>

Expand Down
17 changes: 10 additions & 7 deletions gcp/templates/gcp_access/accessRequest.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
handleGCPGroupSelectionView();
};

const removeGroupSelectionSpanElem = (rightElem, leftElem) => {
const removeGcpGroupSelectionSpanElem = (rightElem, leftElem) => {
rightElem.remove();
selectGCPGroupCheckbox(leftElem, false);

Expand All @@ -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();
Expand Down Expand Up @@ -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) => {
Expand All @@ -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();
Expand Down Expand Up @@ -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 `<tr onclick="handleGCPGroupSelection(this)" class="${(gcpSelectedList[group] || gcpDisabled)? "bg-gray-50": "hover:bg-blue-50 hover:text-blue-700"}" group="${group}">
<td class="relative w-12 px-6 sm:w-16 sm:px-8">
Expand All @@ -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(""));
Expand Down
11 changes: 7 additions & 4 deletions github_access/templates/github_access/access_request_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<tr onclick="handleGithubReposelection(this)" org_name="${repo["orgName"]}" repo_name="${repo["repoName"]}" repo_id="${repo_id}" class="${(githubSelectedList[repo_id] || githubDisabled)? "bg-gray-50": "hover:bg-blue-50 hover:text-blue-700"}" >
Expand Down Expand Up @@ -233,10 +240,6 @@
$("#githubPaginationNav").addClass("hidden")
}

if(data["search_error"]) {
showNotification("failed", data["search_error"])
}

$("#githubScrollBar").scrollTop(0)

$("#selectAllGithubRepo").prop("disabled", false);
Expand Down
2 changes: 1 addition & 1 deletion github_access/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
27 changes: 14 additions & 13 deletions opsgenie_access/templates/opsgenie_access/access_request_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
opsgenieHandleDisableMode();
updateSelectedOpsgenieTeam();
handleOpsgenieTeamSelectionView();
$('#max-team-selected-warning').hide();
$('#max-opsgenie-team-selected-warning').hide();
};

const selectAllOpsgenieTeam = () => {
Expand Down Expand Up @@ -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 = () => {
Expand All @@ -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);
Expand All @@ -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();
}
};

Expand All @@ -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 `<tr onclick="handleOpsgenieTeamSelection(this)" class="${(opsgenieSelectedList[team_name] || opsgenieDisabled)? "bg-gray-50": "hover:bg-blue-50 hover:text-blue-700"}" team_name="${team_name}" >
<td id="opsgenie-checkbox-td" class="relative w-12 px-6 sm:w-16 sm:px-8">
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -272,7 +273,7 @@
</div>
</div>

<div id="max-team-selected-warning" class="hidden">
<div id="max-opsgenie-team-selected-warning" class="hidden">
{% get_error_panel_with_message "Max number of teams selected" "Deselect some selections or Submit request to select more teams." %}
</div>

Expand Down
2 changes: 1 addition & 1 deletion opsgenie_access/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
27 changes: 14 additions & 13 deletions ssh/templates/ssh/access_request_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
SSHMachineHandleDisableMode();
updateSelectedSSHMachine();
handleSSHMachineSelectionView();
$('#max-machines-selected-warning').hide();
$('#max-ssh-machine-selected-warning').hide();
};

const selectAllSSHMachines = () => {
Expand Down Expand Up @@ -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 = () => {
Expand All @@ -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);
Expand All @@ -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();
}
};

Expand Down Expand Up @@ -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 `<tr onclick="handleSSHMachineSelection(this)" class="${(sshSelectedList[machine.ip] || sshDisabled) ? "bg-gray-50": "hover:bg-blue-50 hover:text-blue-700"}" machine_name="${machine.name}" machine_ip="${ machine.ip }" >
<td id="checkbox-td" class="relative w-12 px-6 sm:w-16 sm:px-8">
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -295,7 +296,7 @@
</div>
</div>

<div id="max-machines-selected-warning" class="hidden">
<div id="max-ssh-machine-selected-warning" class="hidden">
{% get_error_panel_with_message "Max number of ssh machines selected" "Deselect some selections or Submit request to select more machines." %}
</div>

Expand Down
2 changes: 1 addition & 1 deletion ssh/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down