Add query parameter to override Mirage scenario (#9380)
This commit is contained in:
parent
6334ad1b42
commit
ba147a4fca
|
@ -30,6 +30,8 @@ You may need to reference the direct path to `ember`, typically in `./node_modul
|
||||||
|
|
||||||
The fake data in development is generated from a stable seed of 1. To generate different data, you can include a query parameter of `?faker-seed=2` or any other number in the URL. To turn off the seed and get different data with every load, use `?faker=seed=0`.
|
The fake data in development is generated from a stable seed of 1. To generate different data, you can include a query parameter of `?faker-seed=2` or any other number in the URL. To turn off the seed and get different data with every load, use `?faker=seed=0`.
|
||||||
|
|
||||||
|
When running with Mirage, the default scenario is set in `config/environment.js` but can be overridden with a query parameter to any of the scenarios named in `mirage/scenarios/default.js` with something like `?mirage-scenario=emptyCluster`.
|
||||||
|
|
||||||
## Running / Development with Vagrant
|
## Running / Development with Vagrant
|
||||||
|
|
||||||
All necessary tools for UI development are installed as part of the Vagrantfile. This is primarily to make it easy to build the UI from source while working on Nomad. Due to the filesystem requirements of [Broccoli](http://broccolijs.com/) (which powers Ember CLI), it is strongly discouraged to use Vagrant for developing changes to the UI.
|
All necessary tools for UI development are installed as part of the Vagrantfile. This is primarily to make it easy to build the UI from source while working on Nomad. Due to the filesystem requirements of [Broccoli](http://broccolijs.com/) (which powers Ember CLI), it is strongly discouraged to use Vagrant for developing changes to the UI.
|
||||||
|
|
|
@ -18,7 +18,7 @@ const allScenarios = {
|
||||||
...topoScenarios,
|
...topoScenarios,
|
||||||
};
|
};
|
||||||
|
|
||||||
const scenario = getConfigValue('mirageScenario', 'emptyCluster');
|
const scenario = getScenarioQueryParameter() || getConfigValue('mirageScenario', 'emptyCluster');
|
||||||
|
|
||||||
export default function(server) {
|
export default function(server) {
|
||||||
const activeScenario = allScenarios[scenario];
|
const activeScenario = allScenarios[scenario];
|
||||||
|
@ -169,4 +169,9 @@ function getConfigValue(variableName, defaultValue) {
|
||||||
);
|
);
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getScenarioQueryParameter() {
|
||||||
|
const params = new URLSearchParams(window.location.search);
|
||||||
|
return params.get('mirage-scenario');
|
||||||
|
}
|
||||||
/* eslint-enable */
|
/* eslint-enable */
|
||||||
|
|
Loading…
Reference in a new issue