2017-02-13 11:26:50 -08:00
|
|
|
import Ember from 'ember';
|
2017-04-28 13:44:31 -07:00
|
|
|
import { makeUrnBreadcrumbs } from 'wherehows-web/utils/entities';
|
2017-08-24 00:23:48 -07:00
|
|
|
import { datasetComplianceFor, datasetComplianceSuggestionsFor } from 'wherehows-web/utils/api/datasets/compliance';
|
2017-09-19 18:20:03 -07:00
|
|
|
import { readDatasetComments } from 'wherehows-web/utils/api/datasets/comments';
|
2017-09-20 14:25:27 -07:00
|
|
|
import {
|
|
|
|
readDatasetColumns,
|
|
|
|
columnDataTypesAndFieldNames,
|
|
|
|
columnsWithHtmlComments
|
|
|
|
} from 'wherehows-web/utils/api/datasets/columns';
|
|
|
|
|
2017-08-24 00:23:48 -07:00
|
|
|
import {
|
|
|
|
getDatasetOwners,
|
2017-08-24 11:31:54 -07:00
|
|
|
getUserEntities,
|
|
|
|
isRequiredMinOwnersNotConfirmed
|
2017-08-24 00:23:48 -07:00
|
|
|
} from 'wherehows-web/utils/api/datasets/owners';
|
2017-09-20 14:25:27 -07:00
|
|
|
import { readDataset, datasetUrnToId } from 'wherehows-web/utils/api/datasets/dataset';
|
|
|
|
import isDatasetUrn from 'wherehows-web/utils/validators/urn';
|
2017-03-24 22:15:48 -07:00
|
|
|
|
2017-09-20 14:25:27 -07:00
|
|
|
const { Route, get, set, setProperties, inject: { service }, $: { getJSON }, run } = Ember;
|
|
|
|
const { schedule } = run;
|
|
|
|
// TODO: DSS-6581 Move to URL retrieval module
|
2017-03-24 22:15:48 -07:00
|
|
|
const datasetsUrlRoot = '/api/v1/datasets';
|
|
|
|
const datasetUrl = id => `${datasetsUrlRoot}/${id}`;
|
|
|
|
const ownerTypeUrlRoot = '/api/v1/owner/types';
|
|
|
|
const getDatasetPropertiesUrl = id => `${datasetUrl(id)}/properties`;
|
|
|
|
const getDatasetSampleUrl = id => `${datasetUrl(id)}/sample`;
|
|
|
|
const getDatasetImpactAnalysisUrl = id => `${datasetUrl(id)}/impacts`;
|
|
|
|
const getDatasetDependsUrl = id => `${datasetUrl(id)}/depends`;
|
|
|
|
const getDatasetPartitionsUrl = id => `${datasetUrl(id)}/access`;
|
|
|
|
const getDatasetReferencesUrl = id => `${datasetUrl(id)}/references`;
|
|
|
|
const getDatasetInstanceUrl = id => `${datasetUrl(id)}/instances`;
|
2017-06-19 17:11:53 -07:00
|
|
|
const getDatasetVersionUrl = (id, dbId) => `${datasetUrl(id)}/versions/db/${dbId}`;
|
2017-03-24 22:15:48 -07:00
|
|
|
|
|
|
|
export default Route.extend({
|
2017-06-19 17:11:53 -07:00
|
|
|
/**
|
|
|
|
* Runtime application configuration options
|
|
|
|
* @type {Ember.Service}
|
|
|
|
*/
|
|
|
|
configurator: service(),
|
|
|
|
|
2017-09-20 16:10:52 -07:00
|
|
|
queryParams: {
|
|
|
|
urn: {
|
|
|
|
refreshModel: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reads the dataset given a identifier from the dataset endpoint
|
|
|
|
* @param {string} datasetIdentifier a identifier / id for the dataset to be fetched
|
|
|
|
* @param {string} [urn] optional urn identifier for dataset
|
|
|
|
* @return {Promise<IDataset>}
|
|
|
|
*/
|
|
|
|
async model({ datasetIdentifier, urn }) {
|
|
|
|
let datasetId = datasetIdentifier;
|
|
|
|
|
|
|
|
if (datasetId === 'urn' && isDatasetUrn(urn)) {
|
|
|
|
datasetId = await datasetUrnToId(urn);
|
|
|
|
}
|
|
|
|
|
|
|
|
return await readDataset(datasetId);
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* resetting the urn query param when the hook is invoked
|
|
|
|
* @param {Controller} controller
|
|
|
|
*/
|
|
|
|
resetController(controller) {
|
|
|
|
set(controller, 'urn', void 0);
|
|
|
|
},
|
|
|
|
|
2017-03-24 22:15:48 -07:00
|
|
|
//TODO: DSS-6632 Correct server-side if status:error and record not found but response is 200OK
|
2017-02-13 11:26:50 -08:00
|
|
|
setupController(controller, model) {
|
2017-03-24 22:15:48 -07:00
|
|
|
let source = '';
|
2017-08-07 22:21:05 -07:00
|
|
|
let id = 0;
|
|
|
|
let urn = '';
|
2017-02-13 11:26:50 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Series of chain-able functions invoked to set set properties on the controller required for dataset tab sections
|
|
|
|
*/
|
|
|
|
const fetchThenSetOnController = {
|
2017-06-19 17:11:53 -07:00
|
|
|
datasetSchemaFieldNamesAndTypes(controller, { id }) {
|
|
|
|
Promise.resolve(getJSON(datasetUrl(id))).then(({ dataset: { schema } = { schema: undefined } } = {}) => {
|
2017-03-24 22:15:48 -07:00
|
|
|
/**
|
2017-02-13 11:26:50 -08:00
|
|
|
* Parses a JSON dataset schema representation and extracts the field names and types into a list of maps
|
|
|
|
* @param {JSON} schema
|
|
|
|
* @returns {Array.<*>}
|
|
|
|
*/
|
2017-03-24 22:15:48 -07:00
|
|
|
function getFieldNamesAndTypesFrom(schema = JSON.stringify({})) {
|
|
|
|
/**
|
2017-02-13 11:26:50 -08:00
|
|
|
* schema argument may contain property with name `fields` or `fields` may be nested in `schema` object
|
|
|
|
* with same name.
|
|
|
|
* Unfortunately shape is inconsistent depending of dataset queried.
|
|
|
|
* Use `fields` property if present and is an array, otherwise use `fields` property on `schema`.
|
|
|
|
* Will default to empty array.
|
|
|
|
* @param {Array} [nestedFields]
|
|
|
|
* @param {Array} [fields]
|
|
|
|
* @returns {Array.<*>}
|
|
|
|
*/
|
2017-06-19 17:11:53 -07:00
|
|
|
function getFieldTypeMappingArray({ schema: { fields: nestedFields = [] } = { schema: {} }, fields }) {
|
2017-03-24 22:15:48 -07:00
|
|
|
fields = Array.isArray(fields) ? fields : nestedFields;
|
|
|
|
|
|
|
|
// As above, field may contain a label with string property or a name property
|
|
|
|
return fields.map(({ label: { string } = {}, name, type }) => ({
|
|
|
|
name: string || name,
|
2017-06-19 17:11:53 -07:00
|
|
|
type: Array.isArray(type) ? (type[0] === 'null' ? type.slice(1) : type) : [type]
|
2017-03-24 22:15:48 -07:00
|
|
|
}));
|
|
|
|
}
|
2017-02-13 11:26:50 -08:00
|
|
|
|
2017-03-24 22:15:48 -07:00
|
|
|
schema = JSON.parse(schema);
|
|
|
|
return [...getFieldTypeMappingArray(schema)];
|
|
|
|
}
|
2017-02-13 11:26:50 -08:00
|
|
|
|
2017-06-19 17:11:53 -07:00
|
|
|
set(controller, 'datasetSchemaFieldsAndTypes', getFieldNamesAndTypesFrom(schema));
|
2017-03-24 22:15:48 -07:00
|
|
|
});
|
2017-02-13 11:26:50 -08:00
|
|
|
|
|
|
|
return this;
|
2017-06-19 17:11:53 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the isInternal flag as a property on the controller
|
|
|
|
* @param controller {Ember.Controller} the controller to set the internal flag on
|
|
|
|
* @param configurator {Ember.Service}
|
|
|
|
* @return {Promise.<void>}
|
|
|
|
*/
|
|
|
|
async isInternal(controller, { configurator }) {
|
|
|
|
const isInternal = await configurator.getConfig('isInternal');
|
|
|
|
set(controller, 'isInternal', isInternal);
|
2017-02-13 11:26:50 -08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-03-24 22:15:48 -07:00
|
|
|
set(controller, 'hasProperty', false);
|
2017-02-13 11:26:50 -08:00
|
|
|
|
|
|
|
if (model && model.id) {
|
2017-03-24 22:15:48 -07:00
|
|
|
({ id, source, urn } = model);
|
|
|
|
let { originalSchema = null } = model;
|
2017-02-13 11:26:50 -08:00
|
|
|
|
|
|
|
this.controllerFor('datasets').set('detailview', true);
|
|
|
|
if (originalSchema) {
|
2017-03-24 22:15:48 -07:00
|
|
|
set(model, 'schema', originalSchema);
|
2017-02-13 11:26:50 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
controller.set('model', model);
|
|
|
|
} else if (model.dataset) {
|
2017-03-24 22:15:48 -07:00
|
|
|
({ id, source, urn } = model.dataset);
|
2017-02-13 11:26:50 -08:00
|
|
|
|
|
|
|
controller.set('model', model.dataset);
|
|
|
|
this.controllerFor('datasets').set('detailview', true);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Don't set default zero Ids on controller
|
|
|
|
if (id) {
|
|
|
|
controller.set('datasetId', id);
|
|
|
|
// Creates list of partially applied functions from `fetchThenSetController` and invokes each in turn
|
|
|
|
Object.keys(fetchThenSetOnController)
|
2017-03-24 22:15:48 -07:00
|
|
|
.map(funcRef =>
|
2017-06-19 17:11:53 -07:00
|
|
|
fetchThenSetOnController[funcRef]['bind'](fetchThenSetOnController, controller, {
|
2017-03-24 22:15:48 -07:00
|
|
|
id,
|
2017-06-19 17:11:53 -07:00
|
|
|
configurator: get(this, 'configurator')
|
|
|
|
})
|
|
|
|
)
|
2017-03-24 22:15:48 -07:00
|
|
|
.forEach(func => func());
|
2017-08-07 22:21:05 -07:00
|
|
|
|
|
|
|
/**
|
2017-09-20 14:25:27 -07:00
|
|
|
* ****************************
|
|
|
|
* Note: Refactor in progress *
|
|
|
|
* ****************************
|
2017-08-07 22:21:05 -07:00
|
|
|
* async IIFE sets the the complianceInfo and schemaFieldNamesMappedToDataTypes
|
|
|
|
* at once so observers will be buffered
|
|
|
|
* @param {number} id the dataset id
|
|
|
|
* @return {Promise.<void>}
|
|
|
|
*/
|
|
|
|
(async id => {
|
2017-09-20 14:25:27 -07:00
|
|
|
try {
|
|
|
|
const [columns, compliance, complianceSuggestion, datasetComments] = await Promise.all([
|
|
|
|
readDatasetColumns(id),
|
|
|
|
datasetComplianceFor(id),
|
|
|
|
datasetComplianceSuggestionsFor(id),
|
|
|
|
readDatasetComments(id)
|
|
|
|
]);
|
|
|
|
const { complianceInfo, isNewComplianceInfo } = compliance;
|
|
|
|
const schemas = columnsWithHtmlComments(columns);
|
2017-09-10 19:31:54 -07:00
|
|
|
|
2017-09-20 14:25:27 -07:00
|
|
|
setProperties(controller, {
|
|
|
|
complianceInfo,
|
|
|
|
isNewComplianceInfo,
|
|
|
|
complianceSuggestion,
|
|
|
|
datasetComments,
|
|
|
|
schemas,
|
|
|
|
hasSchemas: !!schemas.length,
|
|
|
|
schemaFieldNamesMappedToDataTypes: columnDataTypesAndFieldNames(columns)
|
|
|
|
});
|
|
|
|
|
|
|
|
if (schemas.length) {
|
|
|
|
run(() => {
|
|
|
|
schedule('afterRender', null, () => {
|
|
|
|
// TODO: DSS-6122 Refactor direct legacy method invocation on controller
|
|
|
|
controller.buildJsonView();
|
|
|
|
// TODO: DSS-6122 Refactor legacy global function reference
|
|
|
|
window.initializeColumnTreeGrid();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
} catch (e) {
|
|
|
|
throw e;
|
|
|
|
}
|
2017-08-07 22:21:05 -07:00
|
|
|
})(id);
|
2017-02-13 11:26:50 -08:00
|
|
|
}
|
|
|
|
|
2017-03-24 22:15:48 -07:00
|
|
|
Promise.resolve(getJSON(getDatasetInstanceUrl(id)))
|
|
|
|
.then(({ status, instances = [] }) => {
|
|
|
|
if (status === 'ok' && instances.length) {
|
|
|
|
const [firstInstance = {}] = instances;
|
|
|
|
const { dbId } = firstInstance;
|
|
|
|
|
|
|
|
setProperties(controller, {
|
|
|
|
instances,
|
|
|
|
hasinstances: true,
|
|
|
|
currentInstance: firstInstance,
|
|
|
|
latestInstance: firstInstance
|
|
|
|
});
|
|
|
|
|
2017-06-19 17:11:53 -07:00
|
|
|
return Promise.resolve(getJSON(getDatasetVersionUrl(id, dbId))).then(({ status, versions = [] }) => {
|
2017-03-24 22:15:48 -07:00
|
|
|
if (status === 'ok' && versions.length) {
|
|
|
|
const [firstVersion] = versions;
|
|
|
|
|
|
|
|
setProperties(controller, {
|
|
|
|
versions,
|
|
|
|
hasversions: true,
|
|
|
|
currentVersion: firstVersion,
|
|
|
|
latestVersion: firstVersion
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-06-19 17:11:53 -07:00
|
|
|
return Promise.reject(new Error('Dataset versions request failed.'));
|
2017-03-24 22:15:48 -07:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
return Promise.reject(new Error('Dataset instances request failed.'));
|
|
|
|
})
|
|
|
|
.catch(() => {
|
|
|
|
setProperties(controller, {
|
|
|
|
hasinstances: false,
|
|
|
|
hasversions: false,
|
|
|
|
currentInstance: '0',
|
|
|
|
latestInstance: '0',
|
|
|
|
currentVersion: '0',
|
|
|
|
latestVersion: '0'
|
2017-02-13 11:26:50 -08:00
|
|
|
});
|
2017-03-24 22:15:48 -07:00
|
|
|
});
|
2017-02-13 11:26:50 -08:00
|
|
|
|
2017-04-28 13:44:31 -07:00
|
|
|
// If urn exists, create a breadcrumb list
|
|
|
|
// TODO: DSS-7068 Refactoring in progress , move this to a computed prop on a container component
|
|
|
|
// FIXME: DSS-7068 browse.entity?urn route does not exist for last item in breadcrumb i.e. the dataset
|
|
|
|
// currently being viewed. Should this even be a link in the first place?
|
2017-02-13 11:26:50 -08:00
|
|
|
if (urn) {
|
2017-04-28 13:44:31 -07:00
|
|
|
set(controller, 'breadcrumbs', makeUrnBreadcrumbs(urn));
|
2017-02-13 11:26:50 -08:00
|
|
|
}
|
|
|
|
|
2017-03-25 15:30:47 -07:00
|
|
|
// Get the list of ownerTypes from endpoint,
|
|
|
|
// then prevent display of the `consumer`
|
|
|
|
// insert on controller
|
2017-06-19 17:11:53 -07:00
|
|
|
Promise.resolve(getJSON(ownerTypeUrlRoot)).then(({ status, ownerTypes = [] }) => {
|
|
|
|
ownerTypes = ownerTypes
|
|
|
|
.filter(ownerType => String(ownerType).toLowerCase() !== 'consumer')
|
|
|
|
.sort((a, b) => a.localeCompare(b));
|
2017-03-26 06:36:23 -07:00
|
|
|
|
2017-06-19 17:11:53 -07:00
|
|
|
status === 'ok' && set(controller, 'ownerTypes', ownerTypes);
|
|
|
|
});
|
2017-02-13 11:26:50 -08:00
|
|
|
|
2017-03-24 22:15:48 -07:00
|
|
|
if (source.toLowerCase() !== 'pinot') {
|
|
|
|
Promise.resolve(getJSON(getDatasetPropertiesUrl(id)))
|
|
|
|
.then(({ status, properties }) => {
|
|
|
|
if (status === 'ok' && properties) {
|
2017-06-19 17:11:53 -07:00
|
|
|
const propertyArray = window.convertPropertiesToArray(properties) || [];
|
2017-03-24 22:15:48 -07:00
|
|
|
if (propertyArray.length) {
|
|
|
|
controller.set('hasProperty', true);
|
|
|
|
|
|
|
|
return controller.set('properties', propertyArray);
|
2017-02-13 11:26:50 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-06-19 17:11:53 -07:00
|
|
|
return Promise.reject(new Error('Dataset properties request failed.'));
|
2017-03-24 22:15:48 -07:00
|
|
|
})
|
|
|
|
.catch(() => controller.set('hasProperty', false));
|
|
|
|
|
|
|
|
Promise.resolve(getJSON(getDatasetSampleUrl(id)))
|
|
|
|
.then(({ status, sampleData = {} }) => {
|
|
|
|
if (status === 'ok') {
|
|
|
|
const { sample = [] } = sampleData;
|
|
|
|
const { length } = sample;
|
|
|
|
if (length) {
|
|
|
|
const samplesObject = sample.reduce(
|
2017-06-19 17:11:53 -07:00
|
|
|
(sampleObject, record, index) => ((sampleObject[`record${index}`] = record), sampleObject),
|
2017-03-24 22:15:48 -07:00
|
|
|
{}
|
|
|
|
);
|
|
|
|
// TODO: DSS-6122 Refactor global function reference
|
|
|
|
const node = window.JsonHuman.format(samplesObject);
|
|
|
|
|
|
|
|
controller.set('hasSamples', true);
|
|
|
|
|
|
|
|
// TODO: DSS-6122 Refactor setTimeout
|
2017-06-19 17:11:53 -07:00
|
|
|
setTimeout(function() {
|
|
|
|
const jsonHuman = document.getElementById('datasetSampleData-json-human');
|
|
|
|
if (jsonHuman) {
|
|
|
|
if (jsonHuman.children && jsonHuman.children.length) {
|
|
|
|
jsonHuman.removeChild(jsonHuman.childNodes[jsonHuman.children.length - 1]);
|
2017-03-24 22:15:48 -07:00
|
|
|
}
|
2017-06-19 17:11:53 -07:00
|
|
|
|
|
|
|
jsonHuman.appendChild(node);
|
|
|
|
}
|
|
|
|
}, 500);
|
2017-03-24 22:15:48 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
2017-02-13 11:26:50 -08:00
|
|
|
}
|
2017-03-24 22:15:48 -07:00
|
|
|
|
|
|
|
return Promise.reject(new Error('Dataset sample request failed.'));
|
|
|
|
})
|
|
|
|
.catch(() => set(controller, 'hasSamples', false));
|
2017-02-13 11:26:50 -08:00
|
|
|
}
|
|
|
|
|
2017-03-24 22:15:48 -07:00
|
|
|
if (source.toLowerCase() === 'pinot') {
|
2017-06-19 17:11:53 -07:00
|
|
|
Promise.resolve(getJSON(getDatasetPropertiesUrl(id))).then(({ status, properties = {} }) => {
|
2017-03-24 22:15:48 -07:00
|
|
|
if (status === 'ok') {
|
|
|
|
const { elements = [] } = properties;
|
|
|
|
const [{ columnNames = [], results } = {}] = elements;
|
|
|
|
|
|
|
|
if (columnNames.length) {
|
|
|
|
return setProperties(controller, {
|
|
|
|
hasSamples: true,
|
|
|
|
samples: results,
|
|
|
|
columns: columnNames
|
|
|
|
});
|
2017-02-13 11:26:50 -08:00
|
|
|
}
|
|
|
|
}
|
2017-03-24 22:15:48 -07:00
|
|
|
|
|
|
|
return Promise.reject(new Error('Dataset properties request failed.'));
|
2017-02-13 11:26:50 -08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-03-24 22:15:48 -07:00
|
|
|
Promise.resolve(getJSON(getDatasetImpactAnalysisUrl(id)))
|
|
|
|
.then(({ status, impacts = [] }) => {
|
|
|
|
if (status === 'ok') {
|
|
|
|
if (impacts.length) {
|
|
|
|
return setProperties(controller, {
|
|
|
|
hasImpacts: true,
|
|
|
|
impacts: impacts
|
|
|
|
});
|
|
|
|
}
|
2017-02-13 11:26:50 -08:00
|
|
|
}
|
|
|
|
|
2017-06-19 17:11:53 -07:00
|
|
|
return Promise.reject(new Error('Dataset impact analysis request failed.'));
|
2017-03-24 22:15:48 -07:00
|
|
|
})
|
|
|
|
.catch(() => set(controller, 'hasImpacts', false));
|
|
|
|
|
|
|
|
Promise.resolve(getJSON(getDatasetDependsUrl(id)))
|
|
|
|
.then(({ status, depends = [] }) => {
|
|
|
|
if (status === 'ok') {
|
|
|
|
if (depends.length) {
|
|
|
|
// TODO: DSS-6122 Refactor setTimeout,
|
|
|
|
// global function reference
|
|
|
|
setTimeout(window.initializeDependsTreeGrid, 500);
|
|
|
|
return setProperties(controller, {
|
|
|
|
depends,
|
|
|
|
hasDepends: true
|
|
|
|
});
|
|
|
|
}
|
2017-02-13 11:26:50 -08:00
|
|
|
}
|
|
|
|
|
2017-03-24 22:15:48 -07:00
|
|
|
return Promise.reject(new Error('Dataset depends request failed.'));
|
|
|
|
})
|
|
|
|
.catch(() => set(controller, 'hasDepends', false));
|
|
|
|
|
|
|
|
Promise.resolve(getJSON(getDatasetPartitionsUrl(id)))
|
|
|
|
.then(({ status, access = [] }) => {
|
|
|
|
if (status === 'ok' && access.length) {
|
|
|
|
return setProperties(controller, {
|
|
|
|
hasAccess: true,
|
|
|
|
accessibilities: access
|
|
|
|
});
|
2017-02-13 11:26:50 -08:00
|
|
|
}
|
|
|
|
|
2017-03-24 22:15:48 -07:00
|
|
|
return Promise.reject(new Error('Dataset partitions request failed.'));
|
|
|
|
})
|
|
|
|
.catch(() => set(controller, 'hasAccess', false));
|
|
|
|
|
|
|
|
Promise.resolve(getJSON(getDatasetReferencesUrl(id)))
|
|
|
|
.then(({ status, references = [] }) => {
|
|
|
|
if (status === 'ok' && references.length) {
|
|
|
|
setTimeout(window.initializeReferencesTreeGrid, 500);
|
|
|
|
|
|
|
|
return setProperties(controller, {
|
|
|
|
references,
|
|
|
|
hasReferences: true
|
|
|
|
});
|
2017-02-13 11:26:50 -08:00
|
|
|
}
|
|
|
|
|
2017-03-24 22:15:48 -07:00
|
|
|
return Promise.reject(new Error('Dataset references request failed.'));
|
|
|
|
})
|
|
|
|
.catch(() => set(controller, 'hasReferences', false));
|
|
|
|
|
2017-03-25 15:30:47 -07:00
|
|
|
// Retrieve the current owners of the dataset and store on the controller
|
2017-08-24 00:23:48 -07:00
|
|
|
(async id => {
|
2017-08-24 11:31:54 -07:00
|
|
|
const [owners, { userEntitiesSource, userEntitiesMaps }] = await Promise.all([
|
|
|
|
getDatasetOwners(id),
|
|
|
|
getUserEntities()
|
|
|
|
]);
|
2017-08-24 00:23:48 -07:00
|
|
|
setProperties(controller, {
|
|
|
|
requiredMinNotConfirmed: isRequiredMinOwnersNotConfirmed(owners),
|
|
|
|
owners,
|
2017-08-24 11:31:54 -07:00
|
|
|
userEntitiesMaps,
|
|
|
|
userEntitiesSource
|
2017-03-24 22:15:48 -07:00
|
|
|
});
|
2017-08-24 00:23:48 -07:00
|
|
|
})(id);
|
2017-02-13 11:26:50 -08:00
|
|
|
},
|
|
|
|
|
2017-09-20 14:25:27 -07:00
|
|
|
actions: {
|
2017-03-24 22:15:48 -07:00
|
|
|
getDataset() {
|
2017-06-19 17:11:53 -07:00
|
|
|
Promise.resolve(getJSON(datasetUrl(this.get('controller.model.id')))).then(
|
|
|
|
({ status, dataset }) => status === 'ok' && set(this, 'controller.model', dataset)
|
2017-03-24 22:15:48 -07:00
|
|
|
);
|
2017-02-13 11:26:50 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|