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

Default config values are not being used #30

Open
kmanaseryan opened this issue Sep 17, 2020 · 3 comments
Open

Default config values are not being used #30

kmanaseryan opened this issue Sep 17, 2020 · 3 comments
Assignees

Comments

@kmanaseryan
Copy link
Contributor

If I don't provide any config values the default values are not being used.

Expected result

Use the following config values:

{
    authToken: "be270cae-1c77-4853-b8c1-30b6cf5e9878",
    api: "http://localhost:5000",
    lfs: "http://localhost:5001", // Feel free to modify this
    organizationId: "myorg",
    datasetId: "data-test-2",
}

Actual result

{
    api: null,
    authToken: null,
    datasetId: "test-id",
    lfs: null,
    organizationId: null,
}
@anuveyatsu
Copy link
Member

Looks like you're setting one of the config vars but missing others.

@mariorodeghiero

@mariorodeghiero
Copy link
Contributor

mariorodeghiero commented Sep 17, 2020

Probaly the default props didn't work because of the last changes and the code below:

// Mount the ResourceEditor app explicitly
// (make sure you call the function after it's loaded)
function mountResourceEditorApp([elementId, config, resource] = ['root', {
  authToken: null,
  api: null,
  lfs: null,
  organizationId: null,
  datasetId: null
}, {}]) {
  ReactDOM.render(
    <React.StrictMode>
      <App config={config} resource={resource} />
    </React.StrictMode>,
    document.getElementById(elementId)
  );
};


// Automatically mount the app if an element with id='ResourceEditor' exists
const element = document.getElementById('ResourceEditor');
if (element) {
  const config = {
    datasetId: element.getAttribute('data-dataset-id'),
    api: element.getAttribute('data-api'),
    lfs: element.getAttribute('data-lfs'),
    authToken: element.getAttribute('data-auth-token'),
    organizationId: element.getAttribute('data-organization-id')
  }

The datasetId is already set in index.html file because of this you are receiving test-id, I'll focus on multiple files for while, but @kmanaseryan if you need this config, you can edit in index.html with the config below:

<div id="ResourceEditor" data-api="http://localhost:5000"  data-lfs="http://localhost:9419" data-auth-token="XXXX-XXXX-XXXX-XXXX" data-dataset-id="data-test-2" data-organization-id="myorg"></div>

@kmanaseryan
Copy link
Contributor Author

@mariorodeghiero yea not a big deal, it was easy to find a workaround, just saw and wanted to open an issue for later improvements

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants