@data-fair/dev-server 1.5.6 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/local-development.js +5 -0
- package/dist/200.html +2 -2
- package/dist/_nuxt/{3dafdeb.js → 32ef397.js} +1 -1
- package/dist/_nuxt/a6ec596.js +1 -0
- package/dist/index.html +2 -2
- package/package.json +1 -2
- package/server/app.js +48 -25
- package/server/index.js +1 -3
- package/dist/_nuxt/c3d8b5b.js +0 -1
package/dist/200.html
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<!doctype html>
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
|
-
<title>DataFair - Dev server</title><meta data-n-head="1" charset="utf-8"><meta data-n-head="1" name="viewport" content="width=device-width,initial-scale=1"><meta data-n-head="1" data-hid="application" name="application-name" content="DataFair - Dev server"><meta data-n-head="1" data-hid="description" name="description" content="A development server for optimal development experience of data-fair applications."><meta data-n-head="1" data-hid="robots" name="robots" content="noindex"><link rel="preload" href="/_nuxt/
|
|
4
|
+
<title>DataFair - Dev server</title><meta data-n-head="1" charset="utf-8"><meta data-n-head="1" name="viewport" content="width=device-width,initial-scale=1"><meta data-n-head="1" data-hid="application" name="application-name" content="DataFair - Dev server"><meta data-n-head="1" data-hid="description" name="description" content="A development server for optimal development experience of data-fair applications."><meta data-n-head="1" data-hid="robots" name="robots" content="noindex"><link rel="preload" href="/_nuxt/32ef397.js" as="script"><link rel="preload" href="/_nuxt/0c5f45a.js" as="script"><link rel="preload" href="/_nuxt/df98766.js" as="script"><link rel="preload" href="/_nuxt/b1b5217.js" as="script">
|
|
5
5
|
</head>
|
|
6
6
|
<body>
|
|
7
7
|
<div id="__nuxt"><style>#nuxt-loading{background:#fff;visibility:hidden;opacity:0;position:absolute;left:0;right:0;top:0;bottom:0;display:flex;justify-content:center;align-items:center;flex-direction:column;animation:nuxtLoadingIn 10s ease;-webkit-animation:nuxtLoadingIn 10s ease;animation-fill-mode:forwards;overflow:hidden}@keyframes nuxtLoadingIn{0%{visibility:hidden;opacity:0}20%{visibility:visible;opacity:0}100%{visibility:visible;opacity:1}}@-webkit-keyframes nuxtLoadingIn{0%{visibility:hidden;opacity:0}20%{visibility:visible;opacity:0}100%{visibility:visible;opacity:1}}#nuxt-loading>div,#nuxt-loading>div:after{border-radius:50%;width:5rem;height:5rem}#nuxt-loading>div{font-size:10px;position:relative;text-indent:-9999em;border:.5rem solid #f5f5f5;border-left:.5rem solid #000;-webkit-transform:translateZ(0);-ms-transform:translateZ(0);transform:translateZ(0);-webkit-animation:nuxtLoading 1.1s infinite linear;animation:nuxtLoading 1.1s infinite linear}#nuxt-loading.error>div{border-left:.5rem solid #ff4500;animation-duration:5s}@-webkit-keyframes nuxtLoading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes nuxtLoading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}</style><script>window.addEventListener("error",function(){var e=document.getElementById("nuxt-loading");e&&(e.className+=" error")})</script><div id="nuxt-loading" aria-live="polite" role="status"><div>Loading...</div></div></div><script>window.__NUXT__={config:{_app:{basePath:"/",assetsPath:"/_nuxt/",cdnURL:null}}}</script>
|
|
8
|
-
<script src="/_nuxt/
|
|
8
|
+
<script src="/_nuxt/32ef397.js"></script><script src="/_nuxt/0c5f45a.js"></script><script src="/_nuxt/df98766.js"></script><script src="/_nuxt/b1b5217.js"></script></body>
|
|
9
9
|
</html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e){function r(data){for(var r,n,f=data[0],l=data[1],d=data[2],i=0,h=[];i<f.length;i++)n=f[i],Object.prototype.hasOwnProperty.call(o,n)&&o[n]&&h.push(o[n][0]),o[n]=0;for(r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r]);for(v&&v(data);h.length;)h.shift()();return c.push.apply(c,d||[]),t()}function t(){for(var e,i=0;i<c.length;i++){for(var r=c[i],t=!0,n=1;n<r.length;n++){var l=r[n];0!==o[l]&&(t=!1)}t&&(c.splice(i--,1),e=f(f.s=r[0]))}return e}var n={},o={7:0},c=[];function f(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,f),t.l=!0,t.exports}f.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var c,script=document.createElement("script");script.charset="utf-8",script.timeout=120,f.nc&&script.setAttribute("nonce",f.nc),script.src=function(e){return f.p+""+{0:"b68e30f",1:"553dac1",4:"d6dd90c",5:"898243c",6:"
|
|
1
|
+
!function(e){function r(data){for(var r,n,f=data[0],l=data[1],d=data[2],i=0,h=[];i<f.length;i++)n=f[i],Object.prototype.hasOwnProperty.call(o,n)&&o[n]&&h.push(o[n][0]),o[n]=0;for(r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r]);for(v&&v(data);h.length;)h.shift()();return c.push.apply(c,d||[]),t()}function t(){for(var e,i=0;i<c.length;i++){for(var r=c[i],t=!0,n=1;n<r.length;n++){var l=r[n];0!==o[l]&&(t=!1)}t&&(c.splice(i--,1),e=f(f.s=r[0]))}return e}var n={},o={7:0},c=[];function f(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,f),t.l=!0,t.exports}f.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var c,script=document.createElement("script");script.charset="utf-8",script.timeout=120,f.nc&&script.setAttribute("nonce",f.nc),script.src=function(e){return f.p+""+{0:"b68e30f",1:"553dac1",4:"d6dd90c",5:"898243c",6:"a6ec596",9:"5d119d6",10:"4f0f04d"}[e]+".js"}(e);var l=new Error;c=function(r){script.onerror=script.onload=null,clearTimeout(d);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),c=r&&r.target&&r.target.src;l.message="Loading chunk "+e+" failed.\n("+n+": "+c+")",l.name="ChunkLoadError",l.type=n,l.request=c,t[1](l)}o[e]=void 0}};var d=setTimeout((function(){c({type:"timeout",target:script})}),12e4);script.onerror=script.onload=c,document.head.appendChild(script)}return Promise.all(r)},f.m=e,f.c=n,f.d=function(e,r,t){f.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.t=function(e,r){if(1&r&&(e=f(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(f.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)f.d(t,n,function(r){return e[r]}.bind(null,n));return t},f.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(r,"a",r),r},f.o=function(object,e){return Object.prototype.hasOwnProperty.call(object,e)},f.p="/_nuxt/",f.oe=function(e){throw console.error(e),e};var l=window.webpackJsonp=window.webpackJsonp||[],d=l.push.bind(l);l.push=r,l=l.slice();for(var i=0;i<l.length;i++)r(l[i]);var v=d;t()}([]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(window.webpackJsonp=window.webpackJsonp||[]).push([[6,5],{308:function(e,t){e.exports=function(e){e.options.__i18n=e.options.__i18n||[],e.options.__i18n.push('{"en":{"metadata":"Metadata read from index.html","missingApplicationName":"Metadata \\"application-name\\" is missing. Add a tag <meta name=\\"application-name\\" content=\\"my-application\\">","missingThumbnail":"Metadata \\"thumbnail\\" is missing. Add a tag <meta name=\\"thumbnail\\" content=\\"http://my/thumbnail.png\\">","missingTitle":"Add a tag <title lang=\\"{locale}\\">My title</title>","missingDesc":"Metadata \\"description\\" is missing. Add a tag <meta name=\\"description\\" lang=\\"{locale}\\" content=\\"My description\\">","missingKeywords":"Metadata \\"keywords\\" is missing. Add a tag <meta name=\\"keywords\\" lang=\\"{locale}\\" content=\\"My keyword\\">","missingVocabAccept":"Metadata \\"vocabulary-accept\\" is missing. Add a tag <meta name=\\"vocabulary-accept\\" content=\\"http://www.w3.org/2000/01/rdf-schema#label\\">","missingVocabRequire":"Metadata \\"vocabulary-require\\" is missing. Add a tag <meta name=\\"vocabulary-require\\" content=\\"http://www.w3.org/2003/01/geo/wgs84_pos#lat_long\\">","config":"Configuration form created from config-schema.json"}}'),delete e.options._Ctor}},312:function(e,t,n){"use strict";n.r(t);var r={components:{VIframe:n(311).a},data:function(){return{dialog:!1}}},o=n(63),l=n(127),c=n.n(l),d=n(358),m=n(328),f=n(264),v=n(659),component=Object(o.a)(r,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("v-dialog",{attrs:{scrollable:"","max-width":"1100px"},scopedSlots:e._u([{key:"activator",fn:function(t){var r=t.on;return[n("v-btn",e._g({attrs:{color:"primary",text:""}},r),[e._v("\n Simulate screenshot\n ")])]}}]),model:{value:e.dialog,callback:function(t){e.dialog=t},expression:"dialog"}},[e._v(" "),n("v-card",[n("v-card-title",{attrs:{"primary-title":""}},[e._v("\n Screenshot simulation\n ")]),e._v(" "),n("v-card-text",[n("p",[e._v("Data Fair will automatically render the visualization after each configuration change and take a screenshot to be used as a thumbnail.")]),e._v(" "),n("p",[e._v("The screenshot will be rendered in a box of 1050x450 pixels (21/9 resolution) and the URL will have the query parameter ?thumbnail=true.")]),e._v(" "),n("p",[e._v('For performance it is a recommended to call the window.triggerCapture method as soon as the application is fully rendered. For guidance look for messages prefixed with "[capture]" in your browser developper\'s console.')]),e._v(" "),e.dialog?n("v-iframe",{staticStyle:{border:"1px solid grey",width:"1050px"},attrs:{"aspect-ratio":21/9,src:"http://localhost:5888/app?thumbnail=true"}}):e._e()],1)],1)],1)}),[],!1,null,"c87a3f30",null);t.default=component.exports;c()(component,{VBtn:d.a,VCard:m.a,VCardText:f.b,VCardTitle:f.c,VDialog:v.a})},356:function(e,t,n){var content=n(641);content.__esModule&&(content=content.default),"string"==typeof content&&(content=[[e.i,content,""]]),content.locals&&(e.exports=content.locals);(0,n(61).default)("a3899b04",content,!0,{sourceMap:!1})},357:function(e,t,n){"use strict";n.r(t);var r={computed:{locales:function(){return["en","fr"]}},methods:{setLocale:function(e){this.$i18n.setLocale(e),window.location.reload()}}},o=n(63),l=n(127),c=n.n(l),d=n(358),m=n(643),component=Object(o.a)(r,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return e.locales.length>1?n("v-speed-dial",{attrs:{direction:"bottom",transition:"fade-transition"},scopedSlots:e._u([{key:"activator",fn:function(){return[n("v-btn",{staticClass:"mx-2",attrs:{fab:"",small:""}},[e._v("\n "+e._s(e.$i18n.locale)+"\n ")])]},proxy:!0}],null,!1,4142082435)},[e._v(" "),e._l(e.locales.filter((function(t){return t!==e.$i18n.locale})),(function(t){return n("v-btn",{key:t,attrs:{fab:"",small:"",nuxt:""},on:{click:function(n){return e.setLocale(t)}}},[e._v("\n "+e._s(t)+"\n ")])}))],2):e._e()}),[],!1,null,null,null);t.default=component.exports;c()(component,{VBtn:d.a,VSpeedDial:m.a})},640:function(e,t,n){"use strict";n(356)},641:function(e,t,n){var r=n(60)(!1);r.push([e.i,".app-meta p[data-v-01f5d3fa]{margin-bottom:4px}",""]),e.exports=r},642:function(e,t,n){"use strict";var r=n(308),o=n.n(r);t.default=o.a},658:function(e,t,n){"use strict";n.r(t);n(15),n(11),n(26),n(27),n(28),n(36),n(35),n(32);var r=n(3),o=n(4),l=(n(83),n(16),n(22),n(31),n(38),n(39),n(13),n(45),n(362)),c=n(644),d=(n(489),n(491),n(314)),m=n(620),f=n.n(m),v=(n(622),n(311)),h=n(312);function _(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return y(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,l=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){c=!0,o=e},f:function(){try{l||null==n.return||n.return()}finally{if(c)throw o}}}}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function w(object,e){var t=Object.keys(object);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(object);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(object,e).enumerable}))),t.push.apply(t,n)}return t}var x=n(627),$=n(302),C=n(349),k=n(348),A=new $({strict:!1,allErrors:!0,messages:!1});A.addFormat("hexcolor",/^#[0-9A-Fa-f]{6,8}$/),C(A);var O={components:{VIframe:v.a,VJsf:c.a,ScreenshotSimulation:h.default},data:function(){return{error:null,schema:null,dataFair:null,editConfig:null,showPreview:!0,compileError:null,formValid:!1,iframeLog:!1,loading:!1,meta:null}},computed:{options:function(){return{context:{owner:this.dataFair&&this.dataFair.owner},locale:this.$i18n.locale,defaultLocale:this.$i18n.defaultLocale,rootDisplay:"expansion-panels",expansionPanelsProps:{value:0,hover:!0},dialogProps:{maxWidth:500,overlayOpacity:0},arrayItemCardProps:{outlined:!0,tile:!0},dialogCardProps:{outlined:!0}}},validationErrors:function(){if(this.schema&&this.schemaValidate)return this.schemaValidate(this.editConfig)?null:(k[this.$i18n.locale](this.schemaValidate.errors),this.schemaValidate.errors)}},created:function(){var e=this;return Object(o.a)(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.dataFair={url:"https://STARTCONFIGALIAS-string-dataFair.url-ENDCONFIGALIAS",owner:{type:"STARTCONFIGALIAS-string-dataFair.owner.type-ENDCONFIGALIAS",id:"STARTCONFIGALIAS-string-dataFair.owner.id-ENDCONFIGALIAS"},apiKey:"STARTCONFIGALIAS-string-dataFair.apiKey-ENDCONFIGALIAS"},e.iframeLog="STARTCONFIGALIAS-boolean-iframeLog-ENDCONFIGALIAS",t.next=4,e.$axios.$get("http://localhost:5888/config");case 4:e.editConfig=t.sent,e.fetchInfo();case 6:case"end":return t.stop()}}),t)})))()},mounted:function(){var e=this;console.log("connect to to ws://localhost:5888"),this.socketDevServer=new l.a("ws://localhost:5888"),this.socketDevServer.onopen=function(){e.socketDevServer.onmessage=function(t){var data=JSON.parse(t.data);"app-error"===data.type&&(e.error=data.data.message)}},window.addEventListener("message",(function(t){console.log("received message from iframe",t.data),"set-config"===t.data.type&&(e.editConfig=f.a.set(function(e){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?w(Object(source),!0).forEach((function(t){Object(r.a)(e,t,source[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(source)):w(Object(source)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(source,t))}))}return e}({},e.editConfig),t.data.content.field,t.data.content.value),e.validate())}))},destroyed:function(){this.socketDevServer&&this.socketDevServer.close()},methods:{empty:function(){var e=this;return Object(o.a)(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.editConfig=null,t.next=3,e.save({});case 3:e.editConfig={};case 4:case"end":return t.stop()}}),t)})))()},validate:function(){var e=arguments,t=this;return Object(o.a)(regeneratorRuntime.mark((function n(){var r;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:r=!(e.length>0&&void 0!==e[0])||e[0],t.$refs.form.validate()&&(t.save(t.editConfig,r),t.error=null);case 2:case"end":return n.stop()}}),n)})))()},save:function(e){var t=this;return Object(o.a)(regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,t.$axios.$put("http://localhost:5888/config",e);case 2:return n.next=4,t.reloadIframe();case 4:case"end":return n.stop()}}),n)})))()},fetchInfo:function(){var e=this;return Object(o.a)(regeneratorRuntime.mark((function t(){var n,r,o,l,html,c,head,meta,m,f,v,h,y,w,$,C,k,O,S,I,V;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.loading=!0,t.next=3,e.$axios.$get("http://localhost:5888/app/index.html");case 3:if(o=t.sent,l=x.parse(o),html=l.childNodes.find((function(e){return"html"===e.tagName}))){t.next=8;break}throw new Error("broken HTML");case 8:if(c=(null===(n=html.attrs)||void 0===n||null===(r=n.find((function(a){return"lang"===a.name})))||void 0===r?void 0:r.value)||e.$i18n.defaultLocale,head=html.childNodes.find((function(e){return"head"===e.tagName}))){t.next=12;break}throw new Error("broken HTML, missing head tag");case 12:meta={title:{}},m=_(head.childNodes.filter((function(e){return"title"===e.tagName})));try{for(m.s();!(f=m.n()).done;)y=f.value,meta.title[(null==y||null===(v=y.attrs.find((function(a){return"lang"===a.name})))||void 0===v?void 0:v.value)||c]=null===(h=y.childNodes)||void 0===h?void 0:h[0].value}catch(e){m.e(e)}finally{m.f()}w=["application-name","description","keywords","vocabulary-accept","vocabulary-require","thumbnail"],$=["description","keywords"],C=["keywords","vocabulary-accept","vocabulary-require"],k=head.childNodes.filter((function(e){return"meta"===e.tagName})).map((function(e){var t,n,r;return{name:null===(t=e.attrs.find((function(a){return"name"===a.name})))||void 0===t?void 0:t.value,locale:(null===(n=e.attrs.find((function(a){return"lang"===a.name})))||void 0===n?void 0:n.value)||c,content:null===(r=e.attrs.find((function(a){return"content"===a.name})))||void 0===r?void 0:r.value}})).filter((function(e){return w.includes(e.name)})),O=_(k);try{for(O.s();!(S=O.n()).done;)I=S.value,$.includes(I.name)?(meta[I.name]=meta[I.name]||{},C.includes(I.name)?(meta[I.name][I.locale]=meta[I.name][I.locale]||[],I.content&&meta[I.name][I.locale].push(I.content)):meta[I.name][I.locale]=I.content):C.includes(I.name)?(meta[I.name]=meta[I.name]||[],I.content&&meta[I.name].push(I.content)):meta[I.name]=I.content}catch(e){O.e(e)}finally{O.f()}return e.meta=meta,e.schema=null,t.next=25,e.$axios.$get("http://localhost:5888/app/config-schema.json");case 25:(V=t.sent)["x-display"]="tabs",e.schema=d.a.resolve(V,{"~$locale~":e.$i18n.locale===e.$i18n.defaultLocale?e.$i18n.locale:[e.$i18n.locale,e.$i18n.defaultLocale]});try{e.schemaValidate=A.compile(e.schema),e.compileError=null}catch(t){console.error(t),e.compileError=t.message}e.loading=!1;case 30:case"end":return t.stop()}}),t)})))()},reloadIframe:function(){var e=this;return Object(o.a)(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.showPreview=!1,t.next=3,new Promise((function(e){return setTimeout(e,10)}));case 3:e.showPreview=!0;case 4:case"end":return t.stop()}}),t)})))()}}},S=O,I=(n(640),n(63)),V=n(642),j=n(127),L=n.n(j),N=n(651),F=n(358),E=n(328),R=n(653),T=n(660),D=n(656),P=n(322),M=n(654),G=n(655),component=Object(I.a)(S,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("v-container",{staticClass:"pt-4",attrs:{fluid:""}},[n("v-row",[n("v-col",{attrs:{xs:"12",md:"6",lg:"4"}},[e.error?n("v-alert",{attrs:{color:"error"}},[e._v("\n "+e._s(e.error.message||e.error)+"\n ")]):e._e(),e._v(" "),n("v-row",{staticClass:"mb-2"},[n("v-spacer"),e._v(" "),n("v-btn",{staticClass:"mx-2",attrs:{fab:"",dark:"",small:"",color:"primary",loading:e.loading},on:{click:e.fetchInfo}},[n("v-icon",{attrs:{dark:""}},[e._v("\n mdi-refresh\n ")])],1)],1),e._v(" "),n("h2",{staticClass:"text-h6 mt-2"},[e._v("\n "+e._s(e.$t("config"))+"\n ")]),e._v(" "),n("v-form",{ref:"form",model:{value:e.formValid,callback:function(t){e.formValid=t},expression:"formValid"}},[n("v-alert",{attrs:{value:!!e.compileError,type:"error"}},[e._v("\n "+e._s(e.compileError)+"\n ")]),e._v(" "),n("v-alert",{attrs:{value:!!e.validationErrors&&e.formValid,type:"error"}},[e._v("\n Formulaire valide pourtant le modèle ne respecte pas le schéma:\n "),n("p",[e._v(e._s(e.validationErrors))])]),e._v(" "),e.schema&&e.editConfig?n("v-jsf",{attrs:{schema:e.schema,options:e.options},on:{change:e.validate},model:{value:e.editConfig,callback:function(t){e.editConfig=t},expression:"editConfig"}}):e._e()],1),e._v(" "),n("v-row",{staticClass:"ma-2"},[n("v-spacer"),e._v(" "),n("v-btn",{attrs:{color:"warning"},on:{click:e.empty}},[e._v("\n Empty\n ")])],1),e._v(" "),e.meta?n("v-row",{staticClass:"mt-4"},[n("v-col",{staticClass:"app-meta"},[n("h2",{staticClass:"text-h6"},[e._v("\n "+e._s(e.$t("metadata"))+"\n ")]),e._v(" "),e.meta["application-name"]?n("p",[n("b",[e._v("application-name:")]),e._v(" "+e._s(e.meta["application-name"])+"\n ")]):n("v-alert",{attrs:{type:"error",dense:""}},[e._v("\n "+e._s(e.$t("missingApplicationName"))+"\n ")]),e._v(" "),e.meta.thumbnail?n("p",[n("b",[e._v("thumbnail:")]),e._v(" "),n("img",{attrs:{width:"25",src:e.meta.thumbnail.startsWith("http://")||e.meta.thumbnail.startsWith("https://")?e.meta.thumbnail:"http://localhost:5888/app/"+e.meta.thumbnail}})]):n("v-alert",{attrs:{type:"error",dense:""}},[e._v("\n "+e._s(e.$t("missingThumbnail"))+"\n ")]),e._v(" "),e.meta.title&&e.meta.title[e.$i18n.locale]?n("p",[n("b",[e._v("title:")]),e._v(" "+e._s(e.meta.title[e.$i18n.locale])+"\n ")]):n("v-alert",{attrs:{type:"error",dense:""}},[e._v("\n "+e._s(e.$t("missingTitle",{locale:e.$i18n.locale}))+"\n ")]),e._v(" "),e.meta.description&&e.meta.description[e.$i18n.locale]?n("p",[n("b",[e._v("description:")]),e._v(" "+e._s(e.meta.description[e.$i18n.locale])+"\n ")]):n("v-alert",{attrs:{type:"error",dense:""}},[e._v("\n "+e._s(e.$t("missingDesc",{locale:e.$i18n.locale}))+"\n ")]),e._v(" "),e.meta.keywords&&e.meta.keywords[e.$i18n.locale]?n("p",[n("b",[e._v("keywords:")]),e._v(" "+e._s(e.meta.keywords[e.$i18n.locale])+"\n ")]):n("v-alert",{attrs:{type:"error",dense:""}},[e._v("\n "+e._s(e.$t("missingKeywords",{locale:e.$i18n.locale}))+"\n ")]),e._v(" "),e.meta["vocabulary-accept"]&&e.meta["vocabulary-accept"]?n("p",[n("b",[e._v("vocabulary-accept:")]),e._v(" "+e._s(e.meta["vocabulary-accept"])+"\n ")]):n("v-alert",{attrs:{type:"info",dense:""}},[e._v("\n "+e._s(e.$t("missingVocabAccept",{locale:e.$i18n.locale}))+"\n ")]),e._v(" "),e.meta["vocabulary-require"]&&e.meta["vocabulary-require"]?n("p",[n("b",[e._v("vocabulary-require:")]),e._v(" "+e._s(e.meta["vocabulary-require"])+"\n ")]):n("v-alert",{attrs:{type:"info",dense:""}},[e._v("\n "+e._s(e.$t("missingVocabRequire",{locale:e.$i18n.locale}))+"\n ")])],1)],1):e._e()],1),e._v(" "),n("v-col",{attrs:{xs:"12",md:"6",lg:"8"}},[n("v-row",{staticClass:"mb-2"},[n("v-spacer"),e._v(" "),n("screenshot-simulation"),e._v(" "),n("v-btn",{staticClass:"mx-2",attrs:{fab:"",dark:"",small:"",color:"primary"},on:{click:e.reloadIframe}},[n("v-icon",{attrs:{dark:""}},[e._v("\n mdi-refresh\n ")])],1),e._v(" "),n("lang-switcher")],1),e._v(" "),n("v-card",[e.showPreview?n("v-iframe",{attrs:{src:"http://localhost:5888/app?draft=true",log:e.iframeLog}}):e._e()],1)],1)],1)],1)}),[],!1,null,"01f5d3fa",null);"function"==typeof V.default&&Object(V.default)(component);t.default=component.exports;L()(component,{ScreenshotSimulation:n(312).default,LangSwitcher:n(357).default}),L()(component,{VAlert:N.a,VBtn:F.a,VCard:E.a,VCol:R.a,VContainer:T.a,VForm:D.a,VIcon:P.a,VRow:M.a,VSpacer:G.a})}}]);
|
package/dist/index.html
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<!doctype html>
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
|
-
<title>DataFair - Dev server</title><meta data-n-head="1" charset="utf-8"><meta data-n-head="1" name="viewport" content="width=device-width,initial-scale=1"><meta data-n-head="1" data-hid="application" name="application-name" content="DataFair - Dev server"><meta data-n-head="1" data-hid="description" name="description" content="A development server for optimal development experience of data-fair applications."><meta data-n-head="1" data-hid="robots" name="robots" content="noindex"><link rel="preload" href="/_nuxt/
|
|
4
|
+
<title>DataFair - Dev server</title><meta data-n-head="1" charset="utf-8"><meta data-n-head="1" name="viewport" content="width=device-width,initial-scale=1"><meta data-n-head="1" data-hid="application" name="application-name" content="DataFair - Dev server"><meta data-n-head="1" data-hid="description" name="description" content="A development server for optimal development experience of data-fair applications."><meta data-n-head="1" data-hid="robots" name="robots" content="noindex"><link rel="preload" href="/_nuxt/32ef397.js" as="script"><link rel="preload" href="/_nuxt/0c5f45a.js" as="script"><link rel="preload" href="/_nuxt/df98766.js" as="script"><link rel="preload" href="/_nuxt/b1b5217.js" as="script">
|
|
5
5
|
</head>
|
|
6
6
|
<body>
|
|
7
7
|
<div id="__nuxt"><style>#nuxt-loading{background:#fff;visibility:hidden;opacity:0;position:absolute;left:0;right:0;top:0;bottom:0;display:flex;justify-content:center;align-items:center;flex-direction:column;animation:nuxtLoadingIn 10s ease;-webkit-animation:nuxtLoadingIn 10s ease;animation-fill-mode:forwards;overflow:hidden}@keyframes nuxtLoadingIn{0%{visibility:hidden;opacity:0}20%{visibility:visible;opacity:0}100%{visibility:visible;opacity:1}}@-webkit-keyframes nuxtLoadingIn{0%{visibility:hidden;opacity:0}20%{visibility:visible;opacity:0}100%{visibility:visible;opacity:1}}#nuxt-loading>div,#nuxt-loading>div:after{border-radius:50%;width:5rem;height:5rem}#nuxt-loading>div{font-size:10px;position:relative;text-indent:-9999em;border:.5rem solid #f5f5f5;border-left:.5rem solid #000;-webkit-transform:translateZ(0);-ms-transform:translateZ(0);transform:translateZ(0);-webkit-animation:nuxtLoading 1.1s infinite linear;animation:nuxtLoading 1.1s infinite linear}#nuxt-loading.error>div{border-left:.5rem solid #ff4500;animation-duration:5s}@-webkit-keyframes nuxtLoading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes nuxtLoading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}</style><script>window.addEventListener("error",function(){var e=document.getElementById("nuxt-loading");e&&(e.className+=" error")})</script><div id="nuxt-loading" aria-live="polite" role="status"><div>Loading...</div></div></div><script>window.__NUXT__={config:{_app:{basePath:"/",assetsPath:"/_nuxt/",cdnURL:null}}}</script>
|
|
8
|
-
<script src="/_nuxt/
|
|
8
|
+
<script src="/_nuxt/32ef397.js"></script><script src="/_nuxt/0c5f45a.js"></script><script src="/_nuxt/df98766.js"></script><script src="/_nuxt/b1b5217.js"></script></body>
|
|
9
9
|
</html>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@data-fair/dev-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "A development server for optimal development experience of data-fair applications.",
|
|
5
5
|
"main": "server/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -58,7 +58,6 @@
|
|
|
58
58
|
"express": "^4.17.2",
|
|
59
59
|
"fs-extra": "^10.0.0",
|
|
60
60
|
"http-proxy-middleware": "^2.0.1",
|
|
61
|
-
"open": "^8.4.0",
|
|
62
61
|
"parse5": "^6.0.1",
|
|
63
62
|
"tree-kill": "^1.2.2",
|
|
64
63
|
"ws": "^8.3.0"
|
package/server/app.js
CHANGED
|
@@ -9,28 +9,47 @@ const http = require('http')
|
|
|
9
9
|
const fs = require('fs-extra')
|
|
10
10
|
const { createProxyMiddleware } = require('http-proxy-middleware')
|
|
11
11
|
const cors = require('cors')
|
|
12
|
-
const open = require('open')
|
|
13
12
|
const kill = require('tree-kill')
|
|
14
13
|
const escapeStringRegexp = require('escape-string-regexp')
|
|
15
14
|
const parse5 = require('parse5')
|
|
16
|
-
const WebSocket = require('ws')
|
|
15
|
+
const { WebSocket, WebSocketServer } = require('ws')
|
|
17
16
|
const debug = require('debug')('df-dev-server')
|
|
17
|
+
const chalk = require('chalk')
|
|
18
18
|
|
|
19
19
|
const app = express()
|
|
20
20
|
const server = http.createServer(app)
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
wss
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
// web socket server, used both by dev-server UI (opened on / path)
|
|
23
|
+
// and by application (opened on /data-fair), in this case we transmit all messages to and from data-fair
|
|
24
|
+
const wss = new WebSocketServer({ noServer: true })
|
|
25
|
+
let devServerWS, dataFairWS
|
|
26
|
+
server.on('upgrade', function upgrade (req, socket, head) {
|
|
27
|
+
wss.handleUpgrade(req, socket, head, (ws) => {
|
|
28
|
+
if (req.url === '/data-fair') {
|
|
29
|
+
console.log('data-fair websocket connection from application')
|
|
30
|
+
if (dataFairWS) dataFairWS.terminate()
|
|
31
|
+
dataFairWS = ws
|
|
32
|
+
ws.on('message', (data) => {
|
|
33
|
+
if (dataFairOutputWS) {
|
|
34
|
+
const message = JSON.parse(data)
|
|
35
|
+
if (message.type === 'subscribe') message.apiKey = config.dataFair.apiKey
|
|
36
|
+
dataFairOutputWS.send(JSON.stringify(message))
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
} else {
|
|
40
|
+
if (devServerWS) devServerWS.terminate()
|
|
41
|
+
devServerWS = ws
|
|
42
|
+
}
|
|
43
|
+
wss.emit('connection', ws, req)
|
|
30
44
|
})
|
|
31
|
-
ws.send(JSON.stringify({ type: 'ping' }))
|
|
32
45
|
})
|
|
33
46
|
|
|
47
|
+
const dfWsUrl = config.dataFair.url.replace('http://', 'ws://').replace('https://', 'wss://') + '/'
|
|
48
|
+
const dataFairOutputWS = new WebSocket(dfWsUrl)
|
|
49
|
+
dataFairOutputWS.on('open', () => dataFairOutputWS.send('connect to external websocket server', dfWsUrl))
|
|
50
|
+
dataFairOutputWS.on('message', (data) => { if (dataFairWS) dataFairWS.send(data.toString()) })
|
|
51
|
+
dataFairOutputWS.on('error', (err) => console.error('failed to connect to external websocket server', dfWsUrl, err))
|
|
52
|
+
|
|
34
53
|
app.use(bodyParser.json())
|
|
35
54
|
app.use(cors())
|
|
36
55
|
|
|
@@ -47,7 +66,8 @@ app.put('/config', (req, res, next) => {
|
|
|
47
66
|
})
|
|
48
67
|
app.post('/config/error', (req, res) => {
|
|
49
68
|
console.log('Application sent an error', req.body)
|
|
50
|
-
if (
|
|
69
|
+
if (devServerWS) devServerWS.send(JSON.stringify({ type: 'app-error', data: req.body }))
|
|
70
|
+
else console.error('no dev-server websocket open to send error to')
|
|
51
71
|
res.send()
|
|
52
72
|
})
|
|
53
73
|
|
|
@@ -58,7 +78,6 @@ app.use('/app', createProxyMiddleware({
|
|
|
58
78
|
pathRewrite: { '^/app': appUrl.pathname === '/' ? '' : appUrl.pathname },
|
|
59
79
|
secure: false,
|
|
60
80
|
changeOrigin: true,
|
|
61
|
-
ws: true,
|
|
62
81
|
selfHandleResponse: true, // so that the onProxyRes takes care of sending the response
|
|
63
82
|
onProxyReq (proxyReq, req, res) {
|
|
64
83
|
proxyReq.setHeader('Accept-Encoding', 'identity') // disable compression
|
|
@@ -80,7 +99,8 @@ app.use('/app', createProxyMiddleware({
|
|
|
80
99
|
exposedUrl: 'http://localhost:5888/app',
|
|
81
100
|
href: 'http://localhost:5888/config',
|
|
82
101
|
apiUrl: 'http://localhost:5888/data-fair/api/v1',
|
|
83
|
-
wsUrl: 'ws://localhost:5888/data-fair'
|
|
102
|
+
wsUrl: 'ws://localhost:5888/data-fair',
|
|
103
|
+
owner: config.dataFair && config.dataFair.owner
|
|
84
104
|
})))
|
|
85
105
|
const html = document.childNodes.find(c => c.tagName === 'html')
|
|
86
106
|
if (!html) throw new Error('HTML structure is broken, expect html, head and body elements')
|
|
@@ -159,7 +179,6 @@ app.use('/data-fair', createProxyMiddleware({
|
|
|
159
179
|
pathRewrite: { '^/data-fair': dfUrl.pathname },
|
|
160
180
|
secure: false,
|
|
161
181
|
changeOrigin: true,
|
|
162
|
-
ws: true,
|
|
163
182
|
selfHandleResponse: true, // so that the onProxyRes takes care of sending the response
|
|
164
183
|
onProxyReq (proxyReq) {
|
|
165
184
|
// no gzip so that we can process the content
|
|
@@ -188,14 +207,6 @@ app.use('/data-fair', createProxyMiddleware({
|
|
|
188
207
|
|
|
189
208
|
// run the dev-src command from current project
|
|
190
209
|
let spawnedDevSrc
|
|
191
|
-
if (fs.existsSync('package.json')) {
|
|
192
|
-
const pJson = fs.readJsonSync('package.json')
|
|
193
|
-
if (pJson.scripts && pJson.scripts['dev-src']) {
|
|
194
|
-
spawnedDevSrc = spawn('npm', ['run', 'dev-src'], { stdio: 'inherit' }).on('error', () => {})
|
|
195
|
-
} else {
|
|
196
|
-
console.error('No script "dev-src" in package.json')
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
210
|
|
|
200
211
|
// Run app and return it in a promise
|
|
201
212
|
exports.run = async () => {
|
|
@@ -217,13 +228,25 @@ exports.run = async () => {
|
|
|
217
228
|
}
|
|
218
229
|
server.listen(config.port)
|
|
219
230
|
await eventToPromise(server, 'listening')
|
|
220
|
-
|
|
231
|
+
console.log(chalk.bold.blue('\nDataFair dev server available on ') + chalk.underline.bold.blue(`http://localhost:${config.port}`))
|
|
232
|
+
|
|
233
|
+
if (fs.existsSync('package.json')) {
|
|
234
|
+
const pJson = fs.readJsonSync('package.json')
|
|
235
|
+
if (pJson.scripts && pJson.scripts['dev-src']) {
|
|
236
|
+
console.log(chalk.blue('running application with "npm run dev-src"'))
|
|
237
|
+
spawnedDevSrc = spawn('npm', ['run', 'dev-src'], { stdio: 'inherit' }).on('error', () => {})
|
|
238
|
+
} else {
|
|
239
|
+
console.error(chalk.red('No script "dev-src" in package.json'))
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
// if (process.env.NODE_ENV !== 'development') open('http://localhost:5888')
|
|
221
243
|
return server
|
|
222
244
|
}
|
|
223
245
|
|
|
224
246
|
exports.stop = async () => {
|
|
225
247
|
if (spawnedDevSrc) kill(spawnedDevSrc.pid)
|
|
226
|
-
if (
|
|
248
|
+
if (devServerWS) devServerWS.terminate()
|
|
249
|
+
if (dataFairWS) dataFairWS.terminate()
|
|
227
250
|
server.close()
|
|
228
251
|
await eventToPromise(server, 'close')
|
|
229
252
|
await app.get('client').close()
|
package/server/index.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
const chalk = require('chalk')
|
|
4
3
|
const path = require('path')
|
|
5
4
|
require('dotenv').config()
|
|
6
5
|
process.env.NODE_CONFIG_DIR = path.join(__dirname, '../config')
|
|
7
|
-
const config = require('config')
|
|
8
6
|
const app = require('./app')
|
|
9
7
|
|
|
10
8
|
app.run().then(app => {
|
|
11
|
-
|
|
9
|
+
// nothing to do
|
|
12
10
|
}, error => {
|
|
13
11
|
console.error('Failure in customers process', error)
|
|
14
12
|
process.exit(-1)
|
package/dist/_nuxt/c3d8b5b.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(window.webpackJsonp=window.webpackJsonp||[]).push([[6,5],{308:function(e,t){e.exports=function(e){e.options.__i18n=e.options.__i18n||[],e.options.__i18n.push('{"en":{"metadata":"Metadata read from index.html","missingApplicationName":"Metadata \\"application-name\\" is missing. Add a tag <meta name=\\"application-name\\" content=\\"my-application\\">","missingThumbnail":"Metadata \\"thumbnail\\" is missing. Add a tag <meta name=\\"thumbnail\\" content=\\"http://my/thumbnail.png\\">","missingTitle":"Add a tag <title lang=\\"{locale}\\">My title</title>","missingDesc":"Metadata \\"description\\" is missing. Add a tag <meta name=\\"description\\" lang=\\"{locale}\\" content=\\"My description\\">","missingKeywords":"Metadata \\"keywords\\" is missing. Add a tag <meta name=\\"keywords\\" lang=\\"{locale}\\" content=\\"My keyword\\">","missingVocabAccept":"Metadata \\"vocabulary-accept\\" is missing. Add a tag <meta name=\\"vocabulary-accept\\" content=\\"http://www.w3.org/2000/01/rdf-schema#label\\">","missingVocabRequire":"Metadata \\"vocabulary-require\\" is missing. Add a tag <meta name=\\"vocabulary-require\\" content=\\"http://www.w3.org/2003/01/geo/wgs84_pos#lat_long\\">","config":"Configuration form created from config-schema.json"}}'),delete e.options._Ctor}},312:function(e,t,n){"use strict";n.r(t);var r={components:{VIframe:n(311).a},data:function(){return{dialog:!1}}},o=n(63),l=n(127),c=n.n(l),d=n(358),m=n(328),v=n(264),f=n(659),component=Object(o.a)(r,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("v-dialog",{attrs:{scrollable:"","max-width":"1100px"},scopedSlots:e._u([{key:"activator",fn:function(t){var r=t.on;return[n("v-btn",e._g({attrs:{color:"primary",text:""}},r),[e._v("\n Simulate screenshot\n ")])]}}]),model:{value:e.dialog,callback:function(t){e.dialog=t},expression:"dialog"}},[e._v(" "),n("v-card",[n("v-card-title",{attrs:{"primary-title":""}},[e._v("\n Screenshot simulation\n ")]),e._v(" "),n("v-card-text",[n("p",[e._v("Data Fair will automatically render the visualization after each configuration change and take a screenshot to be used as a thumbnail.")]),e._v(" "),n("p",[e._v("The screenshot will be rendered in a box of 1050x450 pixels (21/9 resolution) and the URL will have the query parameter ?thumbnail=true.")]),e._v(" "),n("p",[e._v('For performance it is a recommended to call the window.triggerCapture method as soon as the application is fully rendered. For guidance look for messages prefixed with "[capture]" in your browser developper\'s console.')]),e._v(" "),e.dialog?n("v-iframe",{staticStyle:{border:"1px solid grey",width:"1050px"},attrs:{"aspect-ratio":21/9,src:"http://localhost:5888/app?thumbnail=true"}}):e._e()],1)],1)],1)}),[],!1,null,"c87a3f30",null);t.default=component.exports;c()(component,{VBtn:d.a,VCard:m.a,VCardText:v.b,VCardTitle:v.c,VDialog:f.a})},356:function(e,t,n){var content=n(641);content.__esModule&&(content=content.default),"string"==typeof content&&(content=[[e.i,content,""]]),content.locals&&(e.exports=content.locals);(0,n(61).default)("1b283daa",content,!0,{sourceMap:!1})},357:function(e,t,n){"use strict";n.r(t);var r={computed:{locales:function(){return["en","fr"]}},methods:{setLocale:function(e){this.$i18n.setLocale(e),window.location.reload()}}},o=n(63),l=n(127),c=n.n(l),d=n(358),m=n(643),component=Object(o.a)(r,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return e.locales.length>1?n("v-speed-dial",{attrs:{direction:"bottom",transition:"fade-transition"},scopedSlots:e._u([{key:"activator",fn:function(){return[n("v-btn",{staticClass:"mx-2",attrs:{fab:"",small:""}},[e._v("\n "+e._s(e.$i18n.locale)+"\n ")])]},proxy:!0}],null,!1,4142082435)},[e._v(" "),e._l(e.locales.filter((function(t){return t!==e.$i18n.locale})),(function(t){return n("v-btn",{key:t,attrs:{fab:"",small:"",nuxt:""},on:{click:function(n){return e.setLocale(t)}}},[e._v("\n "+e._s(t)+"\n ")])}))],2):e._e()}),[],!1,null,null,null);t.default=component.exports;c()(component,{VBtn:d.a,VSpeedDial:m.a})},640:function(e,t,n){"use strict";n(356)},641:function(e,t,n){var r=n(60)(!1);r.push([e.i,".app-meta p[data-v-a6a61bc6]{margin-bottom:4px}",""]),e.exports=r},642:function(e,t,n){"use strict";var r=n(308),o=n.n(r);t.default=o.a},658:function(e,t,n){"use strict";n.r(t);n(15),n(11),n(26),n(27),n(28),n(36),n(35),n(32);var r=n(3),o=n(4),l=(n(83),n(16),n(22),n(31),n(38),n(39),n(13),n(45),n(362)),c=n(644),d=(n(489),n(491),n(314)),m=n(620),v=n.n(m),f=(n(622),n(311)),h=n(312);function _(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return y(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,l=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){c=!0,o=e},f:function(){try{l||null==n.return||n.return()}finally{if(c)throw o}}}}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function w(object,e){var t=Object.keys(object);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(object);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(object,e).enumerable}))),t.push.apply(t,n)}return t}var x=n(627),$=n(302),k=n(349),C=n(348),A=new $({strict:!1,allErrors:!0,messages:!1});A.addFormat("hexcolor",/^#[0-9A-Fa-f]{6,8}$/),k(A);var O={components:{VIframe:f.a,VJsf:c.a,ScreenshotSimulation:h.default},data:function(){return{error:null,schema:null,dataFair:null,editConfig:null,showPreview:!0,compileError:null,formValid:!1,iframeLog:!1,loading:!1,meta:null}},computed:{options:function(){return{context:{owner:this.dataFair&&this.dataFair.owner},locale:this.$i18n.locale,defaultLocale:this.$i18n.defaultLocale,rootDisplay:"expansion-panels",expansionPanelsProps:{value:0,hover:!0},dialogProps:{maxWidth:500,overlayOpacity:0},arrayItemCardProps:{outlined:!0,tile:!0},dialogCardProps:{outlined:!0}}},validationErrors:function(){if(this.schema&&this.schemaValidate)return this.schemaValidate(this.editConfig)?null:(C[this.$i18n.locale](this.schemaValidate.errors),this.schemaValidate.errors)}},created:function(){var e=this;return Object(o.a)(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.dataFair={url:"https://STARTCONFIGALIAS-string-dataFair.url-ENDCONFIGALIAS",owner:{type:"STARTCONFIGALIAS-string-dataFair.owner.type-ENDCONFIGALIAS",id:"STARTCONFIGALIAS-string-dataFair.owner.id-ENDCONFIGALIAS"},apiKey:"STARTCONFIGALIAS-string-dataFair.apiKey-ENDCONFIGALIAS"},e.iframeLog="STARTCONFIGALIAS-boolean-iframeLog-ENDCONFIGALIAS",t.next=4,e.$axios.$get("http://localhost:5888/config");case 4:e.editConfig=t.sent,e.fetchInfo();case 6:case"end":return t.stop()}}),t)})))()},mounted:function(){var e=this;console.log("connect to to ws://localhost:5888"),this.socketDevServer=new l.a("ws://localhost:5888"),this.socketDevServer.onopen=function(){e.socketDevServer.onmessage=function(t){var data=JSON.parse(t.data);"app-error"===data.type&&(e.error=data.data.message),"ping"===data.type&&e.socketDevServer.send(JSON.stringify({type:"pong"}))}},window.addEventListener("message",(function(t){console.log("received message from iframe",t.data),"set-config"===t.data.type&&(e.editConfig=v.a.set(function(e){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?w(Object(source),!0).forEach((function(t){Object(r.a)(e,t,source[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(source)):w(Object(source)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(source,t))}))}return e}({},e.editConfig),t.data.content.field,t.data.content.value),e.validate(!1))}))},destroyed:function(){console.log("destroyed"),this.socketDevServer&&this.socketDevServer.close()},methods:{empty:function(){var e=this;return Object(o.a)(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.editConfig=null,t.next=3,e.save({});case 3:e.editConfig={};case 4:case"end":return t.stop()}}),t)})))()},validate:function(){var e=arguments,t=this;return Object(o.a)(regeneratorRuntime.mark((function n(){var r;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:r=!(e.length>0&&void 0!==e[0])||e[0],t.$refs.form.validate()&&(t.save(t.editConfig,r),t.error=null);case 2:case"end":return n.stop()}}),n)})))()},save:function(e){var t=arguments,n=this;return Object(o.a)(regeneratorRuntime.mark((function r(){var o;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return o=!(t.length>1&&void 0!==t[1])||t[1],r.next=3,n.$axios.$put("http://localhost:5888/config",e);case 3:if(!o){r.next=6;break}return r.next=6,n.reloadIframe();case 6:case"end":return r.stop()}}),r)})))()},fetchInfo:function(){var e=this;return Object(o.a)(regeneratorRuntime.mark((function t(){var n,r,o,l,html,c,head,meta,m,v,f,h,y,w,$,k,C,O,S,I,V;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.loading=!0,t.next=3,e.$axios.$get("http://localhost:5888/app/index.html");case 3:if(o=t.sent,l=x.parse(o),html=l.childNodes.find((function(e){return"html"===e.tagName}))){t.next=8;break}throw new Error("broken HTML");case 8:if(c=(null===(n=html.attrs)||void 0===n||null===(r=n.find((function(a){return"lang"===a.name})))||void 0===r?void 0:r.value)||e.$i18n.defaultLocale,head=html.childNodes.find((function(e){return"head"===e.tagName}))){t.next=12;break}throw new Error("broken HTML, missing head tag");case 12:meta={title:{}},m=_(head.childNodes.filter((function(e){return"title"===e.tagName})));try{for(m.s();!(v=m.n()).done;)y=v.value,meta.title[(null==y||null===(f=y.attrs.find((function(a){return"lang"===a.name})))||void 0===f?void 0:f.value)||c]=null===(h=y.childNodes)||void 0===h?void 0:h[0].value}catch(e){m.e(e)}finally{m.f()}w=["application-name","description","keywords","vocabulary-accept","vocabulary-require","thumbnail"],$=["description","keywords"],k=["keywords","vocabulary-accept","vocabulary-require"],C=head.childNodes.filter((function(e){return"meta"===e.tagName})).map((function(e){var t,n,r;return{name:null===(t=e.attrs.find((function(a){return"name"===a.name})))||void 0===t?void 0:t.value,locale:(null===(n=e.attrs.find((function(a){return"lang"===a.name})))||void 0===n?void 0:n.value)||c,content:null===(r=e.attrs.find((function(a){return"content"===a.name})))||void 0===r?void 0:r.value}})).filter((function(e){return w.includes(e.name)})),O=_(C);try{for(O.s();!(S=O.n()).done;)I=S.value,$.includes(I.name)?(meta[I.name]=meta[I.name]||{},k.includes(I.name)?(meta[I.name][I.locale]=meta[I.name][I.locale]||[],I.content&&meta[I.name][I.locale].push(I.content)):meta[I.name][I.locale]=I.content):k.includes(I.name)?(meta[I.name]=meta[I.name]||[],I.content&&meta[I.name].push(I.content)):meta[I.name]=I.content}catch(e){O.e(e)}finally{O.f()}return e.meta=meta,e.schema=null,t.next=25,e.$axios.$get("http://localhost:5888/app/config-schema.json");case 25:(V=t.sent)["x-display"]="tabs",e.schema=d.a.resolve(V,{"~$locale~":e.$i18n.locale===e.$i18n.defaultLocale?e.$i18n.locale:[e.$i18n.locale,e.$i18n.defaultLocale]});try{e.schemaValidate=A.compile(e.schema),e.compileError=null}catch(t){console.error(t),e.compileError=t.message}e.loading=!1;case 30:case"end":return t.stop()}}),t)})))()},reloadIframe:function(){var e=this;return Object(o.a)(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.showPreview=!1,t.next=3,new Promise((function(e){return setTimeout(e,10)}));case 3:e.showPreview=!0;case 4:case"end":return t.stop()}}),t)})))()}}},S=O,I=(n(640),n(63)),V=n(642),j=n(127),N=n.n(j),L=n(651),F=n(358),E=n(328),D=n(653),R=n(660),T=n(656),P=n(322),M=n(654),G=n(655),component=Object(I.a)(S,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("v-container",{staticClass:"pt-4",attrs:{fluid:""}},[n("v-row",[n("v-col",{attrs:{xs:"12",md:"6",lg:"4"}},[e.error?n("v-alert",{attrs:{color:"error"}},[e._v("\n "+e._s(e.error.message||e.error)+"\n ")]):e._e(),e._v(" "),n("v-row",{staticClass:"mb-2"},[n("v-spacer"),e._v(" "),n("v-btn",{staticClass:"mx-2",attrs:{fab:"",dark:"",small:"",color:"primary",loading:e.loading},on:{click:e.fetchInfo}},[n("v-icon",{attrs:{dark:""}},[e._v("\n mdi-refresh\n ")])],1)],1),e._v(" "),n("h2",{staticClass:"text-h6 mt-2"},[e._v("\n "+e._s(e.$t("config"))+"\n ")]),e._v(" "),n("v-form",{ref:"form",model:{value:e.formValid,callback:function(t){e.formValid=t},expression:"formValid"}},[n("v-alert",{attrs:{value:!!e.compileError,type:"error"}},[e._v("\n "+e._s(e.compileError)+"\n ")]),e._v(" "),n("v-alert",{attrs:{value:!!e.validationErrors&&e.formValid,type:"error"}},[e._v("\n Formulaire valide pourtant le modèle ne respecte pas le schéma:\n "),n("p",[e._v(e._s(e.validationErrors))])]),e._v(" "),e.schema&&e.editConfig?n("v-jsf",{attrs:{schema:e.schema,options:e.options},on:{change:e.validate},model:{value:e.editConfig,callback:function(t){e.editConfig=t},expression:"editConfig"}}):e._e()],1),e._v(" "),n("v-row",{staticClass:"ma-2"},[n("v-spacer"),e._v(" "),n("v-btn",{attrs:{color:"warning"},on:{click:e.empty}},[e._v("\n Empty\n ")])],1),e._v(" "),e.meta?n("v-row",{staticClass:"mt-4"},[n("v-col",{staticClass:"app-meta"},[n("h2",{staticClass:"text-h6"},[e._v("\n "+e._s(e.$t("metadata"))+"\n ")]),e._v(" "),e.meta["application-name"]?n("p",[n("b",[e._v("application-name:")]),e._v(" "+e._s(e.meta["application-name"])+"\n ")]):n("v-alert",{attrs:{type:"error",dense:""}},[e._v("\n "+e._s(e.$t("missingApplicationName"))+"\n ")]),e._v(" "),e.meta.thumbnail?n("p",[n("b",[e._v("thumbnail:")]),e._v(" "),n("img",{attrs:{width:"25",src:e.meta.thumbnail.startsWith("http://")||e.meta.thumbnail.startsWith("https://")?e.meta.thumbnail:"http://localhost:5888/app/"+e.meta.thumbnail}})]):n("v-alert",{attrs:{type:"error",dense:""}},[e._v("\n "+e._s(e.$t("missingThumbnail"))+"\n ")]),e._v(" "),e.meta.title&&e.meta.title[e.$i18n.locale]?n("p",[n("b",[e._v("title:")]),e._v(" "+e._s(e.meta.title[e.$i18n.locale])+"\n ")]):n("v-alert",{attrs:{type:"error",dense:""}},[e._v("\n "+e._s(e.$t("missingTitle",{locale:e.$i18n.locale}))+"\n ")]),e._v(" "),e.meta.description&&e.meta.description[e.$i18n.locale]?n("p",[n("b",[e._v("description:")]),e._v(" "+e._s(e.meta.description[e.$i18n.locale])+"\n ")]):n("v-alert",{attrs:{type:"error",dense:""}},[e._v("\n "+e._s(e.$t("missingDesc",{locale:e.$i18n.locale}))+"\n ")]),e._v(" "),e.meta.keywords&&e.meta.keywords[e.$i18n.locale]?n("p",[n("b",[e._v("keywords:")]),e._v(" "+e._s(e.meta.keywords[e.$i18n.locale])+"\n ")]):n("v-alert",{attrs:{type:"error",dense:""}},[e._v("\n "+e._s(e.$t("missingKeywords",{locale:e.$i18n.locale}))+"\n ")]),e._v(" "),e.meta["vocabulary-accept"]&&e.meta["vocabulary-accept"]?n("p",[n("b",[e._v("vocabulary-accept:")]),e._v(" "+e._s(e.meta["vocabulary-accept"])+"\n ")]):n("v-alert",{attrs:{type:"info",dense:""}},[e._v("\n "+e._s(e.$t("missingVocabAccept",{locale:e.$i18n.locale}))+"\n ")]),e._v(" "),e.meta["vocabulary-require"]&&e.meta["vocabulary-require"]?n("p",[n("b",[e._v("vocabulary-require:")]),e._v(" "+e._s(e.meta["vocabulary-require"])+"\n ")]):n("v-alert",{attrs:{type:"info",dense:""}},[e._v("\n "+e._s(e.$t("missingVocabRequire",{locale:e.$i18n.locale}))+"\n ")])],1)],1):e._e()],1),e._v(" "),n("v-col",{attrs:{xs:"12",md:"6",lg:"8"}},[n("v-row",{staticClass:"mb-2"},[n("v-spacer"),e._v(" "),n("screenshot-simulation"),e._v(" "),n("v-btn",{staticClass:"mx-2",attrs:{fab:"",dark:"",small:"",color:"primary"},on:{click:e.reloadIframe}},[n("v-icon",{attrs:{dark:""}},[e._v("\n mdi-refresh\n ")])],1),e._v(" "),n("lang-switcher")],1),e._v(" "),n("v-card",[e.showPreview?n("v-iframe",{attrs:{src:"http://localhost:5888/app?draft=true",log:e.iframeLog}}):e._e()],1)],1)],1)],1)}),[],!1,null,"a6a61bc6",null);"function"==typeof V.default&&Object(V.default)(component);t.default=component.exports;N()(component,{ScreenshotSimulation:n(312).default,LangSwitcher:n(357).default}),N()(component,{VAlert:L.a,VBtn:F.a,VCard:E.a,VCol:D.a,VContainer:R.a,VForm:T.a,VIcon:P.a,VRow:M.a,VSpacer:G.a})}}]);
|