Repository: zeppelin Updated Branches: refs/heads/master 0274cfb7a -> 2d60d0b67
[ZEPPELIN-3063] Notebook loses formatting when importing from 0.6.x Notebook loses formatting (shows table instead of the graph) when importing from 0.6.x if the respective paragraph doesn't have result in it. [Bug Fix] * [ZEPPELIN-3063](https://issues.apache.org/jira/browse/ZEPPELIN-3063) Before:  After:  * Try importing [this](https://issues.apache.org/jira/secure/attachment/12898326/oldnotebook-0.6-clear.json) notebook, and then on running this notebook, the second paragraph should display BarChart instead of a table. Author: Prabhjyot <[email protected]> Author: prabhjyotsingh <[email protected]> Closes #2678 from prabhjyotsingh/ZEPPELIN-3063 and squashes the following commits: 3824eed01 [Prabhjyot] Add comment support for 0.6 1975c74e7 [prabhjyotsingh] ZEPPELIN-3063: Notebook loses formatting when importing from 0.6.x Change-Id: Ife7b557f9517fb6b076cd532354d2b431ed81a12 Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/2d60d0b6 Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/2d60d0b6 Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/2d60d0b6 Branch: refs/heads/master Commit: 2d60d0b678ed72426bed0e90e3954b1d763044b6 Parents: 0274cfb Author: Prabhjyot <[email protected]> Authored: Sun Nov 19 08:40:11 2017 +0530 Committer: prabhjyotsingh <[email protected]> Committed: Tue Nov 21 15:57:44 2017 +0530 ---------------------------------------------------------------------- .../org/apache/zeppelin/notebook/Notebook.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zeppelin/blob/2d60d0b6/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Notebook.java ---------------------------------------------------------------------- diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Notebook.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Notebook.java index c1dc46c..3baf4f1 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Notebook.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Notebook.java @@ -447,6 +447,25 @@ public class Notebook implements NoteEventListener { } config.put("results", results); } + } else if (ret == null && p.getConfig() != null) { + //ZEPPELIN-3063 Notebook loses formatting when importing from 0.6.x + if (p.getConfig().get("graph") != null && p.getConfig().get("graph") instanceof Map + && !((Map) p.getConfig().get("graph")).get("mode").equals("table")) { + Map<String, Object> config = p.getConfig(); + Object graph = config.remove("graph"); + Object apps = config.remove("apps"); + Object helium = config.remove("helium"); + + List<Object> results = new LinkedList<>(); + + HashMap<Object, Object> res = new HashMap<>(); + res.put("graph", graph); + res.put("apps", apps); + res.put("helium", helium); + results.add(res); + + config.put("results", results); + } } } catch (Exception e) { logger.error("Conversion failure", e);
