Web console: better lookup 404 detection (#14108)

* better lookup 404 detection

* update snapshot
This commit is contained in:
Vadim Ogievetsky 2023-04-19 09:27:55 -07:00 committed by GitHub
parent e8674e2a60
commit 4fffee1776
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 7 deletions

View File

@ -16,6 +16,8 @@
* limitations under the License. * limitations under the License.
*/ */
import { deepGet } from './object-change';
export function isLookupsUninitialized(error: Error | undefined) { export function isLookupsUninitialized(error: Error | undefined) {
return error && error.message === 'Request failed with status code 404'; return deepGet(error || {}, 'response.status') === 404;
} }

View File

@ -210,7 +210,7 @@ exports[`LookupsView matches snapshot 1`] = `
multiSort={true} multiSort={true}
nestingLevelKey="_nestingLevel" nestingLevelKey="_nestingLevel"
nextText="Next" nextText="Next"
noDataText="" noDataText="No lookups"
ofText="of" ofText="of"
onFetchData={[Function]} onFetchData={[Function]}
onFilteredChange={[Function]} onFilteredChange={[Function]}

View File

@ -355,11 +355,7 @@ export class LookupsView extends React.PureComponent<LookupsViewProps, LookupsVi
<ReactTable <ReactTable
data={lookups} data={lookups}
loading={lookupEntriesAndTiersState.loading} loading={lookupEntriesAndTiersState.loading}
noDataText={ noDataText={lookupEntriesAndTiersState.getErrorMessage() || 'No lookups'}
!lookupEntriesAndTiersState.loading && !lookups.length
? 'No lookups'
: lookupEntriesAndTiersState.getErrorMessage() || ''
}
filterable filterable
filtered={lookupFilter} filtered={lookupFilter}
onFilteredChange={filtered => { onFilteredChange={filtered => {