mirror of
https://github.com/datahub-project/datahub.git
synced 2025-11-03 12:16:10 +00:00
Merge pull request #651 from theseyi/master
adds default empty array if columns api values are not returned
This commit is contained in:
commit
1df5b3a57e
@ -141,7 +141,7 @@ export default Route.extend({
|
|||||||
*/
|
*/
|
||||||
getDatasetColumn = id =>
|
getDatasetColumn = id =>
|
||||||
Promise.resolve(getJSON(getDatasetColumnUrl(id)))
|
Promise.resolve(getJSON(getDatasetColumnUrl(id)))
|
||||||
.then(({ status, columns }) => {
|
.then(({ status, columns = [] }) => {
|
||||||
if (status === 'ok') {
|
if (status === 'ok') {
|
||||||
if (columns && columns.length) {
|
if (columns && columns.length) {
|
||||||
const columnsWithHTMLComments = columns.map(column => {
|
const columnsWithHTMLComments = columns.map(column => {
|
||||||
@ -171,7 +171,10 @@ export default Route.extend({
|
|||||||
return Promise.reject(new Error('Dataset columns request failed.'));
|
return Promise.reject(new Error('Dataset columns request failed.'));
|
||||||
})
|
})
|
||||||
.then(columns => columns.map(({ dataType, fullFieldPath }) => ({ dataType, fieldName: fullFieldPath })))
|
.then(columns => columns.map(({ dataType, fullFieldPath }) => ({ dataType, fieldName: fullFieldPath })))
|
||||||
.catch(() => setProperties(controller, { hasSchemas: false, schemas: null }));
|
.catch(() => {
|
||||||
|
setProperties(controller, { hasSchemas: false, schemas: null });
|
||||||
|
return [];
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* async IIFE sets the the complianceInfo and schemaFieldNamesMappedToDataTypes
|
* async IIFE sets the the complianceInfo and schemaFieldNamesMappedToDataTypes
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user