mirror of
https://github.com/datahub-project/datahub.git
synced 2025-10-19 04:47:21 +00:00
replaces dataset number id's to urn identifiers in url
This commit is contained in:
parent
9f05a96478
commit
9a637e3d3b
@ -58,6 +58,21 @@ export default Route.extend({
|
|||||||
throw new TypeError(`Could not parse identifier ${identifier}. Please ensure format is valid.`);
|
throw new TypeError(`Could not parse identifier ${identifier}. Please ensure format is valid.`);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
serialize({ uri }) {
|
||||||
|
// updates routes dataset_id param with dataset urn (urn property)
|
||||||
|
return { dataset_id: uri };
|
||||||
|
},
|
||||||
|
|
||||||
|
afterModel(model, transition) {
|
||||||
|
const { dataset_id } = transition.params['datasets.dataset'];
|
||||||
|
|
||||||
|
// Check is dataset_id is a number, and replace with urn
|
||||||
|
// urn's are the primary means of referencing a dataset
|
||||||
|
if (!isNaN(parseInt(dataset_id, 10)) && isFinite(dataset_id)) {
|
||||||
|
this.replaceWith('datasets.dataset', model);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* resetting the urn query param when the hook is invoked
|
* resetting the urn query param when the hook is invoked
|
||||||
* @param {Controller} controller
|
* @param {Controller} controller
|
||||||
|
Loading…
x
Reference in New Issue
Block a user