mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-17 23:14:11 +02:00
Add url logic to domain requests and domain table
This commit is contained in:
parent
8081e9252f
commit
2c4c9ddbce
3 changed files with 31 additions and 2 deletions
|
@ -1183,8 +1183,19 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||||
* @param {*} portfolio - the portfolio id
|
* @param {*} portfolio - the portfolio id
|
||||||
*/
|
*/
|
||||||
function loadDomains(page, sortBy = currentSortBy, order = currentOrder, scroll = scrollToTable, status = currentStatus, searchTerm = currentSearchTerm, portfolio = portfolioValue) {
|
function loadDomains(page, sortBy = currentSortBy, order = currentOrder, scroll = scrollToTable, status = currentStatus, searchTerm = currentSearchTerm, portfolio = portfolioValue) {
|
||||||
|
// fetch json of page of domais, given params
|
||||||
|
let baseUrl = document.getElementById("get_domains_json_url");
|
||||||
|
if (!baseUrl) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let baseUrlValue = baseUrl.value;
|
||||||
|
if (!baseUrlValue) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// fetch json of page of domains, given params
|
// fetch json of page of domains, given params
|
||||||
let url = `/get-domains-json/?page=${page}&sort_by=${sortBy}&order=${order}&status=${status}&search_term=${searchTerm}`
|
let url = `${baseUrlValue}?page=${page}&sort_by=${sortBy}&order=${order}&status=${status}&search_term=${searchTerm}`
|
||||||
if (portfolio)
|
if (portfolio)
|
||||||
url += `&portfolio=${portfolio}`
|
url += `&portfolio=${portfolio}`
|
||||||
|
|
||||||
|
@ -1524,7 +1535,17 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||||
*/
|
*/
|
||||||
function loadDomainRequests(page, sortBy = currentSortBy, order = currentOrder, scroll = scrollToTable, searchTerm = currentSearchTerm) {
|
function loadDomainRequests(page, sortBy = currentSortBy, order = currentOrder, scroll = scrollToTable, searchTerm = currentSearchTerm) {
|
||||||
// fetch json of page of domain requests, given params
|
// fetch json of page of domain requests, given params
|
||||||
fetch(`/get-domain-requests-json/?page=${page}&sort_by=${sortBy}&order=${order}&search_term=${searchTerm}`)
|
let baseUrl = document.getElementById("get_domain_requests_json_url");
|
||||||
|
if (!baseUrl) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let baseUrlValue = baseUrl.value;
|
||||||
|
if (!baseUrlValue) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
fetch(`${baseUrlValue}?page=${page}&sort_by=${sortBy}&order=${order}&search_term=${searchTerm}`)
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
if (data.error) {
|
if (data.error) {
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
|
||||||
|
{% comment %} Stores the json endpoint in a url for easier access {% endcomment %}
|
||||||
|
{% url 'get_domain_requests_json' as url %}
|
||||||
|
<input id="get_domain_requests_json_url" class="display-none" value="{{url}}" />
|
||||||
<section class="section--outlined domain-requests" id="domain-requests">
|
<section class="section--outlined domain-requests" id="domain-requests">
|
||||||
<div class="grid-row">
|
<div class="grid-row">
|
||||||
{% if not has_domain_requests_portfolio_permission %}
|
{% if not has_domain_requests_portfolio_permission %}
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{% comment %} Stores the json endpoint in a url for easier access {% endcomment %}
|
||||||
|
{% url 'get_domains_json' as url %}
|
||||||
|
<input id="get_domains_json_url" class="display-none" value="{{url}}" />
|
||||||
<section class="section--outlined domains{% if not has_domains_portfolio_permission %} margin-top-0{% endif %}" id="domains">
|
<section class="section--outlined domains{% if not has_domains_portfolio_permission %} margin-top-0{% endif %}" id="domains">
|
||||||
<div class="section--outlined__header margin-bottom-3 {% if not has_domains_portfolio_permission %} section--outlined__header--no-portfolio justify-content-space-between{% else %} grid-row{% endif %}">
|
<div class="section--outlined__header margin-bottom-3 {% if not has_domains_portfolio_permission %} section--outlined__header--no-portfolio justify-content-space-between{% else %} grid-row{% endif %}">
|
||||||
{% if not has_domains_portfolio_permission %}
|
{% if not has_domains_portfolio_permission %}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue