[New] Added updateEnvironment()
This commit is contained in:
parent
b449beb4ef
commit
ab470e12d0
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "strolch-wc-util-behavior",
|
"name": "strolch-wc-util-behavior",
|
||||||
"description": "Strolch Polymer Util Behaviors",
|
"description": "Strolch Polymer Util Behaviors",
|
||||||
"version": "0.3.7",
|
"version": "0.3.8",
|
||||||
"authors": [
|
"authors": [
|
||||||
"Robert von Burg"
|
"Robert von Burg"
|
||||||
],
|
],
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// app functions
|
// app functions
|
||||||
//
|
//
|
||||||
clearSearchTerm: function () {
|
clearSearchTerm: function () {
|
||||||
this.fire("strolch-clear-search-term");
|
this.fire("strolch-clear-search-term");
|
||||||
},
|
},
|
||||||
|
|
||||||
// fires an event that will show a dialog
|
// fires an event that will show a dialog
|
||||||
|
@ -67,6 +67,40 @@
|
||||||
this.fire('strolch-show-toast', {text: text});
|
this.fire('strolch-show-toast', {text: text});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set an environment property to a localized value
|
||||||
|
* @param version the version response from the server
|
||||||
|
*/
|
||||||
|
updateEnvironment: function (version) {
|
||||||
|
if (version == null || version.agentVersion == null || version.agentVersion.environment == null) {
|
||||||
|
this.environment = "-";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var environment = version.agentVersion.environment;
|
||||||
|
if (this.localize == null) {
|
||||||
|
this.environment = environment;
|
||||||
|
this.async(function () {
|
||||||
|
if (this.localize == null) {
|
||||||
|
console.error("The localize function is still not available after 100ms of waiting! Cancelling.");
|
||||||
|
} else {
|
||||||
|
this.updateEnvironment(version);
|
||||||
|
}
|
||||||
|
}.bind(this), 100);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (environment.indexOf('prod') >= 0) {
|
||||||
|
this.environment = this.localize('production');
|
||||||
|
} else if (environment.indexOf('test') >= 0) {
|
||||||
|
this.environment = this.localize('testing');
|
||||||
|
} else if (environment.indexOf('stag') >= 0) {
|
||||||
|
this.environment = this.localize('staging');
|
||||||
|
} else if (environment.indexOf('dev') >= 0) {
|
||||||
|
this.environment = this.localize('development');
|
||||||
|
} else {
|
||||||
|
this.environment = environment;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
//
|
//
|
||||||
// Navigation functions
|
// Navigation functions
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue