Skip to content

Commit

Permalink
fix: wrong dummy data format
Browse files Browse the repository at this point in the history
  • Loading branch information
knrdl committed Jan 4, 2023
1 parent e3ca240 commit 239719c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions client/src/api.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ function mockResponse(body) {
return `{"response": "get_container_info", "payload": {"id": "${body.payload.container_id}", "name": "${container_name[body.payload.container_id]}", "status": "running", "command": "/docker-entrypoint.sh nginx -g daemon off;", "created_at": "2021-12-02T10:33:16.628618832Z", "started_at": "2021-12-02T10:33:17.015866729Z", "finished_at": "0001-01-01T00:00:00Z", "crashes": 0, "env": {"PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "NGINX_VERSION": "1.21.1", "NJS_VERSION": "0.6.1", "PKG_RELEASE": "1"}, "labels": {"caasa.admin.full": "user1,user2", "maintainer": "NGINX Docker Maintainers <docker-maint@nginx.com>"}, "image": {"name": "nginx:alpine", "hash": "sha256:b9e2356ea1be9452f3777a587b0b6a30bc16c295fe6190eda6a0776522f27439"}, "mem": {"used": 10452992, "max_used": 19345408, "total": 52428800}, "cpu": {"perc": ${Math.random() * 10}}, "net": {"rx_bytes": 18201, "tx_bytes": 0}, "ports": ["80/tcp"]}}`
case 'get_container_logs':
if (body.payload.onlynew)
return `{"response": "get_container_logs", "payload":""}`
return `{"response": "get_container_logs", "payload":[]}`
else
return `{"response": "get_container_logs", "payload": "2021-12-02T10:33:17.021946340Z /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration\\r\\n2021-12-02T10:33:17.021988550Z /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/\\r\\n2021-12-02T10:33:17.023417432Z /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh\\r\\n2021-12-02T10:33:17.031231257Z 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf\\r\\n2021-12-02T10:33:17.055742664Z 10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf\\r\\n2021-12-02T10:33:17.056041305Z /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh\\r\\n2021-12-02T10:33:17.059979717Z /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh\\r\\n2021-12-02T10:33:17.062059371Z /docker-entrypoint.sh: Configuration complete; ready for start up\\r\\n2021-12-02T10:33:17.074027144Z 2021/12/02 10:33:17 [notice] 1#1: using the \\"epoll\\" event method\\r\\n2021-12-02T10:33:17.074056600Z 2021/12/02 10:33:17 [notice] 1#1: nginx/1.21.1\\r\\n2021-12-02T10:33:17.074063653Z 2021/12/02 10:33:17 [notice] 1#1: built by gcc 10.3.1 20210424 (Alpine 10.3.1_git20210424) \\r\\n2021-12-02T10:33:17.074069845Z 2021/12/02 10:33:17 [notice] 1#1: OS: Linux 5.11.0-40-generic\\r\\n2021-12-02T10:33:17.074075475Z 2021/12/02 10:33:17 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576\\r\\n2021-12-02T10:33:17.074245905Z 2021/12/02 10:33:17 [notice] 1#1: start worker processes\\r\\n2021-12-02T10:33:17.074276953Z 2021/12/02 10:33:17 [notice] 1#1: start worker process 32\\r\\n2021-12-02T10:33:17.074379486Z 2021/12/02 10:33:17 [notice] 1#1: start worker process 33\\r\\n2021-12-02T10:33:17.074401427Z 2021/12/02 10:33:17 [notice] 1#1: start worker process 34\\r\\n2021-12-02T10:33:17.074513127Z 2021/12/02 10:33:17 [notice] 1#1: start worker process 35\\r\\n2021-12-02T10:33:17.074601242Z 2021/12/02 10:33:17 [notice] 1#1: start worker process 36\\r\\n2021-12-02T10:33:17.074666745Z 2021/12/02 10:33:17 [notice] 1#1: start worker process 37\\r\\n2021-12-02T10:33:17.074817979Z 2021/12/02 10:33:17 [notice] 1#1: start worker process 38\\r\\n2021-12-02T10:33:17.074873423Z 2021/12/02 10:33:17 [notice] 1#1: start worker process 39\\r\\n2021-12-02T10:33:17.075007344Z 2021/12/02 10:33:17 [notice] 1#1: start worker process 40\\r\\n2021-12-02T10:33:17.075141746Z 2021/12/02 10:33:17 [notice] 1#1: start worker process 41\\r\\n2021-12-02T10:33:17.075279715Z 2021/12/02 10:33:17 [notice] 1#1: start worker process 42\\r\\n2021-12-02T10:33:17.075393118Z 2021/12/02 10:33:17 [notice] 1#1: start worker process 43\\r\\n"}`
return `{"response": "get_container_logs", "payload": ["2021-12-02T10:33:17.021946340Z /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration","2021-12-02T10:33:17.021988550Z /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/","2021-12-02T10:33:17.023417432Z /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh","2021-12-02T10:33:17.031231257Z 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf","2021-12-02T10:33:17.055742664Z 10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf","2021-12-02T10:33:17.056041305Z /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh","2021-12-02T10:33:17.059979717Z /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh","2021-12-02T10:33:17.062059371Z /docker-entrypoint.sh: Configuration complete; ready for start up","2021-12-02T10:33:17.074027144Z 2021/12/02 10:33:17 [notice] 1#1: using the \\"epoll\\" event method","2021-12-02T10:33:17.074056600Z 2021/12/02 10:33:17 [notice] 1#1: nginx/1.21.1","2021-12-02T10:33:17.074063653Z 2021/12/02 10:33:17 [notice] 1#1: built by gcc 10.3.1 20210424 (Alpine 10.3.1_git20210424) ","2021-12-02T10:33:17.074069845Z 2021/12/02 10:33:17 [notice] 1#1: OS: Linux 5.11.0-40-generic","2021-12-02T10:33:17.074075475Z 2021/12/02 10:33:17 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576","2021-12-02T10:33:17.074245905Z 2021/12/02 10:33:17 [notice] 1#1: start worker processes","2021-12-02T10:33:17.074276953Z 2021/12/02 10:33:17 [notice] 1#1: start worker process 32","2021-12-02T10:33:17.074379486Z 2021/12/02 10:33:17 [notice] 1#1: start worker process 33","2021-12-02T10:33:17.074401427Z 2021/12/02 10:33:17 [notice] 1#1: start worker process 34","2021-12-02T10:33:17.074513127Z 2021/12/02 10:33:17 [notice] 1#1: start worker process 35","2021-12-02T10:33:17.074601242Z 2021/12/02 10:33:17 [notice] 1#1: start worker process 36","2021-12-02T10:33:17.074666745Z 2021/12/02 10:33:17 [notice] 1#1: start worker process 37","2021-12-02T10:33:17.074817979Z 2021/12/02 10:33:17 [notice] 1#1: start worker process 38","2021-12-02T10:33:17.074873423Z 2021/12/02 10:33:17 [notice] 1#1: start worker process 39","2021-12-02T10:33:17.075007344Z 2021/12/02 10:33:17 [notice] 1#1: start worker process 40","2021-12-02T10:33:17.075141746Z 2021/12/02 10:33:17 [notice] 1#1: start worker process 41","2021-12-02T10:33:17.075279715Z 2021/12/02 10:33:17 [notice] 1#1: start worker process 42","2021-12-02T10:33:17.075393118Z 2021/12/02 10:33:17 [notice] 1#1: start worker process 43"]}`
case 'get_filesystem_info':
return `{"response": "get_filesystem_info", "payload": {"workdir": "", "mounts": [{"type": "bind", "destination": "/etc/ssl/certs", "readonly": true, "source": "/etc/ssl/certs"}]}}`
case 'get_directory_list':
Expand Down Expand Up @@ -93,7 +93,7 @@ export class WebSocketMock implements WebSocket {
} else if (res === true) {
// do not send response
} else if (res[0] !== '{') {
console.log('send as blob', res)
// console.log('send as blob', res)
msg.data = new Blob([res])
} else {
msg.data = res
Expand Down

0 comments on commit 239719c

Please sign in to comment.