mirror of https://github.com/rancher/ui.git
Merge pull request #1595 from vincent99/master
Settings, CA Certificate
This commit is contained in:
commit
9bb9bf5ded
|
|
@ -64,7 +64,7 @@ export default Route.extend(Preload, {
|
||||||
this.loadClusters(),
|
this.loadClusters(),
|
||||||
this.loadProjects(),
|
this.loadProjects(),
|
||||||
this.loadPreferences(),
|
this.loadPreferences(),
|
||||||
//this.loadPublicSettings(),
|
this.loadPublicSettings(),
|
||||||
]);
|
]);
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
return this.loadingError(err, transition);
|
return this.loadingError(err, transition);
|
||||||
|
|
@ -142,13 +142,7 @@ export default Route.extend(Preload, {
|
||||||
},
|
},
|
||||||
|
|
||||||
loadPublicSettings() {
|
loadPublicSettings() {
|
||||||
return get(this,'globalStore').find('setting', null, {
|
return get(this,'globalStore').find('setting', null, { url: 'settings' });
|
||||||
url: 'settings',
|
|
||||||
forceReload: true,
|
|
||||||
filter: {
|
|
||||||
all: 'false'
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
loadSecrets() {
|
loadSecrets() {
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ export default Route.extend({
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
return this.get('settings').load([
|
return this.get('settings').load([
|
||||||
C.SETTING.API_HOST,
|
C.SETTING.API_HOST,
|
||||||
C.SETTING.CATALOG_URL,
|
|
||||||
C.SETTING.TELEMETRY,
|
C.SETTING.TELEMETRY,
|
||||||
]);
|
]);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,9 @@ export default Route.extend({
|
||||||
model() {
|
model() {
|
||||||
let store = this.get('globalStore');
|
let store = this.get('globalStore');
|
||||||
|
|
||||||
let def = JSON.parse(this.get(`settings.${C.SETTING.CLUSTER_TEMPLATE}`)) || {};
|
let def ={
|
||||||
def.type = 'cluster';
|
type: 'cluster'
|
||||||
|
};
|
||||||
|
|
||||||
let cluster = store.createRecord(def);
|
let cluster = store.createRecord(def);
|
||||||
cluster.set('nodes', []);
|
cluster.set('nodes', []);
|
||||||
|
|
|
||||||
|
|
@ -16,12 +16,6 @@
|
||||||
<td data-title="Version">{{settings.rancherVersion}}</td>
|
<td data-title="Version">{{settings.rancherVersion}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if settings.cattleVersion}}
|
|
||||||
<tr>
|
|
||||||
<td data-title="Component"><a href="https://github.com/rancher/cattle" target="_blank">{{t 'modalAboutComponent.cattle'}}</a></td>
|
|
||||||
<td data-title="Version">{{settings.cattleVersion}}</td>
|
|
||||||
</tr>
|
|
||||||
{{/if}}
|
|
||||||
{{#if settings.uiVersion}}
|
{{#if settings.uiVersion}}
|
||||||
<tr>
|
<tr>
|
||||||
<td data-title="Component"><a href="https://github.com/rancher/ui" target="_blank">{{t 'modalAboutComponent.ui'}}</a></td>
|
<td data-title="Component"><a href="https://github.com/rancher/ui" target="_blank">{{t 'modalAboutComponent.ui'}}</a></td>
|
||||||
|
|
@ -34,21 +28,16 @@
|
||||||
<td data-title="Version">{{settings.cliVersion}}</td>
|
<td data-title="Version">{{settings.cliVersion}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if settings.composeVersion}}
|
{{#if settings.helmVersion}}
|
||||||
<tr>
|
<tr>
|
||||||
<td data-title="Component"><a href="https://github.com/rancher/rancher-compose" target="_blank">{{settings.appName}} {{t 'modalAboutComponent.compose'}}</a></td>
|
<td data-title="Component"><a href="https://github.com/rancher/rancher-compose" target="_blank">{{t 'modalAboutComponent.helm'}}</a></td>
|
||||||
<td data-title="Version">{{settings.composeVersion}}</td>
|
<td data-title="Version">{{settings.helmVersion}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if settings.goMachineVersion}}
|
{{#if settings.dockerMachineVersion}}
|
||||||
<tr>
|
<tr>
|
||||||
<td data-title="Component"><a href="https://github.com/rancher/go-machine-service" target="_blank">{{t 'modalAboutComponent.machineService'}}</a></td>
|
<td data-title="Component"><a href="https://github.com/rancher/go-machine-service" target="_blank">{{t 'modalAboutComponent.machine'}}</a></td>
|
||||||
<td data-title="Version">
|
<td data-title="Version">{{t 'modalAboutComponent.dockerMachine'}}</td>
|
||||||
{{settings.goMachineVersion}}
|
|
||||||
{{#if settings.dockerMachineVersion}}
|
|
||||||
(<a href="https://github.com/docker/machine" target="_blank">{{t 'modalAboutComponent.dockerMachine'}}</a> {{settings.dockerMachineVersion}})
|
|
||||||
{{/if}}
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</table>
|
</table>
|
||||||
|
|
|
||||||
|
|
@ -23,11 +23,11 @@ export default Component.extend(ModalBase, NewOrEdit, {
|
||||||
},
|
},
|
||||||
|
|
||||||
displayEndpoint: function() {
|
displayEndpoint: function() {
|
||||||
return this.get('endpointService.api.display.account.current');
|
return this.get('endpointService.api.display.current');
|
||||||
}.property(),
|
}.property(),
|
||||||
|
|
||||||
linkEndpoint: function() {
|
linkEndpoint: function() {
|
||||||
return this.get('endpointService.api.auth.account.current');
|
return this.get('endpointService.api.auth.current');
|
||||||
}.property(),
|
}.property(),
|
||||||
|
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import { inject as service } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
import { get, set, computed } from '@ember/object';
|
import { get, set, computed } from '@ember/object';
|
||||||
|
import C from 'shared/utils/constants';
|
||||||
import Component from '@ember/component';
|
import Component from '@ember/component';
|
||||||
import ModalBase from 'shared/mixins/modal-base';
|
import ModalBase from 'shared/mixins/modal-base';
|
||||||
import layout from './template';
|
import layout from './template';
|
||||||
|
|
@ -9,8 +10,8 @@ kind: Config
|
||||||
clusters:
|
clusters:
|
||||||
- name: "%clusterName%"
|
- name: "%clusterName%"
|
||||||
cluster:
|
cluster:
|
||||||
api-version: v1%maybeInsecure%
|
|
||||||
server: "%baseUrl%/k8s/clusters/%clusterId%"
|
server: "%baseUrl%/k8s/clusters/%clusterId%"
|
||||||
|
api-version: v1%maybeCertificate%
|
||||||
|
|
||||||
users:
|
users:
|
||||||
- name: "%username%"
|
- name: "%username%"
|
||||||
|
|
@ -35,6 +36,7 @@ export default Component.extend(ModalBase, {
|
||||||
access: service(),
|
access: service(),
|
||||||
growl: service(),
|
growl: service(),
|
||||||
scope: service(),
|
scope: service(),
|
||||||
|
settings: service(),
|
||||||
modalService: service('modal'),
|
modalService: service('modal'),
|
||||||
|
|
||||||
token: null,
|
token: null,
|
||||||
|
|
@ -45,19 +47,31 @@ export default Component.extend(ModalBase, {
|
||||||
|
|
||||||
replaceVariables(str) {
|
replaceVariables(str) {
|
||||||
let base = window.location.origin;
|
let base = window.location.origin;
|
||||||
let insecure = false;
|
|
||||||
if ( base.indexOf('http://') === 0 ) {
|
if ( base.indexOf('http://') === 0 ) {
|
||||||
base = base.replace(/^http:\/\//,'https://');
|
base = base.replace(/^http:\/\//,'https://');
|
||||||
if ( ! window.location.port ) {
|
if ( ! window.location.port ) {
|
||||||
base += ':80';
|
base += ':80';
|
||||||
}
|
}
|
||||||
insecure = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const me = get(this, 'access.me');
|
const me = get(this, 'access.me');
|
||||||
const cluster = get(this, 'scope.currentCluster');
|
const cluster = get(this, 'scope.currentCluster');
|
||||||
const tokenObj = get(this, 'token');
|
const tokenObj = get(this, 'token');
|
||||||
|
|
||||||
|
let cert = get(this, `settings.${C.SETTING.CA_CERTS}`);
|
||||||
|
let wrapped;
|
||||||
|
if ( cert && cert.length ) {
|
||||||
|
let ary = [];
|
||||||
|
cert = btoa(cert);
|
||||||
|
let split = 45;
|
||||||
|
while ( cert.length ) {
|
||||||
|
ary.push(cert.substr(0,split))
|
||||||
|
cert = cert.substr(split);
|
||||||
|
split=72;
|
||||||
|
}
|
||||||
|
wrapped = ary.join('\\\n ').trim();
|
||||||
|
}
|
||||||
|
|
||||||
let token = '';
|
let token = '';
|
||||||
if ( tokenObj ) {
|
if ( tokenObj ) {
|
||||||
token = tokenObj.token;
|
token = tokenObj.token;
|
||||||
|
|
@ -65,9 +79,9 @@ export default Component.extend(ModalBase, {
|
||||||
|
|
||||||
return str
|
return str
|
||||||
.replace(/%baseUrl%/g, base)
|
.replace(/%baseUrl%/g, base)
|
||||||
.replace(/%maybeInsecure%/g,(insecure ? '\n insecure-skip-tls-verify: true' : ''))
|
|
||||||
.replace(/%clusterId%/g, get(cluster, 'id'))
|
.replace(/%clusterId%/g, get(cluster, 'id'))
|
||||||
.replace(/%clusterName%/g, get(cluster, 'displayName'))
|
.replace(/%clusterName%/g, get(cluster, 'displayName'))
|
||||||
|
.replace(/%maybeCertificate%/g, (wrapped ? '\n certificate-authority-data: "' + wrapped + '"': ''))
|
||||||
.replace(/%username%/g, get(me, 'username'))
|
.replace(/%username%/g, get(me, 'username'))
|
||||||
.replace(/%token%/g, token);
|
.replace(/%token%/g, token);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if (eq step 2)}}
|
{{#if (eq step 2)}}
|
||||||
<p>{{t 'k8sPage.configFile.usage.helpText' htmlSafe=true}}</p>
|
<p>{{t 'k8sPage.configFile.usage.helpText' htmlSafe=true}}</p>
|
||||||
<pre><code>{{kubeconfig}}</code></pre>
|
{{code-block language="yaml" code=kubeconfig}}
|
||||||
{{copy-to-clipboard tooltipText="" buttonText="copyToClipboard.tooltip" clipboardText=kubeconfig class="with-clip"}}
|
{{copy-to-clipboard tooltipText="" buttonText="copyToClipboard.tooltip" clipboardText=kubeconfig class="with-clip"}}
|
||||||
<p class="mt-10 mb-0">{{t 'k8sPage.configFile.usage.downloadText' downloadUrl=downloadUrl htmlSafe=true}}</p>
|
<p class="mt-10 mb-0">{{t 'k8sPage.configFile.usage.downloadText' downloadUrl=downloadUrl htmlSafe=true}}</p>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
||||||
|
|
@ -31,14 +31,8 @@ export default Component.extend({
|
||||||
cli[key.toLowerCase()] = settings.get(C.SETTING.CLI_URL[key]);
|
cli[key.toLowerCase()] = settings.get(C.SETTING.CLI_URL[key]);
|
||||||
});
|
});
|
||||||
|
|
||||||
let compose = {};
|
|
||||||
Object.keys(C.SETTING.COMPOSE_URL).forEach((key) => {
|
|
||||||
compose[key.toLowerCase()] = settings.get(C.SETTING.COMPOSE_URL[key]);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.setProperties({
|
this.setProperties({
|
||||||
cli: cli,
|
cli
|
||||||
compose: compose,
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,11 @@ import C from 'shared/utils/constants';
|
||||||
import { minorVersion } from 'shared/utils/parse-version';
|
import { minorVersion } from 'shared/utils/parse-version';
|
||||||
|
|
||||||
export function normalizeName(str) {
|
export function normalizeName(str) {
|
||||||
return str.replace(/\./g, C.SETTING.DOT_CHAR).toLowerCase();
|
return str; //.replace(/\./g, C.SETTING.DOT_CHAR).toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function denormalizeName(str) {
|
export function denormalizeName(str) {
|
||||||
return str.replace(new RegExp('['+C.SETTING.DOT_CHAR+']','g'),'.').toLowerCase();
|
return str; //.replace(new RegExp('['+C.SETTING.DOT_CHAR+']','g'),'.').toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Service.extend(Evented, {
|
export default Service.extend(Evented, {
|
||||||
|
|
@ -147,7 +147,6 @@ export default Service.extend(Evented, {
|
||||||
issueUrl: function() {
|
issueUrl: function() {
|
||||||
var str = '*Describe your issue here*\n\n\n---\n| Useful | Info |\n| :-- | :-- |\n' +
|
var str = '*Describe your issue here*\n\n\n---\n| Useful | Info |\n| :-- | :-- |\n' +
|
||||||
`|Versions|Rancher \`${this.get('rancherVersion')||'-'}\` ` +
|
`|Versions|Rancher \`${this.get('rancherVersion')||'-'}\` ` +
|
||||||
`Cattle: \`${this.get('cattleVersion')||'-'}\` ` +
|
|
||||||
`UI: \`${this.get('uiVersion')||'--'}\` |\n`;
|
`UI: \`${this.get('uiVersion')||'--'}\` |\n`;
|
||||||
|
|
||||||
if ( this.get('access.enabled') )
|
if ( this.get('access.enabled') )
|
||||||
|
|
@ -164,15 +163,13 @@ export default Service.extend(Evented, {
|
||||||
|
|
||||||
var url = C.EXT_REFERENCES.GITHUB + '/issues/new?body=' + encodeURIComponent(str);
|
var url = C.EXT_REFERENCES.GITHUB + '/issues/new?body=' + encodeURIComponent(str);
|
||||||
return url;
|
return url;
|
||||||
}.property('app.currentRouteName','access.{provider,admin}','cattleVersion','rancherVersion','uiVersion'),
|
}.property('app.currentRouteName','access.{provider,admin}','rancherVersion','uiVersion'),
|
||||||
|
|
||||||
rancherImage: alias(`asMap.${C.SETTING.IMAGE_RANCHER}.value`),
|
rancherImage: alias(`asMap.${C.SETTING.IMAGE_RANCHER}.value`),
|
||||||
rancherVersion: alias(`asMap.${C.SETTING.VERSION_RANCHER}.value`),
|
rancherVersion: alias(`asMap.${C.SETTING.VERSION_RANCHER}.value`),
|
||||||
composeVersion: alias(`asMap.${C.SETTING.VERSION_COMPOSE}.value`),
|
|
||||||
cattleVersion: alias(`asMap.${C.SETTING.VERSION_CATTLE}.value`),
|
|
||||||
cliVersion: alias(`asMap.${C.SETTING.VERSION_CLI}.value`),
|
cliVersion: alias(`asMap.${C.SETTING.VERSION_CLI}.value`),
|
||||||
dockerMachineVersion: alias(`asMap.${C.SETTING.VERSION_MACHINE}.value`),
|
dockerMachineVersion: alias(`asMap.${C.SETTING.VERSION_MACHINE}.value`),
|
||||||
goMachineVersion: alias(`asMap.${C.SETTING.VERSION_GMS}.value`),
|
helmVersion: alias(`asMap.${C.SETTING.VERSION_HELM}.value`),
|
||||||
|
|
||||||
_plValue: function() {
|
_plValue: function() {
|
||||||
let TRUE=true; // @TODO-2.0
|
let TRUE=true; // @TODO-2.0
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,6 @@ var C = {
|
||||||
CLUSTER_DEFAULT : 'defaultClusterId',
|
CLUSTER_DEFAULT : 'defaultClusterId',
|
||||||
LAST_SCALE_MODE : 'lastScaleMode',
|
LAST_SCALE_MODE : 'lastScaleMode',
|
||||||
LAST_NAMESPACE : 'lastNamespace',
|
LAST_NAMESPACE : 'lastNamespace',
|
||||||
SHOW_SYSTEM : 'showSystem',
|
|
||||||
SORT_STACKS_BY : 'sortStacksBy',
|
SORT_STACKS_BY : 'sortStacksBy',
|
||||||
TABLE_COUNT : 'tableCount',
|
TABLE_COUNT : 'tableCount',
|
||||||
THEME : 'theme',
|
THEME : 'theme',
|
||||||
|
|
@ -413,37 +412,27 @@ var C = {
|
||||||
},
|
},
|
||||||
|
|
||||||
SETTING: {
|
SETTING: {
|
||||||
// Dots in key names do not mix well with Ember, so we use $ in their place.
|
IMAGE_RANCHER: 'server-image',
|
||||||
DOT_CHAR: '$',
|
VERSION_RANCHER: 'server-version',
|
||||||
IMAGE_RANCHER: 'rancher$server$image',
|
VERSION_COMPOSE: 'compose-version',
|
||||||
VERSION_RANCHER: 'rancher$server$version',
|
VERSION_CLI: 'cli-version',
|
||||||
VERSION_COMPOSE: 'rancher$compose$version',
|
VERSION_MACHINE: 'machine-version',
|
||||||
VERSION_CLI: 'rancher$cli$version',
|
VERSION_HELM: 'helm-version',
|
||||||
VERSION_CATTLE: 'cattle$version',
|
|
||||||
VERSION_MACHINE: 'docker$machine$version',
|
|
||||||
VERSION_GMS: 'go$machine$service$version',
|
|
||||||
CLI_URL: {
|
CLI_URL: {
|
||||||
DARWIN: 'rancher$cli$darwin$url',
|
DARWIN: 'cli-url-darwin',
|
||||||
WINDOWS: 'rancher$cli$windows$url',
|
WINDOWS: 'cli-url-windows',
|
||||||
LINUX: 'rancher$cli$linux$url',
|
LINUX: 'cli-url-linux',
|
||||||
},
|
},
|
||||||
COMPOSE_URL: {
|
CA_CERTS: 'cacerts',
|
||||||
DARWIN: 'rancher$compose$darwin$url',
|
API_HOST: 'api-host',
|
||||||
WINDOWS: 'rancher$compose$windows$url',
|
ENGINE_URL: 'engine-install-url',
|
||||||
LINUX: 'rancher$compose$linux$url',
|
SUPPORTED_DOCKER: 'engine-supported-range',
|
||||||
},
|
NEWEST_DOCKER: 'engine-newest-version',
|
||||||
API_HOST: 'api$host',
|
TELEMETRY: 'telemetry-opt',
|
||||||
CATALOG_URL: 'catalog$url',
|
|
||||||
ENGINE_URL: 'engine$install$url',
|
AUTH_LOCAL_VALIDATE_DESC: 'auth-password-requirements-description',
|
||||||
SUPPORTED_DOCKER: 'supported$docker$range',
|
BALANCER_IMAGE: 'balancer-instance-image',
|
||||||
NEWEST_DOCKER: 'newest$docker$version',
|
FEEDBACK_FORM: 'ui-feedback-form',
|
||||||
TELEMETRY: 'telemetry$opt',
|
|
||||||
AUTH_LOCAL_VALIDATE_DESC: 'api$auth$local$validate$description',
|
|
||||||
BALANCER_IMAGE: 'lb$instance$image',
|
|
||||||
FEEDBACK_FORM: 'ui$feedback$form',
|
|
||||||
SHOW_SYSTEM: 'ui$show$system',
|
|
||||||
SHOW_CUSTOM_HOST: 'ui$show$custom$host',
|
|
||||||
CLUSTER_TEMPLATE: 'default$cluster$template',
|
|
||||||
},
|
},
|
||||||
|
|
||||||
TABLES: {
|
TABLES: {
|
||||||
|
|
@ -451,7 +440,7 @@ var C = {
|
||||||
},
|
},
|
||||||
|
|
||||||
THEME: {
|
THEME: {
|
||||||
AUTO_UPDATE_TIMER : 1800000,
|
AUTO_UPDATE_TIMER : 30*60*1000,
|
||||||
START_HOUR : 7,
|
START_HOUR : 7,
|
||||||
END_HOUR : 18,
|
END_HOUR : 18,
|
||||||
DEFAULT : 'ui-light',
|
DEFAULT : 'ui-light',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue