datopian/ckanext-dataexplorer-react

Remove unnecessary components for the custom view.

Closed this issue · 8 comments

Now we have UI on the backend from where users can build a custom view.
Screen Shot 2021-05-03 at 11 29 02 AM

Even user-specified specs for the view on backend, the view renders with unnecessary components eg. chart builder, pagination, total counts. There is no point to have that on custom view.
Screen Shot 2021-05-03 at 11 20 13 AM

@sagargg could you paste view spec here when you have only map? I think it is showing up because the given resource is "datastore active", see https://github.com/datopian/data-explorer/blob/master/src/App.js#L105-L107

@anuveyatsu Yes, it will hide query builder aka filter when datastore is false but still it will show chart/map builder. See the specs.

{
  "widgets": [
    {
      "active": true,
      "datapackage": {
        "views": [
          {
            "specType": "tabularmap",
            "id": "27775c43-de82-4f8b-b25a-3214ae1f3eaf",
            "spec": {
              "latField": "lat",
              "lonField": "lng"
            }
          }
        ]
      },
      "name": "Map"
    }
  ],
  "datapackage": {
    "resources": [
      {
        "hash": "",
        "description": "",
        "format": "CSV",
        "api": "http://ckan-dev:5000/api/3/action/datastore_search?filters=%7B%7D&resource_id=21c504af-a730-4570-977a-cb6e97c6e133&limit=121&offset=1",
        "title": "np.csv",
        "package_id": "be8eaf0e-80af-4f4c-9c9a-2f3f13e09ac3",
        "mimetype_inner": null,
        "url_type": "upload",
        "path": "http://ckan-dev:5000/dataset/be8eaf0e-80af-4f4c-9c9a-2f3f13e09ac3/resource/21c504af-a730-4570-977a-cb6e97c6e133/download/np.csv",
        "datastore_active": true,
        "id": "21c504af-a730-4570-977a-cb6e97c6e133",
        "size": 2240,
        "mimetype": "text/csv",
        "cache_url": null,
        "name": "np.csv",
        "created": "2021-05-02T13:34:57.620707",
        "url": "http://ckan-dev:5000/dataset/be8eaf0e-80af-4f4c-9c9a-2f3f13e09ac3/resource/21c504af-a730-4570-977a-cb6e97c6e133/download/np.csv",
        "cache_last_updated": null,
        "state": "active",
        "last_modified": "2021-05-02T13:34:57.579305",
        "position": 2,
        "revision_id": "f7e75d20-1d14-4c5d-8714-433d8369f81c",
        "resource_type": null,
        "schema": {
          "fields": [
            {
              "type": "string",
              "name": "city"
            },
            {
              "type": "number",
              "name": "lat"
            },
            {
              "type": "number",
              "name": "lng"
            },
            {
              "type": "string",
              "name": "country"
            },
            {
              "type": "string",
              "name": "iso2"
            },
            {
              "type": "string",
              "name": "admin_name"
            },
            {
              "type": "string",
              "name": "capital"
            },
            {
              "type": "number",
              "name": "population"
            },
            {
              "type": "number",
              "name": "population_proper"
            }
          ]
        }
      }
    ]
  }
}

@anuveyatsu is there any way to use datapackage-view.js only for other custom views?

  • use `data explorer for multiview (where end-user explorer data via frontend)
  • use datapackage-view.js for custom view (chart/table/map/web) where admin can create a custom view for end-user via backend.
    Not sure it is doable or not but i think this way we don't get chart/map/builder like components. But still, we may need filter components 😕 ?

@sagargg I think all components are relevant here because:

  • user might still want to filter down the data if it's large enough to see only particular markers on the map
  • total rows just displays how many rows the dataset has, e.g., I'm seeing only 50 markers but there are 1m. It still might be useful to know
  • map builder is not so useful but I see no harm for keeping it for now
  • pagination might be useful too, if you have are showing by default 100 records but the data has more rows.

@anuveyatsu I don't think we need above you mentioned components. I belive all similar features are already there on backend.

Note: custom view means admin created view so that end user can see what admin wants to show.

  • Data filter is already there. (As you can see add filter on admin UI, where use can set data filter )
  • map builder allows end user to change the admin create view. (will losing of custom defined view once it changed, also can mislead user cuz builder UI renders with default check/select ).
  • Admin can limit the dataset rows , also can add offset. (works as pagination)

Screen Shot 2021-05-04 at 11 02 51 AM

@sagargg could we keep this issue open for now? It looks like we need to have some discussion on how we should implement this.

@sagargg can this be closed now?

CLOSING AS FIXED