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

DDF-3650 Create Search Form View and refactor existing functionality #3004

Merged
merged 5 commits into from
Mar 30, 2018

Conversation

bdeining
Copy link
Member

@bdeining bdeining commented Feb 26, 2018

What does this PR do?

Create Template View and refactor existing functionality. Currently fixing some CSS issues with the dropdown view.

Who is reviewing it?

@mackncheesiest @Lambeaux
(please choose AT LEAST two reviewers that need to approve the PR before it can get merged)

Select relevant component teams:

https://github.com/orgs/codice/teams

Choose 2 committers to review/merge the PR.

(please choose ONLY two committers from below, delete the rest)
@andrewkfiedler
@jlcsmith
@millerw8

How should this be tested? (List steps with links to updated documentation)

Build / Install / Create Query / Mess around with templates

Any background context you want to provide?

What are the relevant tickets?

DDF-3650

Screenshots (if appropriate)

screen shot 2018-02-26 at 11 54 50 am
screen shot 2018-02-26 at 11 54 57 am
screen shot 2018-02-26 at 11 55 28 am
screen shot 2018-02-26 at 11 55 33 am

Checklist:

  • Documentation Updated
  • Update / Add Unit Tests
  • Update / Add Integration Tests

Notes on Review Process

Please see Notes on Review Process for further guidance on requirements for merging and abbreviated reviews.

Review Comment Legend:

  • ✏️ (Pencil) This comment is a nitpick or style suggestion, no action required for approval. This comment should provide a suggestion either as an in line code snippet or a gist.
  • ❓ (Question Mark) This comment is to gain a clearer understanding of design or code choices, clarification is required but action may not be necessary for approval.
  • ❗ (Exclamation Mark) This comment is critical and requires clarification or action before approval.

