Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
GeoInt_SIDT
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mario Chirinos Colunga
GeoInt_SIDT
Commits
e72de1be
Commit
e72de1be
authored
May 28, 2018
by
Renán Sosa Guillen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
productList view
parent
ae16b9ef
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
27 deletions
+31
-27
dataRetrieval.js
catalog/static/js/dataRetrieval.js
+1
-5
views.py
catalog/views.py
+30
-22
No files found.
catalog/static/js/dataRetrieval.js
View file @
e72de1be
...
@@ -180,7 +180,7 @@ $(document).ready(function () {
...
@@ -180,7 +180,7 @@ $(document).ready(function () {
}
}
});
});
var
productListGlobe
=
[];
// this array represent DB where products will be stor
ag
ed
var
productListGlobe
=
[];
// this array represent DB where products will be stored
var
PRODUCT_IN_LIST
=
false
;
var
PRODUCT_IN_LIST
=
false
;
// function for making POST request to productList in view.py
// function for making POST request to productList in view.py
...
@@ -258,7 +258,3 @@ $(document).ready(function () {
...
@@ -258,7 +258,3 @@ $(document).ready(function () {
event
.
preventDefault
();
event
.
preventDefault
();
});
});
});
});
$
(
"li.hover-me"
).
on
(
'mouseenter'
,
'li'
,
function
()
{
console
.
log
(
"enter!"
);
});
catalog/views.py
View file @
e72de1be
...
@@ -38,43 +38,51 @@ def productList(request):
...
@@ -38,43 +38,51 @@ def productList(request):
"""
"""
View function for home page of site.
View function for home page of site.
"""
"""
req
=
dict
(
request
.
POST
)
req
.
pop
(
'csrfmiddlewaretoken'
,
None
)
# s = APISentinel()
# s = APISentinel()
# s.getProducts()
r2
=
dict
(
request
.
POST
)
city_name
=
req
[
'city'
][
0
]
r2
.
pop
(
'csrfmiddlewaretoken'
,
None
)
process
=
req
[
'platform'
][
0
]
# print("R2: ", r2.keys());
area
=
req
[
'polygon'
][
0
]
# url = 'https://api.daac.asf.alaska.edu/services/search/param?'+urlencode(r2, 'utf-8')+"&output=JSON"
init_date
=
req
[
'start'
][
0
][:
10
]
end_date
=
req
[
'end'
][
0
][:
10
]
cloud_percentage
=
req
[
'cloudPercentage'
][
0
]
# response = requests.get(url)
# json = response.json()
## ----- aqui llamada a api sentinel
## ----------- aqui llamada a api sentinel -----------
## ----- antes consultar en DB si no se tiene ya el producto
## ---------- antes consultad en DB si no se tiene ya el producto ------
# sentinel_result = s.getProducts(area, init_date, end_date, cloud_percentage)
## ----------- aqui llamada a api sentinel -----------
## simulation of 6-digit random id, this will be obtain from sentinel(?)
## simulation of 6-digit random id, this will be obtain from sentinel(?)
random_id
=
''
.
join
([
"
%
s"
%
random
.
randint
(
0
,
9
)
for
i
in
range
(
0
,
6
)])
random_id
=
''
.
join
([
"
%
s"
%
random
.
randint
(
0
,
9
)
for
i
in
range
(
0
,
6
)])
## path from image preview storage location
img_preview
=
'/static/images/sat_preview/sat_test.jpg'
item_data
=
{
item_data
=
{
'id'
:
random_id
,
'id'
:
random_id
,
'img'
:
'/static/images/sat_preview/sat_test.jpg'
,
'img'
:
img_preview
,
'city_name'
:
r2
[
'city'
][
0
],
'city_name'
:
city_name
,
'process'
:
r2
[
'platform'
][
0
],
'process'
:
process
,
'start_date'
:
r2
[
'start'
][
0
][:
10
],
'start_date'
:
init_date
,
'end_date'
:
r2
[
'end'
][
0
][:
10
],
'end_date'
:
end_date
,
'polygon'
:
r2
[
'polygon'
][
0
],
'cloud_percentage'
:
cloud_percentage
'cloud_percentage'
:
r2
[
'cloudPercentage'
][
0
]
}
}
# response = requests.get(url)
return
JsonResponse
(
item_data
);
# json = response.json()
# r2 = dict(request.POST)
# r2.pop('csrfmiddlewaretoken', None)
# print("R2: ", r2.keys());
# url = 'https://api.daac.asf.alaska.edu/services/search/param?'+urlencode(r2, 'utf-8')+"&output=JSON"
# response = requests.get(url)
# json = response.json()
# return render(request, 'productList.html', {}) #"catalog":json[0]})
# return render(request, 'productList.html', {}) #"catalog":json[0]})
# return HttpResponse(json.dumps(item_data, ensure_ascii=True), content_type="application/json")
# return HttpResponse(json.dumps(item_data, ensure_ascii=True), content_type="application/json")
# return render(request, 'productList.html', {'item_data': item_data})
# return render(request, 'productList.html', {'item_data': item_data})
return
JsonResponse
(
item_data
);
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
class
SearchSubmitView
(
View
):
class
SearchSubmitView
(
View
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment