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

import UI implementation #3352

Merged
merged 11 commits into from
May 16, 2022
Merged

import UI implementation #3352

merged 11 commits into from
May 16, 2022

Conversation

eden-ohana
Copy link
Contributor

closes #3137

@eden-ohana eden-ohana added the include-changelog PR description should be included in next release changelog label May 11, 2022
@eden-ohana eden-ohana requested a review from johnnyaug May 11, 2022 15:48
Copy link
Contributor

@johnnyaug johnnyaug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exciting feature!

Not done going over it yet, but going away for today so dropping my comments.

webui/src/lib/api/index.js Outdated Show resolved Hide resolved

<Row className="pt-2 ml-2">
<DotIcon className="mr-1 mt-1"/>
Or, click to&nbsp;<Button variant="link" onClick={onImport}>Import</Button>&nbsp;from the object store.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be the first one.

Also - regarding the "see the docs" one - it doesn't really make sense any more because it leads to the import docs page - so either rephrase the text it to make sense ("learn more bla bla") OR link to another page OR remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, combined then together. I think it is imported to reference other ways to import as well.

webui/src/pages/repositories/repository/objects.jsx Outdated Show resolved Hide resolved
webui/src/pages/repositories/repository/objects.jsx Outdated Show resolved Hide resolved
webui/src/pages/repositories/repository/objects.jsx Outdated Show resolved Hide resolved
webui/src/pages/repositories/repository/objects.jsx Outdated Show resolved Hide resolved
webui/src/pages/repositories/repository/objects.jsx Outdated Show resolved Hide resolved
webui/src/pages/repositories/repository/objects.jsx Outdated Show resolved Hide resolved
webui/src/pages/repositories/repository/objects.jsx Outdated Show resolved Hide resolved
webui/src/pages/repositories/repository/objects.jsx Outdated Show resolved Hide resolved
@johnnyaug
Copy link
Contributor

Still missing the "Test" button to check the connectivity to the import source.
Is that planned for later?

@eden-ohana
Copy link
Contributor Author

@johnnyaug Thanks for the great UX comments!
For the test connection button, we need to implement server functionality first, AFAIK it is not a high priority for now.

@eden-ohana eden-ohana requested a review from johnnyaug May 13, 2022 11:32
Copy link
Contributor

@johnnyaug johnnyaug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the gradual review.

webui/package.json Outdated Show resolved Hide resolved
webui/package.json Outdated Show resolved Hide resolved
webui/src/lib/api/index.js Outdated Show resolved Hide resolved
webui/src/lib/api/index.js Outdated Show resolved Hide resolved
webui/src/pages/repositories/repository/objects.jsx Outdated Show resolved Hide resolved

try {
importBranchResp = await branches.get(repo.id, importBranch)
} catch (error){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
} catch (error){
} catch (error){

I think we should verify that the error here is that the branch wasn't found.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, the import can also fail if there are uncommitted changes for example.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


if (!reference || reference.type !== RefTypeBranch) return <></>

const checkStorageNamespaceValidity = () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the mentions "storage namespace" should be changed to something more meaningful.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

const importBranch = `_${reference.id}_imported`;
const commitMsg = commitMsgRef.current.value;
const sourceRefVal = sourceRef.current.value;
const range_arr = []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const range_arr = []
const rangeArr = []

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

</Button>
<Button variant="success" disabled={importState.inProgress || !importState.isStorageNamespaceValid} onClick={() => {
if (importState.inProgress) return;
ingest()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this called ingest because import is a reserved keyword?
You can use "doImport"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


const UploadButton = ({ config, repo, reference, path, onDone, variant = "success", onClick, onHide, show = false}) => {
const ImportButton = ({ config, repo, reference, path, onDone, onClick, variant = "success", onHide, show = false, enabled= false}) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const ImportButton = ({ config, repo, reference, path, onDone, onClick, variant = "success", onHide, show = false, enabled= false}) => {
const ImportButton = ({ config, repo, reference, path, onDone, onClick, variant = "success", onHide, show = false, enabled = false}) => {

Please format everything (only lines you changed, if possible).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Contributor

@itaiad200 itaiad200 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Played with it, looks amazing! Added some comments.

let prepend = `${destRef.current.value}`;
let importBranchResp
let sum = importState.numObj
const importBranch = `_${reference.id}_imported`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The might lead to a confusing behaviour. If I'm on the imported branch, let's say _main_imported, I wouldn't expect to create another branch named __main_imported_imported. Maybe check for the _ prefix and _imported prefix, and just use the same branch if they match?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines 645 to 646
const requestURL = QueryString.stringifyUrl({url: `/repositories/${repoId}/branches/${branchId}/commits`, query: {source_metarange: source_metarange}});
const parsedURL = QueryString.exclude(requestURL, (name, value) => value === "", {parseNumbers: true});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one!

return (
<Container className="m-4 mb-5">
<h2 className="mt-2">To get started with this repository:</h2>

<Row className="pt-2 ml-2">
<DotIcon className="mr-1 mt-1"/>
<Button variant="link" onClick={onUpload}>Upload</Button>&nbsp;an object.
&nbsp;<Button variant="link" onClick={onImport}>Import</Button>&nbsp;data from the object store. Or, see the&nbsp;<a href="https://docs.lakefs.io/setup/import.html" target="_blank" rel="noopener noreferrer">docs</a>&nbsp;for other ways to import data to your repository.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How hard would it be to replace the object store from the actual object store name (e.g. S3, GCS, Azure) depending on the lakeFS type? I think it would make it much clearer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

{(importState.inProgress) ? (<ImportProgress numObjects={importState.numObj} />)
: ( <>
<Alert variant="info">
Importing doesn&apos;t copy any data, it only create links to them in the lakeFS metadata. Don&apos;t worry, we will never make any changes to objects in the import source.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Importing doesn&apos;t copy any data, it only create links to them in the lakeFS metadata. Don&apos;t worry, we will never make any changes to objects in the import source.
Import doesn't copy the object. It only creates links to the objects in the lakeFS metadata layer. Don&apos;t worry, we will never change objects in the import source.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

</Alert>
<form>
<Form.Group class='form-group'>
<Form.Label><strong>Import source:</strong></Form.Label>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<Form.Label><strong>Import source:</strong></Form.Label>
<Form.Label><strong>Import from:</strong></Form.Label>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

const destRef = useRef(null);
const commitMsgRef = useRef(null);
const storageType = config.blockstore_type
const DEFAULT_BLOCKSTORE_VALIDITY_REGEX = new RegExp(`^s3://`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? We support Azure and GCP too..

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eden-ohana @itaiad200 did we test this feature on Azure and GCS?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes


try {
importBranchResp = await branches.get(repo.id, importBranch)
} catch (error){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, the import can also fail if there are uncommitted changes for example.

@eden-ohana eden-ohana requested a review from johnnyaug May 16, 2022 11:23
Copy link
Contributor

@johnnyaug johnnyaug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great!

@eden-ohana eden-ohana merged commit 7215af6 into master May 16, 2022
@eden-ohana eden-ohana deleted the 3137/import-ui branch May 16, 2022 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
include-changelog PR description should be included in next release changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Import: ingest bucket/path from UI
4 participants