*
**/
/*global define */
define([
Copy link
Member

Choose a reason for hiding this comment

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

I think you should use require here instead of define.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@mjmeno
Copy link
Member

mjmeno commented Feb 27, 2018

-1 at the moment.

Please say "Use another Search Form" and refer to these as "Search Forms" rather than "Templates" -- also please make the cards and window larger with more "white space". They don't look selectable.

The grey color used in "Basic" and "Text" is too light and looks greyed out.

Please say "Search Form Browser" in the title bar (to align with future changes)

@bdeining
Copy link
Member Author

@michaelmenousek addressed your comments. Here is an updated screenshot that also shows highlighting. The text is greyed out because nothing was highlighted in the previous screenshot.
screen shot 2018-02-27 at 10 22 57 am

@@ -14,5 +14,5 @@
<div class="interaction-icon fa fa-file">
</div>
<div class="interaction-text">
Change Type
Use another Search Form
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Should A in "another" be capitalized since everything is title case?

Copy link
Member

Choose a reason for hiding this comment

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

thanks @bdeining! I am +1 now.

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed capitalization

<div class="interaction interaction-type" title="Change the form used to construct the search." data-help="Change the form used to construct the search."></div>

<div class="interaction interaction-type-advanced interaction-form" title="Change the form used to construct the search." data-help="Change the form used to construct the search.">
<div class="interaction-icon fa fa-question-circle"></div>
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: question mark seems a bit odd for "advanced" maybe something like <i class="fas fa-search"></i>

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, seems more consistent with fa-search

onRender: function () {
this.tabsContent.show(new SearchFormsView({
model : this.model
}));
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we have a triggerDropdown() here? Otherwise, if we select a template the dropdown remains open and feels awkward.

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree; looking into this now

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

Copy link

@Variadicism-zz Variadicism-zz left a comment

Choose a reason for hiding this comment

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

The logic seems okay, though a lot of :s have inconsistent spacing around them.

@bdeining
Copy link
Member Author

@Variadicism fixed inconsistent spacing

}
user.savePreferences();
this.triggerCloseDropdown();
this.model.queryModel.trigger('closeDropDown');
Copy link

@Variadicism-zz Variadicism-zz Feb 28, 2018

Choose a reason for hiding this comment

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

❓ It seems odd to me that this call is not in triggerCloseDropdown. triggerCloseDropdown doesn't seem to be used anywhere else, so I would advise moving the one method call in triggerCloseDropdown above this line and deleting the method. If I'm wrong and triggerCloseDropdown is used elsewhere, it seems like this line should be moved inside that method.

Copy link
Member Author

Choose a reason for hiding this comment

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

moved inside of triggerCloseDropdown

defaults: {
name :"A Search Form",
createdBy :"admin",
createdOn :"30 October 2018",

Choose a reason for hiding this comment

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

✏️ The space before each colon on the 3 lines above should be moved after the colon.

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@{customElementNamespace}search-form-system {

.search-form-system-title {
text-align:center;

Choose a reason for hiding this comment

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

✏️ 4 of the rules in here could use a space after the colon.

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

this.model.queryModel.set('type', 'text');
user.getQuerySettings().set('type', 'text');
break;
}

Choose a reason for hiding this comment

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

This switch statement can be simplified to the following if statement:

const type = this.model.get('type');
if (type === 'basic' || type === 'text') {
    this.model.queryModel.set('type', type);
    user.getQuerySettings().set('type', type);
}

Copy link
Member Author

Choose a reason for hiding this comment

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

we might want to leave this as a switch as more cases will likely be added in the future

@Variadicism-zz
Copy link

@bdeining Thanks. I wasn't sure if spacing was considered significant enough for code review comments. If so, I've marked a couple other spots with inconsistent spacing, but they're ✏️.

margin: @minimumSpacing;
width: 200px;
height: 150px;
text-align:center;
Copy link
Contributor

Choose a reason for hiding this comment

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

Add vertical-align: top to keep the choices aligned correctly.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@andrewkfiedler
Copy link
Contributor

andrewkfiedler commented Feb 28, 2018

We should update the folder name for search-forms to be search-form, as well as update the name for search-form-collection.js to be search-form.collection.js.

Also, update the search-form-view.js to be search-form.view.js.

@andrewkfiedler
Copy link
Contributor

andrewkfiedler commented Feb 28, 2018

Move the current search-forms.view.js into another folder and rename it to differentiate it as the search form browser or selector. Maybe search-form-selector.view.js in search-form-selector folder or search-form-browser.view.js in search-form-browser folder.

@bdeining
Copy link
Member Author

@andrewkfiedler addressed your comments

@andrewkfiedler
Copy link
Contributor

Thanks, I'll take another look, I got pulled away to work on something while I was reviewing.

@bdeining bdeining changed the title DDF-3650 Create Template View and refactor existing functionality DDF-3650 Create Search Form View and refactor existing functionality Feb 28, 2018
childView: SearchFormView,
tagName: CustomElements.register('my-search-forms'),
className: 'is-list is-inline has-list-highlighting',
initialize: function(options) {
Copy link
Contributor

Choose a reason for hiding this comment

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

An easier way to pass these options on to the childView will be to use childViewOptions. We do something similar in

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@@ -0,0 +1,41 @@
/**
Copy link
Contributor

Choose a reason for hiding this comment

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

We should update the filename to search-form.collection.js.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

this.add(new SearchForm({type: "basic", queryModel: options[0].queryModel}));
this.add(new SearchForm({type: "text", queryModel: options[0].queryModel}));
},
getCustomQueryForms: function() {
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 for a later PR to utilize?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, there will be a follow-on PR that will utilize this


module.exports = Backbone.Model.extend({
defaults: {
name: "A Search Form",
Copy link
Contributor

Choose a reason for hiding this comment

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

We're going to need an id on these as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

The ID will be passed from the backend; these defaults will probably be removed in a future iteration

Copy link
Contributor

Choose a reason for hiding this comment

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

My thoughts were that type is redundant with id. We would have reserved ids such as basic, text, and advanced while the others would be unique ids generated by the backend.

The reason I push for ids now is that the logic will be more complicated without them (we'll be checking type, and then checking id, when we could just do a check on id and when it doesn't match a reserved id we know it's custom).

}

.search-form-label {
font-weight: bold;
Copy link
Member Author

Choose a reason for hiding this comment

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

.is-bold

Copy link
Member Author

Choose a reason for hiding this comment

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

done

}

@{customElementNamespace}search-form-loading {
padding: 2*@minimumSpacing;
Copy link
Member Author

Choose a reason for hiding this comment

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

whitespace

Copy link
Member Author

Choose a reason for hiding this comment

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

done

},
onRender: function(){
this.listenTo(this.model, 'closeDropDown', this.triggerCloseDropdown);
Copy link
Member Author

Choose a reason for hiding this comment

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

listen to query model here instead

Copy link
Member Author

Choose a reason for hiding this comment

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

done

*
**/
/*global define, alert, setTimeout*/
define([

Choose a reason for hiding this comment

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

✏️ Could refactor this to use the more maintainable require notation

Copy link
Member Author

Choose a reason for hiding this comment

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

done

*
**/
/*global define, alert, setTimeout*/
define([

Choose a reason for hiding this comment

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

✏️ Same nit about requires

Copy link
Member 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

@Schachte Schachte left a comment

Choose a reason for hiding this comment

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

Looks good to me after addressing discussion from UI review meeting

Copy link
Member

@Lambeaux Lambeaux left a comment

Choose a reason for hiding this comment

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

Approved pending:

  • Feedback brought up during mob review meeting
  • Removing nodes with null/empty values from the filter tree before submission to CqlUtils

Regarding the later, if this change is going to take place globally (and not just apply to templates) then introducing a user preference for the inclusion of null or empty fields might be desirable.

'./query-custom.hbs',
'js/CustomElements',
'component/filter-builder-search-form/filter-builder.view',
'component/filter-builder/filter-builder',
Copy link

@mackncheesiest mackncheesiest Mar 27, 2018

Choose a reason for hiding this comment

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

❓ Wait why is the view coming from component/filter-builder-search-form and the model from component/filter-builder? Where does component/filter-builder/filter-builder.view.js factor into this?

Copy link
Member Author

Choose a reason for hiding this comment

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

The model need not be extended; the views use the same model but are presented a little differently. component/filter-builder/filter-builder.view.js is used in the query-advanced view

@bdeining
Copy link
Member Author

build now

@cxbot
Copy link

cxbot commented Mar 29, 2018

Internal build has been scheduled, your results will be available at build completion.

@cxbot
Copy link

cxbot commented Mar 29, 2018

Refer to this link for build results (access rights to CI server needed):
https://jenkins.codice.org/job/DDF-Jobs/job/pr/job/Linux/3694/
❌ JOB FAILURE

@bdeining
Copy link
Member Author

build now

@cxbot
Copy link

cxbot commented Mar 29, 2018

Internal build has been scheduled, your results will be available at build completion.

@cxbot
Copy link

cxbot commented Mar 29, 2018

Refer to this link for build results (access rights to CI server needed):
https://jenkins.codice.org/job/DDF-Jobs/job/pr/job/Linux/3695/
✅ JOB SUCCESS

@codecov
Copy link

codecov bot commented Mar 29, 2018

Codecov Report

Merging #3004 into master will decrease coverage by 19.62%.
The diff coverage is n/a.

Impacted file tree graph

@@              Coverage Diff              @@
##             master    #3004       +/-   ##
=============================================
- Coverage     63.56%   43.93%   -19.63%     
=============================================
  Files          1372       12     -1360     
  Lines         79922      594    -79328     
  Branches       9254      132     -9122     
=============================================
- Hits          50805      261    -50544     
+ Misses        25155      333    -24822     
+ Partials       3962        0     -3962
Impacted Files Coverage Δ Complexity Δ
...df/catalog/ui/metacard/transform/CsvTransform.java
...w/catalog/common/transaction/UpdateActionImpl.java
.../catalog/framework/FrameworkProducerException.java
...ial/kml/converter/KmlToJtsCoordinateConverter.java
...talog/operation/impl/OperationTransactionImpl.java
...nt/catalog/content/FileSystemDataAccessObject.java
...ain/java/ddf/catalog/impl/FrameworkProperties.java
...security/liberty/paos/impl/ResponseMarshaller.java
...ddf/security/service/SecurityServiceException.java
...codice/ddf/spatial/geocoder/GazetteerGeoCoder.java
... and 1350 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f5174e4...239a2c2. Read the comment docs.

@jlcsmith
Copy link
Member

jlcsmith commented Mar 30, 2018

Looks good. There is a minor issue in IE11/Edge with a scroll bar on the text template. The window should be sized so no scrollbar appears.
text-template-ie11edge

@shaundmorris shaundmorris merged commit 252710b into codice:master Mar 30, 2018
shaundmorris pushed a commit to shaundmorris/ddf that referenced this pull request Jul 19, 2018
…odice#3004)

* DDF-3650 Fixes some template bugs, adds caching to template fetching

* DDF-3650 Code Review

* DDF-3650 Create Template View and refactor existing functionality

* Associated model

* DDF-3650 is-bold
@bdeining bdeining deleted the DDF-3650 branch February 11, 2019 16:57
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

Successfully merging this pull request may close these issues.

None yet