Merge pull request #2195 from westlywright/2.1

Bugs
This commit is contained in:
Westly Wright 2018-08-28 14:39:24 -07:00 committed by GitHub
commit b80ffc4895
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 152 additions and 95 deletions

View File

@ -6,20 +6,41 @@ import { normalizeName } from 'shared/settings/service';
import ModalBase from 'shared/mixins/modal-base';
import layout from './template';
const cmOpts = {
autofocus: true,
gutters: ['CodeMirror-lint-markers'],
lineNumbers: true,
lineWrapping: true,
lint: true,
mode: {
name: 'javascript',
json: true,
},
theme: 'monokai',
viewportMargin: Infinity,
};
export default Component.extend(ModalBase, {
settings: service(),
growl: service(),
settings: service(),
growl: service(),
layout,
classNames: ['span-8', 'offset-2'],
classNames: ['modal-edit-setting', 'span-8', 'offset-2'],
value: null,
removing: false,
codeMirrorOptions: cmOpts,
value: null,
formattedValue: null,
removing: false,
model: alias('modalService.modalOpts'),
model: alias('modalService.modalOpts'),
init() {
this._super(...arguments);
this.set('value', this.get('model.obj.value') || '');
if (this.get('model.kind') === 'json') {
this.set('formattedValue', JSON.stringify(JSON.parse(this.get('model.obj.value')), undefined, 2));
} else {
this.set('value', this.get('model.obj.value') || '');
}
},
didInsertElement() {
@ -49,6 +70,11 @@ export default Component.extend(ModalBase, {
done() {
this.send('cancel');
window.location.href = window.location.href;
},
updateJson(json) {
this.set('value', json);
}
},
});

View File

@ -15,6 +15,12 @@
{{textarea class="form-control" value=value rows=10}}
{{else if (eq model.kind 'int')}}
{{input-integer value=value class="form-control"}}
{{else if (eq model.kind 'json')}}
{{ivy-codemirror
value=formattedValue
valueUpdated=(action 'updateJson')
options=codeMirrorOptions
}}
{{else if (eq model.kind 'boolean')}}
<div class="radio">
<label>{{radio-button selection=value value="true"}} True</label>

View File

@ -56,6 +56,13 @@ $modal-overlay : rgba($light-grey, 0.75) !default;
padding: 20px;
margin-bottom: 20px;
&.modal-edit-setting {
.container-setting {
max-height: 70vh !important;
overflow-y: scroll;
}
}
&.large-modal {
&.modal-container {
width: calc(100% - 40px);
@ -120,4 +127,5 @@ $modal-overlay : rgba($light-grey, 0.75) !default;
.modal-yaml {
max-width: calc(100vw - 40px);
}
}

View File

@ -32,7 +32,7 @@
&.gitlab {
background-image: url('images/providers/gitlab.svg');
}
&.github-for-pipeline {
background-image: url('images/providers/github-for-pipeline.svg');
}
@ -95,3 +95,9 @@
}
}
}
.container-json-setting {
max-height: 50vh;
overflow-y: scroll;
margin-bottom: 15px;
}

View File

