enable user reset date/time to now (#152)
* enable user reset date/time to now * addressed comments * address size of button to fit the screen * edit unit test to have build succeful * minor change
This commit is contained in:
Родитель
552db95bd8
Коммит
14ae23c068
|
@ -33,7 +33,7 @@ func Test_timeRangeTable(t *testing.T) {
|
|||
expectedEnd time.Time
|
||||
}{
|
||||
// Valid Cases
|
||||
{"2h", "", fmt.Sprintf("%v", someQueryEndTs.UTC().Unix()), false, someQueryEndTs.Add(-2 * time.Hour), someQueryEndTs},
|
||||
{"2h", "", "", false, someQueryEndTs.Add(-2 * time.Hour), someQueryEndTs},
|
||||
{"1h", "", "", false, someQueryEndTs.Add(-1 * time.Hour), someQueryEndTs},
|
||||
{"0h", "", "", false, someQueryEndTs.Add(-1 * minLookback), someQueryEndTs},
|
||||
{"1000h", "", "", false, someQueryEndTs.Add(-1 * someMaxLookBack), someQueryEndTs},
|
||||
|
@ -193,7 +193,7 @@ func Test_parseTimestampString(t *testing.T){
|
|||
assert.NotNil(t, err)
|
||||
assert.NotEqual(t, result.Format(longForm), str)
|
||||
|
||||
// edge case: str is empty
|
||||
//edge case: str is empty
|
||||
str = ""
|
||||
result, err = parseTimestampString(str)
|
||||
assert.NotNil(t, err)
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -36,9 +36,10 @@ For full license text, see LICENSE.txt file in the repo root or https://opensour
|
|||
<select name="query" id="filterquery" hidden="true"> </select>
|
||||
<!-- <br><br> -->
|
||||
|
||||
<label for="selectedEndTime">End time</label><br/>
|
||||
<label for="selectedEndTime">End Time</label><br/>
|
||||
<div>
|
||||
<input type="datetime-local" step="1" id="selectedEndTime" name="selectedEndTime" />
|
||||
<input type="button" value="Now" name="now" id="now">
|
||||
</div><br>
|
||||
|
||||
<label for="filterlookback">Look Back Range:</label><br/>
|
||||
|
|
|
@ -78,7 +78,7 @@ div#resource_container {
|
|||
|
||||
#sloopleftnav {
|
||||
height: 100%;
|
||||
width: 250px;
|
||||
width: 320px;
|
||||
padding-right: 20px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
@ -133,4 +133,15 @@ input[type="datetime-local"] {
|
|||
width: 200px;
|
||||
height: 1.3rem;
|
||||
font-size: 0.85em;
|
||||
}
|
||||
|
||||
input[type="button"] {
|
||||
width: 35px;
|
||||
height: 1.3rem;
|
||||
font-size: 0.80em;
|
||||
}
|
||||
|
||||
input[type="text"] {
|
||||
width: 245px;
|
||||
height: 1.3rem;
|
||||
}
|
|
@ -536,4 +536,13 @@ $(document).ready(function() {
|
|||
userDate.setMilliseconds(null);
|
||||
document.getElementById('selectedEndTime').value = userDate.toISOString().slice(0, -1);
|
||||
|
||||
$('#now').click(function(){
|
||||
const resetNow = new Date();
|
||||
resetNow.setMinutes(resetNow.getMinutes() - resetNow.getTimezoneOffset());
|
||||
resetNow.setMilliseconds(null);
|
||||
document.getElementById('selectedEndTime').value = resetNow.toISOString().slice(0, -1);
|
||||
sessionStorage.removeItem('selectedEndTime');
|
||||
sessionStorage.setItem('selectedEndTime', resetNow.toISOString().slice(0, -1));
|
||||
});
|
||||
|
||||
});
|
Загрузка…
Ссылка в новой задаче