[Kimchi-devel] [PATCH v2 4/4] [UI] Attach/Replace/Detach a CDROM to/in/from a VM

Adam King rak at linux.vnet.ibm.com
Wed Mar 5 00:38:18 UTC 2014


Reviewed-by: Adam King <rak at linux.vnet.ibm.com>
Tested-by: Adam King <rak at linux.vnet.ibm.com>



On 03/04/2014 04:01 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.
>
> Signed-off-by: Hongliang Wang <hlwang at linux.vnet.ibm.com>
> ---
>   ui/css/theme-default/guest-edit.css           | 108 +++++++++++++++---
>   ui/images/theme-default/guest-icon-sprite.png | Bin 0 -> 6748 bytes
>   ui/js/src/kimchi.guest_edit_main.js           |  75 ++++++++++++-
>   ui/pages/guest-edit.html.tmpl                 | 153 +++++++++++++++++---------
>   4 files changed, 263 insertions(+), 73 deletions(-)
>   create mode 100644 ui/images/theme-default/guest-icon-sprite.png
>
> diff --git a/ui/css/theme-default/guest-edit.css b/ui/css/theme-default/guest-edit.css
> index f4ccdee..61a740d 100644
> --- a/ui/css/theme-default/guest-edit.css
> +++ b/ui/css/theme-default/guest-edit.css
> @@ -17,36 +17,39 @@
>    */
>   #guest-edit-window {
>       font-size: 13px;
> -    height: 380px;
> -    width: 420px;
> +    height: 400px;
> +    width: 600px;
> +}
> +
> +#guest-edit-tabs {
> +    border: none;
> +    height: 100%;
> +    padding: 0;
>   }
>
>   .guest-edit-fieldset {
> -    float: left;
> -    padding: 1em;
> +    padding-right: 0;
>   }
>
>   .guest-edit-wrapper-label, .guest-edit-wrapper-controls {
>       display: inline-block;
>   }
>
> -.guest-edit-wrapper-controls input[type="text"][disabled] {
> -    color: #bbb;
> -    background-color: #fafafa;
> -    cursor: not-allowed;
> -}
> -
>   .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: 470px;
>   }
>
>   .guest-edit-wrapper-controls input[type="text"] {
> +    font-size: 16px;
>       height: 38px;
> -    line-height: 38px;
>       background: #fff;
>       -webkit-border-radius: 5px;
>       border-radius: 5px;
> @@ -54,7 +57,7 @@
>       border-top: 1px solid #bbb;
>       border-left: 1px solid #bbb;
>       padding-left: 10px;
> -    width: 100%;
> +    width: 450px;
>   }
>
>   .guest-edit-wrapper-controls input[type="text"][disabled] {
> @@ -62,3 +65,80 @@
>       background-color: #fafafa;
>       cursor: not-allowed;
>   }
> +
> +#guest-edit-cdrom-row-container {
> +    max-height: 180px;
> +    overflow: auto;
> +}
> +
> +#guest-edit-cdrom-row-container input[type="text"] {
> +    width: 390px;
> +}
> +
> +.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 at 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 at _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;kCMk
> zhH%VK2?BwrqoSd?CzK8N!&WF7<d44NqtD5Su~J7fO+Bx$&=0G20$jQ|5fvXlUbPh$
> z7n94*Sq1DC4Y~{tj^;mRA2HU})&|y^T6VAiGyY;U`X;);c7VqF4UC-h4J*@K`TIx#
> zm~#piOu#|1P~7KtnnEn;6A(WEEQrH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++d8w)ws#8-M9RkBkVdm-G~vUXF$&EW?A=(P<*UzFD7^-M6d&0z`@NeR4e1YB&J><
> zK`l8(fYG=tSb+^0)`pQe(I)c`3a#8<4rt!Z$zaskJR1WdezkSq_8X1Ifcj`b+-S8r
> z6|D at VZ2*y?z0r?lUN%S+6aJt5{g~B5Bd}lsC}k15s+knvcUyQ-hD7$dG<USRFPjt;
> z7Iq1}d>JyZH{Uph5p_8yD#1(cqSO6NkpdC-p=RDg>=hLibd_i&eSeaP<&q+Ewn at S+
> zo)K*-`V7HA6me{C<jIM5FVp*x8J~Z57mNZq>WnFvg5z7e&sNK)n*+3NlM5E)fpz2j
> z at x0^C;SxsH=6R}Bh*719Ux<o^7}i;Y(d~E;2U5zas8&jHp>g$y{^OgwJr-u+Z;+6S
> zgRtGos at mK~s!Bo|aLU}EOnV9p)(AwUCc6~xx4XmvMj5VzpGe>yx7azA>I!V!A?J^N
> zVqjqKXM4Mc{k>Tfr`}UmZf>Gq_P@^k$fWd1o2}*5tF_T|dhlsUAcKMPNh-Bo0FfGJ
> zXqR-p)FLhrc$XwPZ1#K(%Q%ZqEr6(QjwpFc+tM;+dkV?=%n|fpH2#Z6QK(?r0S)ad
> zUQY(@@&g(YlBAV at m7qlt*V*cifalR#Ppqk_X at Kj?*Q3k4!JjPhrNbU>^e5@%YZ|Sd
> z?|U at uEw=J49ME8p#<lO8UXI!jvvhDMce_5_cAKA{Pm&xnx(V$%CugKhR<37s{rNTC
> z($(3SV$`8goRyVzXyf=azT`*r4-9)uYd-u(_IBb;a at _^h%zr<5AWE8wwenU`{{t?*
> Bz#9Mn
>
> literal 0
> HcmV?d00001
>
> diff --git a/ui/js/src/kimchi.guest_edit_main.js b/ui/js/src/kimchi.guest_edit_main.js
> index f32fbb1..9bab195 100644
> --- a/ui/js/src/kimchi.guest_edit_main.js
> +++ b/ui/js/src/kimchi.guest_edit_main.js
> @@ -16,17 +16,83 @@
>    * limitations under the License.
>    */
>   kimchi.guest_edit_main = function() {
> -    var guestEditForm = $('#form-guest-edit');
> +    var buttonContainer = $('#action-button-container');
> +    $('#guest-edit-tabs').tabs({
> +        beforeActivate: function(event, ui) {
> +            var deactivated = ui['oldPanel'];
> +            if($(deactivated).attr('id') === 'form-guest-edit-general') {
> +                $(buttonContainer).addClass('hidden');
> +            }
> +            else {
> +                $(buttonContainer).removeClass('hidden');
> +            }
> +        }
> +    });
> +
> +    var guestEditForm = $('#form-guest-edit-general');
>       var saveButton = $('#guest-edit-button-save');
> +
> +    var refreshCDROMs = function() {
> +        kimchi.listVMStorages({
> +            vm: kimchi.selectedGuest,
> +            storageType: 'cdrom'
> +        }, function(storages) {
> +            var rowHTML = $('#cdrom-row-tmpl').html();
> +            var container = $('#guest-edit-cdrom-row-container');
> +            $(container).empty();
> +
> +            $.each(storages, function(index, storage) {
> +                storage['vm'] = kimchi.selectedGuest;
> +                var templated = kimchi.template(rowHTML, storage);
> +                container.append(templated);
> +            });
> +
> +            var replaceCDROM = function(event) {
> +                event.preventDefault();
> +                kimchi.selectedGuestStorage = $(this).data('dev');
> +                kimchi.window.open("guest-cdrom-edit.html");
> +            };
> +
> +            $('input[type="text"][name="cdrom"]', container).on('click', replaceCDROM);
> +            $('.replace', container).on('click', replaceCDROM);
> +
> +            $('.detach', container).on('click', function(e) {
> +                event.preventDefault();
> +                var settings = {
> +                    title : i18n['KCHAPI6004M'],
> +                    content : i18n['KCHVM6003M'],
> +                    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]);
>           }
> -    });
>
> -    $('#guest-edit-button-cancel').on('click', function() {
> -        kimchi.window.close();
> +        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);
>       });
>
>       var submitForm = function(event) {
> @@ -42,6 +108,7 @@ kimchi.guest_edit_main = function() {
>           }, function(err) {
>               kimchi.message.error(err.responseJSON.reason);
>           });
> +
>           event.preventDefault();
>       };
>
> diff --git a/ui/pages/guest-edit.html.tmpl b/ui/pages/guest-edit.html.tmpl
> index a461031..815bd21 100644
> --- a/ui/pages/guest-edit.html.tmpl
> +++ b/ui/pages/guest-edit.html.tmpl
> @@ -27,74 +27,117 @@
>           <div class="close">X</div>
>       </header>
>       <div class="content">
> -        <form id="form-guest-edit">
> -            <fieldset class="guest-edit-fieldset">
> -                <div>
> -                    <div class="guest-edit-wrapper-label">
> -                        <label for="guest-edit-id-textbox">
> -                            $_("Name")
> -                        </label>
> +        <div id="guest-edit-tabs">
> +            <ul>
> +                <li>
> +                    <a href="#form-guest-edit-general">$_("General")</a>
> +                </li>
> +                <li>
> +                    <a href="#form-guest-edit-storage">$_("Storage")</a>
> +                </li>
> +            </ul>
> +            <form id="form-guest-edit-general">
> +                <fieldset class="guest-edit-fieldset">
> +                    <div>
> +                        <div class="guest-edit-wrapper-label">
> +                            <label for="guest-edit-id-textbox">
> +                                $_("Name")
> +                            </label>
> +                        </div>
> +                        <div class="guest-edit-wrapper-controls">
> +                            <input id="guest-edit-id-textbox"
> +                                name="name" type="text" />
> +                        </div>
>                       </div>
> -                    <div class="guest-edit-wrapper-controls">
> -                        <input id="guest-edit-id-textbox"
> -                            name="name" type="text" />
> +                    <div>
> +                        <div class="guest-edit-wrapper-label">
> +                            <label for="guest-edit-cores-textbox">
> +                                $_("CPUs")
> +                            </label>
> +                        </div>
> +                        <div class="guest-edit-wrapper-controls">
> +                            <input
> +                                id="guest-edit-cores-textbox"
> +                                name="cpus"
> +                                type="text"
> +                                disabled="disabled" />
> +                        </div>
>                       </div>
> -                </div>
> -                <div>
> -                    <div class="guest-edit-wrapper-label">
> -                        <label for="guest-edit-cores-textbox">
> -                            $_("CPUs")
> -                        </label>
> +                    <div>
> +                        <div class="guest-edit-wrapper-label">
> +                            <label for="guest-edit-memory-textbox">
> +                                $_("Memory")
> +                            </label>
> +                        </div>
> +                        <div class="guest-edit-wrapper-controls">
> +                            <input id="guest-edit-memory-textbox"
> +                                name="memory"
> +                                type="text"
> +                                disabled="disabled" />
> +                        </div>
>                       </div>
> -                    <div class="guest-edit-wrapper-controls">
> -                        <input
> -                            id="guest-edit-cores-textbox"
> -                            name="cpus"
> -                            type="text"
> -                            disabled="disabled" />
> +                    <div>
> +                        <div class="guest-edit-wrapper-label">
> +                            <label for="guest-edit-icon-textbox">
> +                                $_("Icon")
> +                            </label>
> +                        </div>
> +                        <div class="guest-edit-wrapper-controls">
> +                            <input
> +                                id="guest-edit-icon-textbox"
> +                                name="icon"
> +                                type="text"
> +                                disabled="disabled" />
> +                        </div>
>                       </div>
> -                </div>
> -                <div>
> -                    <div class="guest-edit-wrapper-label">
> -                        <label for="guest-edit-memory-textbox">
> -                            $_("Memory")
> -                        </label>
> +                </fieldset>
> +            </form>
> +            <form id="form-guest-edit-storage">
> +                <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>
> -                    <div class="guest-edit-wrapper-controls">
> -                        <input id="guest-edit-memory-textbox"
> -                            name="memory"
> -                            type="text"
> -                            disabled="disabled" />
> -                    </div>
> -                </div>
> -                <div>
> -                    <div class="guest-edit-wrapper-label">
> -                        <label for="guest-edit-icon-textbox">
> -                            $_("Icon")
> -                        </label>
> -                    </div>
> -                    <div class="guest-edit-wrapper-controls">
> -                        <input
> -                            id="guest-edit-icon-textbox"
> -                            name="icon"
> -                            type="text"
> -                            disabled="disabled" />
> -                    </div>
> -                </div>
> -            </fieldset>
> -        </form>
> +                </fieldset>
> +            </form>
> +        </div>
>       </div>
>       <footer>
> -        <div class="btn-group">
> -            <button id="guest-edit-button-cancel" class="btn-normal">
> -                <span class="text">$_("Cancel")</span>
> -            </button>
> +        <div id="action-button-container" class="btn-group">
>               <button id="guest-edit-button-save" class="btn-normal">
>                   <span class="text">$_("Save")</span>
>               </button>
>           </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>


-- 
Adam King <rak at linux.vnet.ibm.com>
IBM CSI




More information about the Kimchi-devel mailing list