[Kimchi-devel] [PATCH] Issue #704: page refreshing in Wok when no plugins installed
pvital at linux.vnet.ibm.com
pvital at linux.vnet.ibm.com
Tue Sep 29 14:00:44 UTC 2015
From: Atreyee <atreyee at linux.vnet.ibm.com>
This patch fixes the issue of continuous page refresh once we logged into
wok running without any plugin installed.
Page url was switching between '/#' and '/undefined' . With the existing
UI code, a infinite loop got created for loading the page when no plugin
installed.
Signed-off-by: Atreyee <atreyee at linux.vnet.ibm.com>
---
ui/css/theme-default/message.css | 10 ++++++++++
ui/js/src/wok.main.js | 15 +++++++++++++--
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/ui/css/theme-default/message.css b/ui/css/theme-default/message.css
index c3f9b03..e77886b 100644
--- a/ui/css/theme-default/message.css
+++ b/ui/css/theme-default/message.css
@@ -133,3 +133,13 @@
border: 2px solid #444;
color: #444;
}
+
+.noPluginMessage{
+ font-size: 18px;
+ height: 48px;
+ line-height: 48px;
+ text-shadow: -1px -1px 1px #ccc, 1px 1px 1px #fff;
+ padding-left: 10px;
+ padding-top:10px;
+
+}
diff --git a/ui/js/src/wok.main.js b/ui/js/src/wok.main.js
index 570743d..447140e 100644
--- a/ui/js/src/wok.main.js
+++ b/ui/js/src/wok.main.js
@@ -102,10 +102,15 @@ wok.main = function() {
var defaultTab = tabs[0]
var defaultTabPath = defaultTab && defaultTab['path']
+
+ //redirect to empty page when no plugin installed
+ if(tabs.length===0){
+ DEFAULT_HASH = 'wok-empty';
+ }else{
// Remove file extension from 'defaultTabPath'
DEFAULT_HASH = defaultTabPath &&
defaultTabPath.substring(0, defaultTabPath.lastIndexOf('.'))
-
+ }
$('#nav-menu').append(genTabs(tabs));
callback && callback();
@@ -136,11 +141,16 @@ wok.main = function() {
* and clear location.hash to jump to home page.
*/
var tab = $('#nav-menu a[href="' + url + '"]');
- if (tab.length === 0) {
+ if (tab.length === 0 && url!='wok-empty.html') {
location.hash = '';
return;
}
+ //Remove the tab arrow indicator for no plugin
+ if(url=='wok-empty.html'){
+ $('.menu-arrow').hide();
+ $('#main').html('No plugins installed currently.You can download the available plugins <a href="https://github.com/kimchi-project/kimchi">Kimchi</a> and <a href="https://github.com/kimchi-project/ginger">Ginger</a> from Github').addClass('noPluginMessage');
+ }else{
// Animate arrow indicator.
var left = $(tab).parent().position().left;
var width = $(tab).parent().width();
@@ -163,6 +173,7 @@ wok.main = function() {
}
// Load page content.
loadPage(url);
+ }
};
/**
--
2.4.3
More information about the Kimchi-devel
mailing list