From nobody Wed Jan 15 15:39:47 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of ovirt.org designates 66.187.230.42 as permitted sender) client-ip=66.187.230.42; envelope-from=kimchi-devel-bounces@ovirt.org; helo=lists.ovirt.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of ovirt.org designates 66.187.230.42 as permitted sender) smtp.mailfrom=kimchi-devel-bounces@ovirt.org; Return-Path: Received: from lists.ovirt.org (lists.phx.ovirt.org [66.187.230.42]) by mx.zohomail.com with SMTPS id 1486994325660595.9617256852275; Mon, 13 Feb 2017 05:58:45 -0800 (PST) Received: from lists.phx.ovirt.org (localhost [127.0.0.1]) by lists.ovirt.org (Postfix) with ESMTP id 61DBB820712; Mon, 13 Feb 2017 13:58:44 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lists.ovirt.org (Postfix) with ESMTPS id 3EB418206E1 for ; Mon, 13 Feb 2017 13:57:30 +0000 (UTC) Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v1DDmeix074176 for ; Mon, 13 Feb 2017 08:57:29 -0500 Received: from e24smtp04.br.ibm.com (e24smtp04.br.ibm.com [32.104.18.25]) by mx0b-001b2d01.pphosted.com with ESMTP id 28kaf19u5k-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 13 Feb 2017 08:57:29 -0500 Received: from localhost by e24smtp04.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 13 Feb 2017 11:57:27 -0200 Received: from d24dlp01.br.ibm.com (9.18.248.204) by e24smtp04.br.ibm.com (10.172.0.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 13 Feb 2017 11:57:24 -0200 Received: from d24relay04.br.ibm.com (d24relay04.br.ibm.com [9.18.232.146]) by d24dlp01.br.ibm.com (Postfix) with ESMTP id C0FCF352005F for ; Mon, 13 Feb 2017 08:56:50 -0500 (EST) Received: from d24av02.br.ibm.com (d24av02.br.ibm.com [9.8.31.93]) by d24relay04.br.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v1DDvOPI35586286 for ; Mon, 13 Feb 2017 11:57:24 -0200 Received: from d24av02.br.ibm.com (localhost [127.0.0.1]) by d24av02.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v1DDvNYp005784 for ; Mon, 13 Feb 2017 11:57:24 -0200 Received: from alinefm-TP440.ibmmodules.com ([9.85.175.177]) by d24av02.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v1DDv63j005628 for ; Mon, 13 Feb 2017 11:57:22 -0200 X-Original-To: kimchi-devel@ovirt.org From: Aline Manera To: Kimchi Devel Date: Mon, 13 Feb 2017 11:57:04 -0200 X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170213135704.7556-1-alinefm@linux.vnet.ibm.com> References: <20170213135704.7556-1-alinefm@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17021313-0028-0000-0000-0000019501F6 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17021313-0029-0000-0000-0000149201E9 Message-Id: <20170213135704.7556-8-alinefm@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-13_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1702130136 Subject: [Kimchi-devel] [PATCH] [Wok 7/7] Plugins management UI X-BeenThere: kimchi-devel@ovirt.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: kimchi-devel-bounces@ovirt.org Errors-To: kimchi-devel-bounces@ovirt.org X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Aline Manera --- ui/config/tab-ext.xml | 7 ++ ui/css/Makefile.am | 6 +- ui/css/settings.css | 144 ++++++++++++++++++++++++----------- ui/css/src/settings.scss | 156 +++++++++++++++++++++++++++++++++++= +++ ui/images/pl.png | Bin 0 -> 2904 bytes ui/js/src/wok.api.js | 26 ++++++- ui/js/wok.settings.js | 157 +++++++++++++++++++++++++++++++++++= ++++ ui/pages/i18n.json.tmpl | 4 + ui/pages/tabs/settings.html.tmpl | 89 ++++++++++++++++++++++ 9 files changed, 544 insertions(+), 45 deletions(-) create mode 100644 ui/css/src/settings.scss create mode 100644 ui/images/pl.png create mode 100644 ui/js/wok.settings.js create mode 100644 ui/pages/tabs/settings.html.tmpl diff --git a/ui/config/tab-ext.xml b/ui/config/tab-ext.xml index 5780b96..0cc9c83 100644 --- a/ui/config/tab-ext.xml +++ b/ui/config/tab-ext.xml @@ -8,4 +8,11 @@ -1 tabs/user-log.html + + + + Settings + 0 + tabs/settings.html + diff --git a/ui/css/Makefile.am b/ui/css/Makefile.am index ea49ec8..1a75e6d 100644 --- a/ui/css/Makefile.am +++ b/ui/css/Makefile.am @@ -36,6 +36,10 @@ user-log: src/user-log.scss echo "Compiling .scss file $<" sassc -s expanded $< user-log.css =20 +settings: src/settings.scss + echo "Compiling .scss file $<" + sassc -s expanded $< settings.css + bootstrap-select: src/bootstrap-select.custom.scss echo "Compiling .scss file $<" sassc -s expanded $< bootstrap-select.custom.css @@ -44,7 +48,7 @@ datatables: src/datatables.bootstrap.scss echo "Compiling .scss file $<" sassc -s expanded $< datatables.bootstrap.css =20 -css: wok bootstrap bootstrap-select user-log datatables +css: wok bootstrap bootstrap-select user-log settings datatables =20 theme-default.min.css: theme-default/*.css cat $^ > $@ diff --git a/ui/css/settings.css b/ui/css/settings.css index 0c56597..f184390 100644 --- a/ui/css/settings.css +++ b/ui/css/settings.css @@ -83,59 +83,131 @@ vertical-align: middle; } =20 -.wok div.modal-footer { - background-color: #d9182d; +#plugins-mgmt-content-area .well { + border: 0; + padding: 0; + margin: 0; + background: transparent; } =20 -.wok .modal-body .nav-tabs > li.active > a, -.wok .modal-body .nav-tabs > li.active > a:hover, -.wok .modal-body .nav-tabs > li.active > a:focus { - border-color: -moz-use-text-color -moz-use-text-color #d9182d; +#plugins-mgmt-content-area #plugins-mgmt-body > .wok-datagrid-row { + display: flex; + flex-flow: row wrap; } =20 -.wok.modal .row.clearfix { - margin-left: -10px; - margin-right: -10px; +#plugins-mgmt-content-area #plugins-mgmt-body .handle[aria-expanded=3Dtrue= ] .fa-chevron-down { + transform: rotate(-180deg); } =20 -.wok.modal .form-group.col-sm-6 { - padding-left: 10px; - padding-right: 10px; +#plugins-mgmt-content-area #plugins-mgmt-body img { + width: 40px; + display: inline-block; } =20 -.action-group { - position: absolute; - z-index: 999; +#plugins-mgmt-content-area #plugins-mgmt-body img.disabled { + filter: opacity(50%); } =20 -div#user-log-actions { - padding-top: 15px; +#plugins-mgmt-content-area span.column-plugin-name, +#plugins-mgmt-content-area div.column-plugin-name { + width: 20%; + min-width: 20%; + flex-basis: 20%; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + display: inline-block; } =20 -.label { - display: inline-block; - vertical-align: middle; +@media (min-width: 780px) { + #plugins-mgmt-content-area span.column-plugin-name, + #plugins-mgmt-content-area div.column-plugin-name { + width: 20%; + min-width: 20%; + flex-basis: 20%; + } } =20 -.bootgrid-table th > .column-header-anchor > .icon.fa { - right: 6px; - top: 4px; +#plugins-mgmt-content-area span.column-plugin-description { + display: none; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; } =20 -span.trim { - display: inline-block; - width: 100%; - vertical-align: middle; +@media (min-width: 1017px) { + #plugins-mgmt-content-area span.column-plugin-description { + display: inline-block; + width: 30%; + min-width: 30%; + flex-basis: 30%; + } +} + +@media (min-width: 1302px) { + #plugins-mgmt-content-area span.column-plugin-description { + display: inline-block; + width: 40%; + min-width: 40%; + flex-basis: 40%; + } +} + +@media (min-width: 1540px) { + #plugins-mgmt-content-area span.column-plugin-description { + display: inline-block; + width: 50%; + min-width: 50%; + flex-basis: 50%; + } +} + +@media (min-width: 1680px) { + #plugins-mgmt-content-area span.column-plugin-description { + flex-basis: auto; + flex-grow: 1; + min-width: auto; + width: auto; + } +} + +#plugins-mgmt-content-area span.column-plugin-status { + width: 80px; + min-width: 80px; + flex-basis: 80px; + text-align: center; + text-transform: capitalize; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; - padding-right: 6px; + display: inline-block; + position: relative; + padding: 10px; +} + +#plugins-mgmt-content-area span.column-plugin-status > input[type=3D"check= box"] { + top: 20px; + left: 20px; } =20 -.table > tbody > tr > td { +#plugins-mgmt-content-area span.column-plugin-status > label { + margin-bottom: 0 !important; + margin-right: 0 !important; vertical-align: middle; } =20 +#plugins-mgmt-content-area .no-matching-data { + text-align: center; + font-size: 14.5pt !important; + padding: 6px 2px; + border-top: 1px solid #eee; +} + +#wok-confirm-modal .modal-body strong, +.modal-dialog .modal-body strong { + border-bottom: 1px dotted; +} + .tooltip > .tooltip-inner { font-weight: 400; font-size: 12.5pt; @@ -143,17 +215,3 @@ span.trim { max-width: 420px !important; text-align: left; } - -.search { - margin: 0 !important; - width: 514px !important; -} - -.pagination .button { - font-weight: 600; - cursor: pointer; -} - -.pagination .disabled .button { - cursor: not-allowed; -} diff --git a/ui/css/src/settings.scss b/ui/css/src/settings.scss new file mode 100644 index 0000000..2862a6c --- /dev/null +++ b/ui/css/src/settings.scss @@ -0,0 +1,156 @@ +/* + * Project Wok + * + * Copyright IBM Corp, 2016-2017 + * + * Code derived from Project Kimchi + * + * 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. + */ + +// Core variables +@import "modules/wok-variables"; +// Core variables and mixins +@import "vendor/bootstrap-sass/bootstrap/mixins"; +// Compass Mixins +@import "vendor/compass-mixins/lib/compass"; +// Wok Accordion Mixin +@import "modules/wok-accordion"; + +#wok-root-container{ + .accordion { + @include wok-accordion(); + } +} + +#plugins-mgmt-content-area { + + .well { + border: 0; + padding: 0; + margin: 0; + background: transparent; + } + + #plugins-mgmt-body > .wok-datagrid-row { + display: flex; + flex-flow: row wrap; + } + + #plugins-mgmt-body .handle[aria-expanded=3Dtrue] .fa-chevron-down { + transform: rotate(-180deg); + } + + #plugins-mgmt-body img { + width: 40px; + display: inline-block; + } + + #plugins-mgmt-body img.disabled { + filter: opacity(50%); + } + + span.column-plugin-name, + div.column-plugin-name { + width: 20%; + min-width: 20%; + flex-basis: 20%; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + display: inline-block; + @media (min-width: $screen-sm + 12) { + width: 20%; + min-width: 20%; + flex-basis: 20%; + } + } + + span.column-plugin-description { + display: none; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + + @media (min-width: $screen-sm + 249) { + display: inline-block; + width: 30%; + min-width: 30%; + flex-basis: 30%; + } + + @media (min-width: $screen-lg + 102) { + display: inline-block; + width: 40%; + min-width: 40%; + flex-basis: 40%; + } + + @media (min-width: $screen-xlg) { + display: inline-block; + width: 50%; + min-width: 50%; + flex-basis: 50%; + } + + @media (min-width: $screen-xlg + 140) { + flex-basis: auto; + flex-grow: 1; + min-width: auto; + width: auto; + } + } + + span.column-plugin-status { + width: 80px; + min-width: 80px; + flex-basis: 80px; + text-align: center; + text-transform: capitalize; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + display: inline-block; + position: relative; + padding: 10px; + > input[type=3D"checkbox"] { + top: 20px; + left: 20px; + } + > label { + margin-bottom: 0 !important; + margin-right: 0 !important; + vertical-align: middle; + } + } + + .no-matching-data { + text-align: center; + font-size: 14.5pt !important; + padding: 6px 2px; + border-top: 1px solid #eee; + } +} + +#wok-confirm-modal .modal-body strong, +.modal-dialog .modal-body strong { + border-bottom: 1px dotted; +} + +.tooltip > .tooltip-inner { + font-weight: 400; + font-size: 12.5pt; + padding: 8px !important; + max-width: 420px !important; + text-align: left; +} diff --git a/ui/images/pl.png b/ui/images/pl.png new file mode 100644 index 0000000000000000000000000000000000000000..03970c527ba24f97fe5c3564396= 5368dc94ef287 GIT binary patch literal 2904 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 A5dZ)H literal 0 HcmV?d00001 diff --git a/ui/js/src/wok.api.js b/ui/js/src/wok.api.js index 4af3f88..06b97aa 100644 --- a/ui/js/src/wok.api.js +++ b/ui/js/src/wok.api.js @@ -111,7 +111,7 @@ var wok =3D { =20 listPlugins : function(suc, err, sync) { wok.requestJSON({ - url : '/config/plugins', + url : 'config/plugins', type : 'GET', contentType : 'application/json', dataType : 'json', @@ -122,6 +122,30 @@ var wok =3D { }); }, =20 + enablePlugin : function(plugin, suc, err) { + wok.requestJSON({ + url : 'config/plugins/' + encodeURIComponent(plugin) + "/enabl= e", + type : 'POST', + contentType : 'application/json', + dataType : 'json', + resend: true, + success : suc, + error : err + }); + }, + + disablePlugin : function(plugin, suc, err) { + wok.requestJSON({ + url : 'config/plugins/' + encodeURIComponent(plugin) + "/disab= le", + type : 'POST', + contentType : 'application/json', + dataType : 'json', + resend: true, + success : suc, + error : err + }); + }, + getConfig: function(suc, err, sync) { wok.requestJSON({ url : 'config', diff --git a/ui/js/wok.settings.js b/ui/js/wok.settings.js new file mode 100644 index 0000000..9583fa7 --- /dev/null +++ b/ui/js/wok.settings.js @@ -0,0 +1,157 @@ +/* + * Copyright IBM Corp, 2017 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-13= 01 USA + */ + +wok.initSettings =3D function() { + wok.initPluginsMgmt(); +}; + +wok.initPluginsMgmt =3D function() { + // Make wok.plugins is ready to be used + if (wok.plugins =3D=3D undefined) { + setTimeout(wok.initPluginsMgmt, 2000); + return; + } + + var plugins =3D wok.plugins; + if (plugins && plugins.length) { + plugins.sort(function(a, b) { + if (a.name !=3D=3D undefined && b.name !=3D=3D undefined) { + return a.name.localeCompare( b.name ); + } else { + return 0 + } + }); + $("#plugins-mgmt-body").empty(); + $.each(plugins, function(i,value){ + wok.generatePluginEntry(value); + }); + $('#plugins-mgmt-datagrid').dataGrid({enableSorting: false}); + } else { + $('#plugins-mgmt-datagrid ul').addClass('hidden'); + $('#plugins-mgmt-datagrid .no-matching-data').removeClass('hidden'= ); + } + + // Filter configuration + var pluginsOptions =3D { + valueNames: ['plugin-name-filter', 'plugin-description-filter'] + }; + var pluginsFilterList =3D new List('plugins-mgmt-content-area', plugin= sOptions); + pluginsFilterList.sort('plugin-name-filter', { + order: "asc" + }); + + pluginsFilterList.search($('#search_input_plugins_mgmt').val()); + pluginsFilterList.on('searchComplete',function(){ + if(pluginsFilterList.matchingItems.length =3D=3D 0){ + $('#plugins-mgmt-datagrid ul').addClass('hidden'); + $('#plugins-mgmt-datagrid .no-matching-data').removeClass('hid= den'); + } else { + $('#plugins-mgmt-datagrid ul').removeClass('hidden'); + $('#plugins-mgmt-datagrid .no-matching-data').addClass('hidden= '); + } + }); + + // Toggle handler + $('#plugins-mgmt-body').on('change', '.wok-toggleswitch-checkbox', fun= ction(event) { + var pluginNode =3D $(this).parent().parent(); + if($(this).is(":checked")) { + togglePlugin(pluginNode, true); + } else { + togglePlugin(pluginNode, false); + } + }); + + var enablePlugin =3D function(plugin) { + wok.enablePlugin(plugin, function(result){ + location.reload(); + }, function(){}); + }; + + var disablePlugin =3D function(plugin) { + wok.disablePlugin(plugin, function(result){ + location.reload(); + }, function(){}); + }; + + var togglePlugin =3D function(pluginNode, enable) { + var plugin =3D pluginNode.data('id'); + var depends =3D $('input[name=3Dplugin-depends]', pluginNode).val(= ); + var is_dependency_of =3D $('input[name=3Dplugin-is-dependency-of]'= , pluginNode).val(); + + var confirmMessage =3D undefined; + if (depends && enable) { + var confirmMessage =3D i18n['WOKPL0001M'].replace('%1', '' + plugin + ''); + confirmMessage =3D confirmMessage.replace('%2', '' + d= epends + ''); + } else if (is_dependency_of && !enable) { + var confirmMessage =3D i18n['WOKPL0002M'].replace('%1', '' + plugin + ''); + confirmMessage =3D confirmMessage.replace('%2', '' + i= s_dependency_of + ''); + } + + if (confirmMessage) { + var settings =3D { + title: i18n['WOKAPI6005M'], + content: confirmMessage, + confirm: i18n['WOKAPI6004M'], + cancel: i18n['WOKAPI6003M'] + }; + wok.confirm(settings, function() { + $("body").css("cursor", "wait"); + if (enable) + enablePlugin(plugin); + else if (!enable) + disablePlugin(plugin); + }, function() { + if (enable) { + $('.wok-toggleswitch-checkbox', pluginNode).removeAttr= ('checked'); + } + else if (!enable) { + $('.wok-toggleswitch-checkbox', pluginNode).replaceWit= h(''); + } + }); + } else { + if (enable) + enablePlugin(plugin); + else if (!enable) + disablePlugin(plugin); + } + }; +}; + +wok.generatePluginEntry =3D function(value){ + //var description =3D value.description; + var description =3D "Plugin description " + value.name; + var checked =3D (value.enabled) ? 'checked' : ''; + + var id =3D 'plugin-' + value.name; + var disabled =3D (value.enabled) ? '' : 'disabled'; + var pluginstatus =3D (value.enabled) ? 'On' : 'Off'; + + var pluginEntry =3D $.parseHTML(wok.substitute($("#pluginItem").html()= , { + id: id, + name: value.name, + disabled: disabled, + checked: checked, + pluginstatus: pluginstatus, + depends: value.depends.join(", "), + is_dependency_of: value.is_dependency_of.join(", "), + logo: value.image ? value.image : '../images/pl.png', + description: description + })); + + $('#plugins-mgmt-body').append(pluginEntry); +}; diff --git a/ui/pages/i18n.json.tmpl b/ui/pages/i18n.json.tmpl index 4329ad0..3c886f9 100644 --- a/ui/pages/i18n.json.tmpl +++ b/ui/pages/i18n.json.tmpl @@ -31,6 +31,7 @@ "WOKAPI6007E": "$_("Can not contact the host system. Verify the host s= ystem is up and that you have network connectivity to it. HTTP request resp= onse %1. ")", "WOKAPI6003M": "$_("Cancel")", "WOKAPI6004M": "$_("Confirm")", + "WOKAPI6005M": "$_("Action Confirmation")", =20 "WOKGRD6001M": "$_("Loading...")", "WOKGRD6002M": "$_("An error occurred while retrieving system informat= ion.")", @@ -58,6 +59,9 @@ "WOKSETT0014M": "$_("IP Address")", "WOKSETT0015M": "$_("Status")", =20 + "WOKPL0001M": "$_("Plugin %1 depends on %2 which will be automatically= enabled on this confirmation.")", + "WOKPL0002M": "$_("Plugin %1 is dependency of %2 which will be automat= ically disabled on this confirmation.")", + "WOKSESS0001M": "$_("Your session will be expired on: %1 s. Do you wan= t to renew it?")", =20 "WOKFMT2001M": "$_("Ki")", diff --git a/ui/pages/tabs/settings.html.tmpl b/ui/pages/tabs/settings.html= .tmpl new file mode 100644 index 0000000..ccc5b01 --- /dev/null +++ b/ui/pages/tabs/settings.html.tmpl @@ -0,0 +1,89 @@ + + +#unicode UTF-8 +#import gettext +#from wok.cachebust import href +#silent t =3D gettext.translation($lang.domain, $lang.localedir, languages= =3D$lang.lang) +#silent _ =3D t.gettext +#silent _t =3D t.gettext + + + + + + + + + --=20 2.9.3 _______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel