From 639161d37384323d955efa4c22947b56e7330705 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mose=20M=C3=BCller?= Date: Thu, 4 Jul 2024 12:19:19 +0200 Subject: [PATCH 1/3] feat: showing service class name in browser tab and on top of the frontend page --- frontend/src/App.tsx | 10 ++++++++-- frontend/src/utils/stateUtils.ts | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 248d15c..c9760b7 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -46,6 +46,7 @@ const reducer = (state: State, action: Action): State => { }; const App = () => { const [state, dispatch] = useReducer(reducer, null); + const [serviceName, setServiceName] = useState(null); const [webSettings, setWebSettings] = useState>({}); const [isInstantUpdate, setIsInstantUpdate] = useState(false); const [showSettings, setShowSettings] = useState(false); @@ -72,7 +73,12 @@ const App = () => { // Fetch data from the API when the client connects fetch(`http://${hostname}:${port}/service-properties`) .then((response) => response.json()) - .then((data: State) => dispatch({ type: 'SET_DATA', data })); + .then((data: State) => { + dispatch({ type: 'SET_DATA', data }); + setServiceName(data.name); + + document.title = data.name; // Setting browser tab title + }); fetch(`http://${hostname}:${port}/web-settings`) .then((response) => response.json()) .then((data: Record) => setWebSettings(data)); @@ -149,7 +155,7 @@ const App = () => { <> - Data Service App + {serviceName} diff --git a/frontend/src/utils/stateUtils.ts b/frontend/src/utils/stateUtils.ts index 5891603..1b759c1 100644 --- a/frontend/src/utils/stateUtils.ts +++ b/frontend/src/utils/stateUtils.ts @@ -2,6 +2,7 @@ import { SerializedValue } from '../components/GenericComponent'; export type State = { type: string; + name: string; value: Record | null; readonly: boolean; doc: string | null; From bfcf72fec7dcd9d0f55e7d644b579201b6dbf1f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mose=20M=C3=BCller?= Date: Thu, 4 Jul 2024 12:20:07 +0200 Subject: [PATCH 2/3] npm run build --- src/pydase/frontend/asset-manifest.json | 6 +++--- src/pydase/frontend/index.html | 2 +- .../static/js/{main.57f8ec4c.js => main.4facf514.js} | 6 +++--- ...57f8ec4c.js.LICENSE.txt => main.4facf514.js.LICENSE.txt} | 0 src/pydase/frontend/static/js/main.4facf514.js.map | 1 + src/pydase/frontend/static/js/main.57f8ec4c.js.map | 1 - 6 files changed, 8 insertions(+), 8 deletions(-) rename src/pydase/frontend/static/js/{main.57f8ec4c.js => main.4facf514.js} (99%) rename src/pydase/frontend/static/js/{main.57f8ec4c.js.LICENSE.txt => main.4facf514.js.LICENSE.txt} (100%) create mode 100644 src/pydase/frontend/static/js/main.4facf514.js.map delete mode 100644 src/pydase/frontend/static/js/main.57f8ec4c.js.map diff --git a/src/pydase/frontend/asset-manifest.json b/src/pydase/frontend/asset-manifest.json index fd4f27c..99342d3 100644 --- a/src/pydase/frontend/asset-manifest.json +++ b/src/pydase/frontend/asset-manifest.json @@ -1,13 +1,13 @@ { "files": { "main.css": "/static/css/main.7ef670d5.css", - "main.js": "/static/js/main.57f8ec4c.js", + "main.js": "/static/js/main.4facf514.js", "index.html": "/index.html", "main.7ef670d5.css.map": "/static/css/main.7ef670d5.css.map", - "main.57f8ec4c.js.map": "/static/js/main.57f8ec4c.js.map" + "main.4facf514.js.map": "/static/js/main.4facf514.js.map" }, "entrypoints": [ "static/css/main.7ef670d5.css", - "static/js/main.57f8ec4c.js" + "static/js/main.4facf514.js" ] } \ No newline at end of file diff --git a/src/pydase/frontend/index.html b/src/pydase/frontend/index.html index 213c530..78f0c53 100644 --- a/src/pydase/frontend/index.html +++ b/src/pydase/frontend/index.html @@ -1 +1 @@ -pydase App
\ No newline at end of file +pydase App
\ No newline at end of file diff --git a/src/pydase/frontend/static/js/main.57f8ec4c.js b/src/pydase/frontend/static/js/main.4facf514.js similarity index 99% rename from src/pydase/frontend/static/js/main.57f8ec4c.js rename to src/pydase/frontend/static/js/main.4facf514.js index 999d6ca..c1a4aa1 100644 --- a/src/pydase/frontend/static/js/main.57f8ec4c.js +++ b/src/pydase/frontend/static/js/main.4facf514.js @@ -1,3 +1,3 @@ -/*! For license information please see main.57f8ec4c.js.LICENSE.txt */ -(()=>{var e={694:(e,t)=>{var n;!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var e=[],t=0;t{"use strict";e.exports=function(e,t,n,r,o,a,i,s){if(!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,o,a,i,s],u=0;(l=new Error(t.replace(/%s/g,(function(){return c[u++]})))).name="Invariant Violation"}throw l.framesToPop=1,l}}},888:(e,t,n)=>{"use strict";var r=n(47);function o(){}function a(){}a.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,a,i){if(i!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:o};return n.PropTypes=n,n}},7:(e,t,n)=>{e.exports=n(888)()},47:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},463:(e,t,n)=>{"use strict";var r=n(791),o=n(296);function a(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n