From nobody Sat Apr 20 07:48:10 2024 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 1486993108163273.0135686060478; Mon, 13 Feb 2017 05:38:28 -0800 (PST) Received: from lists.phx.ovirt.org (localhost [127.0.0.1]) by lists.ovirt.org (Postfix) with ESMTP id D2E498206FA; Mon, 13 Feb 2017 13:38:25 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lists.ovirt.org (Postfix) with ESMTPS id A884A8206EB for ; Mon, 13 Feb 2017 13:37:46 +0000 (UTC) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v1DDXwxP110012 for ; Mon, 13 Feb 2017 08:37:46 -0500 Received: from e24smtp02.br.ibm.com (e24smtp02.br.ibm.com [32.104.18.86]) by mx0a-001b2d01.pphosted.com with ESMTP id 28k7jaftqs-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 13 Feb 2017 08:37:45 -0500 Received: from localhost by e24smtp02.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 13 Feb 2017 11:37:43 -0200 Received: from d24dlp01.br.ibm.com (9.18.248.204) by e24smtp02.br.ibm.com (10.172.0.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 13 Feb 2017 11:37:41 -0200 Received: from d24relay02.br.ibm.com (d24relay02.br.ibm.com [9.18.232.42]) by d24dlp01.br.ibm.com (Postfix) with ESMTP id 3C75D352005F for ; Mon, 13 Feb 2017 08:37:07 -0500 (EST) Received: from d24av02.br.ibm.com (d24av02.br.ibm.com [9.8.31.93]) by d24relay02.br.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v1DDbesC39714864 for ; Mon, 13 Feb 2017 11:37:40 -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 v1DDbeDJ023367 for ; Mon, 13 Feb 2017 11:37:40 -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 v1DDba2v023332 for ; Mon, 13 Feb 2017 11:37:39 -0200 X-Original-To: kimchi-devel@ovirt.org From: Aline Manera To: Kimchi Devel Date: Mon, 13 Feb 2017 11:37:29 -0200 X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170213133735.10975-1-alinefm@linux.vnet.ibm.com> References: <20170213133735.10975-1-alinefm@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17021313-0020-0000-0000-0000028677E2 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17021313-0021-0000-0000-000030A09C60 Message-Id: <20170213133735.10975-2-alinefm@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-13_07:, , 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-1702130134 Subject: [Kimchi-devel] [PATCH] [Wok 1/7] Fix last page cookie setting 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" It was not considering that cherrypy.request.app.script_name may be an empty string (which happens when accessing a Wok tab and server_root is not defined). And that was leading to set a wrong last page cookie like "/#/tabs/settings.html" (with an extra /) that does not correspond to any tab content. That way, no matter on what Wok page was the last page visited, the user would be always redirected to the default one (which was the first Wok tab - because that the problem was not found befor= e). Signed-off-by: Aline Manera --- src/wok/root.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wok/root.py b/src/wok/root.py index 279ca7f..a0323f9 100644 --- a/src/wok/root.py +++ b/src/wok/root.py @@ -116,8 +116,8 @@ class Root(Resource): # template to save the delay of the extra get to the guest page # For that, the tab template needs to know the correct path to ui = files paths =3D cherrypy.request.app.root.paths - script_name =3D cherrypy.request.app.script_name - last_page =3D script_name.lstrip("/") + "/tabs/" + page[:-5] + script_name =3D cherrypy.request.app.script_name or "/" + last_page =3D os.path.join(script_name, "tabs/", page[:-5]).lstrip= ("/") =20 data =3D {} data['ui_dir'] =3D paths.ui_dir --=20 2.9.3 _______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel From nobody Sat Apr 20 07:48:10 2024 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 1486993128227130.75517619241418; Mon, 13 Feb 2017 05:38:48 -0800 (PST) Received: from lists.phx.ovirt.org (localhost [127.0.0.1]) by lists.ovirt.org (Postfix) with ESMTP id 3F52A820707; Mon, 13 Feb 2017 13:38:47 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lists.ovirt.org (Postfix) with ESMTPS id D196F8206F0 for ; Mon, 13 Feb 2017 13:37:48 +0000 (UTC) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v1DDY2Q8130982 for ; Mon, 13 Feb 2017 08:37:48 -0500 Received: from e24smtp04.br.ibm.com (e24smtp04.br.ibm.com [32.104.18.25]) by mx0a-001b2d01.pphosted.com with ESMTP id 28k75xrp0n-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 13 Feb 2017 08:37:47 -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:37:45 -0200 Received: from d24dlp02.br.ibm.com (9.18.248.206) 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:37:42 -0200 Received: from d24relay03.br.ibm.com (d24relay03.br.ibm.com [9.18.232.225]) by d24dlp02.br.ibm.com (Postfix) with ESMTP id 775521DC0054 for ; Mon, 13 Feb 2017 08:37:43 -0500 (EST) Received: from d24av02.br.ibm.com (d24av02.br.ibm.com [9.8.31.93]) by d24relay03.br.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v1DDbgwD41025772 for ; Mon, 13 Feb 2017 11:37:42 -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 v1DDbf5Z023389 for ; Mon, 13 Feb 2017 11:37:42 -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 v1DDba2w023332 for ; Mon, 13 Feb 2017 11:37:41 -0200 X-Original-To: kimchi-devel@ovirt.org From: Aline Manera To: Kimchi Devel Date: Mon, 13 Feb 2017 11:37:30 -0200 X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170213133735.10975-1-alinefm@linux.vnet.ibm.com> References: <20170213133735.10975-1-alinefm@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17021313-0028-0000-0000-0000019490CC X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17021313-0029-0000-0000-00001490C3EE Message-Id: <20170213133735.10975-3-alinefm@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-13_07:, , 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-1702130134 Subject: [Kimchi-devel] [PATCH] [Wok 2/7] Fix test case by removing authorization verification for css/theme-default.min.css 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" css/theme-default.min.css does not exist on Wok server which was causing the test case to fail. So remove it. Signed-off-by: Aline Manera --- tests/test_server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_server.py b/tests/test_server.py index 9c12b27..439f157 100644 --- a/tests/test_server.py +++ b/tests/test_server.py @@ -167,7 +167,6 @@ class ServerTests(unittest.TestCase): def test_auth_unprotected(self): hdrs =3D {'AUTHORIZATION': ''} uris =3D ['/js/wok.min.js', - '/css/theme-default.min.css', '/images/favicon.png', '/libs/jquery/jquery.min.js', '/login.html', @@ -175,6 +174,7 @@ class ServerTests(unittest.TestCase): =20 for uri in uris: resp =3D self.request(uri, None, 'HEAD', hdrs) + print "\n\naaaaaaaaaaaaaaaa ", uri self.assertEquals(200, resp.status) =20 def test_auth_protected(self): --=20 2.9.3 _______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel From nobody Sat Apr 20 07:48:10 2024 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 1486993117932230.5780828091075; Mon, 13 Feb 2017 05:38:37 -0800 (PST) Received: from lists.phx.ovirt.org (localhost [127.0.0.1]) by lists.ovirt.org (Postfix) with ESMTP id 0F6AC820703; Mon, 13 Feb 2017 13:38:37 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lists.ovirt.org (Postfix) with ESMTPS id 74A928206EB for ; Mon, 13 Feb 2017 13:37:48 +0000 (UTC) Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v1DDXwLi084428 for ; Mon, 13 Feb 2017 08:37:47 -0500 Received: from e24smtp05.br.ibm.com (e24smtp05.br.ibm.com [32.104.18.26]) by mx0b-001b2d01.pphosted.com with ESMTP id 28kax4qstb-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 13 Feb 2017 08:37:47 -0500 Received: from localhost by e24smtp05.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 13 Feb 2017 11:37:45 -0200 Received: from d24dlp02.br.ibm.com (9.18.248.206) by e24smtp05.br.ibm.com (10.172.0.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 13 Feb 2017 11:37:44 -0200 Received: from d24relay02.br.ibm.com (d24relay02.br.ibm.com [9.18.232.42]) by d24dlp02.br.ibm.com (Postfix) with ESMTP id B6DB41DC0054 for ; Mon, 13 Feb 2017 08:37:44 -0500 (EST) Received: from d24av02.br.ibm.com (d24av02.br.ibm.com [9.8.31.93]) by d24relay02.br.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v1DDbhfU34013318 for ; Mon, 13 Feb 2017 11:37:43 -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 v1DDbhMG023453 for ; Mon, 13 Feb 2017 11:37:43 -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 v1DDba2x023332 for ; Mon, 13 Feb 2017 11:37:42 -0200 X-Original-To: kimchi-devel@ovirt.org From: Aline Manera To: Kimchi Devel Date: Mon, 13 Feb 2017 11:37:31 -0200 X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170213133735.10975-1-alinefm@linux.vnet.ibm.com> References: <20170213133735.10975-1-alinefm@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17021313-0032-0000-0000-0000053D8A69 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17021313-0033-0000-0000-000011BFB871 Message-Id: <20170213133735.10975-4-alinefm@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-13_07:, , 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-1702130134 Subject: [Kimchi-devel] [PATCH] [Wok 3/7] Move AJAX API calls to wok.api.js 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" All the AJAX calls should be placed on wok.api.js Signed-off-by: Aline Manera --- ui/js/src/wok.api.js | 40 ++++++++++++++++++++++++++++++++++++++++ ui/js/wok.user-log.js | 40 ---------------------------------------- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/ui/js/src/wok.api.js b/ui/js/src/wok.api.js index c465dfb..4af3f88 100644 --- a/ui/js/src/wok.api.js +++ b/ui/js/src/wok.api.js @@ -144,5 +144,45 @@ var wok =3D { success : suc, error : err }); + }, + + getUserLogs : function(suc, err) { + wok.requestJSON({ + url : 'logs', + type : 'GET', + contentType : 'application/json', + dataType : 'json', + resend : true, + success : suc, + error : err || function(data) { + wok.message.error(data.responseJSON.reason); + } + }); + }, + + getFilteredUserLogs : function(suc, err, search) { + wok.requestJSON({ + url : 'logs?' + search, + type : 'GET', + contentType : 'application/json', + dataType : 'json', + success : suc, + error : err || function(data) { + wok.message.error(data.responseJSON.reason); + } + }); + }, + + downloadLogs : function(suc, err, search) { + wok.requestJSON({ + url : 'logs?'+search+'download=3DTrue', + type : 'GET', + contentType : 'application/json', + dataType : 'json', + success : suc, + error : err || function(data) { + wok.message.error(data.responseJSON.reason); + } + }); } }; diff --git a/ui/js/wok.user-log.js b/ui/js/wok.user-log.js index fa4945f..160f9a0 100644 --- a/ui/js/wok.user-log.js +++ b/ui/js/wok.user-log.js @@ -28,46 +28,6 @@ wok.initUserLogConfig =3D function() { wok.listUserLogConfig(); } =20 -wok.getUserLogs =3D function(suc, err) { - wok.requestJSON({ - url : 'logs', - type : 'GET', - contentType : 'application/json', - dataType : 'json', - resend : true, - success : suc, - error : err || function(data) { - wok.message.error(data.responseJSON.reason); - } - }); -}; - -wok.getFilteredUserLogs =3D function(suc, err, search) { - wok.requestJSON({ - url : 'logs?' + search, - type : 'GET', - contentType : 'application/json', - dataType : 'json', - success : suc, - error : err || function(data) { - wok.message.error(data.responseJSON.reason); - } - }); -}; - -wok.downloadLogs =3D function(suc, err, search) { - wok.requestJSON({ - url : 'logs?'+search+'download=3DTrue', - type : 'GET', - contentType : 'application/json', - dataType : 'json', - success : suc, - error : err || function(data) { - wok.message.error(data.responseJSON.reason); - } - }); -}; - wok.listUserLogConfig =3D function() { =20 var ulGrid =3D []; --=20 2.9.3 _______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel From nobody Sat Apr 20 07:48:10 2024 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 1486993141414752.0786971500816; Mon, 13 Feb 2017 05:39:01 -0800 (PST) Received: from lists.phx.ovirt.org (localhost [127.0.0.1]) by lists.ovirt.org (Postfix) with ESMTP id 6B44782070A; Mon, 13 Feb 2017 13:38:59 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lists.ovirt.org (Postfix) with ESMTPS id 6F22D82063E for ; Mon, 13 Feb 2017 13:37:51 +0000 (UTC) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v1DDXxaQ110068 for ; Mon, 13 Feb 2017 08:37:51 -0500 Received: from e24smtp05.br.ibm.com (e24smtp05.br.ibm.com [32.104.18.26]) by mx0a-001b2d01.pphosted.com with ESMTP id 28k7jafttq-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 13 Feb 2017 08:37:50 -0500 Received: from localhost by e24smtp05.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 13 Feb 2017 11:37:47 -0200 Received: from d24dlp01.br.ibm.com (9.18.248.204) by e24smtp05.br.ibm.com (10.172.0.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 13 Feb 2017 11:37:45 -0200 Received: from d24relay02.br.ibm.com (d24relay02.br.ibm.com [9.18.232.42]) by d24dlp01.br.ibm.com (Postfix) with ESMTP id EEDD73520068 for ; Mon, 13 Feb 2017 08:37:11 -0500 (EST) Received: from d24av02.br.ibm.com (d24av02.br.ibm.com [9.8.31.93]) by d24relay02.br.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v1DDbjoe38666452 for ; Mon, 13 Feb 2017 11:37:45 -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 v1DDbj9B023470 for ; Mon, 13 Feb 2017 11:37:45 -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 v1DDba30023332 for ; Mon, 13 Feb 2017 11:37:44 -0200 X-Original-To: kimchi-devel@ovirt.org From: Aline Manera To: Kimchi Devel Date: Mon, 13 Feb 2017 11:37:32 -0200 X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170213133735.10975-1-alinefm@linux.vnet.ibm.com> References: <20170213133735.10975-1-alinefm@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17021313-0032-0000-0000-0000053D8A6B X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17021313-0033-0000-0000-000011BFB874 Message-Id: <20170213133735.10975-5-alinefm@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-13_07:, , 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-1702130134 Subject: [Kimchi-devel] [PATCH] [Wok 4/7] Fix indentation on wok.user-log.js file 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" Always use 4 spaces indentation on JS files Signed-off-by: Aline Manera --- ui/js/wok.user-log.js | 371 +++++++++++++++++++++++++---------------------= ---- 1 file changed, 184 insertions(+), 187 deletions(-) diff --git a/ui/js/wok.user-log.js b/ui/js/wok.user-log.js index 160f9a0..560fbfa 100644 --- a/ui/js/wok.user-log.js +++ b/ui/js/wok.user-log.js @@ -17,228 +17,225 @@ */ =20 wok.initSettings =3D function() { - wok.opts_user_log =3D {}; - wok.opts_user_log['id'] =3D 'user-log-content'; - wok.opts_user_log['gridId'] =3D "user-log-grid"; - wok.opts_user_log['loadingMessage'] =3D i18n['WOKSETT0007M']; - wok.initUserLog(); + wok.opts_user_log =3D {}; + wok.opts_user_log['id'] =3D 'user-log-content'; + wok.opts_user_log['gridId'] =3D "user-log-grid"; + wok.opts_user_log['loadingMessage'] =3D i18n['WOKSETT0007M']; + wok.initUserLog(); }; =20 wok.initUserLogConfig =3D function() { - wok.listUserLogConfig(); + wok.listUserLogConfig(); } =20 wok.listUserLogConfig =3D function() { =20 - var ulGrid =3D []; - var gridFields =3D []; + var ulGrid =3D []; + var gridFields =3D []; =20 - gridFields =3D [{ - "column-id": 'app', - "converter": 'string', - "formatter": "settings-user-log-app", - "title": i18n['WOKSETT0001M'] + gridFields =3D [{ + "column-id": 'app', + "converter": 'string', + "formatter": "settings-user-log-app", + "title": i18n['WOKSETT0001M'] }, { - "column-id": 'user', - "converter": 'string', - "title": i18n['WOKSETT0002M'] + "column-id": 'user', + "converter": 'string', + "title": i18n['WOKSETT0002M'] }, { - "column-id": 'ip', - "converter": 'string', - "title": i18n['WOKSETT0014M'] + "column-id": 'ip', + "converter": 'string', + "title": i18n['WOKSETT0014M'] }, { - "column-id": 'req', - "converter": 'string', - "title": i18n['WOKSETT0003M'] + "column-id": 'req', + "converter": 'string', + "title": i18n['WOKSETT0003M'] }, { - "column-id": 'date', - "converter": 'date-locale-converter', - "order": 'desc', - "title": i18n['WOKSETT0004M'] + "column-id": 'date', + "converter": 'date-locale-converter', + "order": 'desc', + "title": i18n['WOKSETT0004M'] }, { - "column-id": 'time', - "converter": 'time-locale-converter', - "order": 'desc', - "title": i18n['WOKSETT0005M'] + "column-id": 'time', + "converter": 'time-locale-converter', + "order": 'desc', + "title": i18n['WOKSETT0005M'] }, { - "column-id": 'zone', - "converter": 'string', - "width": "6%", - "title": i18n['WOKSETT0013M'] + "column-id": 'zone', + "converter": 'string', + "width": "6%", + "title": i18n['WOKSETT0013M'] }, { - "column-id": 'status', - "converter": 'string', - "width": "7%", - "title": i18n['WOKSETT0015M'] + "column-id": 'status', + "converter": 'string', + "width": "7%", + "title": i18n['WOKSETT0015M'] }, { - "column-id": 'message', - "converter": 'string', - "formatter": "settings-user-log-message", - "sortable": false, - "width": "30%", - "title": i18n['WOKSETT0006M'] - } - ]; - - wok.opts_user_log['gridFields'] =3D JSON.stringify(gridFields); - wok.opts_user_log['converters'] =3D wok.localeConverters; - - ulGrid =3D wok.createBootgrid(wok.opts_user_log); - wok.hideBootgridLoading(wok.opts_user_log); - wok.initUserLogConfigGridData(); + "column-id": 'message', + "converter": 'string', + "formatter": "settings-user-log-message", + "sortable": false, + "width": "30%", + "title": i18n['WOKSETT0006M'] + }]; + + wok.opts_user_log['gridFields'] =3D JSON.stringify(gridFields); + wok.opts_user_log['converters'] =3D wok.localeConverters; + + ulGrid =3D wok.createBootgrid(wok.opts_user_log); + wok.hideBootgridLoading(wok.opts_user_log); + wok.initUserLogConfigGridData(); }; =20 wok.initUserLogConfigGridData =3D function() { - wok.clearBootgridData(wok.opts_user_log['gridId']); - wok.hideBootgridData(wok.opts_user_log); - wok.showBootgridLoading(wok.opts_user_log); - - var labelStyle =3D function(status) { - var result =3D null; - if (status !=3D undefined) { - var firstNumberOfStatus =3D status.toString().charAt(0); - result =3D { - labelColor: "", - labelIcon: "" - }; - switch(firstNumberOfStatus) { - case "1": - case "2": result.labelColor =3D 'label label-info'; result.labelIc= on =3D 'fa fa-check fa-2'; break; - case "3": result.labelColor =3D 'label label-warning'; result.labe= lIcon =3D 'fa fa-times fa-2'; break; - case "4": - case "5": result.labelColor =3D 'label label-danger'; result.label= Icon =3D 'fa fa-times fa-2'; break; - } + wok.clearBootgridData(wok.opts_user_log['gridId']); + wok.hideBootgridData(wok.opts_user_log); + wok.showBootgridLoading(wok.opts_user_log); + + var labelStyle =3D function(status) { + var result =3D null; + if (status !=3D undefined) { + var firstNumberOfStatus =3D status.toString().charAt(0); + result =3D { + labelColor: "", + labelIcon: "" + }; + switch(firstNumberOfStatus) { + case "1": + case "2": result.labelColor =3D 'label label-info'; result= .labelIcon =3D 'fa fa-check fa-2'; break; + case "3": result.labelColor =3D 'label label-warning'; res= ult.labelIcon =3D 'fa fa-times fa-2'; break; + case "4": + case "5": result.labelColor =3D 'label label-danger'; resu= lt.labelIcon =3D 'fa fa-times fa-2'; break; + } + } + return result; } - return result; - } - - wok.getUserLogs(function(result) { - $.each(result, function(index, log){ - var statusLabel =3D labelStyle(log.status); - var userLabel =3D labelStyle(log.user); - if (statusLabel !=3D null) { - log.status =3D " " + log.s= tatus + " "; - } else { - log.status =3D ""; - } - if (userLabel =3D=3D null) { - log.user =3D "N/A"; - } - }) - wok.loadBootgridData(wok.opts_user_log['gridId'], result); - wok.showBootgridData(wok.opts_user_log); - wok.hideBootgridLoading(wok.opts_user_log); - }, function(error) { - wok.message.error(error.responseJSON.reason, '#message-container-area'= ); - wok.hideBootgridLoading(wok.opts_user_log); - }); -}; =20 -wok.initUserLog =3D function() { - $(".content-area", "#wokSettings").css("height", "100%"); - wok.initUserLogConfig(); - $('#advanced-search-button').on('click',function(){ - wok.window.open('tabs/settings-search.html'); - }); - - $("#download-button").on('click',function(){ - var search =3D $('#download-button').data('search'); - if(search){ - search +=3D'&'; - }; - wok.downloadLogs(function(result) { - window.open(result.uri, '_blank'); - }, function(error) { + wok.getUserLogs(function(result) { + $.each(result, function(index, log){ + var statusLabel =3D labelStyle(log.status); + var userLabel =3D labelStyle(log.user); + if (statusLabel !=3D null) { + log.status =3D " "= + log.status + " "; + } else { + log.status =3D ""; + } + if (userLabel =3D=3D null) { + log.user =3D "N/A"; + } + }) + wok.loadBootgridData(wok.opts_user_log['gridId'], result); + wok.showBootgridData(wok.opts_user_log); + wok.hideBootgridLoading(wok.opts_user_log); + }, function(error) { wok.message.error(error.responseJSON.reason, '#message-container-a= rea'); - },search); - }); - - $("#refresh-button").on('click', function(){ - $("#download-button").data('search', ''); - $("#user-log-grid").bootgrid("search"); - wok.initUserLogConfigGridData(); - }); + wok.hideBootgridLoading(wok.opts_user_log); + }); +}; =20 +wok.initUserLog =3D function() { + $(".content-area", "#wokSettings").css("height", "100%"); + wok.initUserLogConfig(); + $('#advanced-search-button').on('click',function(){ + wok.window.open('tabs/settings-search.html'); + }); + + $("#download-button").on('click',function(){ + var search =3D $('#download-button').data('search'); + if(search){ + search +=3D'&'; + }; + wok.downloadLogs(function(result) { + window.open(result.uri, '_blank'); + }, function(error) { + wok.message.error(error.responseJSON.reason, '#message-contain= er-area'); + },search); + }); + + $("#refresh-button").on('click', function(){ + $("#download-button").data('search', ''); + $("#user-log-grid").bootgrid("search"); + wok.initUserLogConfigGridData(); + }); }; =20 wok.initUserLogWindow =3D function() { - var currentLocale =3D wok.lang.get_locale(); - currentLocale =3D currentLocale.substring(0, currentLocale.indexOf('-')); - $("#request-type").selectpicker(); - $.datepicker.setDefaults($.datepicker.regional[currentLocale]); - $("#date").datepicker({ dateFormat: 'yy-mm-dd', - onSelect: function(dateText) { - $('#button-search').prop('disabled',false); - }, - beforeShow: function(input, inst) { - $('#ui-datepicker-div').removeClass(function() { - return $('input').get(0).id; - }); - $('#ui-datepicker-div').addClass(this.id); - } - }); - var pluginsData =3D []; - wok.listPlugins(function(pluginReturn) { + var currentLocale =3D wok.lang.get_locale(); + currentLocale =3D currentLocale.substring(0, currentLocale.indexOf('-'= )); + $("#request-type").selectpicker(); + $.datepicker.setDefaults($.datepicker.regional[currentLocale]); + $("#date").datepicker({ dateFormat: 'yy-mm-dd', + onSelect: function(dateText) { + $('#button-search').prop('disabled',false); + }, + beforeShow: function(input, inst) { + $('#ui-datepicker-div').removeClass(function() { + return $('input').get(0).id; + }); + $('#ui-datepicker-div').addClass(this.id); + } + }); + var pluginsData =3D []; + wok.listPlugins(function(pluginReturn) { $.each(pluginReturn, function(i, obj) { - pluginsData.push({"app": obj}); + pluginsData.push({"app": obj}); }); pluginsData.unshift({"app": "wok"}); var pluginsTt =3D new Bloodhound({ - datumTokenizer: Bloodhound.tokenizers.obj.whitespace('ap= p'), - queryTokenizer: Bloodhound.tokenizers.whitespace, - local: pluginsData - }); + datumTokenizer: Bloodhound.tokenizers.obj.whitespace('app'), + queryTokenizer: Bloodhound.tokenizers.whitespace, + local: pluginsData + }); pluginsTt.initialize(); =20 $('.typeahead').typeahead( - { - autoselect: false - }, { + { + autoselect: false + }, { name: 'application-name', displayKey: 'app', source: pluginsTt.ttAdapter() }); - - }); - - $('#form-advanced-search').submit(function(event) { - event.preventDefault(); - var $inputs =3D $('#form-advanced-search :input').not('button'); - var values =3D {}; - $inputs.each(function() { - if($(this).val()) { - values[this.name] =3D $(this).val(); - } - }); - if(Object.keys(values).length){ - var form =3D $('#form-advanced-search').serialize(); - wok.getFilteredUserLogs(function(result) { - $("#"+wok.opts_user_log['gridId']).bootgrid("clear"); - $("#"+wok.opts_user_log['gridId']).bootgrid("append", result.rec= ords); - $("#download-button").data('search',form); - wok.window.close(); - }, function(err) { - wok.message.error(err.responseJSON.reason, '#alert-modal-contain= er'); - wok.hideBootgridLoading(wok.opts_user_log); - }, form); - }else { - wok.getUserLogs(function(result) { - $("#"+wok.opts_user_log['gridId']).bootgrid("clear"); - $("#"+wok.opts_user_log['gridId']).bootgrid("append", result); - }, function(error) { - wok.message.error(error.responseJSON.reason, '#message-container-a= rea'); - wok.hideBootgridLoading(wok.opts_user_log); - }); - wok.window.close(); - } - }); - - $('#button-search').on('click',function(){ - $('#form-advanced-search :input').each(function(){ - if( $(this).val() =3D=3D=3D '' ){ - $(this).prop('disabled',true); - } - }); - $('#form-advanced-search').submit(); - }); + }); + + $('#form-advanced-search').submit(function(event) { + event.preventDefault(); + var $inputs =3D $('#form-advanced-search :input').not('button'); + var values =3D {}; + $inputs.each(function() { + if($(this).val()) { + values[this.name] =3D $(this).val(); + } + }); + if(Object.keys(values).length){ + var form =3D $('#form-advanced-search').serialize(); + wok.getFilteredUserLogs(function(result) { + $("#"+wok.opts_user_log['gridId']).bootgrid("clear"); + $("#"+wok.opts_user_log['gridId']).bootgrid("append", resu= lt.records); + $("#download-button").data('search',form); + wok.window.close(); + }, function(err) { + wok.message.error(err.responseJSON.reason, '#alert-modal-c= ontainer'); + wok.hideBootgridLoading(wok.opts_user_log); + }, form); + }else { + wok.getUserLogs(function(result) { + $("#"+wok.opts_user_log['gridId']).bootgrid("clear"); + $("#"+wok.opts_user_log['gridId']).bootgrid("append", resu= lt); + }, function(error) { + wok.message.error(error.responseJSON.reason, '#message-con= tainer-area'); + wok.hideBootgridLoading(wok.opts_user_log); + }); + wok.window.close(); + } + }); + + $('#button-search').on('click',function(){ + $('#form-advanced-search :input').each(function(){ + if( $(this).val() =3D=3D=3D '' ){ + $(this).prop('disabled',true); + } + }); + $('#form-advanced-search').submit(); + }); }; --=20 2.9.3 _______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel From nobody Sat Apr 20 07:48:10 2024 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 1486993149570688.9853630564849; Mon, 13 Feb 2017 05:39:09 -0800 (PST) Received: from lists.phx.ovirt.org (localhost [127.0.0.1]) by lists.ovirt.org (Postfix) with ESMTP id 9E3B282070E; Mon, 13 Feb 2017 13:39:08 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lists.ovirt.org (Postfix) with ESMTPS id 43E0282069B for ; Mon, 13 Feb 2017 13:37:52 +0000 (UTC) Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v1DDXsHu158790 for ; Mon, 13 Feb 2017 08:37:51 -0500 Received: from e24smtp04.br.ibm.com (e24smtp04.br.ibm.com [32.104.18.25]) by mx0b-001b2d01.pphosted.com with ESMTP id 28jh1narer-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 13 Feb 2017 08:37:51 -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:37:49 -0200 Received: from d24dlp02.br.ibm.com (9.18.248.206) 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:37:47 -0200 Received: from d24relay04.br.ibm.com (d24relay04.br.ibm.com [9.18.232.146]) by d24dlp02.br.ibm.com (Postfix) with ESMTP id 6EF661DC006D for ; Mon, 13 Feb 2017 08:37:48 -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 v1DDblSo34799618 for ; Mon, 13 Feb 2017 11:37:47 -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 v1DDbllU023491 for ; Mon, 13 Feb 2017 11:37:47 -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 v1DDba31023332 for ; Mon, 13 Feb 2017 11:37:46 -0200 X-Original-To: kimchi-devel@ovirt.org From: Aline Manera To: Kimchi Devel Date: Mon, 13 Feb 2017 11:37:33 -0200 X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170213133735.10975-1-alinefm@linux.vnet.ibm.com> References: <20170213133735.10975-1-alinefm@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17021313-0028-0000-0000-0000019490D1 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17021313-0029-0000-0000-00001490C3F2 Message-Id: <20170213133735.10975-6-alinefm@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-13_07:, , 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-1702130134 Subject: [Kimchi-devel] [PATCH] [Wok 5/7] Move "User Log Activity" tab to "Activity Log" tab instead of "Settings" 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" The patch renames all the files used by user log to make it consistence to its new tab name. The "Settings" tab will be used to handle plugins management feature. This patch does not add anything new. The changes was to accomodate the files renaming. Signed-off-by: Aline Manera --- ui/config/tab-ext.xml | 4 +- ui/css/Makefile.am | 10 +- ui/css/src/{settings.scss =3D> user-log.scss} | 2 +- ui/css/user-log.css | 159 +++++++++++++++++= ++++ ui/css/wok.css | 4 +- ui/js/wok.bootgrid.js | 6 +- ui/js/wok.user-log.js | 22 ++- ...-search.html.tmpl =3D> user-log-search.html.tmpl} | 0 .../{settings.html.tmpl =3D> user-log.html.tmpl} | 10 +- 9 files changed, 187 insertions(+), 30 deletions(-) rename ui/css/src/{settings.scss =3D> user-log.scss} (98%) create mode 100644 ui/css/user-log.css rename ui/pages/tabs/{settings-search.html.tmpl =3D> user-log-search.html.= tmpl} (100%) rename ui/pages/tabs/{settings.html.tmpl =3D> user-log.html.tmpl} (87%) diff --git a/ui/config/tab-ext.xml b/ui/config/tab-ext.xml index 348e13e..5780b96 100644 --- a/ui/config/tab-ext.xml +++ b/ui/config/tab-ext.xml @@ -4,8 +4,8 @@ - Settings + Activity Log -1 - tabs/settings.html + tabs/user-log.html diff --git a/ui/css/Makefile.am b/ui/css/Makefile.am index a779e61..ea49ec8 100644 --- a/ui/css/Makefile.am +++ b/ui/css/Makefile.am @@ -1,7 +1,7 @@ # # Project Wok # -# Copyright IBM Corp, 2013-2016 +# Copyright IBM Corp, 2013-2017 # # Code derived from Project Kimchi # @@ -22,7 +22,7 @@ SUBDIRS =3D fontawesome opensans EXTRA_DIST =3D theme-default =20 cssdir =3D $(datadir)/wok/ui/css -dist_css_DATA =3D theme-default.min.css jquery-ui.custom.css wok.css boots= trap.custom.css bootstrap-select.custom.css settings.css datatables.bootstr= ap.css +dist_css_DATA =3D $(wildcard *.css) =20 wok: src/wok.scss src/modules/*.scss echo "Compiling .scss file $<" @@ -32,9 +32,9 @@ bootstrap: src/bootstrap.custom.scss echo "Compiling .scss file $<" sassc -s expanded $< bootstrap.custom.css =20 -settings: src/settings.scss +user-log: src/user-log.scss echo "Compiling .scss file $<" - sassc -s expanded $< settings.css + sassc -s expanded $< user-log.css =20 bootstrap-select: src/bootstrap-select.custom.scss echo "Compiling .scss file $<" @@ -44,7 +44,7 @@ datatables: src/datatables.bootstrap.scss echo "Compiling .scss file $<" sassc -s expanded $< datatables.bootstrap.css =20 -css: wok bootstrap bootstrap-select settings datatables +css: wok bootstrap bootstrap-select user-log datatables =20 theme-default.min.css: theme-default/*.css cat $^ > $@ diff --git a/ui/css/src/settings.scss b/ui/css/src/user-log.scss similarity index 98% rename from ui/css/src/settings.scss rename to ui/css/src/user-log.scss index 557605e..d829516 100644 --- a/ui/css/src/settings.scss +++ b/ui/css/src/user-log.scss @@ -1,7 +1,7 @@ /* * Project Wok * - * Copyright IBM Corp, 2016 + * Copyright IBM Corp, 2017 * * Code derived from Project Kimchi * diff --git a/ui/css/user-log.css b/ui/css/user-log.css new file mode 100644 index 0000000..cba4cc6 --- /dev/null +++ b/ui/css/user-log.css @@ -0,0 +1,159 @@ +/* + * Project Wok + * + * Copyright IBM Corp, 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. + */ +/* + * A partial implementation of the Ruby list functions from Compass: + * https://github.com/Compass/compass/blob/stable/lib/compass/sass_extensi= ons/functions/lists.rb + */ +/* + * A partial implementation of the Ruby constants functions from Compass: + * https://github.com/Compass/compass/blob/stable/lib/compass/sass_extensi= ons/functions/constants.rb + */ +/* + * A partial implementation of the Ruby display functions from Compass: + * https://github.com/Compass/compass/blob/stable/core/lib/compass/core/sa= ss_extensions/functions/display.rb + */ +#wok-root-container .accordion { + margin: 12px 20px 12px 60px; + padding-bottom: 18px; + border-bottom: 1px solid #eee; + overflow: visible; + clear: both; +} + +#wok-root-container .accordion:first-child { + margin-top: 24px; +} + +#wok-root-container .accordion > h3 { + margin: 0; + padding: 0; + font-size: 26px; + font-weight: 300; + height: 44px; + display: block; +} + +#wok-root-container .accordion > h3 a { + color: #3a393b; + text-decoration: none; + display: block; + padding: 6px 30px; + margin-left: -30px; + margin-right: -30px; +} + +#wok-root-container .accordion > h3 a span.accordion-icon { + margin-left: -52px; + vertical-align: middle; + display: inline-block; + font: normal normal normal 32px/1 FontAwesome; + text-rendering: auto; + -webkit-font-smoothing: antialiased; + color: #3a393b; +} + +#wok-root-container .accordion > h3 a[aria-expanded=3D"false"] span.accord= ion-icon:before { + content: "\f01a"; +} + +#wok-root-container .accordion > h3 a[aria-expanded=3D"true"] span.accordi= on-icon:before { + content: "\f01b"; +} + +#wok-root-container .accordion > h3 a span.accordion-text { + margin-left: 23px; + display: inline-block; + vertical-align: middle; +} + +.wok div.modal-footer { + background-color: #d9182d; +} + +.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; +} + +.wok.modal .row.clearfix { + margin-left: -10px; + margin-right: -10px; +} + +.wok.modal .form-group.col-sm-6 { + padding-left: 10px; + padding-right: 10px; +} + +.action-group { + position: absolute; + z-index: 999; +} + +div#user-log-actions { + padding-top: 15px; +} + +.label { + display: inline-block; + vertical-align: middle; +} + +.bootgrid-table th > .column-header-anchor > .icon.fa { + right: 6px; + top: 4px; +} + +span.trim { + display: inline-block; + width: 100%; + vertical-align: middle; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + padding-right: 6px; +} + +.table > tbody > tr > td { + vertical-align: middle; +} + +.tooltip > .tooltip-inner { + font-weight: 400; + font-size: 12.5pt; + padding: 8px !important; + 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/wok.css b/ui/css/wok.css index f77b2af..ec269b5 100644 --- a/ui/css/wok.css +++ b/ui/css/wok.css @@ -1,7 +1,7 @@ /* * Project Wok * - * Copyright IBM Corp, 2015-2016 + * Copyright IBM Corp, 2015-2017 * * Code derived from Project Kimchi * @@ -1473,7 +1473,7 @@ input[type=3Dradio].wok-radio + label { /* * Project Wok * -* Copyright IBM Corp, 2015-2016 +* Copyright IBM Corp, 2015-2017 * * Code derived from Project Kimchi * diff --git a/ui/js/wok.bootgrid.js b/ui/js/wok.bootgrid.js index 1a5a374..e2da393 100644 --- a/ui/js/wok.bootgrid.js +++ b/ui/js/wok.bootgrid.js @@ -1,5 +1,5 @@ /* - * Copyright IBM Corp, 2016 + * Copyright IBM Corp, 2016-2017 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -74,10 +74,10 @@ wok.createBootgrid =3D function(opts) { navigation: navigation, rowSelect: false, formatters: { - "settings-user-log-app": function(column, row) { + "user-log-app": function(column, row) { return '' + row.app + ' '; }, - "settings-user-log-message": function(column, row) { + "user-log-message": function(column, row) { return '' +row.message+ ' '; }, }, diff --git a/ui/js/wok.user-log.js b/ui/js/wok.user-log.js index 560fbfa..80e67e1 100644 --- a/ui/js/wok.user-log.js +++ b/ui/js/wok.user-log.js @@ -1,5 +1,5 @@ /* - * Copyright IBM Corp, 2016 + * Copyright IBM Corp, 2016-2017 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -16,18 +16,14 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-13= 01 USA */ =20 -wok.initSettings =3D function() { +wok.initUserLog =3D function() { wok.opts_user_log =3D {}; wok.opts_user_log['id'] =3D 'user-log-content'; wok.opts_user_log['gridId'] =3D "user-log-grid"; wok.opts_user_log['loadingMessage'] =3D i18n['WOKSETT0007M']; - wok.initUserLog(); + wok.initUserLogContent(); }; =20 -wok.initUserLogConfig =3D function() { - wok.listUserLogConfig(); -} - wok.listUserLogConfig =3D function() { =20 var ulGrid =3D []; @@ -36,7 +32,7 @@ wok.listUserLogConfig =3D function() { gridFields =3D [{ "column-id": 'app', "converter": 'string', - "formatter": "settings-user-log-app", + "formatter": "user-log-app", "title": i18n['WOKSETT0001M'] }, { "column-id": 'user', @@ -73,7 +69,7 @@ wok.listUserLogConfig =3D function() { }, { "column-id": 'message', "converter": 'string', - "formatter": "settings-user-log-message", + "formatter": "user-log-message", "sortable": false, "width": "30%", "title": i18n['WOKSETT0006M'] @@ -133,11 +129,11 @@ wok.initUserLogConfigGridData =3D function() { }); }; =20 -wok.initUserLog =3D function() { - $(".content-area", "#wokSettings").css("height", "100%"); - wok.initUserLogConfig(); +wok.initUserLogContent =3D function() { + $(".content-area", "#wokUserLog").css("height", "100%"); + wok.listUserLogConfig(); $('#advanced-search-button').on('click',function(){ - wok.window.open('tabs/settings-search.html'); + wok.window.open('tabs/user-log-search.html'); }); =20 $("#download-button").on('click',function(){ diff --git a/ui/pages/tabs/settings-search.html.tmpl b/ui/pages/tabs/user-l= og-search.html.tmpl similarity index 100% rename from ui/pages/tabs/settings-search.html.tmpl rename to ui/pages/tabs/user-log-search.html.tmpl diff --git a/ui/pages/tabs/settings.html.tmpl b/ui/pages/tabs/user-log.html= .tmpl similarity index 87% rename from ui/pages/tabs/settings.html.tmpl rename to ui/pages/tabs/user-log.html.tmpl index dde05c8..d45cbaf 100644 --- a/ui/pages/tabs/settings.html.tmpl +++ b/ui/pages/tabs/user-log.html.tmpl @@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston= , MA 02110-1301 USA =20 - + =20 --=20 2.9.3 _______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel From nobody Sat Apr 20 07:48:10 2024 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 1486993171797465.0547180774181; Mon, 13 Feb 2017 05:39:31 -0800 (PST) Received: from lists.phx.ovirt.org (localhost [127.0.0.1]) by lists.ovirt.org (Postfix) with ESMTP id EBD9A8206F0; Mon, 13 Feb 2017 13:39:29 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lists.ovirt.org (Postfix) with ESMTPS id 8117D82063E for ; Mon, 13 Feb 2017 13:37:54 +0000 (UTC) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v1DDXwef110019 for ; Mon, 13 Feb 2017 08:37:54 -0500 Received: from e24smtp04.br.ibm.com (e24smtp04.br.ibm.com [32.104.18.25]) by mx0a-001b2d01.pphosted.com with ESMTP id 28k7jaftvf-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 13 Feb 2017 08:37:53 -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:37:51 -0200 Received: from d24dlp02.br.ibm.com (9.18.248.206) 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:37:49 -0200 Received: from d24relay01.br.ibm.com (d24relay01.br.ibm.com [9.8.31.16]) by d24dlp02.br.ibm.com (Postfix) with ESMTP id 10F901DC006E for ; Mon, 13 Feb 2017 08:37:50 -0500 (EST) Received: from d24av02.br.ibm.com (d24av02.br.ibm.com [9.8.31.93]) by d24relay01.br.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v1DDbmXg4161672 for ; Mon, 13 Feb 2017 11:37:48 -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 v1DDbmAj023497 for ; Mon, 13 Feb 2017 11:37:48 -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 v1DDba32023332 for ; Mon, 13 Feb 2017 11:37:47 -0200 X-Original-To: kimchi-devel@ovirt.org From: Aline Manera To: Kimchi Devel Date: Mon, 13 Feb 2017 11:37:34 -0200 X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170213133735.10975-1-alinefm@linux.vnet.ibm.com> References: <20170213133735.10975-1-alinefm@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17021313-0028-0000-0000-0000019490D3 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17021313-0029-0000-0000-00001490C3F4 Message-Id: <20170213133735.10975-7-alinefm@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-13_07:, , 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-1702130134 Subject: [Kimchi-devel] [PATCH] [Wok 6/7] Cache plugins information on UI to avoid multiple requests 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" Plugins information does not change a lot and once changed the UI needs to reload the browser session to rebuild the UI, so there is no need to do multiple requests to get the plugin information. A single request would be enough to all matters. So do it and update the code according to that change. Signed-off-by: Aline Manera --- ui/js/src/wok.logos.js | 79 ++++++++++++++++++++++++++------------------- ui/js/src/wok.main.js | 87 ++++++++++++++++++++++++++--------------------= ---- ui/js/wok.user-log.js | 45 ++++++++++++++------------ 3 files changed, 116 insertions(+), 95 deletions(-) diff --git a/ui/js/src/wok.logos.js b/ui/js/src/wok.logos.js index b4e2d75..1abab84 100644 --- a/ui/js/src/wok.logos.js +++ b/ui/js/src/wok.logos.js @@ -16,6 +16,15 @@ * limitations under the License. */ =20 + +wok.plugins =3D undefined; +wok.listPlugins(function(result) { + wok.plugins =3D result; +}, function(data) { + wok.plugins =3D []; + wok.message.error(data.responseJSON.reason); +}); + wok.logos =3D function(element, powered) { powered =3D (typeof powered =3D=3D=3D 'undefined') ? false : true; var genLogos =3D function(obj){ @@ -73,44 +82,48 @@ wok.logos =3D function(element, powered) { =20 var pluginUrl =3D 'plugins/{plugin}'; var buildLogos =3D function() { + // Make wok.plugins is ready to be used + if (wok.plugins =3D=3D undefined) { + setTimeout(buildLogos, 2000); + return; + } + var logos =3D []; var obj =3D {}; - wok.listPlugins(function(plugins) { - if(plugins && plugins.length > 0) { - $(plugins).each(function(i, p) { - if (p.enabled =3D=3D=3D false) { - return true; - } - var url =3D wok.substitute(pluginUrl, { - plugin: p.name - }); - obj[i] =3D { - name : p.name - } - var pluginVersions; - pluginVersions =3D retrieveVersion(url); - if(pluginVersions && pluginVersions.length > 0){ - obj[i].version =3D pluginVersions; - } - var imagepath =3D url+'/images/'+p.name; - if(checkImage(imagepath+'.svg') =3D=3D 200) { - obj[i].image =3D imagepath+'.svg'; - } - else if(checkImage(imagepath+'.png') =3D=3D 200) { - obj[i].image =3D imagepath+'.png'; - } + if(wok.plugins && wok.plugins.length > 0) { + $(wok.plugins).each(function(i, p) { + if (p.enabled =3D=3D=3D false) { + return true; + } + var url =3D wok.substitute(pluginUrl, { + plugin: p.name }); - var generatedLogos =3D genLogos(obj); - if(generatedLogos.length > 0) { - $(element).append(generatedLogos); - if(powered) { - $(element).parentsUntil('.container').find('.power= ed').removeClass('hidden'); - }else { - $(element).parentsUntil('.container').find('.power= ed').remove(); - } + obj[i] =3D { + name : p.name + } + var pluginVersions; + pluginVersions =3D retrieveVersion(url); + if(pluginVersions && pluginVersions.length > 0){ + obj[i].version =3D pluginVersions; + } + var imagepath =3D url+'/images/'+p.name; + if(checkImage(imagepath+'.svg') =3D=3D 200) { + obj[i].image =3D wok.plugins[i].image =3D imagepath+'.= svg'; + } + else if(checkImage(imagepath+'.png') =3D=3D 200) { + obj[i].image =3D wok.plugins[i].image =3D imagepath+'= .png'; + } + }); + var generatedLogos =3D genLogos(obj); + if(generatedLogos.length > 0) { + $(element).append(generatedLogos); + if(powered) { + $(element).parentsUntil('.container').find('.powered')= .removeClass('hidden'); + }else { + $(element).parentsUntil('.container').find('.powered')= .remove(); } } - }); + } }; buildLogos(); =20 diff --git a/ui/js/src/wok.main.js b/ui/js/src/wok.main.js index 6de8ea0..20c017e 100644 --- a/ui/js/src/wok.main.js +++ b/ui/js/src/wok.main.js @@ -139,55 +139,58 @@ wok.main =3D function() { var pluginI18nUrl =3D 'plugins/{plugin}/i18n.json'; var DEFAULT_HASH; var buildTabs =3D function(callback) { + // Make wok.plugins is ready to be used + if (wok.plugins =3D=3D undefined) { + setTimeout(buildTabs, 2000); + return; + } + var tabs =3D retrieveTabs('wok', wokConfigUrl); - wok.listPlugins(function(plugins) { - $(plugins).each(function(i, p) { - if (p.enabled =3D=3D=3D false) { - return true; - } + var plugins =3D wok.plugins; + $(plugins).each(function(i, p) { + if (p.enabled =3D=3D=3D false) { + return true; + } =20 - var url =3D wok.substitute(pluginConfigUrl, { - plugin: p.name - }); - var i18nUrl =3D wok.substitute(pluginI18nUrl, { - plugin: p.name - }); - wok.getI18n(function(i18nObj){ $.extend(i18n, i18nObj)}, - function(i18nObj){ //i18n is not define by plu= gin - }, i18nUrl, true); - var pluginTabs =3D retrieveTabs(p.name, url); - if(pluginTabs.length > 0){ - tabs.push.apply(tabs, pluginTabs); - } + var url =3D wok.substitute(pluginConfigUrl, { + plugin: p.name }); - - //sort second level tab based on their ordering number - var orderedTabs =3D tabs.slice(0); - orderedTabs.sort(function(a, b) { - return a.order - b.order; + var i18nUrl =3D wok.substitute(pluginI18nUrl, { + plugin: p.name }); - //redirect to empty page when no plugin installed - if(tabs.length=3D=3D=3D0){ - DEFAULT_HASH =3D 'wok-empty'; - } else { - var defaultTab =3D orderedTabs[0] - var defaultTabPath =3D defaultTab && defaultTab['path'] + wok.getI18n(function(i18nObj){ $.extend(i18n, i18nObj)}, + function(i18nObj){ //i18n is not define by plugin + }, i18nUrl, true); + var pluginTabs =3D retrieveTabs(p.name, url); + if(pluginTabs.length > 0){ + tabs.push.apply(tabs, pluginTabs); + } + }); =20 - // Remove file extension from 'defaultTabPath' - DEFAULT_HASH =3D defaultTabPath && - defaultTabPath.substring(0, defaultTabPath.lastIndexOf= ('.')) - } + //sort second level tab based on their ordering number + var orderedTabs =3D tabs.slice(0); + orderedTabs.sort(function(a, b) { + return a.order - b.order; + }); + //redirect to empty page when no plugin installed + if(tabs.length=3D=3D=3D0){ + DEFAULT_HASH =3D 'wok-empty'; + } else { + var defaultTab =3D orderedTabs[0] + var defaultTabPath =3D defaultTab && defaultTab['path'] + + // Remove file extension from 'defaultTabPath' + DEFAULT_HASH =3D defaultTabPath && + defaultTabPath.substring(0, defaultTabPath.lastIndexOf('.'= )) + } =20 - genTabs(orderedTabs); - wok.getHostname(); - wok.logos('ul#plugins',true); - wok.logos('ul#wok-about',false); + genTabs(orderedTabs); + wok.getHostname(); + wok.logos('ul#plugins',true); + wok.logos('ul#wok-about',false); =20 - callback && callback(); - }, function(data) { - wok.message.error(data.responseJSON.reason); - }, true); - }; + callback && callback(); + } =20 var onLanguageChanged =3D function(lang) { wok.lang.set(lang); diff --git a/ui/js/wok.user-log.js b/ui/js/wok.user-log.js index 80e67e1..0e8fb09 100644 --- a/ui/js/wok.user-log.js +++ b/ui/js/wok.user-log.js @@ -156,6 +156,12 @@ wok.initUserLogContent =3D function() { }; =20 wok.initUserLogWindow =3D function() { + // Make wok.plugins is ready to be used + if (wok.plugins =3D=3D undefined) { + setTimeout(wok.initUserLogWindow, 2000); + return; + } + var currentLocale =3D wok.lang.get_locale(); currentLocale =3D currentLocale.substring(0, currentLocale.indexOf('-'= )); $("#request-type").selectpicker(); @@ -172,26 +178,25 @@ wok.initUserLogWindow =3D function() { } }); var pluginsData =3D []; - wok.listPlugins(function(pluginReturn) { - $.each(pluginReturn, function(i, obj) { - pluginsData.push({"app": obj}); - }); - pluginsData.unshift({"app": "wok"}); - var pluginsTt =3D new Bloodhound({ - datumTokenizer: Bloodhound.tokenizers.obj.whitespace('app'), - queryTokenizer: Bloodhound.tokenizers.whitespace, - local: pluginsData - }); - pluginsTt.initialize(); - - $('.typeahead').typeahead( - { - autoselect: false - }, { - name: 'application-name', - displayKey: 'app', - source: pluginsTt.ttAdapter() - }); + var pluginReturn =3D wok.plugins; + $.each(pluginReturn, function(i, obj) { + pluginsData.push({"app": obj}); + }); + pluginsData.unshift({"app": "wok"}); + var pluginsTt =3D new Bloodhound({ + datumTokenizer: Bloodhound.tokenizers.obj.whitespace('app'), + queryTokenizer: Bloodhound.tokenizers.whitespace, + local: pluginsData + }); + pluginsTt.initialize(); + + $('.typeahead').typeahead( + { + autoselect: false + }, { + name: 'application-name', + displayKey: 'app', + source: pluginsTt.ttAdapter() }); =20 $('#form-advanced-search').submit(function(event) { --=20 2.9.3 _______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel From nobody Sat Apr 20 07:48:10 2024 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 1486993183025667.108072838221; Mon, 13 Feb 2017 05:39:43 -0800 (PST) Received: from lists.phx.ovirt.org (localhost [127.0.0.1]) by lists.ovirt.org (Postfix) with ESMTP id 234188206F7; Mon, 13 Feb 2017 13:39:42 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lists.ovirt.org (Postfix) with ESMTPS id 882A68206F6 for ; Mon, 13 Feb 2017 13:37:57 +0000 (UTC) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v1DDY1X4130922 for ; Mon, 13 Feb 2017 08:37:57 -0500 Received: from e24smtp01.br.ibm.com (e24smtp01.br.ibm.com [32.104.18.85]) by mx0a-001b2d01.pphosted.com with ESMTP id 28k75xrp5d-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 13 Feb 2017 08:37:56 -0500 Received: from localhost by e24smtp01.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 13 Feb 2017 11:37:53 -0200 Received: from d24dlp01.br.ibm.com (9.18.248.204) by e24smtp01.br.ibm.com (10.172.0.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 13 Feb 2017 11:37:51 -0200 Received: from d24relay04.br.ibm.com (d24relay04.br.ibm.com [9.18.232.146]) by d24dlp01.br.ibm.com (Postfix) with ESMTP id 4D01E3520068 for ; Mon, 13 Feb 2017 08:37:17 -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 v1DDboOg34013320 for ; Mon, 13 Feb 2017 11:37:50 -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 v1DDboq9023512 for ; Mon, 13 Feb 2017 11:37:50 -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 v1DDba33023332 for ; Mon, 13 Feb 2017 11:37:49 -0200 X-Original-To: kimchi-devel@ovirt.org From: Aline Manera To: Kimchi Devel Date: Mon, 13 Feb 2017 11:37:35 -0200 X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170213133735.10975-1-alinefm@linux.vnet.ibm.com> References: <20170213133735.10975-1-alinefm@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17021313-1523-0000-0000-0000027F004F X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17021313-1524-0000-0000-00002A14002E Message-Id: <20170213133735.10975-8-alinefm@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-13_07:, , 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-1702130134 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 zcmb7G_ct4k7fooTL{zP!wW~$##E!OFjXi4b6?@i*UDRw;N{y=3D6RaC8tB0;PwYO5K0 zRI3zGHDi2z{)F#&=3De~Q+JMWkG-aYSJw7#wygpQLA002NV)Kv{G*#830uh3lNU5>ba z7ewQrrKSov|1S!NrD+!x+NbK~7j0nX{{RGFbJ#D6pa2b>$Dk!D+N%mIv@~{^007;p zhN_BD@bspYZIY2G$N8L+QWNx3Un;(;<&!bbRJ-FSlfX!3>ezQx2sYi(dK!_Z9b%Zz ziR4vJDxs~0zh!5#NT+#jU*p~{j^Ug}I8Z~x`-Qxy*>S^BnAM^FKYvccr^0^a?dJN^ zZ1)#iNi19q3_9EVGrOC+eei5yJNy@b>iGj+#w(Zpe^R*~e0t(XG*JRA?y%eg0bQwF z0f%x?8-OY*{FOy`)M#2p?{W-hEO!-h!?E~p=3DtPo2N}+}^UF!tZAv~)36R`ElqEM8r zj)@3r=3DL_gZ7Kq_yTY{W-6d+0{K<42g&j@54UfTRhsJZp;fCP)Aq-2yIA$Do}3%hj_ z8xn~;>_3#B(9yOF4t@(b;cmV%ID@eC@CpvQIL_@!-Q7u zYXR=3D(R2XgX62azDCUC)wZxcuMvxB8ltks_(uLd5;NXWuXBG0<^Hs0D=3Db)L-TG}wQM z-&Q7s>_Yb}y!tMt9)dxpj|!!9PDl^Z6|h|Dr^^|_{lsepgY5FkuoGniqE$Bg&Y}(e zDG&?>CqD}rE%Ep1&ky}uR@%C+d!EH!^R(T&oLL4*9>od9btNLT50lfoJA8+^4dJ|J zAdCg=3D1IDw6KkYRM`3nBd<4cnat;C?AJRRWytuHS+Z&w_Lw zp|MFzdQ#S9-qE5jGd%P7C(UN%r$>aWEQx&|4cv*>YOV8dN*M=3DpVvU2qG|qHRtC(VpE~f7 zLI#Wosd~V0e5ySBF~gWE?B0xLUBpOcczeh5drLTv;dEEF&>SNNrv&%9$>0CVpIG$! z<)TN>W$yGboY{pTzU8FweWlS++ikS{81{R{8s8A9BCyhWecO8w%=3D&qS zR6+?ZQ|@{O3S-Yr8MxemhiZqYLp2HFKO~j-m`5F7k=3D5{83O$XPdqXKOM@LaO#PbpX zlQZ9s53rr{nU9WF0 z2ZtCSf20xgB)RdYW3gYMndtm{a|l$(&adEcx3Pn(RKX&c=3Dnlfhx}poyEiVf-lOGhD zZFUSyVHxEnt8J@af)Ia^*AA&eMG1Znj;VkYOY@}6-y#pz>77x6Mjto1g1WoArQ~6b zTvo;uW2Ef0N*zTh%t3?TBMvJC4P#(pT)^6Lqs8oj_m~vGjOfl%ow2e; z+S(g>zSeiZQUUJZq+d+$Y|1f!LlyuF2!s^YgWj+ut?B!u3`^wNyxkOm>WuL6t~@lX z=3D&M&1^`q>2`2%lMz((9{x4m(}q&Rou36)n$kk1HkAGRR$zPk6+bzlL>b9uj;=3DSJR^ z^p8Y?wK+{2Y`~7b{%t6Ug_ZZ#{m=3D6!51R&p%zjbYCWG1lMf~r2+z62 zcqD?pI_zNb`a}ipIy-6F)S4@!8rbzQJ^<%>pYuJv{VlIJ8#$&B9<`#8wlc#~$@_B2 zQB;T-N3n#lH@VN3+k8@OL16GSWn*58U^R5B7V<<(eahq60#6N5r+mC)AY0CNb6RF> z1C^r`#!zW8>iyZ9SPw}2x@?=3DwRh_pT=3Dd@hUO8oZ?$7je2@g#{zd8i%ODg-meJ^Yij zx#|Stgrs206yXxO_&?Pzy)(6n^Y@r#gFSEe#eS=3DHwQEwx-FbY#3BlmxGt4~{zTh3v zZg-P2Iwe@x)Z*3ZO_OrztufJ=3DN|Pti|rL?AktT@e^damZZ)F9y*@K9Ds7U)=3DVMw> z%0)9vZJON6(#5Y&^dlyrl_CR)@9fkgNHWF3tkb4We$B;twoLp{@Qr@K-bM~o;<$7` zAAyc=3DA&>7jB*gIYDaH-3M!^^T#Ox58A$rDmHU1!nbYHAsOJG@<<)@n|uU#&?77Gk| zw^i_rk36Yt>id{E{ zfJW15S6DWz{>%0mj9l*ej4IE9$~B>>hb(f{T2N9q7bW5UkgLlfLlAK7ou7qh8U)*h zzJ|~W9U~=3D4e59br=3DVl=3DWQXzE)dVA#4&o1|eps*Kq~hSoN-^!+LAVtjp2HQ1 z%)v${{LTs&`wq33g+UEUyxg{gMw$7yhaWci6VUwZf{swaZCNs41TiFy`x|?h_aaw99vVC7SzD4)O#m4g9Rv0x$S`&}O%P_<1 zZUUaNE;Z$1jj#GLC0eySjbj@_KI}<4&VA~7?Z1c;w7j#4l;S6jB6{FC9k-jAowA*+ zxk5}(FSydy6%pg>HG|sh&vN_u|9`6pPd$`il8ip;rBz9|@W23#$GWOj5ACA=3D2i+fY 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