-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add code snippets to your files teams folders (#2817)
* feat: add code snippets to your files teams folders * feat: add built js
- Loading branch information
Showing
8 changed files
with
76 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
dataworkspace/dataworkspace/static/js/bundles/yourfiles.2e3320d0c45a8054b2c0.js
This file was deleted.
Oops, something went wrong.
2 changes: 2 additions & 0 deletions
2
dataworkspace/dataworkspace/static/js/bundles/yourfiles.70fed0402f7640f5dcc1.js
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
dataworkspace/dataworkspace/static/js/bundles/yourfiles.bfc1dceee24b64203abb.js
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
dataworkspace/dataworkspace/static/js/bundles/yourfiles.c93bfed2dd8a9c6f4718.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
dataworkspace/dataworkspace/static/js/react_apps/src/your-files/TeamsPrefixMessage.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React from "react"; | ||
export function TeamsPrefixMessage({ team, bucketName }) { | ||
const relativePath = team.prefix.replace(/^teams/, ''); | ||
return ( | ||
<div className="govuk-inset-text"> | ||
<p className="govuk-body"> | ||
Files in the <code>{relativePath}</code> folder are not | ||
automatically accessible from your tools in the same way other files | ||
are. However, they can be manually accessed. For example, after | ||
uploading a file <code>{relativePath}file.csv</code>, you can | ||
create a Pandas DataFrame in a JupyterLab Python notebook by running the | ||
following code. | ||
</p> | ||
<code> | ||
<pre> | ||
{`import os | ||
import pandas as pd | ||
import boto3 | ||
client = boto3.client('s3', region_name='eu-west-2') | ||
response = client.get_object( | ||
Bucket='${bucketName}', | ||
Key=os.environ['${team.env_var}'] + 'file.csv' ) | ||
df = pd.read_csv(response['Body']) | ||
`} | ||
</pre> | ||
</code> | ||
<p className="govuk-body govuk-!-margin-top-2"> | ||
You can also create a tibble from this file in R by running the | ||
following code. | ||
</p> | ||
|
||
<code> | ||
<pre>{`library("aws.s3") | ||
library("readr") | ||
filename <- "file.csv" | ||
conn = s3connection(paste(c( | ||
"s3://${bucketName}/", | ||
Sys.getenv("${team.env_var}"), filename), | ||
collapse="" | ||
)) | ||
tb = read_csv(conn) | ||
close(conn) | ||
`}</pre> | ||
</code> | ||
</div> | ||
) | ||
} |
44 changes: 9 additions & 35 deletions
44
dataworkspace/dataworkspace/static/js/stats/react_apps-stats.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters