Skip to content

Commit

Permalink
V3 update tsdev (#3251)
Browse files Browse the repository at this point in the history
* Add v3 ui to tsdev.sh

---------

Co-authored-by: Janosch <[email protected]>
  • Loading branch information
Annoraaq and jkppr authored Dec 31, 2024
1 parent fb3e8cf commit d2ab97d
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions utils/tsdev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Display a help message and exit
help(){
echo
echo "Usage: tsdev.sh [OPTIONS] COMMAND"
echo "Usage: tsdev.sh [OPTIONS] COMMAND [FRONTEND]"
echo
echo "Run commands to manage resources on your Timesketch development docker container"
echo
Expand All @@ -16,13 +16,19 @@ help(){
echo " logs Follow docker container logs "
echo " shell Open a shell in the docker container"
echo " test Execute run_tests.py --coverage"
echo " vue-build Build the vue frontend"
echo " vue-dev Serve the vue frontend"
echo " vue-install-deps Install vue frontend dependencies"
echo " vue-test Test the vue frontend"
echo " vue-build Build the vue frontend. Default: 'frontend-ng'"
echo " vue-dev Serve the vue frontend on port 5001. Default: 'frontend-ng'"
echo " vue-install-deps Install vue frontend dependencies. Default: 'frontend-ng'"
echo " vue-test Test the vue frontend. Default: 'frontend-ng'"
echo " web Start the web frontend bound to port 5000"
echo
echo "Frontend:"
echo " frontend The old v1 frontend (deprecated)."
echo " frontend-ng The current v2 frontend (vue2)."
echo " frontend-v3 The future v3 frontend (vue3)."
echo
echo "Examples:"
echo " tsdev.sh vue-dev frontend-v3"
echo " tsdev.sh logs"
echo " tsdev.sh test"
exit 0
Expand All @@ -46,6 +52,11 @@ fi
CONTAINER_ID="$($s docker container list --filter name='timesketch-dev' --quiet)"
frontend="frontend-ng"

# Check if a second frontend argument is provided
if [ $# -eq 2 ]; then
frontend="$2"
fi

# Run the provided command
case "$1" in
build-api-cli)
Expand All @@ -72,13 +83,13 @@ case "$1" in
$s docker exec --interactive --tty $CONTAINER_ID yarn run --cwd=/usr/local/src/timesketch/timesketch/$frontend build
;;
vue-dev)
$s docker exec --interactive --tty $CONTAINER_ID yarn run --cwd=/usr/local/src/timesketch/timesketch/$frontend serve
$s docker exec --interactive --tty $CONTAINER_ID yarn run --cwd=/usr/local/src/timesketch/timesketch/$frontend $(if [ "$frontend" == "frontend-v3" ]; then echo "dev"; else echo "serve"; fi)
;;
vue-install-deps)
$s docker exec --interactive --tty $CONTAINER_ID yarn install --cwd=/usr/local/src/timesketch/timesketch/$frontend
;;
vue-test)
$s docker exec --interactive --tty $CONTAINER_ID yarn run --cwd=/usr/local/src/timesketch/timesketch/frontend-ng test
$s docker exec --interactive --tty $CONTAINER_ID yarn run --cwd=/usr/local/src/timesketch/timesketch/$frontend test
;;
web)
$s docker exec --interactive --tty $CONTAINER_ID gunicorn --reload --bind 0.0.0.0:5000 --log-level debug --capture-output --timeout 600 timesketch.wsgi:application
Expand Down

0 comments on commit d2ab97d

Please sign in to comment.