Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
Nos Hs2023
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Språksamlingane
stadnamn
Nos Hs2023
Commits
65e514a8
Commit
65e514a8
authored
5 years ago
by
esikkala
Browse files
Options
Downloads
Patches
Plain Diff
Sketching text facet
parent
5d197e62
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/client/components/facet_bar/TextFacet.js
+128
-0
128 additions, 0 deletions
src/client/components/facet_bar/TextFacet.js
src/client/reducers/manuscriptsFacets.js
+17
-0
17 additions, 0 deletions
src/client/reducers/manuscriptsFacets.js
with
145 additions
and
0 deletions
src/client/components/facet_bar/TextFacet.js
0 → 100644
+
128
−
0
View file @
65e514a8
import
React
from
'
react
'
;
import
PropTypes
from
'
prop-types
'
;
import
{
withStyles
}
from
'
@material-ui/core/styles
'
;
import
IconButton
from
'
@material-ui/core/IconButton
'
;
import
SearchIcon
from
'
@material-ui/icons/Search
'
;
import
Input
from
'
@material-ui/core/Input
'
;
import
InputLabel
from
'
@material-ui/core/InputLabel
'
;
import
InputAdornment
from
'
@material-ui/core/InputAdornment
'
;
import
FormControl
from
'
@material-ui/core/FormControl
'
;
import
CircularProgress
from
'
@material-ui/core/CircularProgress
'
;
const
styles
=
theme
=>
({
textSearch
:
{
margin
:
theme
.
spacing
.
unit
,
},
});
class
TextFacet
extends
React
.
Component
{
state
=
{
value
:
''
,
};
// componentDidUpdate = prevProps => {
// if (prevProps.search.query != this.props.search.query) {
// this.setState({
// value: this.props.search.query
// });
// }
// }
handleChange
=
(
event
)
=>
{
this
.
setState
({
value
:
event
.
target
.
value
});
};
handleMouseDown
=
(
event
)
=>
{
event
.
preventDefault
();
};
// handleOnKeyDown = (event) => {
// if (event.key === 'Enter' && this.hasDatasets() && this.hasValidQuery()) {
// this.props.clearResults();
// this.props.updateQuery(this.state.value);
// this.props.fetchResults('text', this.state.value);
// }
// };
// handleClick = () => {
// if (this.hasDatasets() && this.hasValidQuery()) {
// this.props.clearResults();
// this.props.updateQuery(this.state.value);
// this.props.fetchResults('text', this.state.value);
// }
// };
// hasDatasets = () => {
// let hasDs = false;
// Object.values(this.props.datasets).forEach(value => {
// if (value.selected) {
// hasDs = true;
// }
// });
// return hasDs;
// }
hasValidQuery
=
()
=>
{
return
this
.
state
.
value
.
length
>
2
;
}
render
()
{
const
{
classes
}
=
this
.
props
;
let
searchButton
=
null
;
const
textResultsFetching
=
false
;
if
(
textResultsFetching
)
{
searchButton
=
(
<
IconButton
aria
-
label
=
"
Search places
"
>
<
CircularProgress
size
=
{
24
}
/
>
<
/IconButton
>
);
}
else
{
searchButton
=
(
<
IconButton
aria
-
label
=
"
Search
"
onClick
=
{
this
.
handleClick
}
onMouseDown
=
{
this
.
handleMouseDown
}
>
<
SearchIcon
/>
<
/IconButton
>
);
}
return
(
<
div
className
=
{
classes
.
root
}
>
<
FormControl
className
=
{
classes
.
textSearch
}
>
<
InputLabel
htmlFor
=
"
adornment-search
"
>
Search
<
/InputLabel
>
<
Input
id
=
"
adornment-search
"
type
=
'
text
'
value
=
{
this
.
state
.
value
}
onChange
=
{
this
.
handleChange
}
onKeyDown
=
{
this
.
handleOnKeyDown
}
endAdornment
=
{
<
InputAdornment
position
=
"
end
"
>
{
searchButton
}
<
/InputAdornment
>
}
/
>
<
/FormControl
>
<
/div
>
);
}
}
TextFacet
.
propTypes
=
{
classes
:
PropTypes
.
object
.
isRequired
,
facetID
:
PropTypes
.
string
.
isRequired
,
facet
:
PropTypes
.
object
.
isRequired
,
facetClass
:
PropTypes
.
string
,
resultClass
:
PropTypes
.
string
,
fetchFacet
:
PropTypes
.
func
,
updateFacetOption
:
PropTypes
.
func
,
facetUpdateID
:
PropTypes
.
number
,
updatedFilter
:
PropTypes
.
object
,
updatedFacet
:
PropTypes
.
string
,
};
export
default
withStyles
(
styles
)(
TextFacet
);
This diff is collapsed.
Click to expand it.
src/client/reducers/manuscriptsFacets.js
+
17
−
0
View file @
65e514a8
...
...
@@ -16,6 +16,23 @@ export const INITIAL_STATE = {
facetUpdateID
:
0
,
updatedFilter
:
null
,
facets
:
{
// label: {
// id: 'label',
// label: 'Label',
// // predicate: defined in backend
// distinctValueCount: 0,
// values: [],
// flatValues: [],
// //sortBy: 'instanceCount',
// //sortDirection: 'desc',
// sortButton: false,
// spatialFilterButton: false,
// isFetching: false,
// searchField: false,
// containerClass: 'one',
// filterType: 'text',
// uriFilter: null
// },
source
:
{
id
:
'
source
'
,
label
:
'
Source
'
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment