Merge pull request #1636 from vincent99/master

Stuffs
This commit is contained in:
Vincent Fiduccia 2018-02-13 20:39:48 -07:00 committed by GitHub
commit 6b49fc6eeb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 50 additions and 298 deletions

View File

@ -1,4 +1,5 @@
import { scheduleOnce } from '@ember/runloop';
import { alias } from '@ember/object/computed';
import { inject as service } from '@ember/service';
import Controller from '@ember/controller';
import C from 'ui/utils/constants';
@ -16,13 +17,12 @@ export default Controller.extend({
group: NAMESPACE,
queryParams: ['tags','group'],
namespaces: null,
namespaces: alias('scope.currentProject.namespaces'),
nodes: null,
expandedInstances: null,
init() {
this._super(...arguments);
this.set('namespaces', this.get('store').all('namespace'));
this.set('nodes', this.get('store').all('node'));
this.set('expandedInstances',[]);
},
@ -50,15 +50,6 @@ export default Controller.extend({
return this.get('scope.currentCluster.state') === 'inactive' && !this.get('nodes.length');
}.property('scope.currentCluster.state','nodes.[]'),
simpleMode: false,
/*
simpleMode: function() {
let list = this.get('namespaces');
let bad = list.findBy('isDefault', false);
return !bad;
}.property('namespaces.@each.{system,isDefault}'),
*/
groupTableBy: function() {
if ( this.get('group') === NAMESPACE && !this.get('simpleMode') ) {
return 'namespace';
@ -81,6 +72,7 @@ export default Controller.extend({
let out = {};
let ok;
this.get('namespaces').forEach((obj) => {
ok = true;

View File

@ -13,8 +13,12 @@ export default Route.extend(Preload,{
model(params, transition) {
return get(this, 'globalStore').find('project', params.project_id).then((project) => {
return get(this,'scope').startSwitchToProject(project).then(() => {
return this.loadSchemas('store').then(() => {
return PromiseAll([
this.loadSchemas('clusterStore'),
this.loadSchemas('store'),
]).then(() => {
return PromiseAll([
this.preload('namespace','clusterStore'),
this.preload('pod'),
this.preload('workload'),
this.preload('dnsRecord'),

View File

@ -8,6 +8,7 @@ export default Route.extend({
modalService: service('modal'),
catalog: service(),
scope: service(),
clusterStore: service(),
parentRoute: 'catalog-tab',
@ -18,6 +19,7 @@ export default Route.extend({
},
model: function(params/*, transition*/) {
var store = get(this, 'store');
var clusterStore = get(this, 'clusterStore');
var dependencies = {
tpl: get(this, 'catalog').fetchTemplate(params.template),
@ -30,13 +32,13 @@ export default Route.extend({
if ( params.namespaceId )
{
dependencies.namespace = store.find('namespace', params.namespaceId);
dependencies.namespace = clusterStore.find('namespace', params.namespaceId);
}
return hash(dependencies, 'Load dependencies').then((results) => {
if ( !results.namespace )
{
results.namespace = store.createRecord({
results.namespace = clusterStore.createRecord({
type: 'namespace',
name: results.tpl.get('defaultName'),
answers: {},

View File

@ -32,7 +32,6 @@ export default Route.extend({
this._super(...arguments);
return hash({
namespaces: this.get('store').findAll('namespace'),
catalogs: this.get('catalog').fetchCatalogs({
headers: {
[C.HEADER.PROJECT_ID]: this.get('scope.currentProject.id')
@ -40,21 +39,21 @@ export default Route.extend({
}),
}).then((hash) => {
this.set('catalogs', hash.catalogs);
this.set('namespaces', hash.namespaces);
});
},
model(params) {
const project = this.get('scope.currentProject');
if (params.launchCluster) {
params.plusInfra = true;
} else {
params.plusInfra = this.get('scope.currentProject.clusterOwner') === true;
params.plusInfra = project.get('clusterOwner') === true;
}
let namespaces = this.get('namespaces');
return this.get('catalog').fetchTemplates(params).then((res) => {
res.catalog.forEach((tpl) => {
let exists = namespaces.findBy('externalIdInfo.templateId', tpl.get('id'));
let exists = this.get('project.namespaces').findBy('externalIdInfo.templateId', tpl.get('id'));
tpl.set('exists', !!exists);
});
res.catalogs = this.get('catalogs');

View File

@ -7,6 +7,7 @@ import C from 'ui/utils/constants';
export default Route.extend({
prefs: service(),
clusterStore: service(),
queryParams: {
containerName: {
@ -125,15 +126,15 @@ export default Route.extend({
},
getNamespaceId(params) {
const store = this.get('store');
const clusterStore = this.get('clusterStore');
let ns = null;
if ( params.namespaceId ) {
ns = store.getById('namespace', params.namespaceId);
ns = clusterStore.getById('namespace', params.namespaceId);
}
if ( !ns ) {
ns = store.getById('namespace', this.get(`prefs.${C.PREFS.LAST_NAMESPACE}`));
ns = clusterStore.getById('namespace', this.get(`prefs.${C.PREFS.LAST_NAMESPACE}`));
}
let namespaceId = null;

View File

@ -57,8 +57,8 @@ var Namespace = Resource.extend(StateCounts, {
router: service(),
globalStore: service(),
pods: hasMany('id', 'pod', 'namespaceId'),
workloads: hasMany('id', 'workload', 'namespaceId'),
pods: hasMany('id', 'pod', 'namespaceId', 'store'),
workloads: hasMany('id', 'workload', 'namespaceId', 'store'),
project: reference('projectId', 'project', 'globalStore'),
init() {

View File

@ -13,6 +13,7 @@ export default Resource.extend({
settings: service(),
modalService: service('modal'),
router: service(),
clusterStore: service(),
type: 'project',
name: null,
@ -22,6 +23,8 @@ export default Resource.extend({
projectRoleTemplateBindings: hasMany('id', 'projectRoleTemplateBinding', 'projectId'), // 2.0 bug projectId is wrong in the ptrb should be <cluster-id>:<project-id> instead of just <project-id>
roleTemplateBindings: alias('projectRoleTemplateBindings'),
namespaces: hasMany('id', 'namespace', 'projectId', 'clusterStore'),
actions: {
edit: function () {
get(this,'router').transitionTo('authenticated.cluster.projects.edit', get(this,'id'));

View File

@ -119,6 +119,10 @@
background-image: url('images/providers/custom-registry.svg');
}
@mixin import {
background-image: url('images/providers/custom-import.svg');
}
@mixin generic {
background-image: url('images/providers/generic-driver.svg');
}

View File

@ -54,6 +54,7 @@
&.vmwarevsphere { @include vmwarevsphere; }
&.other { @include other; }
&.custom { @include custom; }
&.import { @include import; }
&.aliyunecs { @include aliyunecs; }
&.amazoneks { @include amazoneks; }
&.azureaks { @include azureaks; }
@ -74,7 +75,7 @@
justify-content: center;
& > .nav-box-item {
min-height : 110px;
min-height : 150px;
flex : 0 1 auto;
position : relative;
outline : 0;
@ -196,47 +197,3 @@ ol > li::before {
.host-blurb {
margin-right: 10px;
}
.hosts-cloud-add {
.addtl-info {
.nav-boxes {
.nav-box-item {
height: 250px;
width: 250px;
border: none;
}
}
.price {
font-size: 4em;
line-height: 1em;
color:$success;
.addon {
font-size: .3em;
white-space: nowrap;
}
}
}
}
.hosts-cloud-new {
padding-bottom: 0px;
margin-bottom: 0px;
.tabs {
ul.tab-header {
li.active {
a {
background-color: transparent;
border-bottom: 2px solid $link-color;
}
}
li {
a {
font-size: 18px;
border: 0px;
background-color: transparent;
}
}
}
}
}

View File

@ -5,7 +5,7 @@ import { getOwner } from '@ember/application';
const headers = [
{
name: 'state',
sort: ['stateSort','name','id'],
sort: ['sortState','name','id'],
translationKey: 'generic.state',
width: 125,
},

View File

@ -24,17 +24,18 @@
<tr class="main-row">
<td data-title="{{dt.prefix}}">
<div class="mr-20">
{{input value=node.prefix}}
{{input class="input-sm" value=node.prefix}}
</div>
</td>
<td data-title="{{dt.count}}">
<div class="input-group mr-20">
{{input type="number" min="1" value=node.count}}
{{input class="input-sm" type="number" min="1" value=node.count}}
<span class="input-group-addon bg-default">x</span>
</div>
</td>
<td data-title="{{dt.nodeTemplate}}">
{{new-select
class="input-sm"
content=model.nodeTemplates
optionLabelPath="displayName"
optionValuePath="id"

View File

@ -1,55 +0,0 @@
import { alias } from '@ember/object/computed';
import Component from '@ember/component';
import Driver from 'shared/mixins/host-driver';
import layout from './template';
import { inject as service } from '@ember/service';
import { get, set, setProperties } from '@ember/object';
export default Component.extend(Driver, {
layout,
globalStore: service(),
router: service(),
errors: null,
host: null,
clonedModel: null,
hostOptions: null,
expandAll: null,
canAddOptions: false,
labelResource: alias('primaryResource'),
primaryResource: alias('clonedModel'),
requestedClusterId: alias('clonedModel.requestedClusterId'),
role: alias('clonedModel.role'),
inModal: false,
didReceiveAttrs() {
this._super(...arguments);
if (!this.get('expandFn')) {
this.set('expandFn', function(item) {
item.toggleProperty('expanded');
});
}
if (!get(this, 'router.currentRouteName').includes('clusters')) {
set(this, 'canAddOptions', true);
}
let cm = get(this, 'globalStore').createRecord({type: 'node'});
set(cm, 'nodeTemplateId', get(this, 'nodeTemplate.id'));
setProperties(this, {
hostOptions: get(this, `nodeTemplate.${this.get('nodeTemplate.driver')}Config`),
// @@TODO@@ - 11-28-17 - not sure we should be doing this this way how the heck do we know which host to clone labels from?
// clonedModel: this.get('host').clone(),
clonedModel: cm,
});
},
doneSaving: function(neu) {
if (get(this, 'inModal')){
set(this, 'clusterNodes', neu);
}
return this._super(...arguments);
},
});

View File

@ -1,80 +0,0 @@
<div class="hosts-cloud-add">
<section class="header clearfix">
<div class="row">
<div class="mb-0">
<h1>
{{t 'hostsPage.cloudHostsPage.addPage.header'}}
</h1>
</div>
</div>
</section>
<section class="mt-20">
<form>
<div class="row addtl-info">
<div class="col span-4">
<div class="nav-boxes driver">
{{#if driver.hasUi}}
<div class="nav-box-item driver machine-driver active {{parse-host-icon machineTemplate.driver}}"></div>
{{else}}
<div class="nav-box-item driver machine-driver active other"></div>
{{/if}}
</div>
</div>
<div class="col span-8 box">
<div>
<label class="acc-label pt-10" for="">{{t 'hostsPage.cloudHostsPage.addPage.template'}}</label>
{{machineTemplate.name}}
</div>
<hr/>
{{#if driver.hasUi}}
{{component (concat 'host-template-' machineTemplate.driver) machineTemplate=model.template hostOptions=hostOptions}}
{{else}}
{{component 'host-template-other' machineTemplate=model.template}}
{{/if}}
</div>
</div>
<div class="row">
<div class="col span-11-of-23 mt-0 mb-0">
{{form-name-description
name=prefix
nameRequired=true
nameLabel="hostsPage.cloudHostsPage.addPage.name.label"
namePlaceholder="hostsPage.cloudHostsPage.addPage.name.placeholder"
nameHelpText=nameCountLabel
descriptionShown=true
}}
</div>
<div class="col span-11-of-23 mt-0 mb-0 offset-1-of-23">
{{form-count
initialScale=1
setScale=(action (mut count))
}}
</div>
</div>
<hr />
{{#if canAddOptions}}
<div class="row">
{{form-cluster-select
classNames="mt-20 mb-20"
machine=clonedModel
clusters=clusters
hasCluster=cluster
requestedClusterId=requestedClusterId
role=role
}}
</div>
{{/if}}
{{!-- @@TODO@@ - 11-28-17 - not sure we should be doing this this way how the heck do we know which host to clone labels from? --}}
{{form-user-labels initialLabels=clonedModel.labels setLabels=(action 'setLabels') detailKey="formUserLabels.nodeDetail" expandAll=null}}
{{top-errors errors=errors}}
{{save-cancel save="save" cancel="cancel" createLabel='hostsPage.cloudHostsPage.addPage.launch'}}
</form>
</section>
</div>

View File

@ -1,16 +0,0 @@
import { alias, notEmpty } from '@ember/object/computed';
import Component from '@ember/component';
import layout from './template';
import { inject as service } from '@ember/service'
export default Component.extend({
layout,
scope: service(),
settings: service(),
cluster: alias('scope.currentCluster'),
canCreate: notEmpty('cluster.registrationToken.hostCommand'),
canImport: notEmpty('cluster.registrationToken.clusterCommand'),
header: true,
});

View File

@ -1,60 +0,0 @@
{{#if header}}
<section class="header">
<h1>{{t 'clusterWelcome.welcome'}}</h1>
<p>{{t 'clusterWelcome.noHost'}}</p>
</section>
{{/if}}
<div class="row">
<div class="col span-5 offset-1 text-center option option-primary {{unless canCreate 'option-disabled'}}">
<h2>{{t 'clusterWelcome.addHost'}}</h2>
<div class="box">
{{t 'clusterWelcome.embeddedDescription' appName=settings.appName htmlSafe=true}}
{{#if canCreate}}
<div class="links" style="top: auto; bottom: 30px;">
{{#link-to "authenticated.host-templates" (query-params clusterId=scope.currentCluster.id) class="btn bg-primary"}}{{t 'clusterWelcome.select'}}{{/link-to}}
</div>
{{/if}}
</div>
<div class="bubble bg-body round p-10"><img src="{{app.baseAssets}}assets/images/environment-standard.svg" class="mt-5" /></div>
</div>
{{!-- Import --}}
<div class="col span-5 text-center option {{unless canImport 'option-disabled'}}">
<h2>{{t 'clusterWelcome.importCluster'}}</h2>
<div class="box">
{{t 'clusterWelcome.importClusterDescription' appName=settings.appName htmlSafe=true}}
<div class="row">
<div class="col span-6 text-center">
<a class="block mb-5" target="_blank" rel="nofollow noreferrer" href="https://cloud.google.com/container-engine/">
<img src="{{app.baseAssets}}assets/images/providers/gke.svg" width="150" height="auto" />
</a>
</div>
<div class="col span-6 text-center">
<a class="block" target="_blank" rel="nofollow noreferrer" href="https://www.ibm.com/cloud-computing/bluemix/containers">
<img src="{{app.baseAssets}}assets/images/providers/bluemix.svg" width="150" height="auto" /><br/>
</a>
</div>
</div>
<div class="row">
<div class="col span-6 text-center">
<a class="block mb-5" target="_blank" rel="nofollow noreferrer" href="https://azure.microsoft.com/en-us/services/container-service/">
<img src="{{app.baseAssets}}assets/images/providers/acs.svg" width="150" height="auto" /><br/>
</a>
</div>
<div class="col span-6 text-center">
<a class="block mb-5" target="_blank" rel="nofollow noreferrer" href="https://www.ubuntu.com/kubernetes">
<img src="{{app.baseAssets}}assets/images/providers/ubuntu.svg" width="150" height="auto" />
</a>
</div>
</div>
{{#if canImport}}
<div class="links" style="top: auto; bottom: 30px;">
{{#link-to "authenticated.cluster.import" scope.currentCluster.id class="btn bg-primary"}}{{t 'clusterWelcome.select'}}{{/link-to}}
</div>
{{/if}}
</div>
<div class="bubble bg-body round p-10"><img src="{{app.baseAssets}}assets/images/environment-import.svg" class="mt-5" /></div>
</div>
</div>

View File

@ -12,6 +12,7 @@ import layout from './template';
export default Component.extend(NewOrEdit, {
layout,
clusterStore: service(),
intl: service(),
prefs: service(),
settings: service(),
@ -131,7 +132,7 @@ export default Component.extend(NewOrEdit, {
}
if ( namespaceId ) {
let namespace = this.get('store').getById('namespace', namespaceId);
let namespace = this.get('clusterStore').getById('namespace', namespaceId);
if ( namespace ) {
this.set('namespace', namespace);
}

View File

@ -1,6 +1,7 @@
import { observer, get } from '@ember/object';
import { next } from '@ember/runloop';
import { equal } from '@ember/object/computed';
import { alias, equal } from '@ember/object/computed';
import { inject as service } from '@ember/service';
import Component from '@ember/component';
import layout from './template';
@ -11,6 +12,7 @@ const CREATE = 'create';
export default Component.extend({
layout,
intl: service(),
scope: service(),
// Outputs
namespace: null,
@ -25,14 +27,13 @@ export default Component.extend({
isReuse: equal('mode', REUSE),
classNames: ['inline-form'],
choices: null,
choices: alias('scope.currentProject.namespaces'),
init() {
this._super(...arguments);
let all = this.get('store').all('namespace');
this.set('choices', all);
let all = this.get('choices');
this.set('createNamespace', this.get('store').createRecord({
this.set('createNamespace', this.get('clusterStore').createRecord({
type: 'namespace',
name: '',
}));

View File

@ -1 +0,0 @@
export { default } from 'shared/components/cloud-host-add-or-edit/component';

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -1905,10 +1905,10 @@ formIngress:
workload: Workload
service: DNS Record
formIngressBackends:
label: Target Backends
label: Target Backend
noRules: No Backends
addServiceLabel: Add a DNS Record
addWorkloadLabel: Add a Service
addServiceLabel: Service
addWorkloadLabel: Workload
service:
label: service
workload:
@ -4227,10 +4227,10 @@ schema:
inputHost:
label: Choose a Host...
inputService:
prompt: Choose a Service...
prompt: Choose a Workload...
custom: Custom
inputDnsRecord:
prompt: Choose a DNS Record...
prompt: Choose a Service...
inputSecret:
prompt: Choose a Secret...
@ -4454,10 +4454,9 @@ nav:
containers:
tab: Workloads
systemTab: System
balancers: Balancers
ingresses: Ingresses
ingresses: Load Balancing
containers: Workloads
dns: DNS
dns: Service Discovery
volumes: Volumes
k8s: Advanced
deploy: Deploy