@ -83,6 +83,7 @@ module.exports = function(defaults) {
app.import('node_modules/prismjs/prism.js');
app.import('node_modules/prismjs/components/prism-bash.js');
app.import('node_modules/prismjs/components/prism-yaml.js');
app.import('node_modules/prismjs/components/prism-json.js');
app.import('node_modules/ember-source/dist/ember-template-compiler.js')
// app.import('vendor/aws-sdk-ec2.js');

View File

@ -1,59 +1,51 @@
<label class="acc-label mt-5">{{t 'authPage.azuread.configure.endpoints.label'}}{{field-required}}</label>
<div class="row">
<div class="col span-6">
<div class="radio">
<label>
{{radio-button selection=region value='standard'}} {{t 'authPage.azuread.configure.regions.standard'}}
</label>
</div>
</div>
</div>
<div class="row">
<div class="col span-6">
<div class="radio">
<label>
{{radio-button selection=region value='china'}} {{t 'authPage.azuread.configure.regions.china'}}
</label>
</div>
</div>
</div>
<div class="row">
<div class="col span-6">
<div class="radio">
<label>
{{radio-button selection=region value='custom'}} {{t 'authPage.azuread.configure.regions.custom'}}
</label>
</div>
</div>
</div>
{{!-- {{#if (eq region 'custom')}} --}}
<div class="row">
<div class="col span-6">
<div class="inline-form">
<label class="acc-label pb-5" for="endpoint">{{t 'authPage.azuread.configure.azureADEndpoint.label'}}{{field-required}}</label>
{{input id="endpoint" type="url" value=authConfig.endpoint classNames="form-control"}}
<div class="col span-3">
<div class="radio">
<label>
{{radio-button selection=region value='standard'}} {{t 'authPage.azuread.configure.regions.standard'}}
</label>
</div>
</div>
<div class="col span-6">
<div class="inline-form">
<label class="acc-label pb-5" for="graph-endpoint">{{t 'authPage.azuread.configure.azureADGraphEndpoint.label'}}{{field-required}}</label>
{{input id="graph-endpoint" type="url" value=authConfig.graphEndpoint classNames="form-control"}}
<div class="radio">
<label>
{{radio-button selection=region value='china'}} {{t 'authPage.azuread.configure.regions.china'}}
</label>
</div>
<div class="radio">
<label>
{{radio-button selection=region value='custom'}} {{t 'authPage.azuread.configure.regions.custom'}}
</label>
</div>
</div>
</div>
{{#if (eq region 'custom')}}
<div class="row">
<div class="col span-6">
<div class="inline-form">
<label class="acc-label pb-5" for="endpoint">{{t 'authPage.azuread.configure.azureADEndpoint.label'}}{{field-required}}</label>
{{input id="endpoint" type="url" value=authConfig.endpoint classNames="form-control"}}
</div>
</div>
<div class="col span-6">
<div class="inline-form">
<label class="acc-label pb-5" for="graph-endpoint">{{t 'authPage.azuread.configure.azureADGraphEndpoint.label'}}{{field-required}}</label>
{{input id="graph-endpoint" type="url" value=authConfig.graphEndpoint classNames="form-control"}}
</div>
</div>
</div>
<div class="row">
<div class="col span-6">
<div class="inline-form">
<label class="acc-label pb-5" for="token-endpoint" >{{t 'authPage.azuread.configure.azureADTokenEndpoint.label'}}{{field-required}}</label>
{{input id="token-endpoint" type="url" value=authConfig.tokenEndpoint classNames="form-control"}}
<div class="row">
<div class="col span-6">
<div class="inline-form">
<label class="acc-label pb-5" for="token-endpoint" >{{t 'authPage.azuread.configure.azureADTokenEndpoint.label'}}{{field-required}}</label>
{{input id="token-endpoint" type="url" value=authConfig.tokenEndpoint classNames="form-control"}}
</div>
</div>
<div class="col span-6">
<div class="inline-form">
<label class="acc-label pb-5" for="auth-endpoint">{{t 'authPage.azuread.configure.azureADAuthEndpoint.label'}}{{field-required}}</label>
{{input id="auth-endpoint" type="url" value=authConfig.authEndpoint classNames="form-control"}}
</div>
</div>
</div>
<div class="col span-6">
<div class="inline-form">
<label class="acc-label pb-5" for="auth-endpoint">{{t 'authPage.azuread.configure.azureADAuthEndpoint.label'}}{{field-required}}</label>
{{input id="auth-endpoint" type="url" value=authConfig.authEndpoint classNames="form-control"}}
</div>
</div>
</div>
{{!-- {{/if}} --}}
{{/if}}

View File

@ -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]);
});

View File

@ -26,15 +26,25 @@
</div>
{{else}}
<div class="">
<pre class="bg-setting m-0">
{{#if (eq row.kind "json" )}}
<div class="container-json-setting">
{{code-block
class="setting-json"
code=row.parsedJSON
language="json"
}}
</div>
{{else}}
<pre class="bg-setting m-0">
{{~#if row.obj.value~}}
{{~row.obj.value~}}
{{~else~}}
<span class="text-muted">&lt;none&gt;</span>
{{~/if~}}
</pre>
</pre>
{{/if}}
<div class="row mt-5">
{{#if (eq row.kind 'multiline')}}
{{#if (or (eq row.kind 'multiline') (eq row.kind 'json'))}}
<div class="btn bg-info btn-sm" {{action "showNode" row}}>Hide {{row.key}}</div>
{{/if}}
</div>

View File

@ -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);
},
});

View File

@ -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')
})
});

View File

@ -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': {},
};

View File

@ -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'