Editing modern traccar web

Jose B4 years ago

Hi Anton,

I would like to know what file is responsible for the button blue / icon "+" (add users, add devices).
I am showing this interface for users, and they are testing, but I need hide this button.

Could you help?

JB

Anton Tananaev4 years ago

I would recommend following resources:

https://reactjs.org/
https://material-ui.com/

There's an extensive documentation available for you to learn.

Jose B4 years ago

Hi Anton,

I was reading the documentation as you have indicated and I get put the traccar development server (port 3000) active - Thank you.
After I edit the interface as I wished, and evething works in this develop interface.
So, I runned "npm run build" and it has created the build folder, without any error.
I copied the content for <traccar>\web\modern.
But when I access the interface (http://<url>/modern), did not work
Is there a adictional command to compile traccar web?
Is possible you help me?
JB

Jose B4 years ago
Failed to load resource: net::ERR_FILE_NOT_FOUND styles.css:1 
2.b88ebf8c.chunk.css:1 Failed to load resource: net::ERR_FILE_NOT_FOUND
2.85a18fc4.chunk.js:1 Failed to load resource: net::ERR_FILE_NOT_FOUND
main.488dbf47.chunk.js:1 Failed to load resource: net::ERR_FILE_NOT_FOUND
/C:/favicon.ico:1 Failed to load resource: net::ERR_FILE_NOT_FOUND
index.html:1 Access to internal resource at 'file:///C:/manifest.json' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https.
Anton Tananaev4 years ago

Use npm run build_release.

Jose B4 years ago

did not work too:

C:\TRACCAR\React_nova_interface_web_moderna\traccar-web-master\modern>npm run build_release

> traccar@0.1.0 build_release C:\TRACCAR\React_nova_interface_web_moderna\traccar-web-master\modern
> PUBLIC_URL=/modern/ craco build

'PUBLIC_URL' não é reconhecido como um comando interno
ou externo, um programa operável ou um arquivo em lotes.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! traccar@0.1.0 build_release: `PUBLIC_URL=/modern/ craco build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the traccar@0.1.0 build_release script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrador\AppData\Roaming\npm-cache\_logs\2020-09-28T16_35_21_335Z-debug.log

C:\TRACCAR\React_nova_interface_web_moderna\traccar-web-master\modern>
C:\TRACCAR\React_nova_interface_web_moderna\traccar-web-master\modern>
Jose B4 years ago

info it worked if it ends with ok

1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'build_release'
1 verbose cli ]
2 info using npm@6.14.5
3 info using node@v12.18.2
4 verbose run-script [ 'prebuild_release', 'build_release', 'postbuild_release' ]
5 info lifecycle traccar@0.1.0~prebuild_release: traccar@0.1.0
6 info lifecycle traccar@0.1.0~build_release: traccar@0.1.0
7 verbose lifecycle traccar@0.1.0~build_release: unsafe-perm in lifecycle true
8 verbose lifecycle traccar@0.1.0~build_release: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\TRACCAR\React_nova_interface_web_moderna\traccar-web-master\modern\node_modules\.bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\php64;C:\Program Files\Microsoft\Web Platform Installer\;C:\ProgramData\ComposerSetup\bin;C:\Program Files\nodejs\;C:\TRACCAR\Sencha\Cmd;C:\Users\Administrador\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Administrador\AppData\Roaming\Composer\vendor\bin;C:\Users\Administrador\AppData\Roaming\npm
9 verbose lifecycle traccar@0.1.0~build_release: CWD: C:\TRACCAR\React_nova_interface_web_moderna\traccar-web-master\modern
10 silly lifecycle traccar@0.1.0~build_release: Args: [ '/d /s /c', 'PUBLIC_URL=/modern/ craco build' ]
11 silly lifecycle traccar@0.1.0~build_release: Returned: code: 1  signal: null
12 info lifecycle traccar@0.1.0~build_release: Failed to exec build_release script
13 verbose stack Error: traccar@0.1.0 build_release: `PUBLIC_URL=/modern/ craco build`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:315:20)
13 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:315:20)
13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid traccar@0.1.0
15 verbose cwd C:\TRACCAR\React_nova_interface_web_moderna\traccar-web-master\modern
16 verbose Windows_NT 6.3.9600
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build_release"
18 verbose node v12.18.2
19 verbose npm  v6.14.5
20 error code ELIFECYCLE
21 error errno 1
22 error traccar@0.1.0 build_release: `PUBLIC_URL=/modern/ craco build`
22 error Exit status 1
23 error Failed at the traccar@0.1.0 build_release script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
Jose B4 years ago

is this a error on traccar script when used on windows?

Jose B4 years ago

now works.
For windows it is not commom used "PUBLIC_URL" into deploy command. only in enviroment file.

Thank you for all help

Joystick3 years ago

Hi Jose B, how did you get this to work I get the same error as you when using npm run build_release. Please help

Joystick3 years ago

Morning Anton,

Please assist, I get the below error when I run "npm run build_release" in IntelliJ on Windows.

> traccar@0.1.0 build_release
> PUBLIC_URL=/modern/ craco build

'PUBLIC_URL' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code 1
npm ERR! path D:\Desktop\IntelliJ\traccar-web\modern
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c PUBLIC_URL=/modern/ craco build

npm ERR! A complete log of this run can be found in:
Anton Tananaev3 years ago

I don't have Windows, so I don't think I can help with your problem.

jesus leguizamon3 years ago

just add "homepage": "/modern/",
to package.json and delete PUBLIC_URL=/modern/

Joystick3 years ago

Hi mate Ive tried it and it works as expected. Thanks for assisting it is much appreciated.

Manna2 years ago

Hi mate, I have tried adding "homepage": "/modern/",
to package.json and delete PUBLIC_URL=/modern/

I want to change logo. When I do serve -s build
It works fine but as soon as I replace new build with existing /opt/traccar/web/modern the changes either don't reflect or logo vanishes from modern UI.

Is this the way we should deploy code for modern UI ??