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

Feature new query builder #22

Merged
merged 12 commits into from
Jul 2, 2019
Merged

Feature new query builder #22

merged 12 commits into from
Jul 2, 2019

Conversation

ddelpiano
Copy link
Contributor

  • Refactored the query.js component to export as single file and module each one of the components that were defined in it.
  • Moved all the custom components used through Griddle inside query/customComponent (this might be placed somewhere else to be the more generic possible and not only related to the query builder component).
  • The main component is now defined in queryBuilder.js.
  • The columns now will be filled dynamically, this means that if a certain column that we included in the configuration is present in the header then it will be displayed, differently if not present in the header (even if configured) the column won't show up.
  • Events to handle click outside the component migrated to react handles' style.
  • Fixed and refactored keyboards events to handle opening/closing of the component itself.
  • Fixed minor issues in other components (e.g. the canvas was detecting the click outside the query component and trying to interact with this action but the values where undefined due not clicking in its own area of responsibility).

Important notes:

  • All the possible columns have now to be defined in queryResultsColMeta in the querybuilder configuration, as per the example below:
var queryResultsColMeta = [
  {
    "columnName": "id",
    "order": 1,
    "locked": false,
    "visible": true,
    "displayName": "ID",
  },
  {
    "columnName": "name",
    "order": 2,
    "locked": false,
    "visible": true,
    "customComponent": QueryLinkComponent,
    "actions": "window.addVfbId('$entity$');",
    "displayName": "Name",
    "cssClassName": "query-results-name-column",
  },
  {
    "columnName": "description",
    "order": 3,
    "locked": false,
    "visible": true,
    "displayName": "Definition",
    "cssClassName": "query-results-description-column"
  },
  {
    "columnName": "type",
    "order": 4,
    "locked": false,
    "visible": true,
    "displayName": "Type",
    "cssClassName": "query-results-type-column"
  },
  {
    "columnName": "controls",
    "order": 5,
    "locked": false,
    "visible": false,
    "customComponent": QueryResultsControlsComponent,
    "displayName": "Controls",
    "actions": "",
    "cssClassName": "query-results-controls-column"
  },
  {
    "columnName": "images",
    "order": 6,
    "locked": false,
    "visible": true,
    "customComponent": SlideshowImageComponent,
    "displayName": "Images",
    "actions": "window.addVfbId('$entity$');",
    "cssClassName": "query-results-images-column"
  },
  {
    "columnName": "score",
    "order": 7,
    "locked": false,
    "visible": true,
    "displayName": "Score",
    "cssClassName": "query-results-score-column"
  }
];

Note, the columns name have to respect the convention where the field columnName is the lowercase version of the headers that arrive from the query processor defined in the backend, if these names don't match the filter will not work so the developers need to know in advance the columns name that will arrive from the backend.

  • All the columns that the developer wants to show have to be defined in the queryResultsColumn, as per example below:
var queryResultsColumns = ['name', 'description', 'type', 'images', 'score'];

Note, as discussed previously, even if a column is not defined in this array will be placed inside the csv that the use can download, but not displayed.

  • Do not use anymore jquery to hide and display the component, this can be references through GEPPETTO.QueryBuilder and displayed through the method open(), viceversa closed through the method close().
    (e.g. GEPPETTO.QueryBuilder.close(); ).

@ddelpiano ddelpiano added the enhancement New feature or request label Jun 10, 2019
@ddelpiano ddelpiano self-assigned this Jun 10, 2019
@@ -28,11 +28,11 @@ define(['jquery'], function () {
THREE.FilmPass = require('imports-loader?THREE=three!exports-loader?THREE.FilmPass!three\/examples\/js\/postprocessing\/FilmPass');
Copy link
Member

Choose a reason for hiding this comment

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

@ddelpiano why is this file changed here in this branch? I see mostly formatting but also some actual changes and I thought this is stuff that was a untouched since we solved those other issues months ago

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there is a single line changed, the canvas was detecting the click when the querybuilder is open but the coordinates were undefined since the action was not performed on the canvas itself, I had to add that check to avoid this issue.

Copy link
Member

Choose a reason for hiding this comment

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

Ah ok got it, I forgot and I thought unrelated to query stuff. In particular if there is a singel change trying to not do a lot of formatting at the same time otherwise it's very hard to spot what actually changed 👍

var actionStr = that.props.metadata.actions;
actionStr = actionStr.replace(/\$entity\$/gi, path);
GEPPETTO.CommandController.execute(actionStr);
GEPPETTO.QueryBuilder.close();
Copy link
Member

Choose a reason for hiding this comment

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

@ddelpiano commandController is ok but would be good to remove the GEPPETTO.QueryBuilder reference as part of this refactoring

Copy link
Contributor Author

@ddelpiano ddelpiano Jul 1, 2019

Choose a reason for hiding this comment

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

This has been removed from almost everywhere, the only point where I have this at the moment it's the QueryBuilderConfiguration, in this point , this will be removed as part of this within INFRA if you agree.


render () {
// TODO: would be nicer to pass controls and config straight from the parent component rather than assume
var config = GEPPETTO.QueryBuilder.state.resultsControlsConfig;
Copy link
Member

Choose a reason for hiding this comment

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

@ddelpiano same, we should remove GEPPETTO.QueryBuilder referencing from within these components ideally

Copy link
Contributor Author

Choose a reason for hiding this comment

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

as per my reply above.


showBrentSpiner: function (spin) {
showBrentSpiner (spin) {
Copy link
Member

Choose a reason for hiding this comment

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

@ddelpiano anybody catch this star trek reference yet? 😂

useGriddleStyles={false} columnMetadata={this.state.resultsColumnMeta} />
</Typography>
return (focusTabIndex === index
&& <Typography component="div" key={index}>
Copy link
Member

Choose a reason for hiding this comment

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

@ddelpiano something upsets me in this indentation 😬

Copy link
Contributor Author

Choose a reason for hiding this comment

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

already discussed, blame the linter or @rodriguez-facundo in case 😂

…e part of the componentWillMount of the queryBuilder itself, passing all the configs as props. Also the global GEPPETTO.Querybuilder as been removed almost everywhere
@ddelpiano
Copy link
Contributor Author

@gidili this is ready to be reviewed again, thx

@gidili gidili merged commit e808b39 into development Jul 2, 2019
@ddelpiano ddelpiano deleted the feature_new_query_builder branch July 4, 2019 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants