Adjust client-side support for SSE
Change-Id: Ic907fc7c243676101f2afe535a3701bf64db0eb7
diff --git a/plugin/src/main/resources/assets/export.js b/plugin/src/main/resources/assets/export.js
index 941efbe..e612ead 100644
--- a/plugin/src/main/resources/assets/export.js
+++ b/plugin/src/main/resources/assets/export.js
@@ -81,18 +81,20 @@
window.plugin.log(0, e.data);
});
sse.addEventListener('Relocate', function (e) {
- prog.style.display = "none";
- sse.close();
- console.log(e.data);
+ window.Plugin.log(0,e.data);
+ // Todo:
+ // Start a timer to automatically close
+ // the eventsource
});
sse.addEventListener('Process', function (e) {
- prog.style.display = "display";
+ prog.style.display = "block";
if (e.data == "init") {
prog.value = 0;
prog.textualData = "0%";
- P.resize();
+ window.Plugin.resize();
}
else if (e.data == 'done') {
+ sse.close();
prog.value = 100;
prog.textualData = "100%";
}
diff --git a/plugin/src/main/resources/assets/templates/export.ftl b/plugin/src/main/resources/assets/templates/export.ftl
index 8bac95a..8a1ccd7 100644
--- a/plugin/src/main/resources/assets/templates/export.ftl
+++ b/plugin/src/main/resources/assets/templates/export.ftl
@@ -6,6 +6,14 @@
<title>Export</title>
<script src="${assetPath}/js/korap-plugin-latest.js"></script>
<link href="${assetPath}/css/kalamar-plugin-latest.css" type="text/css" rel="stylesheet" />
+ <style>
+ progress {
+ min-width: 20em;
+ width: 20%;
+ padding:8px;
+ margin-top: 2em;
+ };
+ </style>
</head>
<body>
<div class="banner" data-note="Experimental"></div>