tobybatch / kimai2

Docker containers for the kimai2 web application including docker-compose and kubernetes/helm deployment.
MIT License
181 stars 96 forks source link

[BUG] Pagination does not work #66

Closed asawatzki closed 4 years ago

asawatzki commented 4 years ago

Describe the bug The pagination does not work.

To Reproduce Steps to reproduce the behaviour:

  1. clone repo
  2. change kimai version from 1.5 to 1.6
  3. run docker-compose
  4. add more than 51 activities to generate a button for page 2
  5. click button to change to page 2
  6. error: page does not change

Desktop (please complete the following information):

Command used to run the container

Docker compose file (with passwords redacted)

version: '3.5'
services:

  sqldb:
    image: mysql:5.7
    environment:
      - MYSQL_DATABASE=kimai
      - MYSQL_USER=kimaiuser
      - MYSQL_PASSWORD=kimaipassword
      - MYSQL_ROOT_PASSWORD=changemeplease
    volumes:
      - /var/lib/mysql
    command: --default-storage-engine innodb
    restart: unless-stopped
    healthcheck:
      test: mysqladmin -pchangemeplease ping -h localhost
      interval: 20s
      start_period: 10s
      timeout: 10s
      retries: 3 

  nginx:
    build: compose
    ports:
      - 8001:80
    volumes:
      - ./nginx_site.conf:/etc/nginx/conf.d/default.conf
    restart: unless-stopped
    depends_on:
      - kimai
    volumes:
      - public:/opt/kimai/public
    healthcheck:
      test:  wget --spider http://nginx/health || exit 1 
      interval: 20s
      start_period: 10s
      timeout: 10s
      retries: 3 

  kimai:
    image: kimai/kimai2:fpm-alpine-1.6-prod
    environment:
      - APP_ENV=prod
      - TRUSTED_HOSTS=localhost
      - ADMINMAIL=admin@kimai.local
      - ADMINPASS=changemeplease
    volumes:
      - public:/opt/kimai/public
      - var:/opt/kimai/var
    restart: unless-stopped
    healthcheck:
      test: wget --spider http://nginx || exit 1
      interval: 20s
      start_period: 10s
      timeout: 10s
      retries: 3

  postfix:
    image: catatnight/postfix
    environment:
      maildomain: neontribe.co.uk
      smtp_user: kimai:kimai
    restart: unless-stopped
    restart: always

volumes:
    var:
    public:

Additional context Changing the page via URL works like a charm: http://localhost:8001/en/admin/activity/page/2

Am I missing some configuration?

kevinpapst commented 4 years ago

Anything inside the javascript console of your browser? What does the network tab say? Is there a request going out and what is the response?

asawatzki commented 4 years ago

The js console is empty. In the network tab is one event:

request headers

GET /en/admin/activity/?globalsOnly=0&visibility=1&pageSize=50&page=2&order=ASC&orderBy=name HTTP/1.1
Host: localhost:8001
Connection: keep-alive
Accept: */*
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Referer: http://localhost:8001/en/admin/activity/
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9,de;q=0.8
Cookie: PHPSESSID=63be660fa8f96d0d50bbaf51d00dcd00

response headers

HTTP/1.1 200 OK
Server: nginx/1.17.7
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/7.3.10
Cache-Control: max-age=0, must-revalidate, private
Date: Wed, 15 Jan 2020 11:26:12 GMT
Expires: Wed, 15 Jan 2020 11:26:12 GMT

EDIT: formatted some stuff

kevinpapst commented 4 years ago

Do the regular search filters work? Most of the search forms use GET params as well...

asawatzki commented 4 years ago

Unfortunately not. Neither the sorting nor the search works. The js console is still empty. In the network tab appears many event (mostly documents like svg, woff2, etc) and these two:

request

GET /en/admin/activity/?searchTerm=&customer=&project=&globalsOnly=0&visibility=1&pageSize=10&page=1&order=DESC&orderBy=name HTTP/1.1
Host: localhost:8001
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36
Sec-Fetch-User: ?1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: navigate
Referer: http://localhost:8001/en/admin/activity/?searchTerm=&customer=&project=&globalsOnly=0&visibility=2&pageSize=50&page=1&order=ASC&orderBy=name
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9,de;q=0.8
Cookie: PHPSESSID=b7a67967bc01d1ff7d7a9e606e6b4a30

response

HTTP/1.1 200 OK
Server: nginx/1.17.7
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/7.3.10
Cache-Control: max-age=0, must-revalidate, private
Date: Wed, 15 Jan 2020 12:36:51 GMT
Expires: Wed, 15 Jan 2020 12:36:51 GMT

and: request

GET /api/timesheets/recent?size=10 HTTP/1.1
Host: localhost:8001
Connection: keep-alive
Accept: application/json, text/javascript, */*; q=0.01
X-Requested-With: XMLHttpRequest
X-AUTH-SESSION: true
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36
Content-Type: application/json
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Referer: http://localhost:8001/en/admin/activity/?searchTerm=&customer=&project=&globalsOnly=0&visibility=1&pageSize=10&page=1&order=DESC&orderBy=name
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9,de;q=0.8
Cookie: PHPSESSID=b7a67967bc01d1ff7d7a9e606e6b4a30

response

HTTP/1.1 200 OK
Server: nginx/1.17.7
Content-Type: application/json
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/7.3.10
Cache-Control: max-age=0, must-revalidate, private
Date: Wed, 15 Jan 2020 12:36:52 GMT
Expires: Wed, 15 Jan 2020 12:36:52 GMT
kevinpapst commented 4 years ago

Thanks @asawatzki for the feedback. This is a very likely a configuration issue in nginx. There was recently a user in the Kimai issue tracker who had a similar problem. I couldn't find the issue quickly, but it was in the last 14 days.

@tobybatch and @Schrolli91 he mentioned that the GET params weren't passed to PHP/Symfony. I can only assume, but maybe an issue with the fastcgi params definition. He found a solution in the Symfony docs, probably the webserver setup section

asawatzki commented 4 years ago

You are very welcome. Let me know if you need more support.

tobybatch commented 4 years ago

Duplicate #61

heeen commented 4 years ago

I have this issue but I can't get it to work. The nginx site config does not represent the file form the repo:

/srv/kimai2# docker exec kimai2_nginx_1 grep try_files /etc/nginx/conf.d/default.conf
        try_files $uri $uri/ /index.php;
/srv/kimai2# grep try_files compose/nginx_site.conf 
        try_files $uri $uri/ /index.php$is_args$args;

I tried docker-compose stop, docker-compose rm, docker system purge --volumes, nothing makes it update

tobybatch commented 4 years ago

@heeen Can you open a fresh issue please? We need information about which images you are using etc.