Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
VIPSWeb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VIPS
VIPSWeb
Commits
73d8d977
Commit
73d8d977
authored
7 months ago
by
Tor-Einar Skog
Browse files
Options
Downloads
Patches
Plain Diff
feat: Add progress icon
parent
56e87f39
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
fusarium/static/fusarium/js/oatFloweringModelForm.js
+19
-33
19 additions, 33 deletions
fusarium/static/fusarium/js/oatFloweringModelForm.js
fusarium/templates/fusarium/oat_flowering.html
+5
-0
5 additions, 0 deletions
fusarium/templates/fusarium/oat_flowering.html
with
24 additions
and
33 deletions
fusarium/static/fusarium/js/oatFloweringModelForm.js
+
19
−
33
View file @
73d8d977
...
...
@@ -121,7 +121,8 @@ var submitForm = function()
}
// Erase previous results
displayResultHTML
(
""
);
document
.
getElementById
(
"
oatFloweringModelResults
"
).
style
.
display
=
"
none
"
;
document
.
getElementById
(
"
progressIconRow
"
).
style
.
display
=
"
block
"
;
// Start chain of async functions
createConfig
();
...
...
@@ -137,15 +138,6 @@ const createConfig = async function(){
const
theForm
=
document
.
getElementById
(
theFormId
);
const
weatherStationId
=
theForm
.
weatherStationId
.
options
[
theForm
.
weatherStationId
.
selectedIndex
].
value
;
const
dateOfSowing
=
getDateOfSowing
();
const
endDateNormalData
=
moment
(
dateOfSowing
).
month
(
9
).
date
(
1
);
var
weatherDataUri
=
[
weatherDataBaseUri
,
"
?startDate=
"
,
dateOfSowing
.
format
(
"
YYYY-MM-DD
"
),
(
DEBUG
?
"
&today=
"
+
now
.
format
(
"
YYYY-MM-DD
"
)
:
""
),
"
&weatherStationId=
"
,
weatherStationId
//,
//"&callback=?"
].
join
(
""
);
const
normalDataRequestUri
=
LMTServicesBaseUri
+
"
rest/vips/getdata/grovfornormal?
"
+
"
elementMeasurementTypes[]=TM&timeZone=Europe/Oslo
"
+
...
...
@@ -178,7 +170,7 @@ const createConfig = async function(){
measuredData
.
sort
(
sortWeatherData
);
const
maxMeasuredDataTimestamp
=
moment
(
measuredData
[
measuredData
.
length
-
1
].
timeMeasured
);
const
mergedData
=
measuredData
.
concat
(
normalData
.
filter
((
obs
)
=>
moment
(
obs
.
timeMeasured
)
>
maxMeasuredDataTimestamp
));
console
.
info
(
mergedData
);
//
console.info(mergedData);
runModel
(
mergedData
);
};
...
...
@@ -191,7 +183,7 @@ function sortWeatherData(a,b)
* Calls the oatFlowering model in the VIPS forecasting system
* Displays data when results are returned
*/
var
runModel
=
function
(
data
)
const
runModel
=
async
function
(
data
)
{
//console.log("runModel");
var
dateOfSowing
=
getDateOfSowing
();
...
...
@@ -207,32 +199,24 @@ var runModel = function(data)
"
observations
"
:
data
}
};
const
modelResponse
=
await
fetch
(
runUri
,
{
method
:
"
POST
"
,
body
:
JSON
.
stringify
(
modelConfig
),
headers
:
{
"
Content-Type
"
:
"
application/json
"
,
}
});
//console.log(data);
var
request
=
$
.
ajax
({
type
:
"
POST
"
,
url
:
runUri
,
data
:
JSON
.
stringify
(
modelConfig
),
dataType
:
"
json
"
,
contentType
:
"
application/json; charset=utf-8
"
,
})
.
done
(
function
(
data
,
textStatus
,
jqXHR
)
{
displayResults
(
data
);
})
.
fail
(
function
(
jqXHR
,
textStatus
,
errorThrown
)
{
alert
(
"
Request failed:
"
+
errorThrown
);
})
.
always
(
function
()
{
//alert( "complete" );
})
;
if
(
modelResponse
.
status
==
200
)
{
displayResults
(
await
modelResponse
.
json
());
}
}
/**
* Analyze and display results from the OatFlowering model in VIPS
*/
var
displayResults
=
function
(
data
)
const
displayResults
=
function
(
data
)
{
// getting the dates
var
dateOfSowing
=
getDateOfSowing
();
...
...
@@ -334,8 +318,10 @@ var getRawResults = function(data)
*/
var
displayResultHTML
=
function
(
text
)
{
document
.
getElementById
(
"
oatFloweringModelResults
"
).
style
.
display
=
"
block
"
;
document
.
getElementById
(
"
oatFloweringModelResults
"
).
innerHTML
=
"
<h2>Resultater</h2>
"
+
text
;
document
.
getElementById
(
"
progressIconRow
"
).
style
.
display
=
"
none
"
;
document
.
getElementById
(
"
oatFloweringModelResults
"
).
style
.
display
=
"
block
"
;
}
/**
...
...
This diff is collapsed.
Click to expand it.
fusarium/templates/fusarium/oat_flowering.html
+
5
−
0
View file @
73d8d977
...
...
@@ -68,6 +68,11 @@
</div>
</div>
</div>
<div
class=
"row"
id=
"progressIconRow"
style=
"margin-bottom: 10px; display: none;"
>
<div
class=
"col-md-6"
>
<button
type=
"button"
class=
"btn btn-info"
style=
"margin-left: 5px;"
><i
class=
"fa fa-hourglass-half fa-lg"
></i>
Vennligst vent...
</button>
</div>
</div>
<div
id=
"oatFloweringModelResults"
class=
"alert alert-info"
role=
"alert"
style=
"width:100%; display: none;"
></div>
</div>
{% endblock %}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment