Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release - Passive Seismic Dataselect DLs Fix #435

Merged
merged 1 commit into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions src/app/menupanel/common/downloadpanel/downloadpanel.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,12 @@ <h5><span class="badge badge-secondary d-inline ml-5 line-height-1-8">South: {{

<!-- Draw bounds/polygon -->
<div class="d-inline-block">
<button *ngIf="!bbox && (!irisDownloadListOption || (irisDownloadListOption && irisDownloadListOption.displayBbox)) " type="button" title="Draw bounding box"
class="btn btn-primary btn-xs" [disabled]="downloadStarted || download4pStarted || download4PolygonKMLStarted || drawBoundsStarted || drawPolygonStarted" (click)="drawBounds()">
<button *ngIf="!bbox" type="button" class="btn btn-primary btn-xs" (click)="drawBounds()"
[title]="irisDownloadListOption?.selectedserviceType === 'Dataselect' ? 'Draw bounding box' : 'Bounding box disabled for Dataselect'"
[disabled]="downloadStarted || download4pStarted || download4PolygonKMLStarted || drawBoundsStarted || drawPolygonStarted || irisDownloadListOption?.selectedserviceType === 'Dataselect'">
<i class="fa fa-edit"></i>&nbsp;Draw Bounds
</button>
<button *ngIf="bbox && (!irisDownloadListOption || (irisDownloadListOption && irisDownloadListOption.displayBbox))" type="button" title="Remove bounds"
<button *ngIf="bbox" type="button" title="Remove bounds"
class="btn btn-danger btn-xs" [disabled]="downloadStarted || download4pStarted || download4PolygonKMLStarted || drawBoundsStarted || drawPolygonStarted" (click)="clearBounds()">
<i class="fa fa-refresh fa-sm"></i>&nbsp;Clear Bounds
</button>
Expand All @@ -90,7 +91,8 @@ <h5><span class="badge badge-secondary d-inline ml-5 line-height-1-8">South: {{

<!-- Download options for bounds, polygon or all (if irisDownloadListOption) -->
<div *ngIf="downloadButtonEnabled()" class="d-inline-block" ngbDropdown>
<button type="button" class="btn btn-primary btn-xs" [disabled]="drawBoundsStarted || downloadStarted || download4pStarted || download4PolygonKMLStarted" title="Download data" ngbDropdownToggle>
<button type="button" class="btn btn-primary btn-xs" title="Download data" ngbDropdownToggle
[disabled]="drawBoundsStarted || downloadStarted || download4pStarted || download4PolygonKMLStarted">
<i *ngIf="downloadStarted || download4pStarted || download4PolygonKMLStarted" class="fa fa-spinner fa-spin fa-fw"></i>
<i *ngIf="!downloadStarted && !download4pStarted && !download4PolygonKML" class="fa fa-cloud-download"></i>&nbsp;Download
</button>
Expand All @@ -113,18 +115,18 @@ <h5><span class="badge badge-secondary d-inline ml-5 line-height-1-8">South: {{

<div [hidden]='!isWCSDownloadSupported' class="form-group">
<div *ngIf="!bbox&&drawBoundsStarted===false">
<div class="alert alert-warning fade show">
<i class="ti-bell float-left"></i>
<p>Select an area to download <span *ngIf="downloadSizeLimit > 0">not exceeding {{downloadSizeLimit}} m<sup>2</sup>.</span></p>
</div>
<div class="alert alert-warning fade show">
<i class="ti-bell float-left"></i>
<p>Select an area to download <span *ngIf="downloadSizeLimit > 0">not exceeding {{downloadSizeLimit}} m<sup>2</sup>.</span></p>
</div>
</div>
<div *ngIf="drawBoundsStarted===true">
<div class="alert alert-primary fade show">
<i class="ti-bell float-left"></i>
<p>Click on the map to draw bounding box.</p>
</div>
<div class="alert alert-primary fade show">
<i class="ti-bell float-left"></i>
<p>Click on the map to draw bounding box.</p>
</div>
</div>
<div *ngIf="bbox && (!irisDownloadListOption || (irisDownloadListOption && irisDownloadListOption.displayBbox))" class="container">
<div *ngIf="bbox" class="container">
<div class="standard-title row">
<h4><span>Bounding Box</span></h4>
</div>
Expand Down Expand Up @@ -166,9 +168,9 @@ <h5><span class="badge badge-secondary d-inline ml-5 line-height-1-8">South: {{b

<!-- Bounding box download -->
<div style="display:flex;">
<button *ngIf="!bbox && (!irisDownloadListOption || (irisDownloadListOption && irisDownloadListOption.displayBbox)) " type="button" title="Draw bounding box"
<button *ngIf="!bbox" type="button" title="Draw bounding box"
class="btn btn-primary btn-xs" [disabled]="downloadStarted || drawBoundsStarted" (click)="drawBounds()"><i class="fa fa-edit"></i>&nbsp;Draw Bounds</button>
<button *ngIf="bbox && (!irisDownloadListOption || (irisDownloadListOption && irisDownloadListOption.displayBbox))" type="button" title="Remove bounds"
<button *ngIf="bbox" type="button" title="Remove bounds"
class="btn btn-danger btn-xs" [disabled]="downloadStarted" (click)="clearBounds()"><i class="fa fa-refresh"></i>&nbsp;Clear Bounds</button>
<button type="button" class="btn btn-primary btn-xs" style="margin-left:auto;width:9rem;" [disabled]="!bbox || downloadStarted" title="Download data for bounding box" (click)="download()">
<i *ngIf="downloadStarted" class="fa fa-spinner fa-spin fa-fw"></i><i *ngIf="!downloadStarted" class="fa fa-cloud-download"></i>&nbsp;Download
Expand Down
30 changes: 9 additions & 21 deletions src/app/menupanel/common/downloadpanel/downloadpanel.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 + ')');
}
}
});
}
Expand Down Expand Up @@ -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;
}
Expand Down
Loading