Git Product home page Git Product logo

kimai2-cmd's People

Contributors

akvadrako avatar dependabot[bot] avatar infeeeee avatar kevinpapst avatar m0ark avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

kimai2-cmd's Issues

SyntaxError: Unexpected end of JSON input

When i want to start a measurement:

undefined:1



SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at Request.request [as _callback] (/snapshot/kimai2-cmd/kimai2-cmd.js:84:32)
    at Request.init.self.callback (/snapshot/kimai2-cmd/node_modules/request/request.js:185:22)
    at Request.emit (events.js:198:13)
    at Request.<anonymous> (/snapshot/kimai2-cmd/node_modules/request/request.js:1161:10)
    at Request.emit (events.js:198:13)
    at IncomingMessage.<anonymous> (/snapshot/kimai2-cmd/node_modules/request/request.js:1083:12)
    at Object.onceWrapper (events.js:286:20)
    at IncomingMessage.emit (events.js:203:15)
    at endReadableNT (_stream_readable.js:1145:12)

When using the cli with the linux executable. I'm on arch 6.7.5.

I want to point that all the settings are correct, and i'm able to list the projects from the remote

Add config environment variable

Could you add an environment variable, e.g. KIMAI_CONFIG, which stores the path to the settings.ini?
Then kimai2-cmd could first search for the settings.ini in the path provided by KIMAI_CONFIG and then in its own folder.

With an environment variable I could do something like this:
export KIMAI_CONFIG=$XDG_CONFIG_HOME/kimai2

Starting a project only works with ui

kimai2-cmd start "Foo" "Bar" -v -i

Results in

Found in KIMAI_CONFIG envvar: /home/beavis/.config/kimai2/settings.ini
settings.ini found at: /home/beavis/.config/kimai2/settings.ini
---
calling kimai:  GET projects [object Object]
request options: [object Object]
Response body: [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
---
calling kimai:  GET activities [object Object]
request options: [object Object]
Response body: [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
---
calling kimai:  GET config/i18n [object Object]
request options: [object Object]
kimaistart calling api: [object Object]
---
calling kimai:  POST timesheets [object Object]
request options: [object Object]
Response body: [object Object]
Server error message:
400
Validation Failed
(node:488024) UnhandledPromiseRejectionWarning: Validation Failed
(Use `node --trace-warnings ...` to show where the warning was created)
(node:488024) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:488024) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Response body: [object Object]
servertime: 2021-11-22T15:36:47+0100
localtime: 2021-11-22T15:36:47+01:00

Exceptions of stop of measurement(s) if currently no measurements are running

Thank you for the nice cli. It works fine, but I just had an issue with the cli when no measurement is going on, but I want to stop it.

Situation: No measurement is currently runnning.

Situation A:
Selecting "Stop all active measurements"

Expected:
Message: "Currently no measurements were running." and return to menu, like at "List active measurements".

Result:

(node:1124) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of undefined
    at Promise (/snapshot/kimai2-cmd/kimai2-cmd.js:320:55)
    at new Promise (<anonymous>)
    at callKimaiStop (/snapshot/kimai2-cmd/kimai2-cmd.js:318:12)
    at kimaiList.then.res (/snapshot/kimai2-cmd/kimai2-cmd.js:300:28)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:1124) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:1124) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

and I need to restart the tool.

Situation B:
Select "Stop an active measurement". This shows no running measurments, but allows to select/enter which leads to an error:

Expected:
same as above.

Result:

(node:1136) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'value' of undefined
    at ListPrompt.getCurrentValue (/snapshot/kimai2-cmd/node_modules/inquirer/lib/prompts/list.js:121:53)
    at MapSubscriber._next (/snapshot/kimai2-cmd/node_modules/rxjs/internal/operators/map.js:0:0)
    at MapSubscriber.Subscriber.next (/snapshot/kimai2-cmd/node_modules/rxjs/internal/Subscriber.js:66:18)
    at TakeSubscriber._next (/snapshot/kimai2-cmd/node_modules/rxjs/internal/operators/take.js:0:0)
    at TakeSubscriber.Subscriber.next (/snapshot/kimai2-cmd/node_modules/rxjs/internal/Subscriber.js:66:18)
    at Interface.handler (/snapshot/kimai2-cmd/node_modules/rxjs/internal/observable/fromEvent.js:22:28)
    at Interface.emit (events.js:194:15)
    at Interface._onLine (readline.js:290:10)
    at Interface._line (readline.js:638:8)
    at Interface._ttyWrite (readline.js:919:14)
(node:1136) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1136) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

and I need to restart the tool.

SyntaxError: Unexpected token < in JSON at position 0

Hello,
I've cloned the most recent version
node kimai2-cmd.js -V
0.2.5
node v11.15.0
npm v6.11.2
Linux 4.19.66-1-MANJARO

[serversettings]
kimaiurl=https://server.ch/kimai2/public
username=myuser
password=mypassword

if I'm understanding correctly my access logs, the settings.ini is correct because i've got redirected (Code 302) and logged in (code 200), isn't it ?

server.ch XX.XX.XXX.XXXX - - [04/Sep/2019:13:39:57 +0200] "GET /kimai2/public/en/login HTTP/1.1" 200 3865 "https://server.ch/kimai2/public/api/projects" "-"

server.ch XX.XX.XXX.XXXX - - [04/Sep/2019:13:39:56 +0200] "GET /kimai2/public/api/projects HTTP/1.1" 302 420 "-" "-"

I can launch the menu
image

But any selected function but Exit creates following error messages
image

Hosting (https://www.infomaniak.com/)
Kimai 2 1.2 stable (Ayumi)
Debian 4.9.168-1+deb9u3~deb8u1 (2019-06-17) x86_64 GNU/Linux
PHP 7.3.8
mysql Ver 14.14 Distrib 5.5.62, for debian-linux-gnu (x86_64) using readline 6.3

Thank you for any possible help

Cannot read property 'body' of undefined

Hello,

I have the latest Kimai version with a certificate from internal CA (so untrusted by new devices) which is trusted on my PC.

I use Linux Ubuntu 22.04 as OS.

Installed CLI tool version: 1.3.0

When I try to use this CLI tool, I get this error:

>> kimai2-cmd -v
No environment variable found
Looking for settings.ini in the following places:
{ pkg: '/home/jonah/.local/bin', npm: '/snapshot/kimai2-cmd' }
settings.ini found at: /home/jonah/.local/bin/settings.ini

? Select command Start new measurement
selected answer: start
---
calling kimai:  GET projects [object Object]
request options: [object Object]
/snapshot/kimai2-cmd/kimai2-cmd.js:84
            let jsonarr = JSON.parse(response.body)
                                              ^

TypeError: Cannot read property 'body' of undefined
    at Request.request [as _callback] (/snapshot/kimai2-cmd/kimai2-cmd.js:84:47)
    at Request.init.self.callback (/snapshot/kimai2-cmd/node_modules/request/request.js:185:22)
    at Request.emit (events.js:198:13)
    at Request.onRequestError (/snapshot/kimai2-cmd/node_modules/request/request.js:881:8)
    at ClientRequest.emit (events.js:198:13)
    at TLSSocket.socketErrorListener (_http_client.js:401:9)
    at TLSSocket.emit (events.js:198:13)
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)

Any idea?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.