diff --git a/app/admin-tab/host/controller.js b/app/admin-tab/host/controller.js deleted file mode 100644 index 3cce80eb3..000000000 --- a/app/admin-tab/host/controller.js +++ /dev/null @@ -1,96 +0,0 @@ -import Ember from 'ember'; - -function isPublic(name) { - if ( (name||'').trim().replace(/^https?:\/\//,'').match(/^(localhost|192\.168\.|172\.1[6789]\.|172\.2[0123456789]\.|172\.3[01]\.|10\.)/) ) - { - return false; - } - - return true; -} - -export default Ember.Controller.extend({ - queryParams: ['backToAdd'], - backToAdd: false, - thisPage: '', // Set by route - - errors: null, - customRadio: null, - custom: Ember.computed.equal('customRadio', 'yes'), - editing: true, - saving: false, - customValue: '', - - looksPublic: function() { - return isPublic(this.get('activeValue')); - }.property('activeValue'), - - activeValue: function() { - if ( this.get('custom') ) - { - return this.get('customValue').trim(); - } - else - { - return this.get('thisPage'); - } - }.property('custom','customValue','thisPage'), - - actions: { - save: function() { - var model = this.get('model'); - var value = this.get('activeValue'); - - if ( !value ) - { - this.set('errors', ['Please provide a DNS name or IP address.']); - return; - } - - // If your really want to set it to nothing... - if ( value === '__NONE__' ) - { - value = ' '; - } - - model.set('value', value); - - this.set('saving', true); - model.save().then(() => { - if ( this.get('backToAdd') ) - { - this.transitionToRoute('hosts.new'); - } - else - { - this.send('goToPrevious'); - } - }).catch((err) => { - this.set('errors', [err]); - }).finally(() => { - this.set('saving', false); - }); - - }, - - cancel: function() { - this.send('goToPrevious'); - } - }, - - customValueDidChange: function() { - var val = this.get('customValue')||''.trim(); - var idx = val.indexOf('/', 8); // 8 is enough for "https://" - if ( idx !== -1 ) - { - // Trim paths off of the URL - this.set('customValue', val.substr(0,idx)); - return; // We'll be back... - } - - if ( val ) - { - this.set('customRadio','yes'); - } - }.observes('customValue'), -}); diff --git a/app/admin-tab/host/route.js b/app/admin-tab/host/route.js deleted file mode 100644 index 7c967fec5..000000000 --- a/app/admin-tab/host/route.js +++ /dev/null @@ -1,56 +0,0 @@ -import Ember from 'ember'; -import C from 'ui/utils/constants'; -import { denormalizeName } from 'ui/services/settings'; - -export default Ember.Route.extend({ - endpoint: Ember.inject.service(), - - model: function() { - return this.get('store').find('setting', denormalizeName(C.SETTING.API_HOST)); - }, - - setupController: function(controller, model) { - var thisPage = window.location.origin; - controller.set('thisPage', thisPage); - var endpoint = this.get('endpoint.origin'); - var isDifferent = endpoint !== thisPage; - if ( endpoint !== thisPage ) - { - controller.set('customValue', endpoint); - } - - controller.set('model', model); - controller.set('error', null); - var value = model.get('value'); - if ( value ) - { - if ( value === thisPage ) - { - controller.set('customValue', ''); - controller.set('customRadio', 'no'); - } - else - { - controller.set('customValue', value); - controller.set('customRadio', 'yes'); - } - } - else if ( isDifferent ) - { - controller.set('customValue', endpoint); - controller.set('customRadio', 'yes'); - } - else - { - controller.set('customValue', ''); - controller.set('customRadio', 'no'); - } - }, - - resetController: function (controller, isExiting/*, transition*/) { - if (isExiting) - { - controller.set('backToAdd', false); - } - } -}); diff --git a/app/admin-tab/host/template.hbs b/app/admin-tab/host/template.hbs deleted file mode 100644 index 6bccf2b29..000000000 --- a/app/admin-tab/host/template.hbs +++ /dev/null @@ -1,37 +0,0 @@ -
- -
- -
- {{top-errors errors=errors}} -
We need to know a little about how your environment is set up before you can register hosts.
-
- -
-
What base URL should hosts use to connect to the Rancher API?
- -
- - {{thisPage}} -
- -
- - {{input type="text" class="form-control" value=customValue placeholder="e.g. rancher.mydomain.com" safeStyle="width: calc(100% - 150px); display: inline-block; min-width: 300px;"}} -
Don't include /v1 or any other path, but if you are doing SSL termination in front of Rancher, be sure to use https://.
-
- - {{#unless looksPublic}} -
- -

- Are you sure all the hosts you will create will be able to reach {{activeValue}} ?
It looks like a private IP or local network. -

-
- {{/unless}} -
- diff --git a/app/admin-tab/host/view.js b/app/admin-tab/host/view.js deleted file mode 100644 index 213018f41..000000000 --- a/app/admin-tab/host/view.js +++ /dev/null @@ -1,3 +0,0 @@ -import Ember from 'ember'; -export default Ember.View.extend({ -}); diff --git a/app/admin-tab/settings/controller.js b/app/admin-tab/settings/controller.js new file mode 100644 index 000000000..bf5d34c42 --- /dev/null +++ b/app/admin-tab/settings/controller.js @@ -0,0 +1,77 @@ +import Ember from 'ember'; +import C from 'ui/utils/constants'; + +export default Ember.Controller.extend({ + settings: Ember.inject.service(), + + queryParams: ['backToAdd'], + backToAdd: false, + + errors: null, + editing: true, + saving: false, + + + + actions: { + + setActiveCatalog: function(value) { + var out = []; + Object.keys(value).forEach((item) => { + if (item) { + out.push(`${item}=${value[item]}`); + } + }); + this.get('model').set('catalog', out.join(',')); + }, + + save: function() { + var model = this.get('model'); + var value = this.get('model.host'); + var propsOut = {}; + + if (!value) { + this.set('errors', ['Please provide a DNS name or IP address.']); + return; + } + + Object.keys(model).forEach((item) => { + switch (item) { + case 'host': + propsOut[C.SETTING.API_HOST] = model[item]; + break; + case 'catalog': + propsOut[C.SETTING.CATALOG_URL] = model[item]; + break; + case 'vm': + propsOut[C.SETTING.VM_ENABLED] = model[item]; + break; + default: + break; + } + }); + + this.set('saving', true); + this.get('settings').setProperties(propsOut).one('settingsPromisesResolved', () => { + + this.set('saving', false); + + if (this.get('backToAdd')) { + + this.transitionToRoute('hosts.new'); + } else { + + this.send('goToPrevious'); + } + + }); + + + }, + + cancel: function() { + this.send('goToPrevious'); + } + }, + +}); diff --git a/app/admin-tab/settings/route.js b/app/admin-tab/settings/route.js new file mode 100644 index 000000000..e34f6d50a --- /dev/null +++ b/app/admin-tab/settings/route.js @@ -0,0 +1,29 @@ +import Ember from 'ember'; +import C from 'ui/utils/constants'; + +export default Ember.Route.extend({ + endpoint: Ember.inject.service(), + settings: Ember.inject.service(), + + model: function() { + return this.get('store').findAll('setting').then((/* response */) => { + return Ember.Object.create({ + host: this.get('settings').get(C.SETTING.API_HOST), + catalog: this.get('settings').get(C.SETTING.CATALOG_URL), + vm: this.get('settings').get(C.SETTING.VM_ENABLED), + }); + }); + }, + + setupController: function(controller, model) { + /*not sure we need this anymore except maybe to set error to null?*/ + controller.set('model', model); + controller.set('error', null); + }, + + resetController: function(controller, isExiting /*, transition*/ ) { + if (isExiting) { + controller.set('backToAdd', false); + } + } +}); diff --git a/app/admin-tab/settings/template.hbs b/app/admin-tab/settings/template.hbs new file mode 100644 index 000000000..1b7f7ac7c --- /dev/null +++ b/app/admin-tab/settings/template.hbs @@ -0,0 +1,49 @@ +
+ +
+ +
+ {{top-errors errors=errors}} +
+ +
+ {{host-settings host=model.host sendActiveValue=(action (mut model.host))}} +
+ +{{#unless backToAdd}} +
+ {{catalog-settings catalog=model.catalog keymapChanged="setActiveCatalog"}} +
+ +
+

Virtual Machine

+
+
Here you can enable access to virtual machines.
+
+
+ +
+
+
+ +
+
+ +
+
+
+
+{{/unless}} + + + diff --git a/app/applications-tab/catalog/controller.js b/app/applications-tab/catalog/controller.js index 7104f6e03..c0989cbd9 100644 --- a/app/applications-tab/catalog/controller.js +++ b/app/applications-tab/catalog/controller.js @@ -1,6 +1,7 @@ import Ember from 'ember'; export default Ember.Controller.extend({ - queryParams: ['category'], + queryParams: ['category', 'catalogid'], category: 'all', + catalogid: 'library' }); diff --git a/app/applications-tab/catalog/index/controller.js b/app/applications-tab/catalog/index/controller.js index d5cfb62ff..0dfc14c32 100644 --- a/app/applications-tab/catalog/index/controller.js +++ b/app/applications-tab/catalog/index/controller.js @@ -4,6 +4,7 @@ export default Ember.Controller.extend({ application: Ember.inject.controller(), catalogController: Ember.inject.controller('applications-tab.catalog'), category: Ember.computed.alias('catalogController.category'), + selectedCatalog: Ember.computed.alias('catalogController.catalogid'), search: '', actions: { @@ -18,6 +19,8 @@ export default Ember.Controller.extend({ categories: Ember.computed.alias('model.categories'), + catalogIds: Ember.computed.alias('model.catalogIds'), + arrangedContent: function() { var search = this.get('search').toUpperCase(); var result = []; diff --git a/app/applications-tab/catalog/index/template.hbs b/app/applications-tab/catalog/index/template.hbs index 6c250b647..341577ae5 100644 --- a/app/applications-tab/catalog/index/template.hbs +++ b/app/applications-tab/catalog/index/template.hbs @@ -3,6 +3,19 @@
  • Catalog
  • +
    + + +
    +