From 8b2fb6b253bd3b00a0608da4a835da266a2fff92 Mon Sep 17 00:00:00 2001 From: juanmont Date: Wed, 4 Jan 2017 16:41:06 +0100 Subject: [PATCH 1/2] B #4961 Added the possibility to introduce a empty ssh key --- .../public/app/tabs/settings-tab/panels/user-config.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/sunstone/public/app/tabs/settings-tab/panels/user-config.js b/src/sunstone/public/app/tabs/settings-tab/panels/user-config.js index 97d57100ba..a201d5ca9a 100644 --- a/src/sunstone/public/app/tabs/settings-tab/panels/user-config.js +++ b/src/sunstone/public/app/tabs/settings-tab/panels/user-config.js @@ -123,12 +123,7 @@ define(function(require) { $("#provision_add_ssh_key_form").submit(function() { var keypair = $('#provision_ssh_key', this).val(); - - if (!keypair.length) { - Notifier.notifyError(Locale.tr("You have to provide an SSH key")); - return false; - } - + var template_str = 'SSH_PUBLIC_KEY = "'+TemplateUtils.escapeDoubleQuotes(keypair)+'"'; Sunstone.runAction("User.append_template", "-1", template_str); From ed1d226149c695c4485b684965ac5315b0a6afa8 Mon Sep 17 00:00:00 2001 From: juanmont Date: Wed, 4 Jan 2017 16:49:32 +0100 Subject: [PATCH 2/2] B #4960 Settings field can be disabled --- .../app/tabs/settings-tab/panels/info.js | 2 +- .../tabs/settings-tab/panels/info/html.hbs | 149 ++++++++++++++++++ .../app/tabs/users-tab/panels/info-common.js | 4 +- 3 files changed, 153 insertions(+), 2 deletions(-) create mode 100644 src/sunstone/public/app/tabs/settings-tab/panels/info/html.hbs diff --git a/src/sunstone/public/app/tabs/settings-tab/panels/info.js b/src/sunstone/public/app/tabs/settings-tab/panels/info.js index 7a0d18fe39..ad21b07eef 100644 --- a/src/sunstone/public/app/tabs/settings-tab/panels/info.js +++ b/src/sunstone/public/app/tabs/settings-tab/panels/info.js @@ -34,7 +34,7 @@ define(function(require) { function Panel(info) { this.tabId = TAB_ID; - + info.tabId = this.tabId; return BasePanel.call(this, info); }; diff --git a/src/sunstone/public/app/tabs/settings-tab/panels/info/html.hbs b/src/sunstone/public/app/tabs/settings-tab/panels/info/html.hbs new file mode 100644 index 0000000000..bd11d209c6 --- /dev/null +++ b/src/sunstone/public/app/tabs/settings-tab/panels/info/html.hbs @@ -0,0 +1,149 @@ +{{! -------------------------------------------------------------------------- }} +{{! Copyright 2002-2016, OpenNebula Project, OpenNebula Systems }} +{{! }} +{{! Licensed under the Apache License, Version 2.0 (the "License"); you may }} +{{! not use this file except in compliance with the License. You may obtain }} +{{! a copy of the License at }} +{{! }} +{{! http://www.apache.org/licenses/LICENSE-2.0 }} +{{! }} +{{! Unless required by applicable law or agreed to in writing, software }} +{{! distributed under the License is distributed on an "AS IS" BASIS, }} +{{! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }} +{{! See the License for the specific language governing permissions and }} +{{! limitations under the License. }} +{{! -------------------------------------------------------------------------- }} + +
+
+ + + + + + + + + + + + + + + + + + {{{groupTrHTML}}} + + + + + + + + + + + + + + + + +
{{tr "Information"}}
{{tr "ID"}}{{element.ID}}
{{tr "Name"}}{{element.NAME}}
{{tr "Table Order"}}{{valOrDefault sunstone_template.TABLE_ORDER "-"}} +
+ +
+
{{tr "Language"}}{{valOrDefault sunstone_template.LANG "-"}} + {{#isTabActionEnabled tabId "Settings.change_language"}} +
+ +
+ {{/isTabActionEnabled}} +
{{tr "View"}}{{valOrDefault sunstone_template.DEFAULT_VIEW "-"}} + {{#isTabActionEnabled tabId "Settings.change_view"}} +
+ +
+ {{/isTabActionEnabled}} +
+
+
+
+
+ + + + + + + + + + + + + + + + + {{#isTabActionEnabled tabId "Settings.login_token"}} + + + + + {{/isTabActionEnabled}} + +
{{tr "Authentication"}}
{{tr "Authentication driver"}}{{element.AUTH_DRIVER}}
{{tr "Password"}} + + + {{#isTabActionEnabled tabId "Settings.change_password"}} +
+ +
+ {{/isTabActionEnabled}} +
+
+
+
+
+ + + + + + + +
{{tr "Public SSH Key"}} + {{#isTabActionEnabled tabId "Settings.ssh_key"}} + + {{/isTabActionEnabled}} +
+ + +

+ {{#if element.TEMPLATE.SSH_PUBLIC_KEY}} + {{element.TEMPLATE.SSH_PUBLIC_KEY}} + {{else}} + {{tr "You can provide a SSH Key for this User clicking on the edit button"}} + {{/if}} +

+ +
+
+
+
+
+
+ {{{templateTableHTML}}} +
+
diff --git a/src/sunstone/public/app/tabs/users-tab/panels/info-common.js b/src/sunstone/public/app/tabs/users-tab/panels/info-common.js index 12f5bedc21..94281d173f 100644 --- a/src/sunstone/public/app/tabs/users-tab/panels/info-common.js +++ b/src/sunstone/public/app/tabs/users-tab/panels/info-common.js @@ -21,6 +21,7 @@ define(function(require) { var TemplateInfo = require('hbs!./info/html'); var TemplateChgrpTr = require('hbs!./info/chgrp-tr'); + var TemplateInfoSettings = require('hbs!tabs/settings-tab/panels/info/html'); var ResourceSelect = require('utils/resource-select'); var TemplateUtils = require('utils/template-utils'); var Locale = require('utils/locale'); @@ -50,7 +51,8 @@ define(function(require) { function Panel(info) { this.title = Locale.tr("Info"); this.icon = "fa-info-circle"; - + if(info.tabId == "settings-tab") + TemplateInfo = TemplateInfoSettings; this.element = info[XML_ROOT]; return this;