Skip to content

Commit

Permalink
Post review fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Nikolai Rozanov <nickolay.rozanov@gmail.com>
  • Loading branch information
nrozanov committed Apr 9, 2024
1 parent bf0bd38 commit 8e52a0c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
9 changes: 4 additions & 5 deletions flexmeasures/ui/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@
{% endblock %}
</head>

<script>
// Define picker as a global variable
var picker;
</script>

<body>

{% block body %}
Expand Down Expand Up @@ -196,6 +191,10 @@
{% block sensorChartSetup %}

<!-- Render Charts -->
<script>
// Define picker as a global variable so that other code on the page can access it, e.g. get the times
var picker;
</script>
<script type="module" type="text/javascript">

// Import local js (the FM version is used for cache-busting, causing the browser to fetch the updated version from the server)
Expand Down
8 changes: 4 additions & 4 deletions flexmeasures/ui/templates/crud/asset.html
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ <h3>Edit {{ asset.name }}</h3>
</div>
<div id="sensorchart" class="card" style="width: 100%;"></div>
<div class="row">
<div class="copy-url" title="Click to copy URL to clipboard">
<div class="copy-url" title="Click to copy the URL to the current time range to clipboard.">
<script>
function toIsoString(date) {
var tzo = -date.getTimezoneOffset(),
Expand All @@ -175,8 +175,8 @@ <h3>Edit {{ asset.name }}</h3>
}
const dummy = document.createElement('p');

var startDate = toIsoString(picker.getStartDate().toJSDate());
var endDate = toIsoString(picker.getEndDate().toJSDate());
var startDate = encodeURIComponent(toIsoString(picker.getStartDate().toJSDate()));
var endDate = encodeURIComponent(toIsoString(picker.getEndDate().toJSDate()));
var base_url = window.location.href.split("?")[0];
dummy.textContent = `${base_url}?start_time=${startDate}&end_time=${endDate}`
document.body.appendChild(dummy);
Expand All @@ -199,7 +199,7 @@ <h3>Edit {{ asset.name }}</h3>
<a href="#" onclick="copyUrl(event)" style="display: block; text-align: center;">
<i class="fa fa-link"></i>
</a>
<div id="message" style="display: none; text-align: center;">URL to this view has been copied to your clipboard.</div>
<div id="message" style="display: none; text-align: center;">The URL to the time range currently shown has been copied to your clipboard.</div>
</div>
</div>
<div class="sensors-asset card">
Expand Down

0 comments on commit 8e52a0c

Please sign in to comment.