-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #435 from AuScope/Release-Passive-Seismic-Datasele…
…ct-DLs-Fix Release - Passive Seismic Dataselect DLs Fix
- Loading branch information
Showing
2 changed files
with
26 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -411,10 +411,8 @@ export class DownloadPanelComponent implements OnInit { | |
* Use the rules present in the button options to determine if download button should be enabled | ||
*/ | ||
downloadButtonEnabled(): boolean { | ||
if (this.bbox || (this.bbox && this.irisDownloadListOption) || | ||
(this.polygonFilter && this.isPolygonSupportedLayer) || | ||
((this.bbox || this.polygonFilter) && this.isWCSDownloadSupported) || | ||
this.isTsgDownloadAvailable) { | ||
if (this.bbox || this.isTsgDownloadAvailable || this.irisDownloadListOption || | ||
(this.polygonFilter && (this.isPolygonSupportedLayer || this.isWCSDownloadSupported))) { | ||
return true; | ||
} | ||
return false; | ||
|
@@ -470,21 +468,13 @@ export class DownloadPanelComponent implements OnInit { | |
|
||
// Download IRIS datasets by constructing a data download URL. User can select the either Dataselect or Station | ||
} else if (this.irisDownloadListOption) { | ||
// IRIS requires a bbox be present | ||
if (!this.bbox) { | ||
alert('Cannot download. Make sure you select a bounding box.'); | ||
return; | ||
} | ||
this.downloadStarted = true; | ||
|
||
let start = (this.irisDownloadListOption.dateFrom !== null && this.irisDownloadListOption.dateFrom !== '') ? new Date(new Date(this.irisDownloadListOption.dateFrom)).toISOString().substring(0, 10) : null; | ||
let end = (this.irisDownloadListOption.dateToTo !== null && this.irisDownloadListOption.dateTo !== '') ? new Date(new Date(this.irisDownloadListOption.dateTo)).toISOString().substring(0, 10) : null; | ||
|
||
let station = this.SELECT_ALL_CODE; | ||
station = !this.irisDownloadListOption.selectedStations.includes(this.SELECT_ALL_CODE) ? this.irisDownloadListOption.selectedStations.join(",") : this.SELECT_ALL_CODE; | ||
const start = (this.irisDownloadListOption.dateFrom !== null && this.irisDownloadListOption.dateFrom !== '') ? new Date(new Date(this.irisDownloadListOption.dateFrom)).toISOString().substring(0, 10) : null; | ||
const end = (this.irisDownloadListOption.dateToTo !== null && this.irisDownloadListOption.dateTo !== '') ? new Date(new Date(this.irisDownloadListOption.dateTo)).toISOString().substring(0, 10) : null; | ||
|
||
let channel = this.SELECT_ALL_CODE; | ||
channel = !this.irisDownloadListOption.selectedChannels.includes(this.SELECT_ALL_CHANNEL) ? this.irisDownloadListOption.selectedChannels.join(",") : this.SELECT_ALL_CODE; | ||
const station = !this.irisDownloadListOption.selectedStations.includes(this.SELECT_ALL_CODE) ? this.irisDownloadListOption.selectedStations.join(",") : this.SELECT_ALL_CODE; | ||
const channel = !this.irisDownloadListOption.selectedChannels.includes(this.SELECT_ALL_CHANNEL) ? this.irisDownloadListOption.selectedChannels.join(",") : this.SELECT_ALL_CODE; | ||
|
||
if (this.irisDownloadListOption.selectedserviceType === 'Station') { | ||
observableResponse = this.downloadIrisService.downloadIRISStation(this.layer, this.bbox, station, channel, start, end); | ||
|
@@ -513,17 +503,15 @@ export class DownloadPanelComponent implements OnInit { | |
this.downloadStarted = false; | ||
if (UtilitiesService.isEmpty(err.message)) { | ||
alert('An error has occurred whilst attempting to download. Please contact [email protected]'); | ||
} else if (err.status === 413 && this.irisDownloadListOption) { | ||
alert('An error has occurred whilst attempting to download. (Request entity is too large, please reduce the size by limiting the stations, channels, or time period.) Please contact [email protected]'); | ||
} else { | ||
if (err.status === 413 && this.irisDownloadListOption) { | ||
alert('An error has occurred whilst attempting to download. (Request entity is too large, please reduce the size by limiting the stations, channels, or time period.) Please contact [email protected]'); | ||
} else { | ||
alert('There is an error, when downloading (' + this.layer.name + ') layer at location (' + | ||
'eLongitude:' + Math.floor(this.bbox.eastBoundLongitude) | ||
+ ' nLatitude: ' + Math.floor(this.bbox.northBoundLatitude) | ||
+ ' sLatitude:' + Math.floor(this.bbox.southBoundLatitude) | ||
+ ' wLongitude:' + Math.floor(this.bbox.westBoundLongitude) | ||
+ '). Detail of the error: (' + err.message + ')'); | ||
} | ||
} | ||
}); | ||
} | ||
|
@@ -791,7 +779,7 @@ export class DownloadPanelComponent implements OnInit { | |
// Update the to/from and start/end dates according to the channels selected | ||
let newStartDate = stations[0].startDate; | ||
let newEndDate = stations[0].endDate; | ||
for (let station of stations) { | ||
for (const station of stations) { | ||
newStartDate = station.startDate < newStartDate ? station.startDate : newStartDate; | ||
newEndDate = station.endDate > newEndDate ? station.endDate : newEndDate; | ||
} | ||
|