Page 1 of 1

Activate CMX web locally /

Posted: Wed 29 Mar 2023 10:34 pm
by Zappastre
Hi,

After hour fighting i do not undertand how new web works.

In earlier versions if I open index.html in my PC with all the json files in the same folder, the web page worked.

Now i want to do the same, but theweb pages appears in blank.

i have enabled "Enable file copy of standard files" in web settins, files json are updatin every 5 minutes, but i don't undertand how are to be placed the files locally to see how looks like. I see in htm that varibales are in some kind of array called data-cmxdata, How is it solved?

Mi idea is undertand how it works and complete an ols page with some of the gauges or graph data.

Any help?

Re: Activate CMX web locally /

Posted: Thu 30 Mar 2023 8:56 pm
by Zappastre
Any help?

why webfiles locally do not solve data if json are well generated in folder web?

Re: Activate CMX web locally /

Posted: Thu 30 Mar 2023 9:17 pm
by SamiS
I think it is not possible to open the new pages locally straight from filesystem, since the webpage can’t load the json data contained in separate file. Most likely it will need a webserver even for local access, just like the dashboard also is working. Not 100% sure though.

Re: Activate CMX web locally /

Posted: Fri 31 Mar 2023 1:11 am
by HansR
Could you check the the messages in the console (F12) in your browser when opening the website?
Give ctrl-F5 to restart and have a console refresh.

If anything relevant, please post a screen shot.

Re: Activate CMX web locally /

Posted: Fri 31 Mar 2023 9:40 pm
by Zappastre
HansR wrote: Fri 31 Mar 2023 1:11 am Could you check the the messages in the console (F12) in your browser when opening the website?
Give ctrl-F5 to restart and have a console refresh.

If anything relevant, please post a screen shot.
Thanks,

Console (F12) result:

index.htm:1 Access to XMLHttpRequest at 'file:///C:/TEST%20WEB%20CUM%20New/websitedata.json?_=1680298317810' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, isolated-app, chrome-extension, chrome, https, chrome-untrusted.
Consolo errors.png
With restart same error occur.

I will investigate, but i'm not a web programmer ;). Any thoughts?

Re: Activate CMX web locally /

Posted: Fri 31 Mar 2023 9:49 pm
by Zappastre
As far as i see, I have to install a Webserver locally if i ant to test the web, do I?

Regards

Re: Activate CMX web locally /

Posted: Fri 31 Mar 2023 10:28 pm
by HansR
Zappastre wrote: Fri 31 Mar 2023 9:49 pm As far as i see, I have to install a Webserver locally if i ant to test the web, do I?
I think so yes. The access to the URL is limited by the CORS strategy, I am not sure if that works with local files, apparently not. Maybe somebody else has a trick here? So far, from the users who implemented the local file do have a local server and FTP installed and I think they have no issues.

If you finally want to have a website hosted at a provider (i.e. not hosting it yourself) you might just as well use that hosted domain for the test as well.

Re: Activate CMX web locally /

Posted: Sat 01 Apr 2023 7:47 am
by SamiS
One resolution could be using the old style legacy website, that was present for some time after the new website design was released in 3.10.0 b3115. I haven’t tried it with mx, but if a local webserver is not an option, then this would make some info available.

Technically it would still also be possible to modify the new website at least partially to work as before, by replacing json data values with webtags and make the file as a processable template again. But it would need quite a bit tinkering.

Re: Activate CMX web locally /

Posted: Sat 01 Apr 2023 8:23 am
by HansR
SamiS wrote: Sat 01 Apr 2023 7:47 am One resolution could be using the old style legacy website, that was present for some time after the new website design was released in 3.10.0 b3115. I haven’t tried it with mx, but if a local webserver is not an option, then this would make some info available.
Yes, any HTML (no javascript [data]file loading) would work without a server, loads just as a file.
SamiS wrote: Sat 01 Apr 2023 7:47 am Technically it would still also be possible to modify the new website at least partially to work as before, by replacing json data values with webtags and make the file as a processable template again. But it would need quite a bit tinkering.
I am not sure of my English proverbs but wouldn't that be shooting a mosquito with a cannon? I would apply a variation to Occam's Razor: of all solutions possible choose the simplest. So without a server, leave the new standard website out.

Re: Activate CMX web locally /

Posted: Sat 01 Apr 2023 8:38 am
by mcrossley
What is the web site giving you locally that the dashboard doesn't - apart from a different presentation?

Re: Activate CMX web locally /

Posted: Sat 01 Apr 2023 8:41 am
by mcrossley
And there are lots of "mini" web servers that will serve up simple HTML from a command line program without having to install a full blown web server. I often use one for testing the default web site.

Re: Activate CMX web locally /

Posted: Sat 01 Apr 2023 8:41 am
by water01
shooting a mosquito with a cannon?
Never heard of that one Hans but you might mean "using a sledgehammer to crack a nut"!!

Re: Activate CMX web locally /

Posted: Sat 01 Apr 2023 9:49 am
by SamiS
mcrossley wrote: Sat 01 Apr 2023 8:38 am What is the web site giving you locally that the dashboard doesn't - apart from a different presentation?
For me the different presentation would be the main thing. To see the same data that is on website’s index page, on dashboard you probably need to open four different pages (dashboard, now, gauges and today/yesterday), and for example consecutive dry/wet days is not presented at all.

Re: Activate CMX web locally /

Posted: Sat 01 Apr 2023 10:04 am
by SamiS
HansR wrote: Sat 01 Apr 2023 8:23 am I am not sure of my English proverbs but wouldn't that be shooting a mosquito with a cannon? I would apply a variation to Occam's Razor: of all solutions possible choose the simplest. So without a server, leave the new standard website out.
I agree to that metaphor. But I’m not sure if this would be much a bigger job than many of us have done by translating the website to our own language. I’m not saying anyone should do the website code modification from json to old processable templates. But if a webserver would not be an option for some reason, and you still would want the default website, this would be one way to get it at least partially. Is there any sense in it, probably not. But I’m not here to judge how people want to spend their time. :lol:

Re: Activate CMX web locally /

Posted: Sat 01 Apr 2023 1:45 pm
by HansR
water01 wrote: Sat 01 Apr 2023 8:41 am
shooting a mosquito with a cannon?
Never heard of that one Hans but you might mean "using a sledgehammer to crack a nut"!!
That's the one I was looking for. The mosquito/cannon one is the literal translation of Dutch analogon :)
SamiS wrote: Sat 01 Apr 2023 10:04 am I agree to that metaphor [...] But I’m not here to judge how people want to spend their time.
Agreed. But then the easiest way out is probably: make a simple site yourself.
I would say: if you still want the default website, get a (simple) server. Along what Mark says.
But even Apache is not that difficult to install, it only starts being complex when you start configuring.