diff --git a/src/app/pages/observations/observation-list.component.html b/src/app/pages/observations/observation-list.component.html index f2624568..9c927294 100644 --- a/src/app/pages/observations/observation-list.component.html +++ b/src/app/pages/observations/observation-list.component.html @@ -69,7 +69,7 @@

{{'Go to an observation' | translate}}

- +
{{observer.name}}
diff --git a/src/app/shared/table-filter/table-filter.behavior.ts b/src/app/shared/table-filter/table-filter.behavior.ts index b302473f..5c1d6be3 100644 --- a/src/app/shared/table-filter/table-filter.behavior.ts +++ b/src/app/shared/table-filter/table-filter.behavior.ts @@ -3,6 +3,7 @@ import { JsonApiParams, JsonApiService } from 'app/services/json-api.service'; import { TableComponent, TableState } from 'app/shared/table/table.component'; import { FiltersComponent, Filter } from 'app/shared/filters/filters.component'; import { debounce } from 'lodash'; +import * as Sentry from '@sentry/browser' export class TableFilterBehavior implements AfterViewInit { @@ -39,19 +40,25 @@ export class TableFilterBehavior implements AfterViewInit { const params = Object.assign({}, this.filters.getApiParams(), this.table.getApiParams()); const requestID = ++this.latestRequestID; - // We save the current state of the table and - // filters so the user can come back to them - // later - this.saveState(); - this.service.get(params) .then(res => { if (this.latestRequestID === requestID) { this.table.rows = res.data; this.table.rowCount = res.meta['record-count']; + // We save the current state of the table and + // filters so the user can come back to them + // later + this.saveState(); + } + }) + .catch((error) => { + console.error('Error loading the table data', error) + Sentry.captureException(error); + // bad request so probably a filter or sorting error so bust the saved state + if (error.status === 400) { + sessionStorage.removeItem('tableFilter'); } }) - .catch((error) => console.error('Error loading the table data', error)) .then(() => { if (this.latestRequestID === requestID) { this.table.loading = false; diff --git a/src/app/shared/table/table.component.html b/src/app/shared/table/table.component.html index 87aebae2..a14cb75c 100644 --- a/src/app/shared/table/table.component.html +++ b/src/app/shared/table/table.component.html @@ -23,7 +23,7 @@ c.prop === this.sortColumn.prop)) { + // console.log(sortColumn); + if (this.sortColumn && this.sortColumn.sortable === false) { this.sortColumn = null; this.change.emit(); } @@ -293,7 +294,7 @@ export class TableComponent implements AfterContentInit { const sortColumn = this.columns.find(c => c.prop.replace(/[\[\]]/g, '') === sortColumnProp); const isDesc = !!this.previousState.sort.match(/(-?).*/)[1].length; - if (sortColumn) { + if (sortColumn && sortColumn.sortable !== false) { this.sortColumn = sortColumn; this.sortOrder = isDesc ? 'desc' : 'asc'; }