The API to add/remove/update the cdrom is:
# to attach new storage
POST /vms/<id>/storages {<data>}
# to update a storage
PUT /vms/<id>/storages/<dev> {<data>}
# to deattach (remove) the storage
DELETE /vms/<id>/storages/<dev>
# to list all devices
GET /vms/<id>/storages
# to list all cdrom
GET /vms/<id>/storages?type=cdrom
As we have different ways to update a VM (PUT /vms/<id> and those I
listed above) I'd suggest to display the edit window in tabs:
| General | Storages |
| ^ | |
| Name: |
| OS: |
| Icon: |
And on Storages tabs we list all the cdrom's and allow user to
add/remove/update them.
What do you think?
Because the way you did, there are 2 actions associated with the same
button: "PUT /vms/<id>" and "PUT
/vms/<id>/storages/<dev>"
which caused some problems on my tests
Some comments inline below
On 02/27/2014 09:35 AM, Hongliang Wang wrote:
Allow user to manipulate CDROM(s) in a VM:
1) Attach one or more CDROM(s);
2) Replace a CDROM with another ISO file path;
3) Detach a CDROM from a VM.
Tested on Chrome.
Signed-off-by: Hongliang Wang <hlwang(a)linux.vnet.ibm.com>
---
ui/css/theme-default/guest-cdrom-add.css | 59 +++++++++++++++++
ui/css/theme-default/guest-cdrom-edit.css | 59 +++++++++++++++++
ui/css/theme-default/guest-edit.css | 90 ++++++++++++++++++++++++--
ui/images/theme-default/guest-icon-sprite.png | Bin 0 -> 6748 bytes
ui/js/src/kimchi.api.js | 68 +++++++++++++++++++
ui/js/src/kimchi.guest_cdrom_add_main.js | 82 +++++++++++++++++++++++
ui/js/src/kimchi.guest_cdrom_edit_main.js | 90 ++++++++++++++++++++++++++
ui/js/src/kimchi.guest_edit_main.js | 58 ++++++++++++++++-
ui/pages/guest-cdrom-add.html.tmpl | 76 ++++++++++++++++++++++
ui/pages/guest-cdrom-edit.html.tmpl | 76 ++++++++++++++++++++++
ui/pages/guest-edit.html.tmpl | 34 ++++++++++
ui/pages/i18n.html.tmpl | 5 ++
12 files changed, 690 insertions(+), 7 deletions(-)
create mode 100644 ui/css/theme-default/guest-cdrom-add.css
create mode 100644 ui/css/theme-default/guest-cdrom-edit.css
create mode 100644 ui/images/theme-default/guest-icon-sprite.png
create mode 100644 ui/js/src/kimchi.guest_cdrom_add_main.js
create mode 100644 ui/js/src/kimchi.guest_cdrom_edit_main.js
create mode 100644 ui/pages/guest-cdrom-add.html.tmpl
create mode 100644 ui/pages/guest-cdrom-edit.html.tmpl
diff --git a/ui/css/theme-default/guest-cdrom-add.css
b/ui/css/theme-default/guest-cdrom-add.css
new file mode 100644
index 0000000..622450e
--- /dev/null
+++ b/ui/css/theme-default/guest-cdrom-add.css
@@ -0,0 +1,59 @@
+/*
+ * Project Kimchi
+ *
+ * Copyright IBM, Corp. 2013
+ *
+ * Authors:
+ * Hongliang Wang <hlwang(a)linux.vnet.ibm.com>
+ *
we are not including the authors per file anymore.
> + * 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.
> + */
> +#guest-cdrom-add-window {
> + font-size: 13px;
> + height: 600px;
> + width: 700px;
> +}
> +
> +.guest-cdrom-add-fieldset {
> + padding: 1em;
> +}
> +
> +#guest-cdrom-add-window input[type="text"] {
> + font-size: 16px;
> + height: 38px;
> + background: #fff;
> + -webkit-border-radius: 5px;
> + border-radius: 5px;
> + box-shadow: 2px 2px 2px #eee inset;
> + border-top: 1px solid #bbb;
> + border-left: 1px solid #bbb;
> + padding-left: 10px;
> + width: 600px;
> +}
> +
> +#cdrom-error-message {
> + color: red;
> + padding: 5px;
> +}
> +
> +#vm-cdrom-button-add[disabled] {
> + background: #c0c0c0;
> + color: #ddd;
> + padding-left: 26px;
> +}
> +
> +#vm-cdrom-button-add.loading[disabled] {
> + background: url("../../images/theme-default/loading.gif") 7px center
no-repeat #c0c0c0;
> + color: #ddd;
> + padding-left: 26px;
> +}
> diff --git a/ui/css/theme-default/guest-cdrom-edit.css
b/ui/css/theme-default/guest-cdrom-edit.css
> new file mode 100644
> index 0000000..7014577
> --- /dev/null
> +++ b/ui/css/theme-default/guest-cdrom-edit.css
> @@ -0,0 +1,59 @@
> +/*
> + * Project Kimchi
> + *
> + * Copyright IBM, Corp. 2013
> + *
+ * Authors:
+ * Hongliang Wang <hlwang(a)linux.vnet.ibm.com>
+ *
> + * 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.
> + */
> +#guest-cdrom-edit-window {
> + font-size: 13px;
> + height: 600px;
> + width: 700px;
> +}
> +
> +.guest-cdrom-edit-fieldset {
> + padding: 1em;
> +}
> +
> +#guest-cdrom-edit-window input[type="text"] {
> + font-size: 16px;
> + height: 38px;
> + background: #fff;
> + -webkit-border-radius: 5px;
> + border-radius: 5px;
> + box-shadow: 2px 2px 2px #eee inset;
> + border-top: 1px solid #bbb;
> + border-left: 1px solid #bbb;
> + padding-left: 10px;
> + width: 600px;
> +}
> +
> +#cdrom-error-message {
> + color: red;
> + padding: 5px;
> +}
> +
> +#vm-cdrom-button-edit[disabled] {
> + background: #c0c0c0;
> + color: #ddd;
> + padding-left: 26px;
> +}
> +
> +#vm-cdrom-button-edit.loading[disabled] {
> + background: url("../../images/theme-default/loading.gif") 7px center
no-repeat #c0c0c0;
> + color: #ddd;
> + padding-left: 26px;
> +}
> diff --git a/ui/css/theme-default/guest-edit.css
b/ui/css/theme-default/guest-edit.css
> index 79fca83..aff262a 100644
> --- a/ui/css/theme-default/guest-edit.css
> +++ b/ui/css/theme-default/guest-edit.css
> @@ -20,13 +20,14 @@
> */
> #guest-edit-window {
> font-size: 13px;
> - height: 380px;
> - width: 420px;
> + height: 320px;
> + width: 1000px;
> }
>
> .guest-edit-fieldset {
> float: left;
> padding: 1em;
> + padding-right: 0;
> }
>
> .guest-edit-wrapper-label, .guest-edit-wrapper-controls {
> @@ -40,16 +41,20 @@
> }
>
> .guest-edit-wrapper-label {
> - width: 10em;
> + height: 38px;
> + line-height: 38px;
> + margin-top: 5px;
> + vertical-align: top;
> + width: 80px;
> }
>
> .guest-edit-wrapper-controls {
> - width: 18em;
> + width: 392px;
> }
>
> .guest-edit-wrapper-controls input[type="text"] {
> + font-size: 16px;
> height: 38px;
> - line-height: 38px;
> background: #fff;
> -webkit-border-radius: 5px;
> border-radius: 5px;
> @@ -57,7 +62,7 @@
> border-top: 1px solid #bbb;
> border-left: 1px solid #bbb;
> padding-left: 10px;
> - width: 100%;
> + width: 300px;
> }
>
> .guest-edit-wrapper-controls input[type="text"][disabled] {
> @@ -65,3 +70,76 @@
> background-color: #fafafa;
> cursor: not-allowed;
> }
> +
> +#guest-edit-cdrom-row-container {
> + max-height: 146px;
> + overflow: auto;
> +}
> +
> +.guest-edit-cdrom-button {
> + background: url("../images/theme-default/guest-icon-sprite.png")
no-repeat left top transparent;
> + border: none;
> + height: 25px;
> + vertical-align: middle;
> + width: 25px;
> +}
> +
> +.guest-edit-cdrom-button.attach {
> + margin-top: 5px;
> +}
> +
> +.guest-edit-cdrom-button.attach:hover {
> + background-position: 0 -27px;
> +}
> +
> +.guest-edit-cdrom-button.attach:focus {
> + background-position: 0 -54px;
> +}
> +
> +.guest-edit-cdrom-button.attach:active {
> + background-position: 0 -81px;
> +}
> +
> +.guest-edit-cdrom-button.attach[disabled] {
> + background-position: 0 -108px;
> +}
> +
> +.guest-edit-cdrom-button.replace {
> + background-position: -27px 0;
> +}
> +
> +.guest-edit-cdrom-button.replace:hover {
> + background-position: -27px -27px;
> +}
> +
> +.guest-edit-cdrom-button.replace:focus {
> + background-position: -27px -54px;
> +}
> +
> +.guest-edit-cdrom-button.replace:active {
> + background-position: -27px -81px;
> +}
> +
> +.guest-edit-cdrom-button.replace[disabled] {
> + background-position: -27px -108px;
> +}
> +
> +.guest-edit-cdrom-button.detach {
> + background-position: -54px 0;
> +}
> +
> +.guest-edit-cdrom-button.detach:hover {
> + background-position: -54px -27px;
> +}
> +
> +.guest-edit-cdrom-button.detach:focus {
> + background-position: -54px -54px;
> +}
> +
> +.guest-edit-cdrom-button.detach:active {
> + background-position: -54px -81px;
> +}
> +
> +.guest-edit-cdrom-button.detach[disabled] {
> + background-position: -54px -108px;
> +}
> diff --git a/ui/images/theme-default/guest-icon-sprite.png
b/ui/images/theme-default/guest-icon-sprite.png
> new file mode 100644
> index
0000000000000000000000000000000000000000..81edb5945d3bd204313a6d53b55cecf17ee97679
> GIT binary patch
> literal 6748
> zcma)BbyQSew7v`soze!4l2Ve=JxJ%!-O}9yh|~~L(jYJl(hSWYf=Ht@NQ0nAhjjVo
> zx86VR&$sSA=iIy3I(y&st#iM%_jlv9HC0Fm9})rpKmt)!)Wxh?m=S}Ii<uv)AoMW{
> zuFWeIMd06mSMeugI>tlbscP&407R7k4J;rxpAO^1^Mz<A;jMrkVUvhhyI{dFt|!j=
> zP+tWPH#d8CU(6!_D0tgj``X(v1vvXUF{wZ_wC$eT;{gDDH$+iRKX75cAS6_Org<RZ
> zCO?NQJwWyydFBy*3KNxfBK1dkVEar?rqvMfU@_5R1Zk7lJR7{r%ULs1(QHu0SZTC*
> zZrH$;5*4==z4J*<US1yb#?GdY{3JVPlr?8Ge{SU><!|;->YJcc{f*bsk&x_sk6G!E
> z*%jBC)oOBL0TUCGth~T`0Uw*6or*s466^S5bTMp032U^Hg)4>WhE->X%+}TW=YR~5
> zz%hW|$RK)rTl)L!*HJ|u5cA{6{-`zDY-H<zZL^7`Y0%BS7RVDT6|aMo{!gOgSfROl
> z1JpuOL!&^I9$ZQc7tpShE{8`65USC0*n3K#U%q<vijkLxXNjPjHr|?bG<eCT;kCM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ui/js/src/kimchi.api.js
> index 6433fe0..52ecdd8 100644
> --- a/ui/js/src/kimchi.api.js
> +++ b/ui/js/src/kimchi.api.js
> @@ -731,5 +731,73 @@ var kimchi = {
> success : suc,
> error : err
> });
> + },
> +
> + addVMStorage : function(settings, suc, err) {
> + var vm = encodeURIComponent(settings['vm']);
> + delete settings['vm'];
> + kimchi.requestJSON({
> + url : kimchi.url + 'vms/' + vm + '/storages',
> + type : 'POST',
> + contentType : 'application/json',
> + data : JSON.stringify(settings),
> + dataType : 'json',
> + success : suc,
> + error : err
> + });
> + },
> +
> + retrieveVMStorage : function(settings, suc, err) {
> + var vm = encodeURIComponent(settings['vm']);
> + var dev = encodeURIComponent(settings['dev']);
> + kimchi.requestJSON({
> + url : kimchi.url + "vms/" + vm + '/storages/' + dev,
> + type : 'GET',
> + contentType : 'application/json',
> + dataType : 'json',
> + success: suc,
> + error: err
> + });
> + },
> +
> + replaceVMStorage : function(settings, suc, err) {
> + var vm = encodeURIComponent(settings['vm']);
> + var dev = encodeURIComponent(settings['dev']);
> + kimchi.requestJSON({
> + url : kimchi.url + 'vms/' + vm + '/storages/' + dev,
> + type : 'PUT',
> + contentType : 'application/json',
> + data : JSON.stringify({
> + path: settings['path']
> + }),
> + dataType : 'json',
> + success : suc,
> + error : err
> + });
> + },
> +
> + deleteVMStorage : function(settings, suc, err) {
> + var vm = settings['vm'];
> + var dev = settings['dev'];
> + kimchi.requestJSON({
> + url : kimchi.url + 'vms/' + encodeURIComponent(vm) +
> + '/storages/' + encodeURIComponent(dev),
> + type : 'DELETE',
> + contentType : 'application/json',
> + dataType : 'json',
> + success : suc,
> + error : err
> + });
> + },
> +
> + listVMStorages : function(vm, suc, err) {
> + kimchi.requestJSON({
> + url : kimchi.url + 'vms/' + encodeURIComponent(vm) +
'/storages',
> + type : 'GET',
> + contentType : 'application/json',
> + dataType : 'json',
> + success : suc,
> + error : err
> + });
> }
> };
> diff --git a/ui/js/src/kimchi.guest_cdrom_add_main.js
b/ui/js/src/kimchi.guest_cdrom_add_main.js
> new file mode 100644
> index 0000000..8b19a57
> --- /dev/null
> +++ b/ui/js/src/kimchi.guest_cdrom_add_main.js
> @@ -0,0 +1,82 @@
> +/*
> + * Project Kimchi
> + *
> + * Copyright IBM, Corp. 2013
> + *
+ * Authors:
+ * Hongliang Wang <hlwang(a)linux.vnet.ibm.com>
+ *
Same I commented above
> + * 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.guest_cdrom_add_main = function() {
> + var cdromAddForm = $('#form-vm-cdrom-add');
> + var submitButton = $('#vm-cdrom-button-add');
> + var nameTextbox = $('input[name="dev"]', cdromAddForm);
> + var typeTextbox = $('input[name="type"]', cdromAddForm);
> + var pathTextbox = $('input[name="path"]', cdromAddForm);
> + var errorMessage = $('#cdrom-error-message');
> +
> + var submitForm = function(event) {
> + if(submitButton.prop('disabled')) {
> + return false;
> + }
> +
> + var dev = nameTextbox.val();
> + var type = typeTextbox.val();
> + var path = pathTextbox.val();
> + if(!path || path === '') {
> + return false;
> + }
> +
> + var formData = cdromAddForm.serializeObject();
> + $.each([submitButton, nameTextbox, pathTextbox], function(i, c) {
> + $(c).prop('disabled', true);
> + });
> +
$(submitButton).addClass('loading').text(i18n['KCHVM6004M']);
> + $(errorMessage).text('');
> +
> + var settings = {
> + vm: kimchi.selectedGuest,
> + type: type,
> + path: path
> + };
> +
> + if(dev && dev !== '') {
> + settings['dev'] = dev;
> + }
> +
> + kimchi.addVMStorage(settings, function(result) {
> + kimchi.window.close();
> + kimchi.topic('kimchi/vmCDROMAdded').publish({
> + result: result
> + });
> + }, function(result) {
> + var errText = result['reason'] ||
> + result['responseJSON']['reason'];
> + $(errorMessage).text(errText);
> +
> + $.each([submitButton, nameTextbox, pathTextbox], function(i, c) {
> + $(c).prop('disabled', false);
> + });
> +
$(submitButton).removeClass('loading').text(i18n['KCHVM6003M']);
> + });
> +
> + event.preventDefault();
> + };
> +
> + cdromAddForm.on('submit', submitForm);
> + submitButton.on('click', submitForm);
> + pathTextbox.on('input propertychange', function(event) {
> + $(submitButton).prop('disabled', $(this).val() === '');
> + });
> +};
> diff --git a/ui/js/src/kimchi.guest_cdrom_edit_main.js
b/ui/js/src/kimchi.guest_cdrom_edit_main.js
> new file mode 100644
> index 0000000..76ab459
> --- /dev/null
> +++ b/ui/js/src/kimchi.guest_cdrom_edit_main.js
> @@ -0,0 +1,90 @@
> +/*
> + * Project Kimchi
> + *
> + * Copyright IBM, Corp. 2013
> + *
+ * Authors:
+ * Hongliang Wang <hlwang(a)linux.vnet.ibm.com>
+ *
> + * 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.guest_cdrom_edit_main = function() {
> + var cdromEditForm = $('#form-vm-cdrom-edit');
> + var submitButton = $('#vm-cdrom-button-edit');
> + var nameTextbox = $('input[name="dev"]', cdromEditForm);
> + var typeTextbox = $('input[name="type"]', cdromEditForm);
> + var pathTextbox = $('input[name="path"]', cdromEditForm);
> + var errorMessage = $('#cdrom-error-message');
> + var originalPath = null;
> +
> + kimchi.retrieveVMStorage({
> + vm: kimchi.selectedGuest,
> + dev: kimchi.selectedGuestStorage
> + }, function(storage) {
> + for(var prop in storage) {
> + $('input[name="' + prop + '"]',
cdromEditForm).val(storage[prop]);
> + }
> +
> + originalPath = storage['path'];
> + });
> +
> + var submitForm = function(event) {
> + if(submitButton.prop('disabled')) {
> + return false;
> + }
> +
> + var path = pathTextbox.val();
> + if(!path || path === '') {
> + return false;
> + }
> +
> + $.each([submitButton, nameTextbox, pathTextbox], function(i, c) {
> + $(c).prop('disabled', true);
> + });
> +
$(submitButton).addClass('loading').text(i18n['KCHVM6006M']);
> + $(errorMessage).text('');
> +
> + var settings = {
> + vm: kimchi.selectedGuest,
> + dev: kimchi.selectedGuestStorage,
> + path: path
> + };
> +
> + kimchi.replaceVMStorage(settings, function(result) {
> + kimchi.window.close();
> + kimchi.topic('kimchi/vmCDROMReplaced').publish({
> + result: result
> + });
> + }, function(result) {
> + var errText = result['reason'] ||
> + result['responseJSON']['reason'];
> + $(errorMessage).text(errText);
> +
> + $.each([submitButton, nameTextbox, pathTextbox], function(i, c) {
> + $(c).prop('disabled', false);
> + });
> +
$(submitButton).removeClass('loading').text(i18n['KCHVM6005M']);
> + });
> +
> + event.preventDefault();
> + };
> +
> + cdromEditForm.on('submit', submitForm);
> + submitButton.on('click', submitForm);
> + pathTextbox.on('input propertychange', function(event) {
> + var invalid =
> + ($(this).val() === originalPath) ||
> + ($(this).val() === '');
> + $(submitButton).prop('disabled', invalid);
> + });
> +};
> diff --git a/ui/js/src/kimchi.guest_edit_main.js
b/ui/js/src/kimchi.guest_edit_main.js
> index 13ea9d0..1244dd0 100644
> --- a/ui/js/src/kimchi.guest_edit_main.js
> +++ b/ui/js/src/kimchi.guest_edit_main.js
> @@ -21,14 +21,69 @@
> kimchi.guest_edit_main = function() {
> var guestEditForm = $('#form-guest-edit');
> var saveButton = $('#guest-edit-button-save');
> +
> + var refreshCDROMs = function() {
> + kimchi.listVMStorages(kimchi.selectedGuest, function(storages) {
> + var rowHTML = $('#cdrom-row-tmpl').html();
> + var container = $('#guest-edit-cdrom-row-container');
> + $(container).empty();
> +
> + $.each(storages, function(index, storage) {
> + if(storage['type'] !== 'cdrom') {
> + return;
> + }
> +
> + storage['vm'] = kimchi.selectedGuest;
> + var templated = kimchi.template(rowHTML, storage);
> + container.append(templated);
> + });
> +
> + $('.replace', container).on('click', function(e) {
> + event.preventDefault();
> + kimchi.selectedGuestStorage = $(this).data('dev');
> + kimchi.window.open("guest-cdrom-edit.html");
> + });
> +
> + $('.detach', container).on('click', function(e) {
> + event.preventDefault();
> + var settings = {
> + title : i18n['KCHAPI6004M'],
> + content : i18n['KCHVM6002M'],
> + confirm : i18n['KCHAPI6002M'],
> + cancel : i18n['KCHAPI6003M']
> + };
> +
> + var dev = $(this).data('dev');
> + kimchi.confirm(settings, function() {
> + kimchi.deleteVMStorage({
> + vm: kimchi.selectedGuest,
> + dev: dev
> + }, function() {
> + refreshCDROMs();
> + });
> + });
> + });
> + });
> + };
> +
> kimchi.retrieveVM(kimchi.selectedGuest, function(guest) {
> guest['icon'] = guest['icon'] ||
'images/icon-vm.png';
> for ( var prop in guest) {
> $('input[name="' + prop + '"]',
guestEditForm).val(guest[prop]);
> }
> +
> + refreshCDROMs();
> +
> + $('#guest-edit-attach-cdrom-button').on('click',
function(event) {
> + event.preventDefault();
> + kimchi.window.open("guest-cdrom-add.html");
> + });
> +
> + kimchi.topic('kimchi/vmCDROMAdded').subscribe(refreshCDROMs);
> + kimchi.topic('kimchi/vmCDROMReplaced').subscribe(refreshCDROMs);
> });
>
> - $('#guest-edit-button-cancel').on('click', function() {
> + $('#guest-edit-button-cancel').on('click', function(event) {
> kimchi.window.close();
> });
>
> @@ -45,6 +100,7 @@ kimchi.guest_edit_main = function() {
> }, function(err) {
> kimchi.message.error(err.responseJSON.reason);
> });
> +
> event.preventDefault();
> };
>
> diff --git a/ui/pages/guest-cdrom-add.html.tmpl b/ui/pages/guest-cdrom-add.html.tmpl
> new file mode 100644
> index 0000000..65663a9
> --- /dev/null
> +++ b/ui/pages/guest-cdrom-add.html.tmpl
> @@ -0,0 +1,76 @@
> +#*
> + * Project Kimchi
> + *
> + * Copyright IBM, Corp. 2013
> + *
+ * Authors:
+ * Hongliang Wang <hlwang(a)linux.vnet.ibm.com>
+ *
> + * 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
> +<div id="guest-cdrom-add-window" class="window">
> + <header>
> + <h1 class="title">$_("Attach a CDROM to
VM")</h1>
> + <div class="close">X</div>
> + </header>
> + <div class="content">
> + <form id="form-vm-cdrom-add">
> + <section class="form-section">
> + <h2>1. $_("Device Name")</h2>
> + <div class="field">
> + <p class="text-help">
> + $_("The name used to identify the CDROM. If omitted, a
name will be chosen automatically.")
> + </p>
> + <input type="text" class="text"
name="dev" />
> + </div>
> + </section>
> + <section class="form-section">
> + <h2>2. $_("Device Type")</h2>
> + <div class="field">
> + <p class="text-help">
> + $_("The device type. Currently, only
\"cdrom\" is supported.")
> + </p>
> + <input type="text" class="text"
name="type" value="cdrom" readonly />
> + </div>
> + </section>
> + <section class="form-section">
> + <h2>3. $_("ISO File Path")</h2>
> + <div class="field">
> + <p class="text-help">
> + $_("The ISO file path in the server.")
> + </p>
> + <input type="text" class="text"
name="path" />
> + </div>
> + </section>
> + <section class="form-section">
> + <div id="cdrom-error-message"></div>
> + </section>
> + </form>
> + </div>
> + <footer>
> + <div class="btn-group">
> + <button id="vm-cdrom-button-add"
class="btn-normal" disabled="disabled">
> + <span
class="text">$_("Attach")</span>
> + </button>
> + </div>
> + </footer>
> +</div>
> +<script type="text/javascript">
> + kimchi.guest_cdrom_add_main();
> +</script>
> diff --git a/ui/pages/guest-cdrom-edit.html.tmpl
b/ui/pages/guest-cdrom-edit.html.tmpl
> new file mode 100644
> index 0000000..1af7e7e
> --- /dev/null
> +++ b/ui/pages/guest-cdrom-edit.html.tmpl
> @@ -0,0 +1,76 @@
> +#*
> + * Project Kimchi
> + *
> + * Copyright IBM, Corp. 2013
> + *
+ * Authors:
+ * Hongliang Wang <hlwang(a)linux.vnet.ibm.com>
+ *
> + * 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
> +<div id="guest-cdrom-edit-window" class="window">
> + <header>
> + <h1 class="title">$_("Replace a CDROM of
VM")</h1>
> + <div class="close">X</div>
> + </header>
> + <div class="content">
> + <form id="form-vm-cdrom-edit">
> + <section class="form-section">
> + <h2>1. $_("Device Name")</h2>
> + <div class="field">
> + <p class="text-help">
> + $_("The name used to identify the CDROM.
Read-only.")
> + </p>
> + <input type="text" class="text"
name="dev" readonly />
> + </div>
> + </section>
> + <section class="form-section">
> + <h2>2. $_("Device Type")</h2>
> + <div class="field">
> + <p class="text-help">
> + $_("The device type. Currently, only
\"cdrom\" is supported.")
> + </p>
> + <input type="text" class="text"
name="type" value="cdrom" readonly />
> + </div>
> + </section>
> + <section class="form-section">
> + <h2>3. $_("ISO File Path")</h2>
> + <div class="field">
> + <p class="text-help">
> + $_("The ISO file path in the server.")
> + </p>
> + <input type="text" class="text"
name="path" />
> + </div>
> + </section>
> + <section class="form-section">
> + <div id="cdrom-error-message"></div>
> + </section>
> + </form>
> + </div>
> + <footer>
> + <div class="btn-group">
> + <button id="vm-cdrom-button-edit"
class="btn-normal" disabled="disabled">
> + <span
class="text">$_("Replace")</span>
> + </button>
> + </div>
> + </footer>
> +</div>
> +<script type="text/javascript">
> + kimchi.guest_cdrom_edit_main();
> +</script>
> diff --git a/ui/pages/guest-edit.html.tmpl b/ui/pages/guest-edit.html.tmpl
> index 91f780c..dadff21 100644
> --- a/ui/pages/guest-edit.html.tmpl
> +++ b/ui/pages/guest-edit.html.tmpl
> @@ -86,6 +86,24 @@
> </div>
> </div>
> </fieldset>
> + <fieldset class="guest-edit-fieldset">
> + <div>
> + <div class="guest-edit-wrapper-label">
> + <label>
> + $_("CDROM")
> + </label>
> + </div>
> + <div class="guest-edit-wrapper-controls">
> + <div
id="guest-edit-cdrom-row-container"></div>
> + <div>
> + <button
id="guest-edit-attach-cdrom-button"
> + class="guest-edit-cdrom-button attach"
> + title="$_("Attach")">
> + </button>
> + </div>
> + </div>
> + </div>
> + </fieldset>
> </form>
> </div>
> <footer>
> @@ -99,6 +117,22 @@
> </div>
> </footer>
> </div>
> +<script id="cdrom-row-tmpl" type="text/html">
> +<div>
> + <input name="cdrom" type="text"
> + data-vm="{vm}" data-dev="{dev}"
> + value="{path}" readonly="readonly" />
> + <button class="guest-edit-cdrom-button replace"
> + data-vm="{vm}" data-dev="{dev}"
> + title="$_("Replace")">
> + </button>
> + <button class="guest-edit-cdrom-button detach"
> + data-vm="{vm}" data-dev="{dev}"
> + title="$_("Detach")">
> + </button>
> +</div>
> +</script>
> +
> <script type="text/javascript">
> kimchi.guest_edit_main();
> </script>
> diff --git a/ui/pages/i18n.html.tmpl b/ui/pages/i18n.html.tmpl
> index f8af68e..97fc4f4 100644
> --- a/ui/pages/i18n.html.tmpl
> +++ b/ui/pages/i18n.html.tmpl
> @@ -95,6 +95,11 @@ var i18n = {
> 'KCHDR6011M': "$_("Report name should contain only letters,
digits and/or hyphen ('-').")",
>
> 'KCHVM6001M': "$_("This will delete the virtual machine and
its virtual disks. This operation cannot be undone. Would you like to
continue?")",
> + 'KCHVM6002M': "$_("This CDROM will be detached permanently and
you can re-attach it. Continue to detach it?")",
> + 'KCHVM6003M': "$_("Attach")",
> + 'KCHVM6004M': "$_("Attaching...")",
> + 'KCHVM6005M': "$_("Replace")",
> + 'KCHVM6006M': "$_("Replacing...")",
>
> 'KCHNET6001E': "$_("The VLAN id must be between 1 and
4094.")",
>