-
-{{!-- {{/if}} --}}
\ No newline at end of file
+{{/if}}
\ No newline at end of file
diff --git a/lib/shared/addon/components/settings/danger-zone/component.js b/lib/shared/addon/components/settings/danger-zone/component.js
index 8b03b74d2..d2c73f8f0 100644
--- a/lib/shared/addon/components/settings/danger-zone/component.js
+++ b/lib/shared/addon/components/settings/danger-zone/component.js
@@ -30,7 +30,7 @@ export default Component.extend({
},
},
- allowed: computed(() => {
+ allowed: computed('settings.all.@each.{name,customized}', () => {
let out = {};
Object.keys(C.SETTING.ALLOWED).forEach((key) => {
@@ -43,7 +43,7 @@ export default Component.extend({
return out;
}),
- current: computed('settings.all.@each.{name,source}', function() {
+ current: computed('allowed.@each.{name,customized}', function() {
let all = get(this, 'settings.asMap');
let allowed = get(this, 'allowed');
let isLocalDev = window.location.host === 'localhost:8000';
@@ -65,6 +65,11 @@ export default Component.extend({
out.set('hide', true);
}
+ if (get(details, 'kind') === 'json') {
+ out.set('hide', true);
+ out.set('parsedJSON', JSON.stringify(JSON.parse(out.get('obj.value')), undefined, 2))
+ }
+
(Object.keys(details) || []).forEach((key2) => {
out.set(key2, details[key2]);
});
diff --git a/lib/shared/addon/components/settings/danger-zone/template.hbs b/lib/shared/addon/components/settings/danger-zone/template.hbs
index 471a172e4..1fff644df 100644
--- a/lib/shared/addon/components/settings/danger-zone/template.hbs
+++ b/lib/shared/addon/components/settings/danger-zone/template.hbs
@@ -26,15 +26,25 @@
-
+ {{#if (eq row.kind "json" )}}
+
+ {{code-block
+ class="setting-json"
+ code=row.parsedJSON
+ language="json"
+ }}
+
+ {{else}}
+
{{~#if row.obj.value~}}
{{~row.obj.value~}}
{{~else~}}
<none>
{{~/if~}}
-
+
+ {{/if}}
- {{#if (eq row.kind 'multiline')}}
+ {{#if (or (eq row.kind 'multiline') (eq row.kind 'json'))}}
Hide {{row.key}}
{{/if}}
diff --git a/lib/shared/addon/helpers/to-json.js b/lib/shared/addon/helpers/to-json.js
index e46e0eb80..833516a58 100644
--- a/lib/shared/addon/helpers/to-json.js
+++ b/lib/shared/addon/helpers/to-json.js
@@ -2,6 +2,6 @@ import Helper from '@ember/component/helper';
export default Helper.extend({
compute(params/* , options*/) {
- return JSON.stringify(params[0]);
+ return JSON.stringify(params[0], undefined, 2);
},
});
diff --git a/lib/shared/addon/settings/service.js b/lib/shared/addon/settings/service.js
index 47da3750c..10a581397 100644
--- a/lib/shared/addon/settings/service.js
+++ b/lib/shared/addon/settings/service.js
@@ -5,7 +5,7 @@ import Evented from '@ember/object/evented';
import Service, { inject as service } from '@ember/service';
import C from 'shared/utils/constants';
import { minorVersion } from 'shared/utils/parse-version';
-import { get, set, computed } from '@ember/object';
+import { get, set, computed, observer } from '@ember/object';
import { isEmpty } from '@ember/utils';
export function normalizeName(str) {
@@ -84,18 +84,18 @@ export default Service.extend(Evented, {
return value;
},
- promiseCountObserver: function() {
+ promiseCountObserver: observer('promiseCount', function() {
if (get(this, 'promiseCount') <= 0) {
this.trigger('settingsPromisesResolved');
}
- }.observes('promiseCount'),
+ }),
findByName(name) {
return get(this, 'asMap')[normalizeName(name)];
},
loadAll() {
- return get(this, 'globalStore').find('setting');
+ return get(this, 'globalStore').findAll('setting');
},
load(names) {
@@ -127,7 +127,15 @@ export default Service.extend(Evented, {
return promise;
},
- asMap: function() {
+ cliVersion: alias(`asMap.${ C.SETTING.VERSION_CLI }.value`),
+ dockerMachineVersion: alias(`asMap.${ C.SETTING.VERSION_MACHINE }.value`),
+ helmVersion: alias(`asMap.${ C.SETTING.VERSION_HELM }.value`),
+ minDockerVersion: alias(`asMap.${ C.SETTING.MIN_DOCKER }.value`),
+ rancherImage: alias(`asMap.${ C.SETTING.IMAGE_RANCHER }.value`),
+ rancherVersion: alias(`asMap.${ C.SETTING.VERSION_RANCHER }.value`),
+ serverUrl: alias(`asMap.${ C.SETTING.SERVER_URL }.value`),
+
+ asMap: computed('all.@each.{name,value,customized}', function() {
var out = {};
(get(this, 'all') || []).forEach((setting) => {
@@ -137,15 +145,15 @@ export default Service.extend(Evented, {
});
return out;
- }.property('all.@each.{name,value}'),
+ }),
- uiVersion: function() {
+ uiVersion: computed('app.version', function() {
return `v${ get(this, 'app.version') }`;
- }.property('app.version'),
+ }),
- issueUrl: function() {
+ issueUrl: computed('app.currentRouteName', 'access.{provider,admin}', 'rancherVersion', 'uiVersion', function() {
var str = '*Describe your issue here*\n\n\n---\n| Useful | Info |\n| :-- | :-- |\n' +
- `|Versions|Rancher \`${ get(this, 'rancherVersion') || '-' }\` ` +
+ `|Versions|Rancher \`${ get(this, 'rancherVersion') || '-' }\` ` +
`UI: \`${ get(this, 'uiVersion') || '--' }\` |\n`;
if ( get(this, 'access.enabled') ) {
@@ -161,39 +169,31 @@ export default Service.extend(Evented, {
var url = `${ C.EXT_REFERENCES.GITHUB }/issues/new?body=${ encodeURIComponent(str) }`;
return url;
- }.property('app.currentRouteName', 'access.{provider,admin}', 'rancherVersion', 'uiVersion'),
+ }),
- rancherImage: alias(`asMap.${ C.SETTING.IMAGE_RANCHER }.value`),
- rancherVersion: alias(`asMap.${ C.SETTING.VERSION_RANCHER }.value`),
- cliVersion: alias(`asMap.${ C.SETTING.VERSION_CLI }.value`),
- dockerMachineVersion: alias(`asMap.${ C.SETTING.VERSION_MACHINE }.value`),
- helmVersion: alias(`asMap.${ C.SETTING.VERSION_HELM }.value`),
- serverUrl: alias(`asMap.${ C.SETTING.SERVER_URL }.value`),
serverUrlIsEmpty: computed('serverUrl', function() {
return isEmpty(get(this, 'serverUrl'));
}),
- isRancher: function() {
+ isRancher: computed(C.SETTING.PL, function() {
const out = (get(this, C.SETTING.PL) || '').toUpperCase() === C.SETTING.PL_RANCHER_VALUE.toUpperCase();
return out;
- }.property(C.SETTING.PL),
+ }),
- isEnterprise: function() {
+ isEnterprise: computed('rancherImage', function() {
return get(this, 'rancherImage') === 'rancher/enterprise';
- }.property('rancherImage'),
+ }),
- appName: function() {
+ appName: computed('isRancher', C.SETTING.PL, function() {
if ( get(this, 'isRancher') ) {
return get(this, 'app.appName');
}
return get(this, C.SETTING.PL) || '';
- }.property('isRancher', C.SETTING.PL),
+ }),
- minDockerVersion: alias(`asMap.${ C.SETTING.MIN_DOCKER }.value`),
-
- minorVersion: function() {
+ minorVersion: computed('rancherVersion', function() {
let version = get(this, 'rancherVersion');
if ( !version ) {
@@ -201,9 +201,9 @@ export default Service.extend(Evented, {
}
return minorVersion(version);
- }.property('rancherVersion'),
+ }),
- docsBase: function() {
+ docsBase: computed('intl.locale', 'minorVersion', function() {
let full = get(this, 'rancherVersion');
let version;
@@ -222,5 +222,5 @@ export default Service.extend(Evented, {
}
return `${ C.EXT_REFERENCES.DOCS }/${ version }/${ lang }`;
- }.property('intl.locale', 'minorVersion')
+ })
});
diff --git a/lib/shared/addon/utils/constants.js b/lib/shared/addon/utils/constants.js
index f2ef0857e..81f095072 100644
--- a/lib/shared/addon/utils/constants.js
+++ b/lib/shared/addon/utils/constants.js
@@ -479,6 +479,7 @@ var C = {
API_HOST: 'api-host',
CA_CERTS: 'cacerts',
+ CLUSTER_DEFAULTS: 'cluster-defaults',
ENGINE_URL: 'engine-install-url',
ENGINE_ISO_URL: 'engine-iso-url',
FIRST_LOGIN: 'first-login',
@@ -512,6 +513,7 @@ var C = {
C.SETTING.ALLOWED = {
[C.SETTING.CA_CERTS]: { kind: 'multiline' },
+ [C.SETTING.CLUSTER_DEFAULTS]: { kind: 'json' },
[C.SETTING.ENGINE_URL]: {},
[C.SETTING.ENGINE_ISO_URL]: {},
[C.SETTING.PL]: {},
@@ -519,8 +521,8 @@ C.SETTING.ALLOWED = {
[C.SETTING.SERVER_URL]: {},
'system-default-registry': {},
[C.SETTING.TELEMETRY]: {
- kind: 'enum',
- options: ['prompt', 'in', 'out']
+ kind: 'enum',
+ options: ['prompt', 'in', 'out']
},
'ui-index': {},
};
diff --git a/translations/en-us.yaml b/translations/en-us.yaml
index 71847c03e..de80bae43 100644
--- a/translations/en-us.yaml
+++ b/translations/en-us.yaml
@@ -2896,6 +2896,7 @@ dangerZone:
showLabel: I understand that I can break things by changing advanced settings.
description:
'cacerts': "CA Certificates needed to verify the server's certificate"
+ 'cluster-defaults': 'Override RKE Defaults when creating new clusters.'
'engine-install-url': 'Default Docker engine installation URL (for most node drivers)'
'engine-iso-url': 'Default OS installation URL (for vSphere driver)'
'engine-newest-version': 'The newest supported version of Docker at the time of this release. A Docker version that does not satisfy supported docker range but is newer than this will be marked as untested'