Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow default file url input for radar launch #382

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,12 @@ export RINGS='["Adopt", "Trial", "Assess", "Hold"]'
export QUADRANTS='["Techniques", "Platforms", "Tools", "Languages & Frameworks"]'
```

To launch the Build-radar with default input URL for csv/json file, add the the following environment variable.

```
export DEFAULT_FILE_URL="http://localhost:8080/files/default.csv"
```

## Docker Image

We have released BYOR as a docker image for our users. The image is available in our [DockerHub Repo](https://hub.docker.com/r/wwwthoughtworks/build-your-own-radar/). To pull and run the image, run the following commands.
Expand All @@ -196,6 +202,10 @@ You can check your setup by clicking on "Build my radar" and by loading the `csv
```
$ docker pull wwwthoughtworks/build-your-own-radar
$ docker run --rm -p 8080:80 -e SERVER_NAMES="localhost 127.0.0.1" -v /mnt/radar/files/:/opt/build-your-own-radar/files wwwthoughtworks/build-your-own-radar:latest
$ #
$ # Also, you can load an exisitng csv/json file and launch the radar view directly
$ #
$ docker run --rm -p 8080:80 -e SERVER_NAMES="localhost 127.0.0.1" -v /mnt/radar/files/:/opt/build-your-own-radar/files --env DEFAULT_FILE_URL="http://localhost:8080/files/some_default.csv" wwwthoughtworks/build-your-own-radar:latest
$ open http://localhost:8080
```

Expand All @@ -204,6 +214,7 @@ This will:
- Spawn a server that will listen locally on port 8080.
- Mount the host volume on `/mnt/radar/files/` into the container on `/opt/build-your-own-radar/files/`.
- Open http://localhost:8080 and for the URL enter: `http://localhost:8080/files/<NAME_OF_YOUR_FILE>.<EXTENSION_OF_YOUR_FILE[csv/json]>`. It needs to be a csv/json file.
- If `DEFAULT_FILE_URL` is provided, the file is auto-loaded and endpoint would show radar view.

You can now work locally on your machine, updating the csv/json file and render the result back on your browser.
There is a sample csv and json file placed in `spec/end_to_end_tests/resources/localfiles/` for reference.
Expand Down Expand Up @@ -250,3 +261,4 @@ To run End to End tests, start the dev server and follow the required steps belo
$ docker run -p 8080:8080 -v $PWD:/app -w /app -it node:18 /bin/sh -c 'npm install && npm run dev'

After building it will start on `localhost:8080`.

2 changes: 1 addition & 1 deletion src/util/factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ const Factory = function () {

const domainName = DomainName(window.location.search.substring(1))

const paramId = getDocumentOrSheetId()
const paramId = (process.env.DEFAULT_FILE_URL) ? process.env.DEFAULT_FILE_URL : getDocumentOrSheetId()
if (paramId && paramId.endsWith('.csv')) {
sheet = CSVDocument(paramId)
sheet.init().build()
Expand Down
1 change: 1 addition & 0 deletions webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const plugins = [
'process.env.RINGS': JSON.stringify(process.env.RINGS),
'process.env.QUADRANTS': JSON.stringify(process.env.QUADRANTS),
'process.env.ADOBE_LAUNCH_SCRIPT_URL': JSON.stringify(process.env.ADOBE_LAUNCH_SCRIPT_URL),
'process.env.DEFAULT_FILE_URL': JSON.stringify(process.env.DEFAULT_FILE_URL),
}),
]

Expand Down