Hi Aline,
Below patch was meant for fixing 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.
while implementing the "Welcome to Wok" page/patch , we need to consider
the above scenario and resolve the issue accordingly.
On 8/11/2015 8:55 PM, Aline Manera wrote:
On 05/08/2015 06:18, Atreyee wrote:
> 'undefined' value displayed in url and page was getting refreshed
> after logged into wok page
Could you describe the problem you want to fix with this patch?
Does the problem happen while running wok without no plugin installed?
Isn't it dependent of the "Welcome to Wok" page/patch discussed in
other email?
>
> Signed-off-by: Atreyee <atreyee(a)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 28c392b..7cce15b 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 f4c9940..0d9baec 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.
You should properly write an HTML file to be loaded inside of inject
plain HTML into JS scripts.
> var left = $(tab).parent().position().left;
> var width = $(tab).parent().width();
> @@ -163,6 +173,7 @@ wok.main = function() {
> }
> // Load page content.
> loadPage(url);
> + }
> };
>
> /**