Skip to content

Commit

Permalink
reword time periods None & Infinity (#372)
Browse files Browse the repository at this point in the history
  • Loading branch information
boogheta committed Jul 7, 2021
1 parent fdc9f61 commit 8fe1d2f
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion hyphe_backend/lib/webarchives.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

ARCHIVES_OPTIONS = {
"": {
"label": "Disabled",
"label": "Live Web",
"description": "crawl the live web, not any kind of web archive"
},
"web.archive.org": {
Expand Down
3 changes: 1 addition & 2 deletions hyphe_frontend/app/partials/webentitystartpagesmodal.html
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,7 @@ <h3 class="md-title" md-colors="{'color':'default-warn'}">
</div>

<div style="text-align:center; margin-top: 20px;">
<small ng-show="ed_webarchive_daysrange_choice !== 'infinity'"><em>{{ webarchives_mindate }} &#x2794; {{ webarchives_maxdate }}</em></small>
<b ng-show="ed_webarchive_daysrange_choice === 'infinity'"><em>&infin;</em></b>
<small><em>{{ webarchives_mindate }} &#x2794; {{ webarchives_maxdate }}</em></small>
</div>
</div>
</div>
Expand Down
8 changes: 4 additions & 4 deletions hyphe_frontend/app/views/prepareCrawls.js
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ angular.module('hyphe.preparecrawlsController', [])
$scope.webarchives_options = webarchives_options

$scope.webarchives_periods = {
0: "None",
0: "Only that date",
1: "a day",
3: "3 days",
7: "a week",
Expand All @@ -687,7 +687,7 @@ angular.module('hyphe.preparecrawlsController', [])
}

if ($scope.ed_webarchive_daysrange_custom === undefined || $scope.ed_webarchive_daysrange_choice === undefined) {
if ($scope.webentity.webarchives.days_range === $scope.infinityRange) {
if ($scope.webentity.webarchives.days_range === $scope.infinityRange || $scope.webentity.webarchives.days_range === 'infinity') {
$scope.ed_webarchive_daysrange_choice = 'infinity'
$scope.ed_webarchive_daysrange_custom = $scope.infinityRange;
} else {
Expand Down Expand Up @@ -727,9 +727,9 @@ angular.module('hyphe.preparecrawlsController', [])
return
}
dat.setDate(dat.getDate() - $scope.webentity.webarchives.days_range / 2)
$scope.webarchives_mindate = dat.toISOString().slice(0, 10)
$scope.webarchives_mindate = ($scope.ed_webarchive_daysrange_choice === 'infinity' ? $scope.min_allowed_webarchives_date : dat).toISOString().slice(0, 10)
dat.setDate(dat.getDate() + $scope.webentity.webarchives.days_range)
$scope.webarchives_maxdate = dat.toISOString().slice(0, 10)
$scope.webarchives_maxdate = ($scope.ed_webarchive_daysrange_choice === 'infinity' ? $scope.max_allowed_webarchives_date : dat).toISOString().slice(0, 10)
} catch(e) {
$scope.date_error = "This is not a valid date, the format should be YYYY-MM-DD."
}
Expand Down
3 changes: 1 addition & 2 deletions hyphe_frontend/app/views/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,7 @@ <h3 style="margin:0px">CRAWL WEB ARCHIVES (experimental)</h3>
</div>

<div style="text-align:center; margin-top: 10px">
<small ng-show="ed_webarchive_daysrange_choice !== 'infinity'"<em>{{ webarchives_mindate }} &#x2794; {{ webarchives_maxdate }}</em></small>
<b ng-show="ed_webarchive_daysrange_choice === 'infinity'"><em>&infin;</em></b>
<small><em>{{ webarchives_mindate }} &#x2794; {{ webarchives_maxdate }}</em></small>
</div>
</div>
</dl>
Expand Down
6 changes: 3 additions & 3 deletions hyphe_frontend/app/views/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ angular.module('hyphe.settingsController', [])
}

$scope.webarchives_periods = {
0: "None",
0: "Only that date",
1: "a day",
3: "3 days",
7: "a week",
Expand Down Expand Up @@ -123,9 +123,9 @@ angular.module('hyphe.settingsController', [])
return
}
dat.setDate(dat.getDate() - $scope.ed_webarchive_daysrange)
$scope.webarchives_mindate = dat.toISOString().slice(0, 10)
$scope.webarchives_mindate = ($scope.ed_webarchive_daysrange_choice === 'infinity' ? $scope.min_allowed_webarchives_date : dat).toISOString().slice(0, 10)
dat.setDate(dat.getDate() + 2 * $scope.ed_webarchive_daysrange)
$scope.webarchives_maxdate = dat.toISOString().slice(0, 10)
$scope.webarchives_maxdate = ($scope.ed_webarchive_daysrange_choice === 'infinity' ? $scope.max_allowed_webarchives_date : dat).toISOString().slice(0, 10)
} catch(e) {
$scope.date_error = "This is not a valid date, the format should be YYYY-MM-DD."
}
Expand Down

0 comments on commit 8fe1d2f

Please sign in to comment.