mirror of
https://github.com/nasa/trick.git
synced 2024-12-24 07:16:41 +00:00
Merge pull request #853 from nasa/react-app
React App Example for Embedded Web Server
This commit is contained in:
commit
de490a5dfa
Binary file not shown.
After Width: | Height: | Size: 28 KiB |
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"files": {
|
||||||
|
"main.css": "./static/css/main.a82b4685.chunk.css",
|
||||||
|
"main.js": "./static/js/main.593ee672.chunk.js",
|
||||||
|
"main.js.map": "./static/js/main.593ee672.chunk.js.map",
|
||||||
|
"runtime~main.js": "./static/js/runtime~main.d653cc00.js",
|
||||||
|
"runtime~main.js.map": "./static/js/runtime~main.d653cc00.js.map",
|
||||||
|
"static/css/2.335e4b44.chunk.css": "./static/css/2.335e4b44.chunk.css",
|
||||||
|
"static/js/2.fd0d41cf.chunk.js": "./static/js/2.fd0d41cf.chunk.js",
|
||||||
|
"static/js/2.fd0d41cf.chunk.js.map": "./static/js/2.fd0d41cf.chunk.js.map",
|
||||||
|
"index.html": "./index.html",
|
||||||
|
"precache-manifest.9d8f7ddf3680a6a6d643dad7fa7c8492.js": "./precache-manifest.9d8f7ddf3680a6a6d643dad7fa7c8492.js",
|
||||||
|
"service-worker.js": "./service-worker.js",
|
||||||
|
"static/css/2.335e4b44.chunk.css.map": "./static/css/2.335e4b44.chunk.css.map",
|
||||||
|
"static/css/main.a82b4685.chunk.css.map": "./static/css/main.a82b4685.chunk.css.map",
|
||||||
|
"static/media/index.css": "./static/media/roboto-latin-900italic.ebf6d164.woff2"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="shortcut icon" href="./TrickLogoSmall.png"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><link rel="manifest" href="./manifest.json"/><title>React App</title><link href="./static/css/2.335e4b44.chunk.css" rel="stylesheet"><link href="./static/css/main.a82b4685.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(l){function e(e){for(var r,t,n=e[0],o=e[1],u=e[2],f=0,i=[];f<n.length;f++)t=n[f],p[t]&&i.push(p[t][0]),p[t]=0;for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(l[r]=o[r]);for(s&&s(e);i.length;)i.shift()();return c.push.apply(c,u||[]),a()}function a(){for(var e,r=0;r<c.length;r++){for(var t=c[r],n=!0,o=1;o<t.length;o++){var u=t[o];0!==p[u]&&(n=!1)}n&&(c.splice(r--,1),e=f(f.s=t[0]))}return e}var t={},p={1:0},c=[];function f(e){if(t[e])return t[e].exports;var r=t[e]={i:e,l:!1,exports:{}};return l[e].call(r.exports,r,r.exports,f),r.l=!0,r.exports}f.m=l,f.c=t,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(r,e){if(1&e&&(r=f(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var t=Object.create(null);if(f.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var n in r)f.d(t,n,function(e){return r[e]}.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(e,r){return Object.prototype.hasOwnProperty.call(e,r)},f.p="./";var r=window.webpackJsonp=window.webpackJsonp||[],n=r.push.bind(r);r.push=e,r=r.slice();for(var o=0;o<r.length;o++)e(r[o]);var s=n;a()}([])</script><script src="./static/js/2.fd0d41cf.chunk.js"></script><script src="./static/js/main.593ee672.chunk.js"></script></body></html>
|
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"short_name": "React App",
|
||||||
|
"name": "Create React App Sample",
|
||||||
|
"icons": [
|
||||||
|
{
|
||||||
|
"src": "favicon.ico",
|
||||||
|
"sizes": "64x64 32x32 24x24 16x16",
|
||||||
|
"type": "image/x-icon"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start_url": ".",
|
||||||
|
"display": "standalone",
|
||||||
|
"theme_color": "#000000",
|
||||||
|
"background_color": "#ffffff"
|
||||||
|
}
|
@ -0,0 +1,122 @@
|
|||||||
|
self.__precacheManifest = (self.__precacheManifest || []).concat([
|
||||||
|
{
|
||||||
|
"revision": "577c8ea84fd85c60dc5f5c579560e83d",
|
||||||
|
"url": "./index.html"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"revision": "6c79f9b2aedb002d302c",
|
||||||
|
"url": "./static/css/2.335e4b44.chunk.css"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"revision": "9b46f0f8321ce396aba6",
|
||||||
|
"url": "./static/css/main.a82b4685.chunk.css"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"revision": "6c79f9b2aedb002d302c",
|
||||||
|
"url": "./static/js/2.fd0d41cf.chunk.js"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"revision": "9b46f0f8321ce396aba6",
|
||||||
|
"url": "./static/js/main.593ee672.chunk.js"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"revision": "8c97409f0ee389fe75da",
|
||||||
|
"url": "./static/js/runtime~main.d653cc00.js"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"revision": "5cb7edfceb233100075dc9a1e12e8da3",
|
||||||
|
"url": "./static/media/roboto-latin-100.5cb7edfc.woff"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"revision": "7370c3679472e9560965ff48a4399d0b",
|
||||||
|
"url": "./static/media/roboto-latin-100.7370c367.woff2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"revision": "f8b1df51ba843179fa1cc9b53d58127a",
|
||||||
|
"url": "./static/media/roboto-latin-100italic.f8b1df51.woff2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"revision": "f9e8e590b4e0f1ff83469bb2a55b8488",
|
||||||
|
"url": "./static/media/roboto-latin-100italic.f9e8e590.woff"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"revision": "b00849e00f4c2331cddd8ffb44a6720b",
|
||||||
|
"url": "./static/media/roboto-latin-300.b00849e0.woff"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"revision": "ef7c6637c68f269a882e73bcb57a7f6a",
|
||||||
|
"url": "./static/media/roboto-latin-300.ef7c6637.woff2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"revision": "14286f3ba79c6627433572dfa925202e",
|
||||||
|
"url": "./static/media/roboto-latin-300italic.14286f3b.woff2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"revision": "4df32891a5f2f98a363314f595482e08",
|
||||||
|
"url": "./static/media/roboto-latin-300italic.4df32891.woff"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"revision": "479970ffb74f2117317f9d24d9e317fe",
|
||||||
|
"url": "./static/media/roboto-latin-400.479970ff.woff2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"revision": "60fa3c0614b8fb2f394fa29944c21540",
|
||||||
|
"url": "./static/media/roboto-latin-400.60fa3c06.woff"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"revision": "51521a2a8da71e50d871ac6fd2187e87",
|
||||||
|
"url": "./static/media/roboto-latin-400italic.51521a2a.woff2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"revision": "fe65b8335ee19dd944289f9ed3178c78",
|
||||||
|
"url": "./static/media/roboto-latin-400italic.fe65b833.woff"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"revision": "020c97dc8e0463259c2f9df929bb0c69",
|
||||||
|
"url": "./static/media/roboto-latin-500.020c97dc.woff2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"revision": "87284894879f5b1c229cb49c8ff6decc",
|
||||||
|
"url": "./static/media/roboto-latin-500.87284894.woff"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"revision": "288ad9c6e8b43cf02443a1f499bdf67e",
|
||||||
|
"url": "./static/media/roboto-latin-500italic.288ad9c6.woff"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"revision": "db4a2a231f52e497c0191e8966b0ee58",
|
||||||
|
"url": "./static/media/roboto-latin-500italic.db4a2a23.woff2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"revision": "2735a3a69b509faf3577afd25bdf552e",
|
||||||
|
"url": "./static/media/roboto-latin-700.2735a3a6.woff2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"revision": "adcde98f1d584de52060ad7b16373da3",
|
||||||
|
"url": "./static/media/roboto-latin-700.adcde98f.woff"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"revision": "81f57861ed4ac74741f5671e1dff2fd9",
|
||||||
|
"url": "./static/media/roboto-latin-700italic.81f57861.woff"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"revision": "da0e717829e033a69dec97f1e155ae42",
|
||||||
|
"url": "./static/media/roboto-latin-700italic.da0e7178.woff2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"revision": "9b3766ef4a402ad3fdeef7501a456512",
|
||||||
|
"url": "./static/media/roboto-latin-900.9b3766ef.woff2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"revision": "bb1e4dc6333675d11ada2e857e7f95d7",
|
||||||
|
"url": "./static/media/roboto-latin-900.bb1e4dc6.woff"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"revision": "28f9151055c950874d2c6803a39b425b",
|
||||||
|
"url": "./static/media/roboto-latin-900italic.28f91510.woff"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"revision": "ebf6d1640ccddb99fb49f73c052c55a8",
|
||||||
|
"url": "./static/media/roboto-latin-900italic.ebf6d164.woff2"
|
||||||
|
}
|
||||||
|
]);
|
@ -0,0 +1,39 @@
|
|||||||
|
/**
|
||||||
|
* Welcome to your Workbox-powered service worker!
|
||||||
|
*
|
||||||
|
* You'll need to register this file in your web app and you should
|
||||||
|
* disable HTTP caching for this file too.
|
||||||
|
* See https://goo.gl/nhQhGp
|
||||||
|
*
|
||||||
|
* The rest of the code is auto-generated. Please don't update this file
|
||||||
|
* directly; instead, make changes to your Workbox build configuration
|
||||||
|
* and re-run your build process.
|
||||||
|
* See https://goo.gl/2aRDsh
|
||||||
|
*/
|
||||||
|
|
||||||
|
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");
|
||||||
|
|
||||||
|
importScripts(
|
||||||
|
"./precache-manifest.9d8f7ddf3680a6a6d643dad7fa7c8492.js"
|
||||||
|
);
|
||||||
|
|
||||||
|
self.addEventListener('message', (event) => {
|
||||||
|
if (event.data && event.data.type === 'SKIP_WAITING') {
|
||||||
|
self.skipWaiting();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
workbox.core.clientsClaim();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The workboxSW.precacheAndRoute() method efficiently caches and responds to
|
||||||
|
* requests for URLs in the manifest.
|
||||||
|
* See https://goo.gl/S9QRab
|
||||||
|
*/
|
||||||
|
self.__precacheManifest = [].concat(self.__precacheManifest || []);
|
||||||
|
workbox.precaching.precacheAndRoute(self.__precacheManifest, {});
|
||||||
|
|
||||||
|
workbox.routing.registerNavigationRoute(workbox.precaching.getCacheKeyForURL("./index.html"), {
|
||||||
|
|
||||||
|
blacklist: [/^\/_/,/\/[^\/]+\.[^\/]+$/],
|
||||||
|
});
|
@ -0,0 +1,2 @@
|
|||||||
|
@font-face{font-family:Roboto;font-style:normal;font-display:swap;font-weight:100;src:local("Roboto Thin "),local("Roboto-Thin"),url(../../static/media/roboto-latin-100.7370c367.woff2) format("woff2"),url(../../static/media/roboto-latin-100.5cb7edfc.woff) format("woff")}@font-face{font-family:Roboto;font-style:italic;font-display:swap;font-weight:100;src:local("Roboto Thin italic"),local("Roboto-Thinitalic"),url(../../static/media/roboto-latin-100italic.f8b1df51.woff2) format("woff2"),url(../../static/media/roboto-latin-100italic.f9e8e590.woff) format("woff")}@font-face{font-family:Roboto;font-style:normal;font-display:swap;font-weight:300;src:local("Roboto Light "),local("Roboto-Light"),url(../../static/media/roboto-latin-300.ef7c6637.woff2) format("woff2"),url(../../static/media/roboto-latin-300.b00849e0.woff) format("woff")}@font-face{font-family:Roboto;font-style:italic;font-display:swap;font-weight:300;src:local("Roboto Light italic"),local("Roboto-Lightitalic"),url(../../static/media/roboto-latin-300italic.14286f3b.woff2) format("woff2"),url(../../static/media/roboto-latin-300italic.4df32891.woff) format("woff")}@font-face{font-family:Roboto;font-style:normal;font-display:swap;font-weight:400;src:local("Roboto Regular "),local("Roboto-Regular"),url(../../static/media/roboto-latin-400.479970ff.woff2) format("woff2"),url(../../static/media/roboto-latin-400.60fa3c06.woff) format("woff")}@font-face{font-family:Roboto;font-style:italic;font-display:swap;font-weight:400;src:local("Roboto Regular italic"),local("Roboto-Regularitalic"),url(../../static/media/roboto-latin-400italic.51521a2a.woff2) format("woff2"),url(../../static/media/roboto-latin-400italic.fe65b833.woff) format("woff")}@font-face{font-family:Roboto;font-style:normal;font-display:swap;font-weight:500;src:local("Roboto Medium "),local("Roboto-Medium"),url(../../static/media/roboto-latin-500.020c97dc.woff2) format("woff2"),url(../../static/media/roboto-latin-500.87284894.woff) format("woff")}@font-face{font-family:Roboto;font-style:italic;font-display:swap;font-weight:500;src:local("Roboto Medium italic"),local("Roboto-Mediumitalic"),url(../../static/media/roboto-latin-500italic.db4a2a23.woff2) format("woff2"),url(../../static/media/roboto-latin-500italic.288ad9c6.woff) format("woff")}@font-face{font-family:Roboto;font-style:normal;font-display:swap;font-weight:700;src:local("Roboto Bold "),local("Roboto-Bold"),url(../../static/media/roboto-latin-700.2735a3a6.woff2) format("woff2"),url(../../static/media/roboto-latin-700.adcde98f.woff) format("woff")}@font-face{font-family:Roboto;font-style:italic;font-display:swap;font-weight:700;src:local("Roboto Bold italic"),local("Roboto-Bolditalic"),url(../../static/media/roboto-latin-700italic.da0e7178.woff2) format("woff2"),url(../../static/media/roboto-latin-700italic.81f57861.woff) format("woff")}@font-face{font-family:Roboto;font-style:normal;font-display:swap;font-weight:900;src:local("Roboto Black "),local("Roboto-Black"),url(../../static/media/roboto-latin-900.9b3766ef.woff2) format("woff2"),url(../../static/media/roboto-latin-900.bb1e4dc6.woff) format("woff")}@font-face{font-family:Roboto;font-style:italic;font-display:swap;font-weight:900;src:local("Roboto Black italic"),local("Roboto-Blackitalic"),url(../../static/media/roboto-latin-900italic.ebf6d164.woff2) format("woff2"),url(../../static/media/roboto-latin-900italic.28f91510.woff) format("woff")}
|
||||||
|
/*# sourceMappingURL=2.335e4b44.chunk.css.map */
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,2 @@
|
|||||||
|
body{margin:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}code{font-family:source-code-pro,Menlo,Monaco,Consolas,Courier New,monospace}
|
||||||
|
/*# sourceMappingURL=main.a82b4685.chunk.css.map */
|
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"sources":["index.css"],"names":[],"mappings":"AACA,KACE,QAAS,CACT,mIAEY,CACZ,kCAAmC,CACnC,iCACF,CAEA,KACE,uEAEF","file":"main.a82b4685.chunk.css","sourcesContent":["\nbody {\n margin: 0;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Oxygen\",\n \"Ubuntu\", \"Cantarell\", \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\",\n sans-serif;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\ncode {\n font-family: source-code-pro, Menlo, Monaco, Consolas, \"Courier New\",\n monospace;\n}\n"]}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,2 @@
|
|||||||
|
!function(e){function r(r){for(var n,f,i=r[0],l=r[1],a=r[2],c=0,s=[];c<i.length;c++)f=i[c],o[f]&&s.push(o[f][0]),o[f]=0;for(n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n]);for(p&&p(r);s.length;)s.shift()();return u.push.apply(u,a||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++){var l=t[i];0!==o[l]&&(n=!1)}n&&(u.splice(r--,1),e=f(f.s=t[0]))}return e}var n={},o={1:0},u=[];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.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(e,r){return Object.prototype.hasOwnProperty.call(e,r)},f.p="./";var i=window.webpackJsonp=window.webpackJsonp||[],l=i.push.bind(i);i.push=r,i=i.slice();for(var a=0;a<i.length;a++)r(i[a]);var p=l;t()}([]);
|
||||||
|
//# sourceMappingURL=runtime~main.d653cc00.js.map
|
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -27,6 +27,7 @@
|
|||||||
<li><a href="/apps/vs_connections.html">Variable Server Connections</a></li>
|
<li><a href="/apps/vs_connections.html">Variable Server Connections</a></li>
|
||||||
<li><a href="/apps/alloc_info.html">Trick Memory Allocations</a></li>
|
<li><a href="/apps/alloc_info.html">Trick Memory Allocations</a></li>
|
||||||
<li><a href="/apps/wsexp.html">Websocket Experiment</a></li>
|
<li><a href="/apps/wsexp.html">Websocket Experiment</a></li>
|
||||||
|
<li><a href="/apps/react/index.html">Sim Control and TV Mockup</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ static void* connectionAttendant (void* arg) {
|
|||||||
pthread_mutex_unlock(&S->serviceLock);
|
pthread_mutex_unlock(&S->serviceLock);
|
||||||
return NULL;
|
return NULL;
|
||||||
} else {
|
} else {
|
||||||
mg_mgr_poll(&S->mgr, 50);
|
while(mg_mgr_poll(&S->mgr, 50));
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&S->serviceLock);
|
pthread_mutex_unlock(&S->serviceLock);
|
||||||
}
|
}
|
||||||
|
23
trick_source/web/mockup/.gitignore
vendored
Normal file
23
trick_source/web/mockup/.gitignore
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||||
|
|
||||||
|
# dependencies
|
||||||
|
/node_modules
|
||||||
|
/.pnp
|
||||||
|
.pnp.js
|
||||||
|
|
||||||
|
# testing
|
||||||
|
/coverage
|
||||||
|
|
||||||
|
# production
|
||||||
|
/build
|
||||||
|
|
||||||
|
# misc
|
||||||
|
.DS_Store
|
||||||
|
.env.local
|
||||||
|
.env.development.local
|
||||||
|
.env.test.local
|
||||||
|
.env.production.local
|
||||||
|
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
4
trick_source/web/mockup/.prettierrc
Normal file
4
trick_source/web/mockup/.prettierrc
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"singleQuote": true,
|
||||||
|
"trailingComma": "all"
|
||||||
|
}
|
68
trick_source/web/mockup/README.md
Normal file
68
trick_source/web/mockup/README.md
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
||||||
|
|
||||||
|
## Available Scripts
|
||||||
|
|
||||||
|
In the project directory, you can run:
|
||||||
|
|
||||||
|
### `npm start`
|
||||||
|
|
||||||
|
Runs the app in the development mode.<br>
|
||||||
|
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
|
||||||
|
|
||||||
|
The page will reload if you make edits.<br>
|
||||||
|
You will also see any lint errors in the console.
|
||||||
|
|
||||||
|
### `npm test`
|
||||||
|
|
||||||
|
Launches the test runner in the interactive watch mode.<br>
|
||||||
|
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
||||||
|
|
||||||
|
### `npm run build`
|
||||||
|
|
||||||
|
Builds the app for production to the `build` folder.<br>
|
||||||
|
It correctly bundles React in production mode and optimizes the build for the best performance.
|
||||||
|
|
||||||
|
The build is minified and the filenames include the hashes.<br>
|
||||||
|
Your app is ready to be deployed!
|
||||||
|
|
||||||
|
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
||||||
|
|
||||||
|
### `npm run eject`
|
||||||
|
|
||||||
|
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
|
||||||
|
|
||||||
|
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
||||||
|
|
||||||
|
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
|
||||||
|
|
||||||
|
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
|
||||||
|
|
||||||
|
## Learn More
|
||||||
|
|
||||||
|
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
||||||
|
|
||||||
|
To learn React, check out the [React documentation](https://reactjs.org/).
|
||||||
|
|
||||||
|
### Code Splitting
|
||||||
|
|
||||||
|
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
|
||||||
|
|
||||||
|
### Analyzing the Bundle Size
|
||||||
|
|
||||||
|
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
|
||||||
|
|
||||||
|
### Making a Progressive Web App
|
||||||
|
|
||||||
|
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
|
||||||
|
|
||||||
|
### Advanced Configuration
|
||||||
|
|
||||||
|
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
|
||||||
|
|
||||||
|
### Deployment
|
||||||
|
|
||||||
|
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
|
||||||
|
|
||||||
|
### `npm run build` fails to minify
|
||||||
|
|
||||||
|
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
|
16682
trick_source/web/mockup/package-lock.json
generated
Normal file
16682
trick_source/web/mockup/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
41
trick_source/web/mockup/package.json
Normal file
41
trick_source/web/mockup/package.json
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
{
|
||||||
|
"name": "web-sim-control",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"private": true,
|
||||||
|
"homepage": "./",
|
||||||
|
"dependencies": {
|
||||||
|
"@material-ui/core": "^4.3.3",
|
||||||
|
"@material-ui/icons": "^4.2.1",
|
||||||
|
"@material-ui/lab": "^4.0.0-alpha.24",
|
||||||
|
"@material-ui/styles": "^4.2.1",
|
||||||
|
"plotly.js": "^1.49.0",
|
||||||
|
"prettier": "^1.18.2",
|
||||||
|
"react": "^16.8.6",
|
||||||
|
"react-dom": "^16.8.6",
|
||||||
|
"react-plotly.js": "^2.3.0",
|
||||||
|
"react-scripts": "3.0.1",
|
||||||
|
"reflexbox": "^4.0.1",
|
||||||
|
"typeface-roboto": "0.0.75"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"start": "react-scripts start",
|
||||||
|
"build": "react-scripts build",
|
||||||
|
"test": "react-scripts test",
|
||||||
|
"eject": "react-scripts eject"
|
||||||
|
},
|
||||||
|
"eslintConfig": {
|
||||||
|
"extends": "react-app"
|
||||||
|
},
|
||||||
|
"browserslist": {
|
||||||
|
"production": [
|
||||||
|
">0.2%",
|
||||||
|
"not dead",
|
||||||
|
"not op_mini all"
|
||||||
|
],
|
||||||
|
"development": [
|
||||||
|
"last 1 chrome version",
|
||||||
|
"last 1 firefox version",
|
||||||
|
"last 1 safari version"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
BIN
trick_source/web/mockup/public/TrickLogoSmall.png
Normal file
BIN
trick_source/web/mockup/public/TrickLogoSmall.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 28 KiB |
38
trick_source/web/mockup/public/index.html
Normal file
38
trick_source/web/mockup/public/index.html
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<link rel="shortcut icon" href="%PUBLIC_URL%/TrickLogoSmall.png" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<meta name="theme-color" content="#000000" />
|
||||||
|
<!--
|
||||||
|
manifest.json provides metadata used when your web app is installed on a
|
||||||
|
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||||
|
-->
|
||||||
|
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||||
|
<!--
|
||||||
|
Notice the use of %PUBLIC_URL% in the tags above.
|
||||||
|
It will be replaced with the URL of the `public` folder during the build.
|
||||||
|
Only files inside the `public` folder can be referenced from the HTML.
|
||||||
|
|
||||||
|
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
||||||
|
work correctly both with client-side routing and a non-root public URL.
|
||||||
|
Learn how to configure a non-root public URL by running `npm run build`.
|
||||||
|
-->
|
||||||
|
<title>React App</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||||
|
<div id="root"></div>
|
||||||
|
<!--
|
||||||
|
This HTML file is a template.
|
||||||
|
If you open it directly in the browser, you will see an empty page.
|
||||||
|
|
||||||
|
You can add webfonts, meta tags, or analytics to this file.
|
||||||
|
The build step will place the bundled scripts into the <body> tag.
|
||||||
|
|
||||||
|
To begin the development, run `npm start` or `yarn start`.
|
||||||
|
To create a production bundle, use `npm run build` or `yarn build`.
|
||||||
|
-->
|
||||||
|
</body>
|
||||||
|
</html>
|
15
trick_source/web/mockup/public/manifest.json
Normal file
15
trick_source/web/mockup/public/manifest.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"short_name": "React App",
|
||||||
|
"name": "Create React App Sample",
|
||||||
|
"icons": [
|
||||||
|
{
|
||||||
|
"src": "favicon.ico",
|
||||||
|
"sizes": "64x64 32x32 24x24 16x16",
|
||||||
|
"type": "image/x-icon"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start_url": ".",
|
||||||
|
"display": "standalone",
|
||||||
|
"theme_color": "#000000",
|
||||||
|
"background_color": "#ffffff"
|
||||||
|
}
|
33
trick_source/web/mockup/src/App.css
Normal file
33
trick_source/web/mockup/src/App.css
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/*.App {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.App-logo {
|
||||||
|
animation: App-logo-spin infinite 20s linear;
|
||||||
|
height: 40vmin;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.App-header {
|
||||||
|
background-color: #282c34;
|
||||||
|
min-height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: calc(10px + 2vmin);
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.App-link {
|
||||||
|
color: #61dafb;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes App-logo-spin {
|
||||||
|
from {
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}*/
|
24
trick_source/web/mockup/src/App.js
Normal file
24
trick_source/web/mockup/src/App.js
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import Client from './Client';
|
||||||
|
import { withStyles } from '@material-ui/core/styles';
|
||||||
|
import withRoot from './withRoot';
|
||||||
|
import styles from './AppStyles';
|
||||||
|
|
||||||
|
/*
|
||||||
|
function App(props) {
|
||||||
|
const { classes } = props;
|
||||||
|
return (<Client classes={classes}></Client>);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
class App extends React.Component {
|
||||||
|
render() {
|
||||||
|
const { classes } = this.props;
|
||||||
|
console.log(classes);
|
||||||
|
return (<Client classes={classes}></Client>);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export default withRoot(withStyles(styles)(App));
|
9
trick_source/web/mockup/src/App.test.js
Normal file
9
trick_source/web/mockup/src/App.test.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import ReactDOM from 'react-dom';
|
||||||
|
import App from './App';
|
||||||
|
|
||||||
|
it('renders without crashing', () => {
|
||||||
|
const div = document.createElement('div');
|
||||||
|
ReactDOM.render(<App />, div);
|
||||||
|
ReactDOM.unmountComponentAtNode(div);
|
||||||
|
});
|
137
trick_source/web/mockup/src/AppStyles.js
Normal file
137
trick_source/web/mockup/src/AppStyles.js
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
import { fade } from '@material-ui/core/styles';
|
||||||
|
|
||||||
|
const drawerWidth = 240;
|
||||||
|
|
||||||
|
export default theme => ({
|
||||||
|
|
||||||
|
root: {
|
||||||
|
display: 'flex',
|
||||||
|
},
|
||||||
|
|
||||||
|
toolbar: {},
|
||||||
|
|
||||||
|
appbar: { width: `calc(100% - ${drawerWidth}px)`, marginLeft: drawerWidth },
|
||||||
|
|
||||||
|
paper: {
|
||||||
|
margin: '0 auto',
|
||||||
|
marginTop: theme.spacing(20),
|
||||||
|
marginBottom: theme.spacing(0),
|
||||||
|
maxWidth: 800,
|
||||||
|
},
|
||||||
|
|
||||||
|
drawer: {
|
||||||
|
width: drawerWidth,
|
||||||
|
flexShrink: 0,
|
||||||
|
},
|
||||||
|
|
||||||
|
drawerPaper: {
|
||||||
|
width: drawerWidth,
|
||||||
|
},
|
||||||
|
|
||||||
|
tv: {
|
||||||
|
margin: '0 auto',
|
||||||
|
marginTop: theme.spacing(5),
|
||||||
|
marginBottom: theme.spacing(5),
|
||||||
|
maxWidth: 800,
|
||||||
|
},
|
||||||
|
|
||||||
|
mockup: {
|
||||||
|
margin: '0 auto',
|
||||||
|
maxWidth: 800,
|
||||||
|
padding: theme.spacing(3),
|
||||||
|
},
|
||||||
|
|
||||||
|
appbartitle: {
|
||||||
|
marginLeft: theme.spacing(1),
|
||||||
|
},
|
||||||
|
|
||||||
|
tvtable: {
|
||||||
|
margin: theme.spacing(3),
|
||||||
|
paddingRight: theme.spacing(2),
|
||||||
|
marginLeft: 0,
|
||||||
|
},
|
||||||
|
|
||||||
|
body: {
|
||||||
|
marginTop: theme.spacing(20),
|
||||||
|
},
|
||||||
|
|
||||||
|
textfield: {
|
||||||
|
margin: theme.spacing(1),
|
||||||
|
},
|
||||||
|
|
||||||
|
divider: {
|
||||||
|
borderRight: '0.1em solid ' + theme.palette.divider,
|
||||||
|
margin: theme.spacing(300),
|
||||||
|
},
|
||||||
|
|
||||||
|
button: {
|
||||||
|
margin: theme.spacing(2),
|
||||||
|
},
|
||||||
|
|
||||||
|
timer: {
|
||||||
|
margin: theme.spacing(2),
|
||||||
|
},
|
||||||
|
|
||||||
|
margin: {
|
||||||
|
margin: theme.spacing(1),
|
||||||
|
},
|
||||||
|
|
||||||
|
dividermargin: {
|
||||||
|
height: theme.spacing(1),
|
||||||
|
},
|
||||||
|
|
||||||
|
toolbar: theme.mixins.toolbar,
|
||||||
|
|
||||||
|
appbar: {
|
||||||
|
marginBottom: theme.spacing(20),
|
||||||
|
zIndex: theme.zIndex.drawer + 1,
|
||||||
|
},
|
||||||
|
|
||||||
|
treeview: {
|
||||||
|
margin: theme.spacing(2),
|
||||||
|
marginTop: theme.spacing(5),
|
||||||
|
padding: theme.spacing(1),
|
||||||
|
},
|
||||||
|
|
||||||
|
div: {},
|
||||||
|
|
||||||
|
search: {
|
||||||
|
position: 'relative',
|
||||||
|
borderRadius: theme.shape.borderRadius,
|
||||||
|
backgroundColor: fade(theme.palette.common.white, 0.15),
|
||||||
|
'&:hover': {
|
||||||
|
backgroundColor: fade(theme.palette.common.white, 0.25),
|
||||||
|
},
|
||||||
|
marginRight: theme.spacing(2),
|
||||||
|
marginLeft: 0,
|
||||||
|
width: '100%',
|
||||||
|
[theme.breakpoints.up('sm')]: {
|
||||||
|
marginLeft: theme.spacing(3),
|
||||||
|
width: 'auto',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
searchIcon: {
|
||||||
|
width: theme.spacing(7),
|
||||||
|
height: '100%',
|
||||||
|
position: 'absolute',
|
||||||
|
pointerEvents: 'none',
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
},
|
||||||
|
|
||||||
|
inputRoot: {
|
||||||
|
color: 'inherit',
|
||||||
|
},
|
||||||
|
|
||||||
|
inputInput: {
|
||||||
|
padding: theme.spacing(1, 1, 1, 7),
|
||||||
|
transition: theme.transitions.create('width'),
|
||||||
|
width: '100%',
|
||||||
|
[theme.breakpoints.up('md')]: {
|
||||||
|
width: 200,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
});
|
508
trick_source/web/mockup/src/Client.js
Normal file
508
trick_source/web/mockup/src/Client.js
Normal file
@ -0,0 +1,508 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import AppBar from '@material-ui/core/AppBar';
|
||||||
|
import MuiBox from '@material-ui/core/Box';
|
||||||
|
import Toolbar from '@material-ui/core/Toolbar';
|
||||||
|
import Table from '@material-ui/core/Table';
|
||||||
|
import TableBody from '@material-ui/core/TableBody';
|
||||||
|
import TableCell from '@material-ui/core/TableCell';
|
||||||
|
import TableHead from '@material-ui/core/TableHead';
|
||||||
|
import TableRow from '@material-ui/core/TableRow';
|
||||||
|
import Paper from '@material-ui/core/Paper';
|
||||||
|
import TextField from '@material-ui/core/TextField';
|
||||||
|
import Typography from '@material-ui/core/Typography';
|
||||||
|
import Button from '@material-ui/core/Button';
|
||||||
|
import ExpansionPanel from '@material-ui/core/ExpansionPanel';
|
||||||
|
import ExpansionPanelSummary from '@material-ui/core/ExpansionPanelSummary';
|
||||||
|
import ExpansionPanelDetails from '@material-ui/core/ExpansionPanelDetails';
|
||||||
|
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
|
||||||
|
import { Flex, Box } from 'reflexbox';
|
||||||
|
import TreeView from '@material-ui/lab/TreeView';
|
||||||
|
import ChevronRightIcon from '@material-ui/icons/ChevronRight';
|
||||||
|
import TreeItem from '@material-ui/lab/TreeItem';
|
||||||
|
import SearchIcon from '@material-ui/icons/Search';
|
||||||
|
import InputBase from '@material-ui/core/InputBase';
|
||||||
|
|
||||||
|
import Drawer from '@material-ui/core/Drawer';
|
||||||
|
|
||||||
|
import List from '@material-ui/core/List';
|
||||||
|
|
||||||
|
import Divider from '@material-ui/core/Divider';
|
||||||
|
import ListItem from '@material-ui/core/ListItem';
|
||||||
|
import ListItemIcon from '@material-ui/core/ListItemIcon';
|
||||||
|
import ListItemText from '@material-ui/core/ListItemText';
|
||||||
|
import InboxIcon from '@material-ui/icons/MoveToInbox';
|
||||||
|
import MailIcon from '@material-ui/icons/Mail';
|
||||||
|
|
||||||
|
import OutlinedInput from '@material-ui/core/OutlinedInput';
|
||||||
|
|
||||||
|
import MenuItem from '@material-ui/core/MenuItem';
|
||||||
|
|
||||||
|
import Select from '@material-ui/core/Select';
|
||||||
|
|
||||||
|
export default class Client extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
variables: [],
|
||||||
|
data: [],
|
||||||
|
unit: [],
|
||||||
|
time: 0.0,
|
||||||
|
};
|
||||||
|
console.log('Client created');
|
||||||
|
this.ws = new WebSocket(
|
||||||
|
'ws://localhost:8888/api/ws/VariableServer',
|
||||||
|
'myProtocol',
|
||||||
|
);
|
||||||
|
this.ws.onopen = e => {
|
||||||
|
this.var_cycle(100);
|
||||||
|
this.var_unpause();
|
||||||
|
//this.var_add("trick_sys.sched.time_tics");
|
||||||
|
console.log('opened');
|
||||||
|
};
|
||||||
|
this.ws.onmessage = e => {
|
||||||
|
console.log('Message received');
|
||||||
|
let message = JSON.parse(e.data);
|
||||||
|
console.log(message);
|
||||||
|
this.setState({ time: message.time, data: message.values });
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
send_msg = msg => {
|
||||||
|
//console.log(JSON.stringify(msg));
|
||||||
|
this.ws.send(JSON.stringify(msg));
|
||||||
|
};
|
||||||
|
|
||||||
|
var_add = v => {
|
||||||
|
let msg = {
|
||||||
|
cmd: 'var_add',
|
||||||
|
var_name: v,
|
||||||
|
};
|
||||||
|
this.send_msg(msg);
|
||||||
|
};
|
||||||
|
|
||||||
|
var_unpause = () => {
|
||||||
|
let msg = {
|
||||||
|
cmd: 'var_unpause',
|
||||||
|
};
|
||||||
|
this.send_msg(msg);
|
||||||
|
};
|
||||||
|
|
||||||
|
var_cycle = p => {
|
||||||
|
let msg = {
|
||||||
|
cmd: 'var_cycle',
|
||||||
|
period: p,
|
||||||
|
};
|
||||||
|
this.send_msg(msg);
|
||||||
|
};
|
||||||
|
|
||||||
|
var_clear = () => {
|
||||||
|
let msg = {
|
||||||
|
cmd: 'var_clear',
|
||||||
|
};
|
||||||
|
this.send_msg(msg);
|
||||||
|
};
|
||||||
|
|
||||||
|
addVariable = v => {
|
||||||
|
this.setState({
|
||||||
|
variables: [...this.state.variables, v],
|
||||||
|
data: [...this.state.data, 0.0],
|
||||||
|
});
|
||||||
|
this.var_add(v);
|
||||||
|
};
|
||||||
|
|
||||||
|
clearVariables = () => {
|
||||||
|
this.setState({ variables: [], data: [] });
|
||||||
|
this.var_clear();
|
||||||
|
};
|
||||||
|
|
||||||
|
input_processor = cmd => {
|
||||||
|
let msg = {
|
||||||
|
cmd: 'python',
|
||||||
|
pycode: cmd,
|
||||||
|
};
|
||||||
|
this.send_msg(msg);
|
||||||
|
};
|
||||||
|
|
||||||
|
sim_start = () => {
|
||||||
|
this.input_processor('trick.exec_run()');
|
||||||
|
};
|
||||||
|
|
||||||
|
sim_freeze = () => {
|
||||||
|
this.input_processor('trick.exec_freeze()');
|
||||||
|
};
|
||||||
|
sim_shutdown = () => {
|
||||||
|
this.input_processor('trick.stop()');
|
||||||
|
};
|
||||||
|
sim_step = () => {
|
||||||
|
/* TODO handle debug stepping mode
|
||||||
|
this.input_processor('trick.debug_pause_on()');
|
||||||
|
this.input_processor('trick.exec_run()');
|
||||||
|
*/
|
||||||
|
};
|
||||||
|
|
||||||
|
BoxButton = ({ text, color = 'primary', fullWidth = true, onClick }) => (
|
||||||
|
<Box flexGrow={1} flexShrink={1}>
|
||||||
|
<Button
|
||||||
|
className={this.props.classes.button}
|
||||||
|
variant="contained"
|
||||||
|
color={color}
|
||||||
|
size="large"
|
||||||
|
fullWidth={fullWidth}
|
||||||
|
onClick={onClick}
|
||||||
|
>
|
||||||
|
{text}
|
||||||
|
</Button>
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { classes } = this.props;
|
||||||
|
//console.log(classes);
|
||||||
|
return (
|
||||||
|
<div display="flex">
|
||||||
|
<AppBar position="fixed" className={classes.appbar}>
|
||||||
|
<Toolbar className={classes.toolbar}>
|
||||||
|
<Flex alignItems="center" flexGrow={1}>
|
||||||
|
<Box>
|
||||||
|
<img src="TrickLogoSmall.png" height={45} />
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<Typography variant="h5" className={classes.appbartitle}>
|
||||||
|
Trick Dashboard
|
||||||
|
</Typography>
|
||||||
|
</Box>
|
||||||
|
<Box flexGrow={1} />
|
||||||
|
<Box flexDirection="column">
|
||||||
|
<Typography variant="h6">
|
||||||
|
SIM_cannon_numeric{'\u00A0'}
|
||||||
|
{'\u00A0'}
|
||||||
|
{'\u00A0'}
|
||||||
|
</Typography>
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<Typography variant="h6">localhost:8888</Typography>
|
||||||
|
</Box>
|
||||||
|
</Flex>
|
||||||
|
</Toolbar>
|
||||||
|
</AppBar>
|
||||||
|
<Flex>
|
||||||
|
<Box>
|
||||||
|
<Drawer
|
||||||
|
className={classes.drawer}
|
||||||
|
variant="permanent"
|
||||||
|
classes={{
|
||||||
|
paper: classes.drawerPaper,
|
||||||
|
}}
|
||||||
|
anchor="left"
|
||||||
|
>
|
||||||
|
<div className={classes.toolbar} />
|
||||||
|
<Divider />
|
||||||
|
<List>
|
||||||
|
{['Home', 'Wiki', 'Data Recording', 'Strip Chart'].map(
|
||||||
|
(text, index) => (
|
||||||
|
<ListItem button key={text}>
|
||||||
|
<ListItemIcon>
|
||||||
|
{index % 2 === 0 ? <InboxIcon /> : <MailIcon />}
|
||||||
|
</ListItemIcon>
|
||||||
|
<ListItemText primary={text} />
|
||||||
|
</ListItem>
|
||||||
|
),
|
||||||
|
)}
|
||||||
|
</List>
|
||||||
|
<Divider />
|
||||||
|
<List>
|
||||||
|
{['Sniffer', 'Environment', 'Settings'].map((text, index) => (
|
||||||
|
<ListItem button key={text}>
|
||||||
|
<ListItemIcon>
|
||||||
|
{index % 2 === 0 ? <InboxIcon /> : <MailIcon />}
|
||||||
|
</ListItemIcon>
|
||||||
|
<ListItemText primary={text} />
|
||||||
|
</ListItem>
|
||||||
|
))}
|
||||||
|
</List>
|
||||||
|
</Drawer>
|
||||||
|
</Box>
|
||||||
|
<Flex flexDirection="column" flexGrow={1}>
|
||||||
|
<Box margin={2}>
|
||||||
|
<Paper className={classes.paper}>
|
||||||
|
<Toolbar className={classes.toolbar}>
|
||||||
|
<Typography variant="h6" color="textPrimary">
|
||||||
|
Sim Control
|
||||||
|
</Typography>
|
||||||
|
</Toolbar>
|
||||||
|
<Flex justifyContent="space-between">
|
||||||
|
<Flex flexGrow={1}>
|
||||||
|
<Flex
|
||||||
|
flexDirection="column"
|
||||||
|
marginRight={25}
|
||||||
|
flexShrink={1}
|
||||||
|
>
|
||||||
|
<this.BoxButton text="step" onClick={this.sim_step} />
|
||||||
|
<this.BoxButton text="start" onClick={this.sim_start} />
|
||||||
|
<this.BoxButton text="freeze" onClick={this.sim_freeze} />
|
||||||
|
<this.BoxButton
|
||||||
|
text="shutdown"
|
||||||
|
color="secondary"
|
||||||
|
onClick={this.sim_shutdown}
|
||||||
|
/>
|
||||||
|
</Flex>
|
||||||
|
<Flex flexDirection="column">
|
||||||
|
<this.BoxButton text="data record on" />
|
||||||
|
<this.BoxButton text="realtime on" />
|
||||||
|
<this.BoxButton text="dump checkpoint" />
|
||||||
|
<this.BoxButton text="load checkpoint" />
|
||||||
|
</Flex>
|
||||||
|
</Flex>
|
||||||
|
<Flex
|
||||||
|
flexDirection="column"
|
||||||
|
flexGrow={3}
|
||||||
|
flexShrink={0}
|
||||||
|
margin={25}
|
||||||
|
>
|
||||||
|
<Box>
|
||||||
|
<TextField
|
||||||
|
variant="outlined"
|
||||||
|
label="Sim Time (s)"
|
||||||
|
value={this.state.time.toFixed(2)}
|
||||||
|
disabled={true}
|
||||||
|
className={classes.timer}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<TextField
|
||||||
|
variant="outlined"
|
||||||
|
label="playback speed"
|
||||||
|
value="1.0"
|
||||||
|
className={classes.timer}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
</Flex>
|
||||||
|
</Flex>
|
||||||
|
<ExpansionPanel>
|
||||||
|
<ExpansionPanelSummary expandIcon={<ExpandMoreIcon />}>
|
||||||
|
Status Messages
|
||||||
|
</ExpansionPanelSummary>
|
||||||
|
<ExpansionPanelDetails>
|
||||||
|
<Typography>
|
||||||
|
<MuiBox bgcolor="black" padding={1}>
|
||||||
|
{
|
||||||
|
'|L 1|2019/08/06,09:29:13|thanos| |T 0|1.500000| Freeze OFF.'
|
||||||
|
}
|
||||||
|
<br />
|
||||||
|
{
|
||||||
|
'|L 10|2019/08/06,09:29:14|thanos| |T 0|3.200000| 0x7f6950000fd0 tag=<SimControl> var_server received: trick.exec_freeze()'
|
||||||
|
}
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
{
|
||||||
|
'|L 1|2019/08/06,09:29:14|thanos| |T 0|3.300000| Freeze ON. Simulation time holding at 3.300000 seconds.'
|
||||||
|
}
|
||||||
|
<br />
|
||||||
|
{
|
||||||
|
'|L 10|2019/08/06,09:29:21|thanos| |T 0|3.300000| 0x7f6950000fd0 tag=<SimControl> var_server received: trick.exec_run()'
|
||||||
|
}
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
{
|
||||||
|
'|L 1|2019/08/06,09:29:21|thanos| |T 0|3.300000| Freeze OFF.'
|
||||||
|
}
|
||||||
|
<br />
|
||||||
|
{
|
||||||
|
'|L 10|2019/08/06,09:29:23|thanos| |T 0|4.600000| 0x7f6950000fd0 tag=<SimControl> var_server received: trick.exec_freeze()'
|
||||||
|
}
|
||||||
|
</MuiBox>
|
||||||
|
</Typography>
|
||||||
|
</ExpansionPanelDetails>
|
||||||
|
</ExpansionPanel>
|
||||||
|
</Paper>
|
||||||
|
</Box>
|
||||||
|
<Box margin={2}>
|
||||||
|
<Paper className={classes.tv}>
|
||||||
|
<Toolbar className={classes.toolbar}>
|
||||||
|
<Typography variant="h6" color="textPrimary">
|
||||||
|
Trick View
|
||||||
|
</Typography>
|
||||||
|
<div className={classes.search}>
|
||||||
|
<div className={classes.searchIcon}>
|
||||||
|
<SearchIcon />
|
||||||
|
</div>
|
||||||
|
<InputBase
|
||||||
|
placeholder="Search…"
|
||||||
|
classes={{
|
||||||
|
root: classes.inputRoot,
|
||||||
|
input: classes.inputInput,
|
||||||
|
}}
|
||||||
|
inputProps={{ 'aria-label': 'search' }}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</Toolbar>
|
||||||
|
<Flex justifyContent="space-between">
|
||||||
|
<Flex flexDirection="Column">
|
||||||
|
<TreeView
|
||||||
|
className={classes.treeview}
|
||||||
|
defaultCollapseIcon={<ExpandMoreIcon />}
|
||||||
|
defaultExpandIcon={<ChevronRightIcon />}
|
||||||
|
>
|
||||||
|
<TreeItem nodeId="1" label="Trick Variables">
|
||||||
|
<TreeItem nodeId="2" label="trick_cmd_args">
|
||||||
|
<TreeItem nodeId="3" label="dummy data" />
|
||||||
|
</TreeItem>
|
||||||
|
<TreeItem nodeId="4" label="trick_sys">
|
||||||
|
<TreeItem nodeId="5" label="dummy data" />
|
||||||
|
</TreeItem>
|
||||||
|
<TreeItem nodeId="6" label="trick_ip">
|
||||||
|
<TreeItem nodeId="7" label="dummy data" />
|
||||||
|
</TreeItem>
|
||||||
|
<TreeItem nodeId="8" label="trick_vs">
|
||||||
|
<TreeItem nodeId="9" label="dummy data" />
|
||||||
|
</TreeItem>
|
||||||
|
</TreeItem>
|
||||||
|
<TreeItem nodeId="10" label="Dynamic Allocations">
|
||||||
|
<TreeItem nodeId="11" label="dyn_integloop">
|
||||||
|
<TreeItem nodeId="12" label="name" />
|
||||||
|
<TreeItem nodeId="13" label="id" />
|
||||||
|
<TreeItem nodeId="14" label="integ_sched">
|
||||||
|
<TreeItem nodeId="15" label="dummy data" />
|
||||||
|
</TreeItem>
|
||||||
|
</TreeItem>
|
||||||
|
</TreeItem>
|
||||||
|
<TreeItem nodeId="16" label="dyn">
|
||||||
|
<TreeItem nodeId="17" label="name" />
|
||||||
|
<TreeItem nodeId="18" label="id" />
|
||||||
|
<TreeItem nodeId="19" label="cannon">
|
||||||
|
<TreeItem nodeId="20" label="vel0[2]" />
|
||||||
|
<TreeItem nodeId="21" label="pos0[2]" />
|
||||||
|
<TreeItem nodeId="22" label="init_speed" />
|
||||||
|
<TreeItem nodeId="23" label="init_angle" />
|
||||||
|
<TreeItem nodeId="24" label="g" />
|
||||||
|
<TreeItem nodeId="25" label="acc[2]" />
|
||||||
|
<TreeItem nodeId="26" label="vel[2]" />
|
||||||
|
<TreeItem nodeId="27" label="pos[2]" />
|
||||||
|
<TreeItem nodeId="28" label="time" />
|
||||||
|
<TreeItem nodeId="29" label="timeRate" />
|
||||||
|
<TreeItem nodeId="30" label="impact" />
|
||||||
|
<TreeItem nodeId="31" label="impactTime" />
|
||||||
|
<TreeItem nodeId="32" label="rf">
|
||||||
|
<TreeItem nodeId="33" label="dummy data" />
|
||||||
|
</TreeItem>
|
||||||
|
<TreeItem nodeId="34" label="connection">
|
||||||
|
<TreeItem nodeId="36" label="connection">
|
||||||
|
<TreeItem nodeId="37" label="connection">
|
||||||
|
<TreeItem nodeId="38" label="connection">
|
||||||
|
<TreeItem nodeId="39" label="connection">
|
||||||
|
<TreeItem nodeId="40" label="connection">
|
||||||
|
<TreeItem nodeId="41" label="connection">
|
||||||
|
<TreeItem
|
||||||
|
nodeId="35"
|
||||||
|
label="dummy data"
|
||||||
|
/>
|
||||||
|
</TreeItem>
|
||||||
|
</TreeItem>
|
||||||
|
</TreeItem>
|
||||||
|
</TreeItem>
|
||||||
|
</TreeItem>
|
||||||
|
</TreeItem>
|
||||||
|
</TreeItem>
|
||||||
|
</TreeItem>
|
||||||
|
<TreeItem nodeId="36" label="http">
|
||||||
|
<TreeItem nodeId="37" label="name" />
|
||||||
|
<TreeItem nodeId="38" label="id" />
|
||||||
|
<TreeItem nodeId="39" label="http_server">
|
||||||
|
<TreeItem nodeId="40" label="dummy data" />
|
||||||
|
</TreeItem>
|
||||||
|
</TreeItem>
|
||||||
|
</TreeItem>
|
||||||
|
</TreeView>
|
||||||
|
</Flex>
|
||||||
|
<Flex flexDirection="column">
|
||||||
|
<Box className={classes.dividermargin}></Box>
|
||||||
|
<Box className={classes.divider} flex={1}></Box>
|
||||||
|
<Box className={classes.dividermargin}></Box>
|
||||||
|
</Flex>
|
||||||
|
<Flex flexDirection="column" flexGrow={1}>
|
||||||
|
<Box flexGrow={1} paddingRight={50}>
|
||||||
|
<Table className={classes.tvtable}>
|
||||||
|
<TableHead>
|
||||||
|
<TableRow hover={true}>
|
||||||
|
<TableCell>Variable</TableCell>
|
||||||
|
<TableCell align="right">Value</TableCell>
|
||||||
|
<TableCell align="right">Unit</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
</TableHead>
|
||||||
|
<TableBody>
|
||||||
|
{this.state.variables.map(v => (
|
||||||
|
<TableRow key={v} hover={true}>
|
||||||
|
<TableCell>{v}</TableCell>
|
||||||
|
<TableCell align="right">
|
||||||
|
{this.state.data[
|
||||||
|
this.state.variables.indexOf(v)
|
||||||
|
] &&
|
||||||
|
this.state.data[this.state.variables.indexOf(v)]
|
||||||
|
.toFixed
|
||||||
|
? this.state.data[
|
||||||
|
this.state.variables.indexOf(v)
|
||||||
|
].toFixed(3)
|
||||||
|
: this.state.data[
|
||||||
|
this.state.variables.indexOf(v)
|
||||||
|
]}
|
||||||
|
</TableCell>
|
||||||
|
<TableCell align="right">
|
||||||
|
{this.state.unit[
|
||||||
|
this.state.variables.indexOf(v)
|
||||||
|
] &&
|
||||||
|
this.state.unit[this.state.variables.indexOf(v)]
|
||||||
|
.toFixed
|
||||||
|
? this.state.unit[
|
||||||
|
this.state.variables.indexOf(v)
|
||||||
|
].toFixed(3)
|
||||||
|
: this.state.unit[
|
||||||
|
this.state.variables.indexOf(v)
|
||||||
|
]}
|
||||||
|
</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
))}
|
||||||
|
</TableBody>
|
||||||
|
</Table>
|
||||||
|
</Box>
|
||||||
|
<Flex flexDirection="row">
|
||||||
|
<Box>
|
||||||
|
<TextField
|
||||||
|
className={classes.textfield}
|
||||||
|
variant="outlined"
|
||||||
|
label="Add Variable"
|
||||||
|
onKeyPress={ev => {
|
||||||
|
if (ev.key === 'Enter') {
|
||||||
|
if (ev.target.value !== '') {
|
||||||
|
this.addVariable(ev.target.value);
|
||||||
|
ev.target.value = '';
|
||||||
|
}
|
||||||
|
ev.preventDefault();
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
></TextField>
|
||||||
|
</Box>
|
||||||
|
<this.BoxButton
|
||||||
|
text="clear"
|
||||||
|
onClick={this.clearVariables}
|
||||||
|
fullWidth={false}
|
||||||
|
/>
|
||||||
|
</Flex>
|
||||||
|
</Flex>
|
||||||
|
</Flex>
|
||||||
|
</Paper>
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<Paper className={classes.mockup}>
|
||||||
|
<Typography variant="h6" color="textPrimary">
|
||||||
|
This web application mostly serves as a mockup for now. Most of the elements are not
|
||||||
|
functional. The following buttons and fields are currently functional: START, FREEZE, SHUTDOWN, Add
|
||||||
|
Variable, and CLEAR
|
||||||
|
</Typography>
|
||||||
|
</Paper>
|
||||||
|
</Box>
|
||||||
|
</Flex>
|
||||||
|
</Flex>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
14
trick_source/web/mockup/src/index.css
Normal file
14
trick_source/web/mockup/src/index.css
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
|
||||||
|
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
|
||||||
|
sans-serif;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
|
||||||
|
monospace;
|
||||||
|
}
|
13
trick_source/web/mockup/src/index.js
Normal file
13
trick_source/web/mockup/src/index.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import ReactDOM from 'react-dom';
|
||||||
|
import './index.css';
|
||||||
|
import App from './App';
|
||||||
|
import * as serviceWorker from './serviceWorker';
|
||||||
|
import 'typeface-roboto';
|
||||||
|
|
||||||
|
ReactDOM.render(<App />, document.getElementById('root'));
|
||||||
|
|
||||||
|
// If you want your app to work offline and load faster, you can change
|
||||||
|
// unregister() to register() below. Note this comes with some pitfalls.
|
||||||
|
// Learn more about service workers: https://bit.ly/CRA-PWA
|
||||||
|
serviceWorker.unregister();
|
135
trick_source/web/mockup/src/serviceWorker.js
Normal file
135
trick_source/web/mockup/src/serviceWorker.js
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
// This optional code is used to register a service worker.
|
||||||
|
// register() is not called by default.
|
||||||
|
|
||||||
|
// This lets the app load faster on subsequent visits in production, and gives
|
||||||
|
// it offline capabilities. However, it also means that developers (and users)
|
||||||
|
// will only see deployed updates on subsequent visits to a page, after all the
|
||||||
|
// existing tabs open on the page have been closed, since previously cached
|
||||||
|
// resources are updated in the background.
|
||||||
|
|
||||||
|
// To learn more about the benefits of this model and instructions on how to
|
||||||
|
// opt-in, read https://bit.ly/CRA-PWA
|
||||||
|
|
||||||
|
const isLocalhost = Boolean(
|
||||||
|
window.location.hostname === 'localhost' ||
|
||||||
|
// [::1] is the IPv6 localhost address.
|
||||||
|
window.location.hostname === '[::1]' ||
|
||||||
|
// 127.0.0.1/8 is considered localhost for IPv4.
|
||||||
|
window.location.hostname.match(
|
||||||
|
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
export function register(config) {
|
||||||
|
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
|
||||||
|
// The URL constructor is available in all browsers that support SW.
|
||||||
|
const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
|
||||||
|
if (publicUrl.origin !== window.location.origin) {
|
||||||
|
// Our service worker won't work if PUBLIC_URL is on a different origin
|
||||||
|
// from what our page is served on. This might happen if a CDN is used to
|
||||||
|
// serve assets; see https://github.com/facebook/create-react-app/issues/2374
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener('load', () => {
|
||||||
|
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
|
||||||
|
|
||||||
|
if (isLocalhost) {
|
||||||
|
// This is running on localhost. Let's check if a service worker still exists or not.
|
||||||
|
checkValidServiceWorker(swUrl, config);
|
||||||
|
|
||||||
|
// Add some additional logging to localhost, pointing developers to the
|
||||||
|
// service worker/PWA documentation.
|
||||||
|
navigator.serviceWorker.ready.then(() => {
|
||||||
|
console.log(
|
||||||
|
'This web app is being served cache-first by a service ' +
|
||||||
|
'worker. To learn more, visit https://bit.ly/CRA-PWA'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Is not localhost. Just register service worker
|
||||||
|
registerValidSW(swUrl, config);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function registerValidSW(swUrl, config) {
|
||||||
|
navigator.serviceWorker
|
||||||
|
.register(swUrl)
|
||||||
|
.then(registration => {
|
||||||
|
registration.onupdatefound = () => {
|
||||||
|
const installingWorker = registration.installing;
|
||||||
|
if (installingWorker == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
installingWorker.onstatechange = () => {
|
||||||
|
if (installingWorker.state === 'installed') {
|
||||||
|
if (navigator.serviceWorker.controller) {
|
||||||
|
// At this point, the updated precached content has been fetched,
|
||||||
|
// but the previous service worker will still serve the older
|
||||||
|
// content until all client tabs are closed.
|
||||||
|
console.log(
|
||||||
|
'New content is available and will be used when all ' +
|
||||||
|
'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
|
||||||
|
);
|
||||||
|
|
||||||
|
// Execute callback
|
||||||
|
if (config && config.onUpdate) {
|
||||||
|
config.onUpdate(registration);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// At this point, everything has been precached.
|
||||||
|
// It's the perfect time to display a
|
||||||
|
// "Content is cached for offline use." message.
|
||||||
|
console.log('Content is cached for offline use.');
|
||||||
|
|
||||||
|
// Execute callback
|
||||||
|
if (config && config.onSuccess) {
|
||||||
|
config.onSuccess(registration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error('Error during service worker registration:', error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkValidServiceWorker(swUrl, config) {
|
||||||
|
// Check if the service worker can be found. If it can't reload the page.
|
||||||
|
fetch(swUrl)
|
||||||
|
.then(response => {
|
||||||
|
// Ensure service worker exists, and that we really are getting a JS file.
|
||||||
|
const contentType = response.headers.get('content-type');
|
||||||
|
if (
|
||||||
|
response.status === 404 ||
|
||||||
|
(contentType != null && contentType.indexOf('javascript') === -1)
|
||||||
|
) {
|
||||||
|
// No service worker found. Probably a different app. Reload the page.
|
||||||
|
navigator.serviceWorker.ready.then(registration => {
|
||||||
|
registration.unregister().then(() => {
|
||||||
|
window.location.reload();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Service worker found. Proceed as normal.
|
||||||
|
registerValidSW(swUrl, config);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
console.log(
|
||||||
|
'No internet connection found. App is running in offline mode.'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function unregister() {
|
||||||
|
if ('serviceWorker' in navigator) {
|
||||||
|
navigator.serviceWorker.ready.then(registration => {
|
||||||
|
registration.unregister();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
35
trick_source/web/mockup/src/withRoot.js
Normal file
35
trick_source/web/mockup/src/withRoot.js
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { MuiThemeProvider, createMuiTheme } from '@material-ui/core/styles';
|
||||||
|
import cyan from '@material-ui/core/colors/cyan';
|
||||||
|
import deepPurple from '@material-ui/core/colors/deepPurple';
|
||||||
|
import green from '@material-ui/core/colors/green';
|
||||||
|
import blueGrey from '@material-ui/core/colors/blueGrey';
|
||||||
|
import CssBaseline from '@material-ui/core/CssBaseline';
|
||||||
|
|
||||||
|
// A theme with custom primary and secondary color.
|
||||||
|
// It's optional.
|
||||||
|
const theme = createMuiTheme({
|
||||||
|
palette: {
|
||||||
|
primary: {main: "#5d6a73" /* #333f48 is dark */},
|
||||||
|
secondary: {main: "#bf5700" /* choose f88638 for a lighter color */},
|
||||||
|
type:"dark",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
function withRoot(Component) {
|
||||||
|
function WithRoot(props) {
|
||||||
|
// MuiThemeProvider makes the theme available down the React tree
|
||||||
|
// thanks to React context.
|
||||||
|
return (
|
||||||
|
<MuiThemeProvider theme={theme}>
|
||||||
|
{/* CssBaseline kickstart an elegant, consistent, and simple baseline to build upon. */}
|
||||||
|
<CssBaseline />
|
||||||
|
<Component {...props} />
|
||||||
|
</MuiThemeProvider>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return WithRoot;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default withRoot;
|
Loading…
Reference in New Issue
Block a user