mirror of https://github.com/rancher/ui.git
Page containers, show sysetm services in dropdown
This commit is contained in:
parent
c1fc172f4d
commit
4ec678ee41
|
|
@ -34,6 +34,7 @@ export default Ember.Component.extend({
|
|||
showStats: false,
|
||||
showInstanceState: true,
|
||||
pagingLabel: 'pagination.container',
|
||||
paging: true,
|
||||
|
||||
sortBy: 'name',
|
||||
|
||||
|
|
|
|||
|
|
@ -120,18 +120,20 @@
|
|||
</a>
|
||||
|
||||
<ul class="dropdown-menu dropdown-menu-right" data-dropdown-id="header-user-menu">
|
||||
{{#if accessEnabled}}
|
||||
{{#if accessEnabled}}
|
||||
<li role="presentation" class="user-auth">
|
||||
{{identity-block avatar=false identity=access.identity}}
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
<li role="separator" class="divider"></li>
|
||||
<li>{{#link-to "settings.projects"}}{{t 'nav.environment.manage'}}{{/link-to}}</li>
|
||||
{{#if isCaas}}
|
||||
<li>{{#link-to "user-preferences"}}{{t 'nav.userPreferences.link'}}{{/link-to}}</li>
|
||||
<li role="separator" class="divider"></li>
|
||||
<li>{{#link-to "settings.projects"}}{{t 'nav.environment.manage'}}{{/link-to}}</li>
|
||||
{{/if}}
|
||||
|
||||
<li>{{#link-to "user-preferences"}}{{t 'nav.userPreferences.link'}}{{/link-to}}</li>
|
||||
<li role="separator" class="divider"></li>
|
||||
|
||||
<li>{{#link-to "logout" class="user-logout"}}<i class="icon icon-logout"></i> {{t 'nav.user.logout'}}{{/link-to}}</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -55,7 +55,18 @@ export default Ember.Component.extend({
|
|||
list = list.filter(x => !exclude.includes(x.id));
|
||||
}
|
||||
|
||||
return this.get('allServices').group(list);
|
||||
let out = this.get('allServices').group(list);
|
||||
let selected = this.get('allServices').byId(this.get('selected'));
|
||||
if ( selected && !list.includes(selected) ) {
|
||||
out['(Selected)'] = [{
|
||||
id: selected.get('id'),
|
||||
name: selected.get('displayName'),
|
||||
kind: selected.get('type'),
|
||||
obj: selected,
|
||||
}];
|
||||
}
|
||||
|
||||
return out;
|
||||
}.property('allServices.list.[]','canBalanceTo','canHaveContainers'),
|
||||
|
||||
selectedChanged: function() {
|
||||
|
|
|
|||
|
|
@ -107,18 +107,8 @@ export default Ember.Mixin.create({
|
|||
|
||||
goToApi: function() {
|
||||
let url = this.get('links.self'); // http://a.b.c.d/v1/things/id, a.b.c.d is where the UI is running
|
||||
let endpoint = this.get('endpointSvc.absolute'); // http://e.f.g.h/ , does not include version. e.f.g.h is where the API actually is.
|
||||
url = url.replace(/https?:\/\/[^\/]+\/?/,endpoint);
|
||||
|
||||
// For local development where API doesn't match origin, add basic auth token
|
||||
if ( url.indexOf(window.location.origin) !== 0 && this.get('app.mode') === 'development' )
|
||||
{
|
||||
let token = this.get('cookies').get(C.COOKIE.TOKEN);
|
||||
if ( token )
|
||||
{
|
||||
url = Util.addAuthorization(url, C.USER.BASIC_BEARER, token);
|
||||
}
|
||||
}
|
||||
// let endpoint = this.get('endpointSvc.absolute'); // http://e.f.g.h/ , does not include version. e.f.g.h is where the API actually is.
|
||||
// url = url.replace(/https?:\/\/[^\/]+\/?/,endpoint);
|
||||
|
||||
window.open(url, '_blank');
|
||||
},
|
||||
|
|
|
|||
|
|
@ -3,11 +3,18 @@ import Ember from 'ember';
|
|||
export default Ember.Service.extend({
|
||||
intl: Ember.inject.service(),
|
||||
store: Ember.inject.service(),
|
||||
prefs: Ember.inject.service(),
|
||||
|
||||
list: function() {
|
||||
let intl = this.get('intl');
|
||||
let showSystem = this.get('prefs.showSystemResources');
|
||||
|
||||
return this.get('_allServices').filter((service) => service.get('system') !== true).map((service) => {
|
||||
let out = this.get('_allServices');
|
||||
if ( !showSystem ) {
|
||||
out = out.filter(x => x.get('system') !== true);
|
||||
}
|
||||
|
||||
return out.map((service) => {
|
||||
let stackName = service.get('stack.displayName') || '('+service.get('stackId')+')';
|
||||
|
||||
return {
|
||||
|
|
@ -19,7 +26,7 @@ export default Ember.Service.extend({
|
|||
obj: service,
|
||||
};
|
||||
});
|
||||
}.property('_allServices.@each.{id,system,displayName,type,hostname}'),
|
||||
}.property('_allServices.@each.{id,system,displayName,type,hostname}','prefs.showSystemResources'),
|
||||
|
||||
grouped: function() {
|
||||
return this.group(this.get('list'));
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import Ember from 'ember';
|
||||
import C from 'ui/utils/constants';
|
||||
import Util from 'ui/utils/util';
|
||||
|
||||
export default Ember.Service.extend({
|
||||
cookies: Ember.inject.service(),
|
||||
|
|
@ -69,15 +68,7 @@ export default Ember.Service.extend({
|
|||
project = '/projects/' + projectId;
|
||||
}
|
||||
|
||||
// For local development where API doesn't match origin, add basic auth token
|
||||
var authBase = base;
|
||||
if ( base.indexOf(window.location.origin) !== 0 && this.get('app.mode') === 'development')
|
||||
{
|
||||
var token = this.get('cookies').get(C.COOKIE.TOKEN);
|
||||
if ( token ) {
|
||||
authBase = Util.addAuthorization(base, C.USER.BASIC_BEARER, token);
|
||||
}
|
||||
}
|
||||
var authBase = window.location.origin + '/';
|
||||
|
||||
return {
|
||||
auth: {
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ module.exports = function(environment) {
|
|||
environment: environment,
|
||||
apiServer: 'http://localhost:8080',
|
||||
legacyApiEndpoint: '/v1',
|
||||
apiEndpoint: '/v2-beta',
|
||||
apiEndpoint: '/v2',
|
||||
catalogServer: '',
|
||||
catalogEndpoint: '/v1-catalog',
|
||||
authServer: '',
|
||||
|
|
@ -114,9 +114,9 @@ module.exports = function(environment) {
|
|||
kubernetesWorkload: '/r/projects/%PROJECTID%/kubernetes-dashboard:9090/api/v1/workload?itemsPerPage=1',
|
||||
mesosEndpoint: '/r/projects/%PROJECTID%/mesos-master:5050',
|
||||
swarmDashboard: '/r/projects/%PROJECTID%/portainer/',
|
||||
projectEndpoint: '/v2-beta/projects/%PROJECTID%',
|
||||
proxyEndpoint: '/v2-beta/proxy',
|
||||
wsEndpoint: '/v2-beta/projects/%PROJECTID%/subscribe' +
|
||||
projectEndpoint: '/v2/projects/%PROJECTID%',
|
||||
proxyEndpoint: '/v2/proxy',
|
||||
wsEndpoint: '/v2/projects/%PROJECTID%/subscribe' +
|
||||
'?eventNames=resource.change' +
|
||||
'&limit=-1',
|
||||
baseAssets: '/',
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
"ansi_up": "^1.3.0",
|
||||
"broccoli-asset-rev": "^2.4.5",
|
||||
"dotenv": "^4.0.0",
|
||||
"ember-api-store": "2.2.0",
|
||||
"ember-api-store": "2.2.1",
|
||||
"ember-browserify": "^1.0.1",
|
||||
"ember-cli": "^2.12.1",
|
||||
"ember-cli-app-version": "^2.0.0",
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 178e091d996fe5dd05b2f9c34b447d36c2b2e165
|
||||
Subproject commit 6f7e52bf171e253ce70ee19ded57e18af60832ad
|
||||
Loading…
Reference in New Issue