UNPKG

solrkit

Version:

![Build Status](https://travis-ci.org/garysieling/solrkit.svg?branch=master) ![Dependencies](https://david-dm.org/garysieling/solrkit/status.svg) UI Components for Solr, using TypeScript + React

79 lines 5.47 kB
var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); import * as React from 'react'; import { ResultsLayout } from '../../../layout/ResultsLayout'; import { ResultsList } from '../../../component/ResultsList'; import { SearchBox } from '../../../component/SearchBox'; import { ExcelExport } from '../../../component/ExcelExport'; import { Pagination } from '../../../component/Pagination'; import { Bound, databind } from '../../../context/DataBinding'; import { CheckFacet } from '../../../component/facet/CheckFacet'; import { AppDataStore } from './data/AppDataStore'; import { SingleNumber } from '../../../component/statistics/SingleNumber'; import { Link } from 'react-router-dom'; import { Popup } from 'semantic-ui-react'; var dataStore = new AppDataStore(); function popup(condition, component, tooltip) { if (condition) { return (React.createElement(Popup, { trigger: component, content: tooltip })); } else { return component; } } var SearchPageApp = (function (_super) { __extends(SearchPageApp, _super); function SearchPageApp() { var _this = _super.call(this) || this; _this.left = function () { return (React.createElement("div", null, React.createElement(Bound, { dataStore: dataStore.windows, event: dataStore.windows.registerFacet(['place']), render: function (data) { return (React.createElement(CheckFacet, { title: "Place", values: data, search: true, facet: "place", render: function (label, value) { return label + ': ' + value.toLocaleString(); } })); } }), React.createElement(Bound, { dataStore: dataStore.windows, event: dataStore.windows.registerFacet(['gv_labels']), render: function (data) { return (React.createElement(CheckFacet, { title: "Labels", help: "Google Vision API", values: data, facet: "gv_labels", render: function (label, value) { return label + ': ' + value.toLocaleString(); } })); } }), React.createElement(Bound, { dataStore: dataStore.windows, event: dataStore.windows.registerFacet(['resnet50_tags']), render: function (data) { return (React.createElement(CheckFacet, { title: "Tags", help: "ResNet 50", values: data, search: true, facet: "resnet50_tags", render: function (label, value) { return label + ': ' + value.toLocaleString(); } })); } }), React.createElement(Bound, { dataStore: dataStore.windows, event: dataStore.windows.registerFacet(['face_count']), render: function (data) { return (React.createElement(CheckFacet, { title: "Faces", values: data, facet: "face_count", render: function (label, value) { return label + ': ' + value.toLocaleString(); } })); } }), React.createElement("div", null, React.createElement("h4", null, "Options"), React.createElement(ExcelExport, { core: dataStore.windows }), "Export to Excel"))); }; var databindWindowsQuery = function (fn) { return databind(dataStore.windows.onQuery, dataStore.windows, fn); }; _this.right = databindWindowsQuery(function (windows, pagination) { return (React.createElement(ResultsList, { docs: windows, height: 250, render: function (window) { return popup(!!window.gv_inscription && (window.gv_inscription.length > 0) && (window.gv_inscription[0] !== ''), React.createElement(Link, { to: '/window/' + window.id.replace(/\//g, '_'), style: { height: '100%' } }, React.createElement("img", { style: { height: '100%' }, src: window.url })), window.gv_inscription[0]); } })); }); _this.header = databindWindowsQuery(function (Windows, pagination) { return (React.createElement("div", { className: "ui grid" }, React.createElement("div", { className: "three wide column" }, React.createElement(SingleNumber, { horizontal: true, value: pagination.numFound, label: "Windows" })), React.createElement("div", { className: "twelve wide column" }, React.createElement(SearchBox, { placeholder: "Search...", loading: false })))); }); _this.footer = databindWindowsQuery(function (Windows, pagination) { return (React.createElement(Pagination, { numRows: pagination.numFound, pageSize: pagination.pageSize })); }); return _this; } SearchPageApp.prototype.render = function () { return (React.createElement(ResultsLayout, { leftComponent: this.left, rightComponent: this.right, headerComponent: this.header, footerComponent: this.footer, rightRailComponent: this.rightRail })); }; SearchPageApp.dataStore = dataStore; return SearchPageApp; }(React.Component)); export { SearchPageApp }; //# sourceMappingURL=SearchPage.js.map