Skip to content

Commit

Permalink
Download Button [4/n]: Make this enabled for read-only mode
Browse files Browse the repository at this point in the history
I realized that after I moved `readOnly` check on entire group in #1032, I need to be able to still have the Download button for read-only mode so user can still download the AIConfig. We just need to make sure to define this endpoint in the lastMile repo

## Test Plan
Rebase onto #1045

Go to `aiconfig/python/src/aiconfig/editor/client` and run this command:
```
rm -rf node_modules && yarn && yarn build
```

Then go to `aiconfig` dir and run this command:
```
aiconfig_path=./cookbooks/Gradio/huggingface.aiconfig.json
parsers_path=./cookbooks/Gradio/hf_model_parsers.py
aiconfig edit --aiconfig-path=$aiconfig_path --server-port=8080 --server-mode=debug_servers --parsers-module-path=$parsers_path
```

readOnly is true

<img width="1920" alt="Screenshot 2024-01-30 at 00 45 03" src="https://github.com/lastmile-ai/aiconfig/assets/151060367/356cd898-e3f2-430c-8153-a464b78a254b">

readOnly is false

<img width="1920" alt="Screenshot 2024-01-30 at 00 44 36" src="https://github.com/lastmile-ai/aiconfig/assets/151060367/d14ec7ee-8a10-49f1-b9d8-d4a5a2153b99">
  • Loading branch information
Rossdan Craig rossdan@lastmileai.dev committed Jan 30, 2024
1 parent 2c60fb2 commit ff8c7c4
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -987,13 +987,13 @@ export default function AIConfigEditor({
)}
<Container maw="80rem">
<Flex justify="flex-end" mt="md" mb="xs">
{!readOnly && (
{
<Group>
{downloadCallback && (
<DownloadButton onDownload={onDownload} />
)}
{shareCallback && <ShareButton onShare={onShare} />}
{onClearOutputs && (
{!readOnly && onClearOutputs && (
<Button
loading={undefined}
onClick={onClearOutputs}
Expand All @@ -1003,8 +1003,7 @@ export default function AIConfigEditor({
Clear Outputs
</Button>
)}

{saveCallback && (
{!readOnly && saveCallback && (
<Tooltip
label={
isDirty
Expand All @@ -1028,7 +1027,7 @@ export default function AIConfigEditor({
</Tooltip>
)}
</Group>
)}
}
</Flex>
<ConfigNameDescription
name={aiconfigState.name}
Expand Down
6 changes: 3 additions & 3 deletions python/src/aiconfig/editor/server/static/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"files": {
"main.js": "/static/js/main.7cef3223.js",
"main.js": "/static/js/main.1afb2184.js",
"index.html": "/index.html",
"main.7cef3223.js.map": "/static/js/main.7cef3223.js.map"
"main.1afb2184.js.map": "/static/js/main.1afb2184.js.map"
},
"entrypoints": [
"static/js/main.7cef3223.js"
"static/js/main.1afb2184.js"
]
}
2 changes: 1 addition & 1 deletion python/src/aiconfig/editor/server/static/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>AIConfig Editor</title><script defer="defer" src="/static/js/main.7cef3223.js"></script></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>AIConfig Editor</title><script defer="defer" src="/static/js/main.1afb2184.js"></script></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>

Large diffs are not rendered by default.

Large diffs are not rendered by default.

0 comments on commit ff8c7c4

Please sign in to comment.