[PATCH] UI: Fix VM Delete Confirmation Dialog Box Title
by Zhou Zheng Sheng
Previously it was 'Power off Confirmation', this patch changes it to 'VM
Delete Confirmation'.
Signed-off-by: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
---
ui/js/src/kimchi.guest_main.js | 2 +-
ui/pages/i18n.html.tmpl | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/ui/js/src/kimchi.guest_main.js b/ui/js/src/kimchi.guest_main.js
index 510e7f9..ea36d62 100644
--- a/ui/js/src/kimchi.guest_main.js
+++ b/ui/js/src/kimchi.guest_main.js
@@ -108,7 +108,7 @@ kimchi.vmdelete = function(event) {
var vm = $(this).closest('li[name=guest]');
var vm_id=vm.attr("id");
var settings = {
- title : i18n['KCHVM6002M'],
+ title : i18n['KCHVM6008M'],
content : i18n['KCHVM6001M'],
confirm : i18n['KCHAPI6002M'],
cancel : i18n['KCHAPI6003M']
diff --git a/ui/pages/i18n.html.tmpl b/ui/pages/i18n.html.tmpl
index 98da828..7194792 100644
--- a/ui/pages/i18n.html.tmpl
+++ b/ui/pages/i18n.html.tmpl
@@ -134,6 +134,7 @@ var i18n = {
" the guest OS shutdown. Would you like to continue?")",
'KCHVM6006M': "$_("Shut Down Confirmation")",
'KCHVM6007M': "$_("Note the guest OS may ignore this request. Would you like to continue?")",
+ 'KCHVM6008M': "$_("VM Delete Confirmation")",
'KCHVMCD6001M': "$_("This CDROM will be detached permanently and you can re-attach it. Continue to detach it?")",
'KCHVMCD6002M': "$_("Attach")",
--
1.9.0
10 years, 6 months
[PATCH] adjust the width of host info-container
by shaohef@linux.vnet.ibm.com
From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
the layout is wrong in firefox, fix it.
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
---
ui/css/theme-default/host.css | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ui/css/theme-default/host.css b/ui/css/theme-default/host.css
index 6a1a308..ed28d25 100644
--- a/ui/css/theme-default/host.css
+++ b/ui/css/theme-default/host.css
@@ -117,7 +117,7 @@
.host-panel .info-container {
padding-top: 16px;
- width: 892px;
+ width: 890px;
}
.host-panel .section-header {
--
1.9.0
10 years, 6 months
[PATCH] Exception: fix exception details when not specified
by lvroyce@linux.vnet.ibm.com
From: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
Not every validation error needs to translate for user,
we define user interested errors,
other developer interested error should report directly by schema validator,
and handled by developer directly.
fix exception handling for this situation.
Signed-off-by: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
Signed-off-by: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
---
src/kimchi/control/utils.py | 6 ++++--
src/kimchi/exception.py | 2 +-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/kimchi/control/utils.py b/src/kimchi/control/utils.py
index 5e63816..a67f627 100644
--- a/src/kimchi/control/utils.py
+++ b/src/kimchi/control/utils.py
@@ -98,8 +98,10 @@ def validate_params(params, instance, action):
try:
validator.validate(request)
except ValidationError, e:
- raise InvalidParameter(e.schema['error'], {'value': str(e.instance)})
-
+ if e.schema.get('error'):
+ raise InvalidParameter(e.schema['error'], {'value': str(e.instance)})
+ else:
+ raise InvalidParameter(e.message)
class UrlSubNode(object):
diff --git a/src/kimchi/exception.py b/src/kimchi/exception.py
index fcf60cc..5a292e0 100644
--- a/src/kimchi/exception.py
+++ b/src/kimchi/exception.py
@@ -62,7 +62,7 @@ class KimchiException(Exception):
# itself to a unicode string.
args[key] = unicode(value)
- return unicode(translation.gettext(text), 'utf-8') % args
+ return translation.gettext(text).encode('utf-8') % args
class NotFoundError(KimchiException):
--
1.8.3.2
10 years, 6 months
[PATCH] Remove unused listDeepScanIsos function
by Rodrigo Trujillo
The function listDeepScanIsos is not being used in the Kimchi code. It
was replaced by stepListDeepScanIsos.
---
ui/js/src/kimchi.api.js | 24 ------------------------
1 file changed, 24 deletions(-)
diff --git a/ui/js/src/kimchi.api.js b/ui/js/src/kimchi.api.js
index 7d85fdf..5f3bf00 100644
--- a/ui/js/src/kimchi.api.js
+++ b/ui/js/src/kimchi.api.js
@@ -481,30 +481,6 @@ var kimchi = {
return deepScanHandler;
},
- listDeepScanIsos : function(suc, err) {
- var isoPool = 'iso' + new Date().getTime();
- kimchi.createStoragePool({
- name : isoPool,
- type : 'kimchi-iso',
- path : '/'
- }, function(result) {
- var taskId = result.task_id;
- function monitorTask() {
- kimchi.getTask(taskId, function(result) {
- var status = result.status;
- if (status === "finished") {
- kimchi.listStorageVolumes(isoPool, suc, err);
- } else if (status === "running") {
- setTimeout(monitorTask, 50);
- } else if (status === "failed") {
- err(result.message);
- }
- }, err);
- }
- monitorTask();
- }, err);
- },
-
getTask : function(taskId, suc, err) {
kimchi.requestJSON({
url : kimchi.url + 'tasks/' + encodeURIComponent(taskId),
--
1.9.0
10 years, 6 months
[PATCH] Rename kimchi.template to kimchi.substitute
by Hongliang Wang
This function was designed to substitute variables in HTML template strings originally
so it was named as kimchi.template, and it can be used in other scenarios, e.g. we use
it when we load plugins we have a unified URL for plugin XML files:
/plugins/{plugin}/ui/config/tab-ext.xml
and after we have the plugins list, we can easily generate the corresponding URLs like
/plugins/pluginA/ui/config/tab-ext.xml,
/plugins/pluginB/ui/config/tab-ext.xml.
by list ['pluginA', 'pluginB'].
Though it is sometimes misunderstood to be related with VM templates.
Renamed it in this patch.
Signed-off-by: Hongliang Wang <hlwang(a)linux.vnet.ibm.com>
---
ui/js/src/kimchi.grid.js | 2 +-
ui/js/src/kimchi.guest_add_main.js | 2 +-
ui/js/src/kimchi.guest_edit_main.js | 4 +--
ui/js/src/kimchi.guest_media_main.js | 2 +-
ui/js/src/kimchi.host.js | 2 +-
ui/js/src/kimchi.main.js | 2 +-
ui/js/src/kimchi.network.js | 2 +-
ui/js/src/kimchi.storage_main.js | 4 +--
ui/js/src/kimchi.storagepool_add_main.js | 2 +-
ui/js/src/kimchi.substitute.js | 45 ++++++++++++++++++++++++++++++++
ui/js/src/kimchi.template.js | 45 --------------------------------
ui/js/src/kimchi.template_add_main.js | 4 +--
ui/js/src/kimchi.template_edit_main.js | 2 +-
ui/js/src/kimchi.template_main.js | 2 +-
14 files changed, 60 insertions(+), 60 deletions(-)
create mode 100644 ui/js/src/kimchi.substitute.js
delete mode 100644 ui/js/src/kimchi.template.js
diff --git a/ui/js/src/kimchi.grid.js b/ui/js/src/kimchi.grid.js
index 055f487..2c70969 100644
--- a/ui/js/src/kimchi.grid.js
+++ b/ui/js/src/kimchi.grid.js
@@ -375,7 +375,7 @@ kimchi.widget.Grid.prototype = (function() {
var container = $('#' + containerID);
var gridID = this['opts']['id'];
var rowSelection = this['opts']['rowSelection'] || 'single';
- var domNode = $(kimchi.template(htmlStr, {
+ var domNode = $(kimchi.substitute(htmlStr, {
id: gridID,
loading: i18n['KCHGRD6001M'],
message: i18n['KCHGRD6002M'],
diff --git a/ui/js/src/kimchi.guest_add_main.js b/ui/js/src/kimchi.guest_add_main.js
index 2113099..eefd59a 100644
--- a/ui/js/src/kimchi.guest_add_main.js
+++ b/ui/js/src/kimchi.guest_add_main.js
@@ -25,7 +25,7 @@ kimchi.guest_add_main = function() {
var html = '';
var tmpl = $('#tmpl-template').html();
$.each(result, function(index, value) {
- html += kimchi.template(tmpl, value);
+ html += kimchi.substitute(tmpl, value);
});
$('#templateTile').html(html);
return;
diff --git a/ui/js/src/kimchi.guest_edit_main.js b/ui/js/src/kimchi.guest_edit_main.js
index 0236e2d..90dcb32 100644
--- a/ui/js/src/kimchi.guest_edit_main.js
+++ b/ui/js/src/kimchi.guest_edit_main.js
@@ -42,7 +42,7 @@ kimchi.guest_edit_main = function() {
$.each(storages, function(index, storage) {
storage['vm'] = kimchi.selectedGuest;
rowHTML = $('#' + storage['type'] + '-row-tmpl').html();
- var templated = kimchi.template(rowHTML, storage);
+ var templated = kimchi.substitute(rowHTML, storage);
container.append(templated);
});
@@ -96,7 +96,7 @@ kimchi.guest_edit_main = function() {
$(".action-area", item).toggleClass("hide");
};
var addItem = function(data) {
- var itemNode = $.parseHTML(kimchi.template($('#interface-tmpl').html(),data));
+ var itemNode = $.parseHTML(kimchi.substitute($('#interface-tmpl').html(),data));
$(".body", "#form-guest-edit-interface").append(itemNode);
$("select", itemNode).append(networkOptions);
if(data.network!==""){
diff --git a/ui/js/src/kimchi.guest_media_main.js b/ui/js/src/kimchi.guest_media_main.js
index 02009ec..d6dee2e 100644
--- a/ui/js/src/kimchi.guest_media_main.js
+++ b/ui/js/src/kimchi.guest_media_main.js
@@ -28,7 +28,7 @@ kimchi.guest_media_main = function() {
$.each(storages, function(index, storage) {
storage['vm'] = kimchi.selectedGuest;
- var templated = kimchi.template(rowHTML, storage);
+ var templated = kimchi.substitute(rowHTML, storage);
container.append(templated);
});
diff --git a/ui/js/src/kimchi.host.js b/ui/js/src/kimchi.host.js
index 4c94fc1..ee59a7e 100644
--- a/ui/js/src/kimchi.host.js
+++ b/ui/js/src/kimchi.host.js
@@ -485,7 +485,7 @@ kimchi.host_main = function() {
data['memory'] = kimchi.formatMeasurement(data['memory'], {
fixed: 2
});
- var templated = kimchi.template(htmlTmpl, data);
+ var templated = kimchi.substitute(htmlTmpl, data);
$('#host-content-container').html(templated);
initPage();
diff --git a/ui/js/src/kimchi.main.js b/ui/js/src/kimchi.main.js
index 86fed5b..184029d 100644
--- a/ui/js/src/kimchi.main.js
+++ b/ui/js/src/kimchi.main.js
@@ -69,7 +69,7 @@ kimchi.main = function() {
var tabs = retrieveTabs(tabConfigUrl);
kimchi.listPlugins(function(plugins) {
$(plugins).each(function(i, p) {
- var url = kimchi.template(pluginConfigUrl, {
+ var url = kimchi.substitute(pluginConfigUrl, {
plugin: p
});
tabs.push.apply(tabs, retrieveTabs(url));
diff --git a/ui/js/src/kimchi.network.js b/ui/js/src/kimchi.network.js
index ca6d29b..875bc08 100644
--- a/ui/js/src/kimchi.network.js
+++ b/ui/js/src/kimchi.network.js
@@ -63,7 +63,7 @@ kimchi.getNetworkItemHtml = function(network) {
}
var disable_in_use = network.in_use ? "ui-state-disabled" : "";
- var networkItem = kimchi.template($('#networkItem').html(), {
+ var networkItem = kimchi.substitute($('#networkItem').html(), {
name : network.name,
state : network.state,
type : network.type,
diff --git a/ui/js/src/kimchi.storage_main.js b/ui/js/src/kimchi.storage_main.js
index 6052510..1493124 100644
--- a/ui/js/src/kimchi.storage_main.js
+++ b/ui/js/src/kimchi.storage_main.js
@@ -25,7 +25,7 @@ kimchi.doListStoragePools = function() {
value.capacity = kimchi.changetoProperUnit(value.capacity,1);
value.allocated = kimchi.changetoProperUnit(value.allocated,1);
if ('kimchi-iso' !== value.type) {
- listHtml += kimchi.template(storageHtml, value);
+ listHtml += kimchi.substitute(storageHtml, value);
}
});
$('#storagepoolsList').html(listHtml);
@@ -172,7 +172,7 @@ kimchi.doListVolumes = function(poolObj) {
value.poolname = poolObj.data('name');
value.capacity = kimchi.changetoProperUnit(value.capacity,1);
value.allocation = kimchi.changetoProperUnit(value.allocation,1);
- listHtml += kimchi.template(volumeHtml, value);
+ listHtml += kimchi.substitute(volumeHtml, value);
});
volumeDiv.html(listHtml);
} else {
diff --git a/ui/js/src/kimchi.storagepool_add_main.js b/ui/js/src/kimchi.storagepool_add_main.js
index 86dbe7f..050aa90 100644
--- a/ui/js/src/kimchi.storagepool_add_main.js
+++ b/ui/js/src/kimchi.storagepool_add_main.js
@@ -30,7 +30,7 @@ kimchi.initStorageAddPage = function() {
valid_types = ['part', 'disk', 'mpath'];
$.each(data, function(index, value) {
if (valid_types.indexOf(value.type) != -1) {
- listHtml += kimchi.template(deviceHtml, value);
+ listHtml += kimchi.substitute(deviceHtml, value);
}
});
$('.host-partition').html(listHtml);
diff --git a/ui/js/src/kimchi.substitute.js b/ui/js/src/kimchi.substitute.js
new file mode 100644
index 0000000..27ca8ed
--- /dev/null
+++ b/ui/js/src/kimchi.substitute.js
@@ -0,0 +1,45 @@
+/*
+ * Project Kimchi
+ *
+ * Copyright IBM, Corp. 2013
+ *
+ * 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.
+ */
+kimchi.substitute = function(templatedStr, data, tag) {
+ tag = tag || /\{([^\}]+)\}/g;
+
+ var escapeHtml = function(html) {
+ return String(html)
+ .replace(/&/g, '&')
+ .replace(/</g, '<')
+ .replace(/>/g, '>')
+ .replace(/"/g, '"')
+ .replace(/'/g, ''');
+ };
+
+ return templatedStr.replace(tag, function(matchResult, express) {
+ var propertyArray = express.split('!');
+ var defaultValue = propertyArray[1] || '';
+ propertyArray = propertyArray[0].split('.');
+ var value = data, i = 0, l = propertyArray.length, property;
+ for (; i < l; i++) {
+ property = propertyArray[i];
+ if (value) {
+ value = value[property];
+ } else {
+ break;
+ }
+ }
+ return escapeHtml((value || value === 0) ? value : defaultValue);
+ });
+};
diff --git a/ui/js/src/kimchi.template.js b/ui/js/src/kimchi.template.js
deleted file mode 100644
index 082269f..0000000
--- a/ui/js/src/kimchi.template.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Project Kimchi
- *
- * Copyright IBM, Corp. 2013
- *
- * 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.
- */
-kimchi.template = function(templateStr, data, tag) {
- tag = tag || /\{([^\}]+)\}/g;
-
- var escapeHtml = function(html) {
- return String(html)
- .replace(/&/g, '&')
- .replace(/</g, '<')
- .replace(/>/g, '>')
- .replace(/"/g, '"')
- .replace(/'/g, ''');
- };
-
- return templateStr.replace(tag, function(matchResult, express) {
- var propertyArray = express.split('!');
- var defaultValue = propertyArray[1] || '';
- propertyArray = propertyArray[0].split('.');
- var value = data, i = 0, l = propertyArray.length, property;
- for (; i < l; i++) {
- property = propertyArray[i];
- if (value) {
- value = value[property];
- } else {
- break;
- }
- }
- return escapeHtml((value || value === 0) ? value : defaultValue);
- });
-};
diff --git a/ui/js/src/kimchi.template_add_main.js b/ui/js/src/kimchi.template_add_main.js
index dbb3952..e9adbac 100644
--- a/ui/js/src/kimchi.template_add_main.js
+++ b/ui/js/src/kimchi.template_add_main.js
@@ -152,7 +152,7 @@ kimchi.template_add_main = function() {
volume.isoId = isoId;
volume.capacity = kimchi.changetoProperUnit(volume.capacity, 1);
kimchi.isoInfo[isoId] = volume;
- html += kimchi.template(template, volume);
+ html += kimchi.substitute(template, volume);
}
});
$('#list-local-iso').append(html);
@@ -266,7 +266,7 @@ kimchi.template_add_main = function() {
if (!kimchi.isoInfo[isoId]) {
volume.isoId = isoId;
kimchi.isoInfo[isoId] = volume;
- html += kimchi.template(template, volume);
+ html += kimchi.substitute(template, volume);
}
});
$('#list-remote-iso').html(html);
diff --git a/ui/js/src/kimchi.template_edit_main.js b/ui/js/src/kimchi.template_edit_main.js
index 9ff8bcc..cffc685 100644
--- a/ui/js/src/kimchi.template_edit_main.js
+++ b/ui/js/src/kimchi.template_edit_main.js
@@ -87,7 +87,7 @@ kimchi.template_edit_main = function() {
var html = '';
var tmpl = $('#tmpl-network').html();
$.each(result, function(index, network) {
- html += kimchi.template(tmpl, network);
+ html += kimchi.substitute(tmpl, network);
});
$('#template-edit-network-list').html(html).show();
if(template.networks && template.networks.length > 0) {
diff --git a/ui/js/src/kimchi.template_main.js b/ui/js/src/kimchi.template_main.js
index 160ecc8..b90e3f3 100644
--- a/ui/js/src/kimchi.template_main.js
+++ b/ui/js/src/kimchi.template_main.js
@@ -22,7 +22,7 @@ kimchi.doListTemplates = function() {
var listHtml = '';
var templateHtml = $('#templateTmpl').html();
$.each(result, function(index, value) {
- listHtml += kimchi.template(templateHtml, value);
+ listHtml += kimchi.substitute(templateHtml, value);
});
$('#templateList').html(listHtml);
kimchi.templateBindClick();
--
1.8.1.4
10 years, 6 months
[PATCH] model.host: avoid redundant libvirt lookupByName API invocation
by Zhou Zheng Sheng
In HostModel._get_vms_list_by_state(), it gets a list of domain objects
and extracts the names, then it traverses the names and calls
lookupByName(name) to get domain objects. This is redundant because it
has a list of domain object already.
This patch fixes the problem.
Signed-off-by: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
---
src/kimchi/model/host.py | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/src/kimchi/model/host.py b/src/kimchi/model/host.py
index e9ac487..5844f4b 100644
--- a/src/kimchi/model/host.py
+++ b/src/kimchi/model/host.py
@@ -104,15 +104,9 @@ class HostModel(object):
def _get_vms_list_by_state(self, state):
conn = self.conn.get()
- names = [dom.name().decode('utf-8') for dom in conn.listAllDomains(0)]
-
- ret_list = []
- for name in names:
- dom = conn.lookupByName(name.encode("utf-8"))
- info = dom.info()
- if (DOM_STATE_MAP[info[0]]) == state:
- ret_list.append(name)
- return ret_list
+ return [dom.name().decode('utf-8')
+ for dom in conn.listAllDomains(0)
+ if (DOM_STATE_MAP[dom.info()[0]]) == state]
class HostStatsModel(object):
--
1.9.3
10 years, 6 months
[PATCH 1/2] Remove '.iso' extension checking from json schema
by Rodrigo Trujillo
Libvirt accepts iso files with names that do not end with '.iso'
extension. Also, Kimchi discovers ISOs stored in storagepools by the
file format, it does not care about file name.
This patch removes the .iso checking from API.json schema, then files
ending with '.iso.1', '.iso.bkp' or any other, can be used.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
src/kimchi/API.json | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/kimchi/API.json b/src/kimchi/API.json
index b9d371a..44a1439 100644
--- a/src/kimchi/API.json
+++ b/src/kimchi/API.json
@@ -361,7 +361,7 @@
"cdrom": {
"description": "Path for cdrom",
"type": "string",
- "pattern": "^((/)|(http)[s]?:|[t]?(ftp)[s]?:)+.*([.]iso)$",
+ "pattern": "^((/)|(http)[s]?:|[t]?(ftp)[s]?:)+.*$",
"required": true,
"error": "KCHTMPL0014E"
},
@@ -532,7 +532,7 @@
"cdrom": {
"description": "Path for cdrom",
"type": "string",
- "pattern": "^((/)|(http)[s]?:|[t]?(ftp)[s]?:)+.*([.]iso)$",
+ "pattern": "^((/)|(http)[s]?:|[t]?(ftp)[s]?:)+.*$",
"error": "KCHTMPL0014E"
},
"disks": {
--
1.9.0
10 years, 6 months
[PATCH 1/3] create a new login page
by shaohef@linux.vnet.ibm.com
From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
this page is used for the session timeout or first login.
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
Signed-off-by: Yu Xin Huo <huoyuxin(a)linux.vnet.ibm.com>
---
ui/images/progressing.gif | Bin 0 -> 1152 bytes
ui/pages/login.html.tmpl | 247 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 247 insertions(+)
create mode 100644 ui/images/progressing.gif
create mode 100644 ui/pages/login.html.tmpl
diff --git a/ui/images/progressing.gif b/ui/images/progressing.gif
new file mode 100644
index 0000000000000000000000000000000000000000..6552d41d9d4c874091bb51931c6adf64a95e8bd0
GIT binary patch
literal 1152
zcmZ?wbhEHb6k!ly*v!E2|NsBHckiA#b7s?~O&uK_IXO9@p`oUxrgCy}4A_9;e{Mh5
zkYH!W09PYD17=2`8pWS1oFWVy3_2k7AY&O=+5}E^`WY^hIhD@I;2`qkhUamCHs#2?
zD{Sl5ddqAu;o;E8n07H&VTOd$9w+z3Od8dz)1OOlg@hfQ?6P6gg)Nhut~h8s_iHy|
zTx?f<DfNuF4qs+in1T70o7P)P87f1<g5(0~t-`bz%`;<c7;R*Hby&0+Cd*D$nyx)7
zxH>hoEs9-2GEYbl<TO?^r*$AZO&~F#<dR{_!xK!0-EtLPZ*p|yWoF`%>SmZA?aQ<9
zUT3kA$h=8X2{%vLaEeZ2FfFvxHCy+@)2xTXXx&nW19L8~I4mhFCLSR*N5YUN_g8RC
zxvG$d3rC2Yoni>Hr8Z+mk+UtMt&Fyriq3S|nYyz*lh|s_)v7fmBnyPWjzbSOeSwpn
ztM^*GK3gr@WX{W=;H4@s$Eix`o#&Z+UC|vq;?Mm$*qz>q{MpOLKD$V>lW^GM@gRp<
zTfqAxmTMW#NQtz1Ow(GUENaLTnG@~OSSl%)a-~@^*=_L^Wu6LazRZG$dI^iu%U-z%
zg<00g*_8=1ySk){v9Pk(*~<9qvQD2qQDdsojG1{NY_a__TQemj7eK-u-Fqm>f>utm
zWMS=L&jJU059@Suul#8<RCK0juuU^pO9X~|9`=wYHdzoCYCehQmh?GGSt;IO&EY61
z^|cU^WKC}pQa3GC)^bS)J5HFrADAqr$@=Tg_KIeUMR6Q@nr+9QW_y9zNsLj!T)@YO
zmFW>EN`0IXPrZ>S5M3ptD%hrTMQhc8T>+_g4tF#}E)IMpc<k8J3C>bEce!tTI4V-^
zEEL|{;B8wW%<SUK!k*>CY&#hksVX{CWv466RGb|aXRcN%49rjY*aHrnWY;d4a(eT<
sn9_<U58lHODbH9KGQC;#6@s@G?AG7t-SQycLr1Fr#FC=U9tH+$0KoWQ9smFU
literal 0
HcmV?d00001
diff --git a/ui/pages/login.html.tmpl b/ui/pages/login.html.tmpl
new file mode 100644
index 0000000..e7afbb3
--- /dev/null
+++ b/ui/pages/login.html.tmpl
@@ -0,0 +1,247 @@
+#*
+ * Project Kimchi
+ *
+ * Copyright IBM, Corp. 2014
+ *
+ * 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.
+ *#
+#unicode UTF-8
+#import gettext
+#from kimchi.cachebust import href
+#silent t = gettext.translation($lang.domain, $lang.localedir, languages=$lang.lang)
+#silent _ = t.gettext
+#silent _t = t.gettext
+#from kimchi.config import get_version
+<!DOCTYPE html>
+<html lang="$lang.lang[0]">
+<head>
+<meta charset="UTF-8">
+<title>Kimchi</title>
+<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
+<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
+
+<style type="text/css">
+.login {
+ font-family: Arial;
+ margin: 0px;
+}
+
+.login input.invalid-field {
+ border-color: #C85305 !important;
+}
+
+.login .header {
+ background: none repeat scroll 0 0 #353D40;
+ border-bottom: 3px solid #008ABF;
+ border-top: 0 none;
+ box-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
+ height: 50px;
+ color: #F8F8F8;
+ font-size: 13px;
+ font-weight: 700;
+ font-family: Helvetica;
+ overflow: hidden;
+}
+
+.login .header .lang {
+ float: right;
+ margin-right: 20px;
+ margin-top: 14px;
+}
+
+.login .header .lang select {
+ vertical-align: middle;
+}
+
+.login .content-pane {
+ margin-left: auto;
+ margin-right: auto;
+ margin-top: 200px;
+ width: 260px;
+}
+
+.login .content-pane .trademark {
+ margin-bottom: 30px;
+}
+
+.login .content-pane .trademark .logo {
+ background: url("../images/logo.ico") no-repeat scroll center center transparent;
+ display: inline-block;
+ height: 25px;
+ width: 25px;
+ margin-left: -4px;
+ margin-right: 5px;
+ vertical-align: middle;
+}
+
+.login .content-pane .trademark .name {
+ vertical-align: middle;
+ padding-top: 2px;
+ font-weight: bold;
+ font-size: 18px;
+}
+
+.login .content-pane .trademark .version {
+ vertical-align: middle;
+ padding-top: 6px;
+ font-size: 13px;
+ padding-left: 6px;
+}
+
+.login .content-pane .message-area .item {
+ font-size: 12px;
+ margin-bottom: 30px;
+ margin-top: 30px;
+ height: 20px;
+}
+
+.login .content-pane .message-area .text {
+ color: #C85305;
+}
+
+.login .progress-indicator .progress-icon {
+ margin-right: 3px;
+ vertical-align: middle;
+ width: 15px;
+ height: 15px;
+}
+
+.login .progress-indicator .progress-text {
+ vertical-align: middle;
+ padding-top: 2px;
+}
+
+.login .content-pane .hint {
+ margin-bottom: 10px;
+ font-size: 14px;
+}
+
+.login .content-pane .field-area {
+ overflow: hidden;
+}
+
+.login .content-pane .field-area .text-field {
+ width: 240px;
+ padding: 5px 7px;
+ margin-bottom: 5px;
+ border: 1px solid #BABABA;
+ border-radius: 1px;
+}
+
+.login .button {
+ margin-top: 20px;
+ background: -moz-linear-gradient(center top , #1783BF 0%, #0C4C88 100%) repeat scroll 0 0 transparent;
+ border-color: #666666 #666666 #555555;
+ border-image: none;
+ border-radius: 5px 5px 5px 5px;
+ border-style: solid;
+ border-width: 1px;
+ color: #DDDDDD;
+ cursor: pointer;
+ font-weight: bolder;
+ padding: 5px 10px;
+ float: right;
+}
+</style>
+
+<script>
+
+function validateForm() {
+ var user = document.forms["login"]["username"];
+ var pass = document.forms["login"]["password"];
+ var validateField = function(field){
+ field.className = "text-field";
+ var isValid = field.value && field.value.trim()!="" ? true : false;
+ if(!isValid) field.className += " invalid-field";
+ return isValid;
+ };
+ var isValid = validateField(user);
+ isValid = validateField(pass) && isValid;
+ if(isValid)
+ document.getElementById("messWait").style.display = "";
+ return isValid;
+}
+
+function getCookie(cname) {
+ var name = cname + "=";
+ var ca = document.cookie.split(';');
+ for(var i=0; i<ca.length; i++) {
+ var c = ca[i].trim();
+ if (c.indexOf(name)==0) return c.substring(name.length,c.length);
+ }
+ return null;
+}
+
+function setCookie(cname,cvalue,exdays) {
+ var d = new Date();
+ d.setTime(d.getTime()+(exdays*24*60*60*1000));
+ var expires = "expires="+d.toGMTString();
+ document.cookie = cname + "=" + cvalue + "; " + expires;
+}
+
+function init() {
+ var defaultLang = 'en_US';
+ var clientLang = document.getElementById('userLang').value;
+ var persistLang = getCookie('kimchiLang');
+ document.getElementById("userLang").value = persistLang || clientLang || defaultLang;
+/*
+ var url = window.location.href;
+ if(url.indexOf("wrongUserPass")!=-1)
+ document.getElementById("messUserPass").style.display = "";
+ if(url.indexOf("sessionTimeout")!=-1)
+ document.getElementById("messSession").style.display = "";
+*/
+}
+
+function changeLang() {
+ var lang = document.getElementById('userLang').value;
+ setCookie('kimchiLang', lang, 365);
+ window.location.reload();
+}
+
+</script>
+</head>
+<body class="login" onload="init()">
+
+<div class="header">
+ <div class="lang">
+ <label>$_("Language"):</label>
+ <select id="userLang" onchange="changeLang()">
+ <option value="en_US">English (US)</option>
+ <option value="zh_CN">中文(简体)</option>
+ <option value="pt_BR">Português (Brasil)</option>
+ </select>
+ </div>
+</div>
+<div class="content-pane">
+ <div class="trademark"><span class="logo"></span><span class="name">Kimchi</span><span class="version">1.2</span></div>
+ <div class="message-area">
+ <div id="messUserPass" class="item text" style="display: none;">$_("User Name or password is incorrect.")</div>
+ <div id="messSession" class="item text" style="display: none;">$_("Session timeout, please re-login.")</div>
+ <div id="messWait" class="item progress-indicator" style="display: none;">
+ <img src="images/progressing.gif" class="progress-icon"><span class="progress-text">$_("Processing")...</span>
+ </div>
+ </div>
+ <div class="hint">$_("Sign in with your linux account")</div>
+ <div class="field-area">
+ <form name="login" action="/login?next=$getVar('data.next', '/')" method="POST" onsubmit="return validateForm()">
+ <input type="hidden" name="next" value="$getVar('data.next', '/')">
+ <input type="text" name="username" placeholder="$_("User Name")" class="text-field" autofocus>
+ <input type="password" name="password" placeholder="$_("Password")" class="text-field">
+ <input type="submit" value="$_("Sign In")" class="button">
+ </form>
+ </div>
+</div>
+
+</body>
+</html>
--
1.9.3
10 years, 6 months
UI Design of "Properly display about template type (local or, remote) using icon or text information"
by Yu Xin Huo
Use the original icon when creating template to indicate whether it is
remote or local.
As shao he is new about UI stuff, tips below for reference.
_%kimchi-home%/ui/pages/tabs/templates.html.tmpl_
put an img tag after VM icon, use css 'position', 'width', 'height' to
control the size and position of the image.
<div class="template-icon template-icon-position">
<img alt="" src="{icon}">
/<img alt="" src="{location}" style="width: 20px; height: 20px;
position: relative; top: -15px; left: 47px;">/
</div>
_%kimchi-home%/ui/js/src/kimchi.template_main.js_
differentiate template is local or remote.
kimchi.doListTemplates = function() {
kimchi.listTemplates(function(result) {
if (result && result.length) {
$('#noTemplates').hide();
var listHtml = '';
var templateHtml = $('#templateTmpl').html();
$.each(result, function(index, value) {
/ if(isLocal){ //seek for some way to differentiate
local or remote//
// value.location =
"images/theme-default/icon-local.png";//
// }else{//
// value.location =
"images/theme-default/icon-remote.png";//
// }/
listHtml += kimchi.template(templateHtml, value);
});
$('#templateList').html(listHtml);
kimchi.templateBindClick();
} else {
$('#templateList').html('');
$('#noTemplates').show();
}
$('html').removeClass('processing');
}, function(err) {
kimchi.message.error(err.responseJSON.reason);
$('html').removeClass('processing');
});
};
10 years, 6 months
UI Design of "Properly display about template type (local or remote) using icon or text information"
by Yu Xin Huo
Use the original icon when creating template to indicate whether it is
remote or local.
As shao he is new about UI stuff, tips below for reference.
_%kimchi-home%/ui/pages/tabs/templates.html.tmpl_
put an img tag after VM icon, use css 'position', 'width', 'height' to
control the size and position of the image.
<div class="template-icon template-icon-position">
<img alt="" src="{icon}">
/<img alt="" src="{location}" style="width: 20px; height: 20px;
position: relative; top: -15px; left: 47px;">/
</div>
_%kimchi-home%/ui/js/src/kimchi.template_main.js_
differentiate template is local or remote.
kimchi.doListTemplates = function() {
kimchi.listTemplates(function(result) {
if (result && result.length) {
$('#noTemplates').hide();
var listHtml = '';
var templateHtml = $('#templateTmpl').html();
$.each(result, function(index, value) {
/ if(isLocal){ //seek for some way to differentiate
local or remote//
// value.location =
"images/theme-default/icon-local.png";//
// }else{//
// value.location =
"images/theme-default/icon-remote.png";//
// }/
listHtml += kimchi.template(templateHtml, value);
});
$('#templateList').html(listHtml);
kimchi.templateBindClick();
} else {
$('#templateList').html('');
$('#noTemplates').show();
}
$('html').removeClass('processing');
}, function(err) {
kimchi.message.error(err.responseJSON.reason);
$('html').removeClass('processing');
});
};
10 years, 6 months