| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971 |
- ## Licensed to Cloudera, Inc. under one
- ## or more contributor license agreements. See the NOTICE file
- ## distributed with this work for additional information
- ## regarding copyright ownership. Cloudera, Inc. licenses this file
- ## to you under the Apache License, Version 2.0 (the
- ## "License"); you may not use this file except in compliance
- ## with the License. You may obtain a copy of the License at
- ##
- ## http://www.apache.org/licenses/LICENSE-2.0
- ##
- ## Unless required by applicable law or agreed to in writing, software
- ## distributed under the License is distributed on an "AS IS" BASIS,
- ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ## See the License for the specific language governing permissions and
- ## limitations under the License.
- <%!
- from django.utils.translation import ugettext as _
- from desktop import conf
- from desktop.views import commonheader, commonfooter, _ko, commonshare
- from dashboard.conf import USE_GRIDSTER, HAS_REPORT_ENABLED
- %>
- <%namespace name="dashboard" file="common_dashboard.mako" />
- <%def name="page_structure(is_mobile=False, is_embeddable=False)">
- <script type="text/javascript">
- SLIDER_LABELS = {
- STEP: "${_('Increment')}"
- }
- </script>
- %if is_mobile:
- <h3 data-bind="text: collection.label" style="text-align: center"></h3>
- <form class="form-search" style="margin: 0; text-align: center" data-bind="submit: searchBtn, visible: columns().length != 0">
- <div class="input-append">
- <!-- ko if: query.qs().length > 0 -->
- <!-- ko with: query.qs()[0] -->
- <input data-bind="clearable: q, valueUpdate:'afterkeydown', typeahead: { target: q, nonBindableSource: queryTypeahead, multipleValues: true, multipleValuesSeparator: ':', extraKeywords: 'AND OR TO', completeSolrRanges: true }" maxlength="4096" type="text">
- <!-- /ko -->
- <!-- /ko -->
- <button type="submit" id="search-btn" class="btn btn-inverse add-on">
- <i class="fa fa-search" data-bind="visible: ! isRetrievingResults()"></i>
- <i class="fa fa-spinner fa-spin" data-bind="visible: isRetrievingResults()"></i>
- </button>
- </div>
- </form>
- %else:
- <div class="search-bar" data-bind="visible: ! $root.isPlayerMode()">
- <div class="pull-left">
- <div class="app-header">
- <a href="#" data-bind="hueLink: '${ url('dashboard:new_search') }'">
- <!-- ko template: { name: 'app-icon-template', data: { icon: 'dashboard' } } --><!-- /ko --> ${ _('Dashboard') }
- <!-- ko component: { name: 'hue-favorite-app', params: { hue4: IS_HUE_4, app: 'dashboard' }} --><!-- /ko -->
- </a>
- </div>
- </div>
- <div class="pull-right" style="${ not is_embeddable and 'padding-right:50px' or ''}">
- <a class="btn pointer" title="${ _('Edit') }" rel="tooltip" data-placement="bottom" data-bind="click: toggleEditing, css: {'btn': true, 'btn-inverse': isEditing}">
- <i class="fa fa-pencil"></i>
- </a>
- % if is_owner:
- <a class="btn pointer" title="${ _('Save') }" rel="tooltip" data-placement="bottom" data-loading-text="${ _("Saving...") }" data-bind="click: save, css: {'btn': true}, visible: columns().length != 0">
- <i class="fa fa-save"></i>
- </a>
- % endif
- <div class="dropdown pull-right margin-left-10">
- <a class="btn" data-toggle="dropdown" href="javascript: void(0)">
- <i class="fa fa-fw fa-ellipsis-v"></i>
- </a>
- <ul class="dropdown-menu">
- <li data-bind="visible: isSaved()">
- <a class="share-link" data-bind="click: prepareShareModal, css: {'isShared': isShared()}">
- <i class="fa fa-fw fa-users"></i> ${ _('Share') }
- </a>
- </li>
- %if not is_embeddable:
- <li>
- <a class="pointer" data-bind="click: function(){ hueUtils.goFullScreen(); $root.isEditing(false); $root.isPlayerMode(true); }">
- <i class="fa fa-fw fa-expand"></i> ${ _('Player mode') }
- </a>
- </li>
- %endif
- <li data-bind="visible: columns().length != 0">
- <a class="pointer" data-toggle="modal" data-target="#settingsDemiModal">
- <i class="fa fa-fw fa-cog"></i> ${ _('Settings') }
- </a>
- </li>
- <li data-bind="visible: columns().length != 0">
- <a class="pointer" data-toggle="modal" data-target="#qdefinitionsDemiModal">
- <i class="fa fa-fw fa-bookmark-o"></i> ${ _('Saved Queries') }
- </a>
- </li>
- <li data-bind="visible: columns().length != 0" class="divider"></li>
- <li>
- <a href="javascript:void(0)" data-bind="click: newSearch">
- <i class="fa fa-fw fa-file-o"></i> ${ _('New') }
- </a>
- </li>
- <!-- ko if: IS_HUE_4 -->
- <li>
- <a href="/home/?type=search-dashboard">
- <svg class="hi hi-fw hi-bigger"><use xlink:href="#hi-documents"></use></svg> ${ _('Dashboards') }
- </a>
- </li>
- <!-- /ko -->
- <!-- ko ifnot: IS_HUE_4 -->
- <li>
- <a href="${ url('dashboard:admin_collections') }">
- <svg class="hi hi-fw hi-bigger"><use xlink:href="#hi-documents"></use></svg> ${ _('Dashboards') }
- </a>
- </li>
- <!-- /ko -->
- </ul>
- </div>
- </div>
- <form class="form-search" data-bind="visible: $root.isEditing() && columns().length == 0">
- ${ _('Select one') }
- <!-- ko if: $root.initial.engines().length > 1 -->
- <select class="input-medium" data-bind="options: $root.initial.engines, value: $root.collection.engine, optionsText: 'name', optionsValue: 'type', disable: isSyncingCollections"></select>
- <!-- /ko -->
- <!-- ko ifnot: $root.initial.engines().length > 1 -->
- ${_('index')}
- <!-- /ko -->
- <!-- ko if: $root.collection.engine() == 'solr' -->
- <!-- ko if: columns().length == 0 -->
- <select data-bind="options: $root.initial.collections, value: $root.collection.name, disable: isSyncingCollections"></select>
- <label class="checkbox" style="display:inline-block; margin-left: 10px">
- <i class="fa fa-spinner fa-spin" data-bind="visible: isSyncingCollections"></i>
- </label>
- <!-- /ko -->
- <!-- /ko -->
- <!-- ko if: $root.collection.engine() != 'solr' -->
- <!-- ko if: columns().length == 0 -->
- <input type="text" class="no-margin" data-bind="value: $root.collection.name, hivechooser: $root.collection.name, skipColumns: true, apiHelperUser: '${ user }', apiHelperType: $root.collection.engine()" placeholder="${ _('Table name or <database>.<table>') }">
- <!-- /ko -->
- <!-- /ko -->
- <select data-bind="options: $root.availableDateFields, value: collection.timeFilter.field, optionsValue: 'name', visible: $root.isEditing() && $root.availableDateFields().length > 0" class="input-medium" style="margin-left: 4px"></select>
- <span class="time-filter" data-bind="template: {name: 'time-filter'}, visible: collection.timeFilter.type() == 'rolling'"></span>
- <span class="time-fixed-filter" data-bind="template: {name: 'time-fixed-filter'}, visible: collection.timeFilter.type() == 'fixed'"></span>
- <!-- ko if: $root.collection.engine() == 'solr' -->
- <span data-bind="template: {name: 'nested-document-filter'}"></span>
- <!-- /ko -->
- </form>
- <form class="form-search" style="margin: 0" data-bind="submit: searchBtn, visible: columns().length != 0">
- <div class="input-append">
- <div class="selectMask">
- <span
- data-bind="editable: collection.label, editableOptions: {enabled: $root.isEditing(), placement: 'right'}">
- </span>
- </div>
- <span data-bind="foreach: query.qs">
- <input data-bind="clearable: q, valueUpdate:'afterkeydown', autogrowInput: { minWidth: $root.query.qs().length > 1 ? 90 : 206, maxWidth: 270, comfortZone: 15 }, typeahead: { target: q, nonBindableSource: queryTypeahead, multipleValues: true, multipleValuesSeparator: ':', extraKeywords: 'AND OR TO', completeSolrRanges: true }, css:{'input-small': $root.query.qs().length > 1, 'flat-left': $index() === 0}" maxlength="4096" type="text" class="search-query">
- <!-- ko if: $index() >= 1 -->
- <a class="btn flat-left" href="javascript:void(0)" data-bind="click: $root.query.removeQ"><i class="fa fa-minus"></i></a>
- <!-- /ko -->
- </span>
- <a class="btn" href="javascript:void(0)" data-bind="click: $root.query.addQ, css: { 'flat-left': $root.query.qs().length === 1}, style: { 'margin-left': $root.query.qs().length > 1 ? '10px' : '0' }"><i class="fa fa-plus"></i></a>
- <button type="submit" id="search-btn" class="btn btn-primary disable-feedback" style="margin-left:10px; margin-right:10px">
- <i class="fa fa-search" data-bind="visible: ! isRetrievingResults()"></i>
- <i class="fa fa-spinner fa-spin" data-bind="visible: isRetrievingResults()"></i>
- <!-- ko if: $root.collection.async() -->
- <i class="fa fa-stop" clas="red" data-bind="click: cancelAsync, visible: isRetrievingResults()"></i>
- <!-- /ko -->
- </button>
- </div>
- <span class="time-filter" data-bind="template: {name: 'time-filter'}, visible: collection.timeFilter.type() == 'rolling'"></span>
- <span class="time-fixed-filter" data-bind="template: {name: 'time-fixed-filter'}, visible: collection.timeFilter.type() == 'fixed'"></span>
- <span data-bind="template: {name: 'nested-document-filter'}"></span>
- </form>
- </div>
- %endif
- <%dashboard:layout_toolbar>
- <%def name="results()">
- <div data-bind="css: { 'draggable-widget': true, 'disabled': !availableDraggableResultset() },
- draggable: {data: draggableResultset(), isEnabled: availableDraggableResultset,
- options: {'start': function(event, ui){lastWindowScrollPosition = $(window).scrollTop();$('.card-body').slideUp('fast');},
- 'stop': function(event, ui){$('.card-body').slideDown('fast'); $root.collection.template.isGridLayout(true); checkResultHighlightingAvailability(); }}}"
- title="${_('Grid')}" rel="tooltip" data-placement="top">
- <a data-bind="style: { cursor: $root.availableDraggableResultset() ? 'move' : 'default' }">
- <i class="fa fa-table"></i>
- </a>
- </div>
- <div data-bind="css: { 'draggable-widget': true, 'disabled': !availableDraggableResultset() },
- draggable: {data: draggableHtmlResultset(),
- isEnabled: availableDraggableResultset,
- options: {'start': function(event, ui){lastWindowScrollPosition = $(window).scrollTop();$('.card-body').slideUp('fast');},
- 'stop': function(event, ui){
- $('.card-body').slideDown('fast', function(){$(window).scrollTop(lastWindowScrollPosition)});
- $root.collection.template.isGridLayout(false);
- checkResultHighlightingAvailability();
- }
- }
- }"
- title="${_('HTML')}" rel="tooltip" data-placement="top">
- <a data-bind="style: { cursor: $root.availableDraggableResultset() ? 'move' : 'default' }">
- <i class="fa fa-code"></i>
- </a>
- </div>
- <div data-bind="css: { 'draggable-widget': true, 'disabled': !availableDraggableFilter() },
- draggable: {data: draggableFilter(), isEnabled: availableDraggableFilter,
- options: {'start': function(event, ui){lastWindowScrollPosition = $(window).scrollTop();$('.card-body').slideUp('fast');},
- 'stop': function(event, ui){$('.card-body').slideDown('fast', function(){$(window).scrollTop(lastWindowScrollPosition)});}}}"
- title="${_('Filter Bar')}" rel="tooltip" data-placement="top">
- <a data-bind="style: { cursor: $root.availableDraggableFilter() ? 'move' : 'default' }">
- <i class="fa fa-filter"></i>
- </a>
- </div>
- <div data-bind="css: { 'draggable-widget': true, 'disabled': !availableDraggableLeaflet()},
- draggable: {data: draggableLeafletMap(), isEnabled: availableDraggableLeaflet,
- options: {'start': function(event, ui){lastWindowScrollPosition = $(window).scrollTop();$('.card-body').slideUp('fast');},
- 'stop': function(event, ui){$('.card-body').slideDown('fast', function(){$(window).scrollTop(lastWindowScrollPosition)});}}}"
- title="${_('Marker Map')}" rel="tooltip" data-placement="top">
- <a data-bind="style: { cursor: 'move' }">
- <i class="fa fa-map-marker"></i>
- </a>
- </div>
- <div data-bind="visible: $root.collection.supportAnalytics,
- css: { 'draggable-widget': true, 'disabled': !hasAvailableFields() },
- draggable: {data: draggableCounter(), isEnabled: hasAvailableFields,
- options: {'start': function(event, ui){lastWindowScrollPosition = $(window).scrollTop();$('.card-body').slideUp('fast');},
- 'stop': function(event, ui){$('.card-body').slideDown('fast', function(){$(window).scrollTop(lastWindowScrollPosition)});}}}"
- title="${_('Counter')}" rel="tooltip" data-placement="top">
- <a data-bind="style: { cursor: $root.hasAvailableFields() ? 'move' : 'default' }">
- <i class="fa fa-superscript" style="font-size: 110%"></i>
- </a>
- </div>
- </%def>
- <%def name="widgets()">
- <div data-bind="visible: ! $root.collection.supportAnalytics(), css: { 'draggable-widget': true, 'disabled': !availableDraggableChart() },
- draggable: {data: draggableFacet(), isEnabled: availableDraggableChart,
- options: {'start': function(event, ui){lastWindowScrollPosition = $(window).scrollTop();$('.card-body').slideUp('fast');},
- 'stop': function(event, ui){$('.card-body').slideDown('fast', function(){$(window).scrollTop(lastWindowScrollPosition)});}}}"
- title="${_('Text Facet')}" rel="tooltip" data-placement="top">
- <a data-bind="style: { cursor: $root.availableDraggableChart() ? 'move' : 'default' }">
- <i class="fa fa-sort-amount-asc"></i>
- </a>
- </div>
- <div data-bind="visible: $root.collection.supportAnalytics(), css: { 'draggable-widget': true, 'disabled': !availableDraggableChart() },
- draggable: {data: draggableTextFacet(), isEnabled: availableDraggableChart,
- options: {'start': function(event, ui){lastWindowScrollPosition = $(window).scrollTop();$('.card-body').slideUp('fast');},
- 'stop': function(event, ui){$('.card-body').slideDown('fast', function(){$(window).scrollTop(lastWindowScrollPosition)});}}}"
- title="${_('Text Facet')}" rel="tooltip" data-placement="top">
- <a data-bind="style: { cursor: $root.availableDraggableChart() ? 'move' : 'default' }">
- <i class="fa fa-sort-amount-asc"></i>
- </a>
- </div>
- <div data-bind="visible: ! $root.collection.supportAnalytics(), css: { 'draggable-widget': true, 'disabled': !availableDraggableChart() },
- draggable: {data: draggablePie(), isEnabled: availableDraggableChart,
- options: {'start': function(event, ui){lastWindowScrollPosition = $(window).scrollTop();$('.card-body').slideUp('fast');},
- 'stop': function(event, ui){$('.card-body').slideDown('fast', function(){$(window).scrollTop(lastWindowScrollPosition)});}}}"
- title="${_('Pie Chart')}" rel="tooltip" data-placement="top">
- <a data-bind="style: { cursor: $root.availableDraggableChart() ? 'move' : 'default' }">
- <i class="hcha hcha-pie-chart"></i>
- </a>
- </div>
- <div data-bind="visible: $root.collection.supportAnalytics(), css: { 'draggable-widget': true, 'disabled': !availableDraggableChart() },
- draggable: {data: draggablePie2(), isEnabled: availableDraggableChart,
- options: {'start': function(event, ui){lastWindowScrollPosition = $(window).scrollTop();$('.card-body').slideUp('fast');},
- 'stop': function(event, ui){$('.card-body').slideDown('fast', function(){$(window).scrollTop(lastWindowScrollPosition)});}}}"
- title="${_('Pie Chart')}" rel="tooltip" data-placement="top">
- <a data-bind="style: { cursor: $root.availableDraggableChart() ? 'move' : 'default' }">
- <i class="fa fa-pie-chart"></i>
- </a>
- </div>
- <div data-bind="visible: ! $root.collection.supportAnalytics(),
- css: { 'draggable-widget': true, 'disabled': !availableDraggableChart() },
- draggable: {data: draggableBar(), isEnabled: availableDraggableChart,
- options: {'start': function(event, ui){lastWindowScrollPosition = $(window).scrollTop();$('.card-body').slideUp('fast');},
- 'stop': function(event, ui){$('.card-body').slideDown('fast', function(){$(window).scrollTop(lastWindowScrollPosition)});}}}"
- title="${_('Bar Chart')}" rel="tooltip" data-placement="top">
- <a data-bind="style: { cursor: $root.availableDraggableChart() ? 'move' : 'default' }">
- <i class="hcha hcha-bar-chart"></i>
- </a>
- </div>
- <div data-bind="visible: $root.collection.supportAnalytics(),
- css: { 'draggable-widget': true, 'disabled': ! availableDraggableChart() },
- draggable: {data: draggableBucket(), isEnabled: availableDraggableChart,
- options: {'start': function(event, ui){lastWindowScrollPosition = $(window).scrollTop();$('.card-body').slideUp('fast');},
- 'stop': function(event, ui){$('.card-body').slideDown('fast', function(){$(window).scrollTop(lastWindowScrollPosition)});}}}"
- title="${_('Chart')}" rel="tooltip" data-placement="top">
- <a data-bind="style: { cursor: $root.availableDraggableChart() ? 'move' : 'default' }">
- <i class="fa fa-bar-chart"></i>
- </a>
- </div>
- <div data-bind="visible: ! $root.collection.supportAnalytics(),
- css: { 'draggable-widget': true, 'disabled': !availableDraggableNumbers() },
- draggable: {data: draggableLine(), isEnabled: availableDraggableNumbers,
- options: {'start': function(event, ui){lastWindowScrollPosition = $(window).scrollTop();$('.card-body').slideUp('fast');},
- 'stop': function(event, ui){$('.card-body').slideDown('fast', function(){$(window).scrollTop(lastWindowScrollPosition)});}}}"
- title="${_('Line Chart')}" rel="tooltip" data-placement="top">
- <a data-bind="style: { cursor: $root.availableDraggableNumbers() ? 'move' : 'default' }">
- <i class="hcha hcha-line-chart"></i>
- </a>
- </div>
- <div data-bind="visible: ! $root.collection.supportAnalytics(), css: { 'draggable-widget': true, 'disabled': false },
- draggable: {data: draggableTree(), isEnabled: true,
- options: {'start': function(event, ui){lastWindowScrollPosition = $(window).scrollTop();$('.card-body').slideUp('fast');},
- 'stop': function(event, ui){$('.card-body').slideDown('fast', function(){$(window).scrollTop(lastWindowScrollPosition)});}}}"
- title="${_('Tree')}" rel="tooltip" data-placement="top">
- <a data-bind="style: { cursor: $root.availableDraggableChart() ? 'move' : 'default' }">
- <i class="fa fa-sitemap fa-rotate-270"></i>
- </a>
- </div>
- <div data-bind="visible: $root.collection.supportAnalytics(), css: { 'draggable-widget': true, 'disabled': false },
- draggable: {data: draggableTree2(), isEnabled: true,
- options: {'start': function(event, ui){lastWindowScrollPosition = $(window).scrollTop();$('.card-body').slideUp('fast');},
- 'stop': function(event, ui){$('.card-body').slideDown('fast', function(){$(window).scrollTop(lastWindowScrollPosition)});}}}"
- title="${_('Tree')}" rel="tooltip" data-placement="top">
- <a data-bind="style: { cursor: $root.availableDraggableChart() ? 'move' : 'default' }">
- <i class="fa fa-sitemap fa-rotate-270"></i>
- </a>
- </div>
- <div data-bind="visible: ! $root.collection.supportAnalytics(),
- css: { 'draggable-widget': true, 'disabled': false },
- draggable: {data: draggableHeatmap(), isEnabled: true,
- options: {'start': function(event, ui){lastWindowScrollPosition = $(window).scrollTop();$('.card-body').slideUp('fast');},
- 'stop': function(event, ui){$('.card-body').slideDown('fast', function(){$(window).scrollTop(lastWindowScrollPosition)});}}}"
- title="${_('Heatmap')}" rel="tooltip" data-placement="top">
- <a data-bind="style: { cursor: $root.availableDraggableChart() ? 'move' : 'default' }">
- <i class="fa fa-th"></i>
- </a>
- </div>
- <div data-bind="visible: ! $root.collection.supportAnalytics(), css: { 'draggable-widget': true, 'disabled': ! availableDraggableHistogram() },
- draggable: {data: draggableHistogram(), isEnabled: availableDraggableHistogram,
- options: {'start': function(event, ui){lastWindowScrollPosition = $(window).scrollTop();$('.card-body').slideUp('fast');},
- 'stop': function(event, ui){$('.card-body').slideDown('fast', function(){$(window).scrollTop(lastWindowScrollPosition)});}}}"
- title="${_('Timeline')}" rel="tooltip" data-placement="top">
- <a data-bind="style: { cursor: $root.availableDraggableHistogram() ? 'move' : 'default' }">
- <i class="hcha hcha-timeline-chart"></i>
- </a>
- </div>
- <div data-bind="visible: $root.collection.supportAnalytics(), css: { 'draggable-widget': true, 'disabled': ! availableTimeline() },
- draggable: {data: draggableTimeline(), isEnabled: availableTimeline,
- options: {'start': function(event, ui){lastWindowScrollPosition = $(window).scrollTop();$('.card-body').slideUp('fast');},
- 'stop': function(event, ui){$('.card-body').slideDown('fast', function(){$(window).scrollTop(lastWindowScrollPosition)});}}}"
- title="${_('Timeline')}" rel="tooltip" data-placement="top">
- <a data-bind="style: { cursor: $root.availableTimeline() ? 'move' : 'default' }">
- <i class="fa fa-line-chart"></i>
- </a>
- </div>
- <div data-bind="visible: ! $root.collection.supportAnalytics(), css: { 'draggable-widget': true, 'disabled': ! availableDraggableMap() },
- draggable: {data: draggableMap(), isEnabled: availableDraggableMap,
- options: {'start': function(event, ui){lastWindowScrollPosition = $(window).scrollTop();$('.card-body').slideUp('fast');},
- 'stop': function(event, ui){$('.card-body').slideDown('fast', function(){$(window).scrollTop(lastWindowScrollPosition)});}}}"
- title="${_('Gradient Map')}" rel="tooltip" data-placement="top">
- <a data-bind="style: { cursor: $root.availableDraggableMap() ? 'move' : 'default' }">
- <i class="hcha hcha-map-chart"></i>
- </a>
- </div>
- <div data-bind="visible: $root.collection.supportAnalytics(), css: { 'draggable-widget': true, 'disabled': ! availableDraggableMap() },
- draggable: {data: draggableGradienMap(), isEnabled: availableDraggableMap,
- options: {'start': function(event, ui){lastWindowScrollPosition = $(window).scrollTop();$('.card-body').slideUp('fast');},
- 'stop': function(event, ui){$('.card-body').slideDown('fast', function(){$(window).scrollTop(lastWindowScrollPosition)});}}}"
- title="${_('Gradient Map')}" rel="tooltip" data-placement="top">
- <a data-bind="style: { cursor: $root.availableDraggableMap() ? 'move' : 'default' }">
- <i class="hcha hcha-map-chart"></i>
- </a>
- </div>
- % if HAS_REPORT_ENABLED.get():
- <div data-bind="visible: $root.collection.supportAnalytics(),
- css: { 'draggable-widget': true, 'disabled': false },
- draggable: {data: draggableDocument(), isEnabled: true,
- options: {'start': function(event, ui){lastWindowScrollPosition = $(window).scrollTop();$('.card-body').slideUp('fast');},
- 'stop': function(event, ui){$('.card-body').slideDown('fast', function(){$(window).scrollTop(lastWindowScrollPosition)});}}}"
- title="${_('Document')}" rel="tooltip" data-placement="top">
- <a data-bind="style: { cursor: true ? 'move' : 'default' }">
- <i class="fa fa-file-o"></i>
- </a>
- </div>
- % endif
- </%def>
- </%dashboard:layout_toolbar>
- <div class="player-toolbar" data-bind="visible: $root.isPlayerMode">
- <div class="pull-right pointer" data-bind="visible: $root.isPlayerMode, click: function(){ hueUtils.exitFullScreen(); $root.isPlayerMode(false); }"><i class="fa fa-times"></i></div>
- <img src="${ static('desktop/art/icon_hue_48.png') }" alt="${ _('Hue logo') }" />
- <h4 data-bind="text: collection.label"></h4>
- <form class="form-search" data-bind="submit: searchBtn">
- <span data-bind="foreach: query.qs">
- <input data-bind="clearable: q, valueUpdate:'afterkeydown', typeahead: { target: q, source: $root.collection.template.fieldsNames, multipleValues: true, multipleValuesSeparator: ':', extraKeywords: 'AND OR TO', completeSolrRanges: true }, css:{'input-xlarge': $root.query.qs().length == 1, 'input-medium': $root.query.qs().length < 4, 'input-small': $root.query.qs().length >= 4}" maxlength="4096" type="text" class="search-query">
- <!-- ko if: $parent.query.qs().length > 1 -->
- <div class="pointer muted link" data-bind="click: $root.query.removeQ"><i class="fa fa-minus"></i></div>
- <!-- /ko -->
- </span>
- <div class="pointer muted link" data-bind="click: $root.query.addQ"><i class="fa fa-plus"></i></div>
- <div class="pointer muted link" data-bind="click: $root.searchBtn"><i class="fa fa-search" data-bind="visible: ! isRetrievingResults()"></i></div>
- <i class="fa fa-spinner fa-spin muted" data-bind="visible: isRetrievingResults()"></i>
- </form>
- </div>
- ${ dashboard.layout_skeleton(suffix='search') }
- <script type="text/html" id="empty-widget">
- ${ _('This is an empty widget.')}
- </script>
- <script type="text/html" id="facet-toggle">
- <div class="facet-field-tile">
- <div class="facet-field-cnt">
- <span class="facet-field-label facet-field-label-fixed-width facet-field-label-fixed-width-double facet-field-label-title">${ _('Settings') }</span>
- <i class="fa fa-spinner fa-spin" data-bind="visible: $root.isRetrievingResults()"></i>
- </div>
- <div class="facet-field-cnt" data-bind="visible: properties.canRange">
- <span class="facet-field-label facet-field-label-fixed-width">${ _('Type') }</span>
- <a href="javascript: void(0)" title="${ _('Toggle how to group the values') }" data-bind="click: $root.collection.toggleRangeFacet">
- <i class="fa" data-bind="css: { 'fa-arrows-h': type() == 'range', 'fa-circle': type() == 'field', 'fa-level-up': type() == 'range-up' }, attr: { title: type() == 'field' ? 'Range' : type() == 'range-up' ? 'Range and up' : 'Term' }"></i>
- <span data-bind="visible: type() == 'range'">${_('range')}</span>
- <span data-bind="visible: type() == 'range-up'">${_('range & up')}</span>
- <span data-bind="visible: type() == 'field'">${_('field')}</span>
- </a>
- </div>
- <div class="facet-field-cnt">
- <span class="facet-field-label facet-field-label-fixed-width">${ _('Sorting') }</span>
- <a href="javascript: void(0)" title="${ _('Toggle sort order') }" data-bind="click: $root.collection.toggleSortFacet">
- <i class="fa" data-bind="css: { 'fa-caret-down': properties.sort() == 'desc', 'fa-caret-up': properties.sort() == 'asc' }"></i>
- <span data-bind="visible: properties.sort() == 'desc'">${_('descending')}</span>
- <span data-bind="visible: properties.sort() == 'asc'">${_('ascending')}</span>
- </a>
- </div>
- <!-- ko if: type() == 'pivot' -->
- <div class="facet-field-cnt">
- <span class="spinedit-cnt">
- <span class="facet-field-label facet-field-label-fixed-width">
- ${ _('Limit') }
- </span>
- <input type="text" class="input-medium" data-bind="spinedit: properties.limit"/>
- </span>
- </div>
- <div class="facet-field-cnt">
- <span class="spinedit-cnt">
- <span class="facet-field-label facet-field-label-fixed-width">
- ${ _('Min Count') }
- </span>
- <input type="text" class="input-medium" data-bind="spinedit: properties.mincount"/>
- </span>
- </div>
- <!-- /ko -->
- <!-- ko if: type() == 'range' || type() == 'range-up' || (type() == 'nested' && typeof properties.min != "undefined") -->
- <!-- ko ifnot: properties.isDate() -->
- <div class="slider-cnt" data-bind="slider: {start: properties.min, end: properties.max, gap: properties.initial_gap, min: properties.initial_start, max: properties.initial_end, properties: properties, labels: SLIDER_LABELS}"></div>
- <!-- /ko -->
- <!-- ko if: properties.isDate() && $root.collection.timeFilter && $root.collection.timeFilter.field && $root.collection.timeFilter.field() != field() -->
- <div data-bind="daterangepicker: {start: properties.start, end: properties.end, gap: properties.initial_gap, relatedgap: properties.gap, min: properties.min, max: properties.max}"></div>
- <!-- /ko -->
- <!-- /ko -->
- <!-- ko if: type() == 'field' -->
- <div class="facet-field-cnt">
- <span class="spinedit-cnt">
- <span class="facet-field-label facet-field-label-fixed-width">
- ${ _('Limit') }
- </span>
- <input type="text" class="input-medium" data-bind="spinedit: properties.limit"/>
- </span>
- </div>
- <!-- /ko -->
- <!-- ko if: widgetType() == 'map-widget' || widgetType() == 'gradient-map-widget' -->
- <div class="facet-field-cnt">
- <span class="spinedit-cnt">
- <span class="facet-field-label facet-field-label-fixed-width">
- ${ _('Scope') }
- </span>
- <select data-bind="selectedOptions: properties.scope" class="input-small">
- <option value="world">${ _("World") }</option>
- <option value="europe">${ _("Europe") }</option>
- <option value="aus">${ _("Australia") }</option>
- <option value="bra">${ _("Brazil") }</option>
- <option value="can">${ _("Canada") }</option>
- <option value="chn">${ _("China") }</option>
- <option value="fra">${ _("France") }</option>
- <option value="deu">${ _("Germany") }</option>
- <option value="ita">${ _("Italy") }</option>
- <option value="jpn">${ _("Japan") }</option>
- <option value="gbr">${ _("UK") }</option>
- <option value="usa">${ _("USA") }</option>
- </select>
- </span>
- </div>
- <!-- /ko -->
- </div>
- <!-- ko if: type() == 'pivot' || type() == 'nested' -->
- <div class="facet-field-tile" data-bind="visible: properties.scope() == 'tree' || (type() == 'pivot' && properties.facets().length == 0) || (type() == 'nested' && properties.facets().length < 3)">
- <div class="facet-field-cnt">
- <span class="facet-field-label facet-field-label-fixed-width facet-field-label-fixed-width-double facet-field-label-title">
- ${ _('Add a dimension') }
- </span>
- </div>
- <div class="facet-field-cnt">
- <span class="spinedit-cnt">
- <span class="facet-field-label facet-field-label-fixed-width">
- ${ _('Field') }
- </span>
- <select data-bind="options: $root.collection.template.fieldsNames, value: properties.facets_form.field, optionsCaption: '${ _ko('Choose...') }', selectize: $root.collection.template.fieldsNames"></select>
- </span>
- </div>
- <!-- ko if: type() == 'nested' -->
- <div class="facet-field-cnt">
- <span class="spinedit-cnt">
- <span class="facet-field-label facet-field-label-fixed-width">
- ${ _('Metric') }
- </span>
- <select data-bind="options: HIT_OPTIONS, optionsText: 'label', optionsValue: 'value', value: properties.facets_form.aggregate"></select>
- </span>
- </div>
- <!-- /ko -->
- <div class="facet-field-cnt">
- <span class="spinedit-cnt">
- <span class="facet-field-label facet-field-label-fixed-width">
- ${ _('Limit') }
- </span>
- <input type="text" class="input-medium" data-bind="spinedit: properties.facets_form.limit"/>
- </span>
- </div>
- <div class="facet-field-cnt">
- <span class="spinedit-cnt">
- <span class="facet-field-label facet-field-label-fixed-width">
- ${ _('Min Count') }
- </span>
- <input type="text" class="input-medium" data-bind="spinedit: properties.facets_form.mincount"/>
- <a class="pull-right" href="javascript: void(0)" data-bind="visible: ko.toJSON(properties.facets_form.field), click: $root.collection.addPivotFacetValue">
- <i class="fa fa-plus"></i>
- </a>
- </span>
- </div>
- </div>
- <!-- /ko -->
- <div class="clearfix"></div>
- </script>
- <script type="text/html" id="facet-toggle2">
- <div class="pull-left margin-right-20">
- ## <!-- ko if: $root.isEditing -->
- ## <!-- ko if: properties.canRange() && typeof properties.type != "undefined" -->
- ## <div class="facet-field-cnt">
- ## <span class="facet-field-label facet-field-label-fixed-width">${ _('Type') }</span>
- ## <a href="javascript: void(0)" title="${ _('Toggle how to group the values') }" data-bind="click: $root.collection.toggleRangeFacet2">
- ## <i class="fa" data-bind="css: { 'fa-arrows-h': properties.type() == 'range', 'fa-circle': properties.type() == 'field', 'fa-level-up': properties.type() == 'range-up' }, attr: { title: properties.type() == 'field' ? 'Range' : properties.type() == 'range-up' ? 'Range and up' : 'Term' }"></i>
- ## <span data-bind="visible: properties.type() == 'range'">${_('range')}</span>
- ## <span data-bind="visible: properties.type() == 'range-up'">${_('range & up')}</span>
- ## <span data-bind="visible: properties.type() == 'field'">${_('field')}</span>
- ## </a>
- ## </div>
- ## <!-- /ko -->
- ##
- ## <!-- ko if: widgetType() != 'hit-widget' -->
- ## <div class="facet-field-cnt">
- ## <span class="facet-field-label facet-field-label-fixed-width">${ _('Sorting') }</span>
- ## <a href="javascript: void(0)" title="${ _('Toggle sort order') }" data-bind="click: function() { $root.collection.toggleSortFacet2($data, $data); }">
- ## <i class="fa" data-bind="css: { 'fa-caret-down': properties.sort() == 'desc', 'fa-caret-up': properties.sort() == 'asc', 'fa-sort': properties.sort() == 'default' }"></i>
- ## <span data-bind="visible: properties.sort() == 'desc'">${_('descending')}</span>
- ## <span data-bind="visible: properties.sort() == 'asc'">${_('ascending')}</span>
- ## <span data-bind="visible: properties.sort() == 'default'">${_('default')}</span>
- ## </a>
- ## </div>
- ## <!-- /ko -->
- ##
- ##
- ## <!-- ko if: type() == 'range' || type() == 'range-up' || (type() == 'nested' && typeof properties.min != "undefined") -->
- ## <!-- ko ifnot: properties.isDate() -->
- ## <div class="slider-cnt" data-bind="slider: {start: properties.min, end: properties.max, gap: properties.initial_gap, min: properties.initial_start, max: properties.initial_end, properties: properties, labels: SLIDER_LABELS}"></div>
- ## <!-- /ko -->
- ## <!-- ko if: properties.isDate() && $root.collection.timeFilter && $root.collection.timeFilter.field && $root.collection.timeFilter.field() != field() -->
- ## <div data-bind="daterangepicker: {start: properties.start, end: properties.end, gap: properties.initial_gap, relatedgap: properties.gap, min: properties.min, max: properties.max}"></div>
- ## <!-- /ko -->
- ## <!-- /ko -->
- ## <!-- /ko -->
- ## </div>
- <!-- ko if: $root.isEditing -->
- <div class="facet-field-cnt" data-bind="visible: $root.collection.nested.enabled">
- <span class="spinedit-cnt">
- <span class="facet-field-label">
- ${ _('Domain') }
- </span>
- ${ _('Parent') }
- <select data-bind="selectedOptions: properties.domain.blockParent, options: $root.collection.nestedNames" size="5" multiple="true"></select>
- ${ _('Children') }
- <select data-bind="selectedOptions: properties.domain.blockChildren, options: $root.collection.nestedNames" size="5" multiple="true"></select>
- <input type="text" class="input-medium" data-bind="spinedit: properties.mincount"/>
- </span>
- </div>
- <ul data-bind="sortable: { data: properties.facets, options: { axis: 'x', containment: 'parent', handle: '.title' }}" class="unstyled pull-left white">
- <li class="filter-box">
- <div class="title move">
- <a data-bind="click: function() { $root.collection.removePivotFacetValue({'pivot_facet': $parent, 'value': $data}); }, visible: $parent.properties.facets().length > 1" class="pull-right" href="javascript:void(0)">
- <i class="fa fa-times"></i>
- </a>
- <div class="hit-title" data-bind="text: field, attr: {'title': field}"></div>
- <div class="clearfix"></div>
- </div>
- <div class="content">
- <div class="facet-field-cnt">
- <span class="spinedit-cnt">
- <span data-bind="template: { name: 'metric-form' }"></span>
- </span>
- </div>
- </div>
- </li>
- </ul>
- <!-- /ko -->
- <!-- ko ifnot: $root.isEditing -->
- <span data-bind="foreach: properties.facets, visible: ! $parents[1].isLoading()">
- <div class="filter-box" style="opacity: 0.7">
- <div class="content content-readonly">
- <strong class="hit-title" data-bind="text: field, attr: {'title': field}"></strong>
- <span class="spinedit-cnt">
- <span data-bind="template: { name: 'metric-form' }"></span>
- </span>
- </div>
- </div>
- </span>
- <!-- /ko -->
- <!-- ko if: widgetType() == 'gradient-map-widget' -->
- <div class="facet-field-cnt">
- <span class="spinedit-cnt">
- <span class="facet-field-label facet-field-label-fixed-width">
- ${ _('Scope') }
- </span>
- <select data-bind="selectedOptions: properties.scope" class="input-small">
- <option value="world">${ _("World") }</option>
- <option value="europe">${ _("Europe") }</option>
- <option value="aus">${ _("Australia") }</option>
- <option value="bra">${ _("Brazil") }</option>
- <option value="can">${ _("Canada") }</option>
- <option value="chn">${ _("China") }</option>
- <option value="fra">${ _("France") }</option>
- <option value="deu">${ _("Germany") }</option>
- <option value="ita">${ _("Italy") }</option>
- <option value="jpn">${ _("Japan") }</option>
- <option value="gbr">${ _("UK") }</option>
- <option value="usa">${ _("USA") }</option>
- </select>
- </span>
- </div>
- <!-- /ko -->
- <div class="filter-box" data-bind="visible: $root.isEditing() && properties.facets().length < 15 && widgetType() != 'hit-widget'" style="opacity: 0.7">
- <div class="title" style="border: 1px dashed #d8d8d8; border-bottom: none">
- <a data-bind="visible: properties.facets_form.field() && properties.facets_form.field() != 'formula' || properties.facets_form.aggregate.formula(), click: $root.collection.addPivotFacetValue2" class="pull-right" href="javascript:void(0)">
- <i class="fa fa-fw fa-plus"></i> ${ _('Add') }
- </a>
- </div>
- <div class="content" style="border: 1px dashed #d8d8d8; border-top: none">
- <div class="facet-field-cnt">
- <span class="spinedit-cnt">
- <span class="facet-field-label"></span>
- <span data-bind="template: { name: 'metric-form', data: properties.facets_form }"></span>
- </span>
- </div>
- </div>
- </div>
- <div class="clearfix"></div>
- </script>
- <script type="text/html" id="facet-widget">
- <div class="widget-spinner" data-bind="visible: isLoading()">
- <i class="fa fa-spinner fa-spin"></i>
- </div>
- <!-- ko if: $root.getFacetFromQuery(id()).has_data() -->
- <div class="row-fluid" data-bind="with: $root.getFacetFromQuery(id())">
- <div data-bind="visible: $root.isEditing, with: $root.collection.getFacetById($parent.id())" style="margin-bottom: 20px">
- <span data-bind="template: { name: 'facet-toggle', afterRender: function(){ $root.getWidgetById($parent.id()).isLoading(false); } }"></span>
- </div>
- <div class="clearfix"></div>
- <div data-bind="with: $root.collection.getFacetById($parent.id())">
- <!-- ko if: type() == 'field' -->
- <div data-bind="foreach: $parent.counts">
- <div class="trigger-exclude">
- <!-- ko if: $index() < $parent.properties.limit() -->
- <!-- ko if: ! $data.selected -->
- <a class="exclude pointer" data-bind="click: function(){ $root.query.toggleFacet({facet: $data, widget_id: $parent.id(), 'exclude': true}) }" title="${ _('Exclude this value') }"><i class="fa fa-minus"></i></a>
- <div class="hellip">
- <a class="pointer" dir="ltr" data-bind="html: prettifyDate($data.value), click: function(){ $root.query.toggleFacet({facet: $data, widget_id: $parent.id()}) }, attr: {'title': $data.value + ' (' + $data.count + ')'}"></a>
- <span class="pointer counter" dir="rtl" data-bind="text: ' (' + $data.count + ')', click: function(){ $root.query.toggleFacet({facet: $data, widget_id: $parent.id()}) }"></span>
- </div>
- <!-- /ko -->
- <!-- ko if: $data.selected -->
- <span class="pointer" data-bind="click: function(){ $root.query.toggleFacet({facet: $data, widget_id: $parent.id()}) }">
- <a class="include pointer" data-bind="visible: ! exclude"><i class="fa fa-times"></i></a>
- <a class="include pointer" data-bind="visible: exclude"><i class="fa fa-plus"></i></a>
- <div class="hellip">
- <strong data-bind="html: prettifyDate($data.value), attr: {'title': $data.value}"></strong>
- </div>
- </span>
- <!-- /ko -->
- <!-- /ko -->
- <!-- ko if: $index() == $parent.properties.limit() -->
- <!-- ko if: $parent.properties.prevLimit == undefined || $parent.properties.prevLimit == $parent.properties.limit() -->
- <a class="pointer" data-bind="click: function(){ $root.collection.upDownFacetLimit($parent.id(), 'up') }">
- ${ _('Show more...') }
- </a>
- <!-- /ko -->
- <!-- ko if: $parent.properties.prevLimit != undefined && $parent.properties.prevLimit != $parent.properties.limit() -->
- <a class="pointer" data-bind="click: function(){ $root.collection.upDownFacetLimit($parent.id(), 'up') }">
- ${ _('Show more') }
- </a>
- /
- <a class="pointer" data-bind="click: function(){ $root.collection.upDownFacetLimit($parent.id(), 'down') }">
- ${ _('less...') }
- </a>
- <!-- /ko -->
- <!-- /ko -->
- </div>
- </div>
- <!-- /ko -->
- <!-- ko if: type() == 'range' -->
- <div data-bind="foreach: $parent.counts">
- <div class="trigger-exclude">
- <!-- ko if: ! selected -->
- <a class="exclude pointer" data-bind="click: function(){ $root.query.selectRangeFacet({count: $data.value, widget_id: $parent.id(), from: $data.from, to: $data.to, cat: $data.field, 'exclude': true}) }" title="${ _('Exclude this value') }"><i class="fa fa-minus"></i></a>
- <div class="hellip">
- <a class="pointer" data-bind="html: $data.is_single_unit_gap ? prettifyDate($data.from, $parent, $data.to) : prettifyDateRange($data.from, $data.to, $parent, false), click: function(){ $root.query.selectRangeFacet({count: $data.value, widget_id: $parent.id(), from: $data.from, to: $data.to, cat: $data.field}) }, attr: {'title': ($data.is_single_unit_gap ? $data.from : $data.from + ' - ' + $data.to) + ' (' + $data.value + ')'}"></a>
- <span class="pointer counter" data-bind="text: ' (' + $data.value + ')', click: function(){ $root.query.selectRangeFacet({count: $data.value, widget_id: $parent.id(), from: $data.from, to: $data.to, cat: $data.field}) }"></span>
- </div>
- <!-- /ko -->
- <!-- ko if: selected -->
- <span class="pointer" data-bind="click: function(){ $root.query.selectRangeFacet({count: $data.value, widget_id: $parent.id(), from: $data.from, to: $data.to, cat: $data.field}) }">
- <a class="include pointer" data-bind="visible: ! exclude"><i class="fa fa-times"></i></a>
- <a class="include pointer" data-bind="visible: exclude"><i class="fa fa-plus"></i></a>
- <div class="hellip">
- <strong data-bind="html: $data.is_single_unit_gap ? prettifyDate($data.from, $parent, $data.to) : prettifyDateRange($data.from, $data.to, $parent, false), attr: {'title': ($data.is_single_unit_gap ? $data.from : $data.from + ' - ' + $data.to) + ' (' + $data.value + ')'}"></strong>
- </div>
- </span>
- <!-- /ko -->
- </div>
- </div>
- <!-- /ko -->
- <!-- ko if: type() == 'range-up' -->
- <div data-bind="foreach: $parent.counts">
- <div class="trigger-exclude">
- <!-- ko if: ! selected -->
- <a class="exclude pointer" data-bind="click: function(){ $root.query.selectRangeUpFacet({count: $data.value, widget_id: $parent.id(), from: $data.from, to: $data.to, cat: $data.field, 'exclude': true, is_up: $data.is_up}) }" title="${ _('Exclude this value') }"><i class="fa fa-minus"></i></a>
- <div class="hellip">
- <a class="pointer" data-bind="html: prettifyDate($data.from, $parent) + ($data.is_up ? ' & Up' : ' & Less'), click: function(){ $root.query.selectRangeUpFacet({count: $data.value, widget_id: $parent.id(), from: $data.from, to: $data.to, cat: $data.field, is_up: $data.is_up}) }, attr: {'title': $data.from + ($data.is_up ? ' & Up' : ' & Less') + ' (' + $data.total_counts + ')'}"></a>
- <span class="pointer counter" data-bind="text: ' (' + $data.total_counts + ')', click: function(){ $root.query.selectRangeUpFacet({count: $data.value, widget_id: $parent.id(), from: $data.from, to: $data.to, cat: $data.field, is_up: $data.is_up}) }"></span>
- </div>
- <!-- /ko -->
- <!-- ko if: selected -->
- <span class="pointer" data-bind="click: function(){ $root.query.selectRangeUpFacet({count: $data.value, widget_id: $parent.id(), from: $data.from, to: $data.to, cat: $data.field, is_up: $data.is_up}) }">
- <a class="include pointer" data-bind="visible: ! exclude"><i class="fa fa-times"></i></a>
- <a class="include pointer" data-bind="visible: exclude"><i class="fa fa-plus"></i></a>
- <div class="hellip">
- <strong data-bind="html: prettifyDate($data.from, $parent) + ($data.is_up ? ' & Up' : ' & Less')"></strong>
- </div>
- </span>
- <!-- /ko -->
- </div>
- </div>
- <!-- /ko -->
- </div>
- </div>
- <!-- /ko -->
- </script>
- <script type="text/html" id="text-facet-widget">
- <div class="widget-spinner" data-bind="visible: isLoading()">
- <i class="fa fa-spinner fa-spin"></i>
- </div>
- <!-- ko if: $root.getFacetFromQuery(id()).has_data() -->
- <div class="row-fluid" data-bind="with: $root.getFacetFromQuery(id())">
- <div data-bind="visible: $root.isEditing, with: $root.collection.getFacetById($parent.id())" style="margin-bottom: 20px">
- <span data-bind="template: { name: 'facet-toggle2', afterRender: function(){ $root.getWidgetById($parent.id()).isLoading(false); } }">
- </span>
- </div>
- <div class="clearfix"></div>
- <div data-bind="with: $root.collection.getFacetById($parent.id())">
- <!-- ko if: properties.type() == 'field' -->
- <div data-bind="foreach: $parent.counts">
- <div class="trigger-exclude">
- <!-- ko if: $index() < $parent.properties.limit() -->
- <!-- ko if: ! $data.selected -->
- <a class="exclude pointer" data-bind="click: function(){ $root.query.toggleFacet({facet: $data, widget_id: $parent.id(), 'exclude': true}) }" title="${ _('Exclude this value') }"><i class="fa fa-minus"></i></a>
- <div class="hellip">
- <a class="pointer" dir="ltr" data-bind="html: prettifyDate($data.value), click: function(){ $root.query.toggleFacet({facet: $data, widget_id: $parent.id()}) }, attr: {'title': $data.value + ' (' + $data.count + ')'}"></a>
- <span class="pointer counter" dir="rtl" data-bind="text: ' (' + $data.count + ')', click: function(){ $root.query.toggleFacet({facet: $data, widget_id: $parent.id()}) }"></span>
- </div>
- <!-- /ko -->
- <!-- ko if: $data.selected -->
- <span class="pointer" data-bind="click: function(){ $root.query.toggleFacet({facet: $data, widget_id: $parent.id()}) }">
- <a class="include pointer" data-bind="visible: ! exclude"><i class="fa fa-times"></i></a>
- <a class="include pointer" data-bind="visible: exclude"><i class="fa fa-plus"></i></a>
- <div class="hellip">
- <strong data-bind="html: prettifyDate($data.value), attr: {'title': $data.value}"></strong>
- </div>
- </span>
- <!-- /ko -->
- <!-- /ko -->
- <!-- ko if: $index() == $parent.properties.limit() -->
- <!-- ko if: $parent.properties.prevLimit == undefined || $parent.properties.prevLimit == $parent.properties.limit() -->
- <a class="pointer" data-bind="click: function(){ $root.collection.upDownFacetLimit($parent.id(), 'up') }">
- ${ _('Show more...') }
- </a>
- <!-- /ko -->
- <!-- ko if: $parent.properties.prevLimit != undefined && $parent.properties.prevLimit != $parent.properties.limit() -->
- <a class="pointer" data-bind="click: function(){ $root.collection.upDownFacetLimit($parent.id(), 'up') }">
- ${ _('Show more') }
- </a>
- /
- <a class="pointer" data-bind="click: function(){ $root.collection.upDownFacetLimit($parent.id(), 'down') }">
- ${ _('less...') }
- </a>
- <!-- /ko -->
- <!-- /ko -->
- </div>
- </div>
- <!-- /ko -->
- <!-- ko if: properties.type() == 'range' -->
- <div data-bind="foreach: $parent.counts">
- <div class="trigger-exclude">
- <!-- ko if: ! selected -->
- <a class="exclude pointer" data-bind="click: function(){ $root.query.selectRangeFacet({count: $data.value, widget_id: $parent.id(), from: $data.from, to: $data.to, cat: $data.field, 'exclude': true}) }" title="${ _('Exclude this value') }"><i class="fa fa-minus"></i></a>
- <div class="hellip">
- <a class="pointer" data-bind="html: $data.is_single_unit_gap ? prettifyDate($data.from, $parent, $data.to) : prettifyDateRange($data.from, $data.to, $parent, false), click: function(){ $root.query.selectRangeFacet({count: $data.value, widget_id: $parent.id(), from: $data.from, to: $data.to, cat: $data.field}) }, attr: {'title': ($data.is_single_unit_gap ? $data.from : $data.from + ' - ' + $data.to) + ' (' + $data.value + ')'}"></a>
- <span class="pointer counter" data-bind="text: ' (' + $data.value + ')', click: function(){ $root.query.selectRangeFacet({count: $data.value, widget_id: $parent.id(), from: $data.from, to: $data.to, cat: $data.field}) }"></span>
- </div>
- <!-- /ko -->
- <!-- ko if: selected -->
- <span class="pointer" data-bind="click: function(){ $root.query.selectRangeFacet({count: $data.value, widget_id: $parent.id(), from: $data.from, to: $data.to, cat: $data.field}) }">
- <a class="include pointer" data-bind="visible: ! exclude"><i class="fa fa-times"></i></a>
- <a class="include pointer" data-bind="visible: exclude"><i class="fa fa-plus"></i></a>
- <div class="hellip">
- <strong data-bind="html: $data.is_single_unit_gap ? prettifyDate($data.from, $parent, $data.to) : prettifyDateRange($data.from, $data.to, $parent, false), attr: {'title': ($data.is_single_unit_gap ? $data.from : $data.from + ' - ' + $data.to) + ' (' + $data.value + ')'}"></strong>
- </div>
- </span>
- <!-- /ko -->
- </div>
- </div>
- <!-- /ko -->
- <!-- ko if: properties.type() == 'range-up' -->
- <div data-bind="foreach: $parent.counts">
- <div class="trigger-exclude">
- <!-- ko if: ! selected -->
- <a class="exclude pointer" data-bind="click: function(){ $root.query.selectRangeUpFacet({count: $data.value, widget_id: $parent.id(), from: $data.from, to: $data.to, cat: $data.field, 'exclude': true, is_up: $data.is_up}) }" title="${ _('Exclude this value') }"><i class="fa fa-minus"></i></a>
- <div class="hellip">
- <a class="pointer" data-bind="html: prettifyDate($data.from, $parent) + ($data.is_up ? ' & Up' : ' & Less'), click: function(){ $root.query.selectRangeUpFacet({count: $data.value, widget_id: $parent.id(), from: $data.from, to: $data.to, cat: $data.field, is_up: $data.is_up}) }, attr: {'title': $data.from + ($data.is_up ? ' & Up' : ' & Less') + ' (' + $data.total_counts + ')'}"></a>
- <span class="pointer counter" data-bind="text: ' (' + $data.total_counts + ')', click: function(){ $root.query.selectRangeUpFacet({count: $data.value, widget_id: $parent.id(), from: $data.from, to: $data.to, cat: $data.field, is_up: $data.is_up}) }"></span>
- </div>
- <!-- /ko -->
- <!-- ko if: selected -->
- <span class="pointer" data-bind="click: function(){ $root.query.selectRangeUpFacet({count: $data.value, widget_id: $parent.id(), from: $data.from, to: $data.to, cat: $data.field, is_up: $data.is_up}) }">
- <a class="include pointer" data-bind="visible: ! exclude"><i class="fa fa-times"></i></a>
- <a class="include pointer" data-bind="visible: exclude"><i class="fa fa-plus"></i></a>
- <div class="hellip">
- <strong data-bind="html: prettifyDate($data.from, $parent) + ($data.is_up ? ' & Up' : ' & Less')"></strong>
- </div>
- </span>
- <!-- /ko -->
- </div>
- </div>
- <!-- /ko -->
- </div>
- </div>
- <!-- /ko -->
- </script>
- <script type="text/html" id="resultset-widget">
- <!-- ko if: $root.collection.template.isGridLayout() -->
- <!-- ko with: $root -->
- <!-- ko if: $root.hasRetrievedResults() && $root.response().response -->
- <span data-bind="template: {name: 'data-grid', data: $root.collection}"></span>
- <!-- /ko -->
- <!-- /ko -->
- <!-- /ko -->
- </script>
- <script type="text/html" id="grid-chart-settings">
- <!-- ko if: $parent.widgetType() == 'resultset-widget' -->
- <ul class="nav nav-list" style="border: none; background-color: #FFF" data-bind="visible: chartType() != ''">
- <li data-bind="visible: [ko.HUE_CHARTS.TYPES.MAP, ko.HUE_CHARTS.TYPES.GRADIENTMAP, ko.HUE_CHARTS.TYPES.PIECHART].indexOf(chartType()) == -1" class="nav-header">${_('x-axis')}</li>
- <li data-bind="visible: chartType() == ko.HUE_CHARTS.TYPES.GRADIENTMAP" class="nav-header">${_('region')}</li>
- <li data-bind="visible: chartType() == ko.HUE_CHARTS.TYPES.MAP" class="nav-header">${_('latitude')}</li>
- <li data-bind="visible: chartType() == ko.HUE_CHARTS.TYPES.PIECHART" class="nav-header">${_('legend')}</li>
- </ul>
- <div data-bind="visible: chartType() != ''">
- <select data-bind="options: (chartType() == ko.HUE_CHARTS.TYPES.BARCHART || chartType() == ko.HUE_CHARTS.TYPES.PIECHART) ? $root.collection.template.cleanedMeta : $root.collection.template.cleanedNumericMeta, value: chartX, optionsText: 'name', optionsValue: 'name', optionsCaption: '${_ko('Choose a column...')}', select2: { width: '100%', placeholder: '${ _ko("Choose a column...") }', update: chartX}" class="input-medium"></select>
- </div>
- <ul class="nav nav-list" style="border: none; background-color: #FFF" data-bind="visible: chartType() != ''">
- <li data-bind="visible: [ko.HUE_CHARTS.TYPES.MAP, ko.HUE_CHARTS.TYPES.GRADIENTMAP, ko.HUE_CHARTS.TYPES.PIECHART].indexOf(chartType()) == -1" class="nav-header">${_('y-axis')}</li>
- <li data-bind="visible: chartType() == ko.HUE_CHARTS.TYPES.MAP" class="nav-header">${_('longitude')}</li>
- <li data-bind="visible: chartType() == ko.HUE_CHARTS.TYPES.PIECHART" class="nav-header">${_('value')}</li>
- </ul>
- <div style="overflow-y: auto; max-height: 220px" data-bind="visible: chartType() != '' && (chartType() == ko.HUE_CHARTS.TYPES.BARCHART || chartType() == ko.HUE_CHARTS.TYPES.LINECHART)">
- <ul class="unstyled" data-bind="foreach: $root.collection.template.cleanedNumericMeta">
- <li><input type="checkbox" data-bind="checkedValue: name, checked: $parent.chartYMulti" /> <span data-bind="text: $data.name"></span></li>
- </ul>
- </div>
- <div data-bind="visible: chartType() == ko.HUE_CHARTS.TYPES.PIECHART || chartType() == ko.HUE_CHARTS.TYPES.MAP">
- <select data-bind="options: chartType() == ko.HUE_CHARTS.TYPES.GRADIENTMAP ? $root.collection.template.cleanedMeta : $root.collection.template.cleanedNumericMeta, value: chartYSingle, optionsText: 'name', optionsValue: 'name', optionsCaption: '${_ko('Choose a column...')}', select2: { width: '100%', placeholder: '${ _ko("Choose a column...") }', update: chartYSingle}" class="input-medium"></select>
- </div>
- <ul class="nav nav-list" style="border: none; background-color: #FFF" data-bind="visible: chartType() != '' && chartType() == ko.HUE_CHARTS.TYPES.MAP">
- <li class="nav-header">${_('label')}</li>
- </ul>
- <div data-bind="visible: chartType() == ko.HUE_CHARTS.TYPES.MAP">
- <select data-bind="options: $root.collection.template.cleanedMeta, value: chartMapLabel, optionsText: 'name', optionsValue: 'name', optionsCaption: '${_ko('Choose a column...')}', select2: { width: '100%', placeholder: '${ _ko("Choose a column...") }', update: chartMapLabel}" class="input-medium"></select>
- </div>
- <ul class="nav nav-list" style="border: none; background-color: #FFF" data-bind="visible: chartType() != '' && chartType() != ko.HUE_CHARTS.TYPES.MAP">
- <li class="nav-header">${_('sorting')}</li>
- </ul>
- <div class="btn-group" data-toggle="buttons-radio" data-bind="visible: chartType() != '' && chartType() != ko.HUE_CHARTS.TYPES.MAP">
- <a rel="tooltip" data-placement="top" title="${_('No sorting')}" href="javascript:void(0)" class="btn" data-bind="css: {'active': chartSorting() == 'none'}, click: function(){ chartSorting('none'); }"><i class="fa fa-align-left fa-rotate-270"></i></a>
- <a rel="tooltip" data-placement="top" title="${_('Sort ascending')}" href="javascript:void(0)" class="btn" data-bind="css: {'active': chartSorting() == 'asc'}, click: function(){ chartSorting('asc'); }"><i class="fa fa-sort-amount-asc fa-rotate-270"></i></a>
- <a rel="tooltip" data-placement="top" title="${_('Sort descending')}" href="javascript:void(0)" class="btn" data-bind="css: {'active': chartSorting() == 'desc'}, click: function(){ chartSorting('desc'); }"><i class="fa fa-sort-amount-desc fa-rotate-270"></i></a>
- </div>
- <!-- /ko -->
- </script>
- <script type="text/html" id="html-resultset-widget">
- <!-- ko ifnot: $root.collection.template.isGridLayout() -->
- <div data-bind="visible: $root.isEditing" style="margin-bottom: 20px">
- <ul class="nav nav-pills">
- <li class="active"><a href="javascript: void(0)" class="widget-editor-pill">${_('Editor')}</a></li>
- <li><a href="javascript: void(0)" class="widget-html-pill">${_('HTML')}</a></li>
- <li><a href="javascript: void(0)" class="widget-css-pill">${_('CSS & JS')}</a></li>
- <li><a href="javascript: void(0)" class="widget-settings-pill">${_('Sorting')}</a></li>
- </ul>
- </div>
- <!-- ko if: $root.isEditing() -->
- <div class="widget-section widget-editor-section">
- <div class="row-fluid">
- <div class="span9">
- <div data-bind="freshereditor: {data: $root.collection.template.template}"></div>
- </div>
- <div class="span3">
- <h5 class="editor-title">${_('Available Fields')}</h5>
- <select data-bind="options: $root.collection.fields, optionsText: 'name', value: $root.collection.template.selectedVisualField" class="input-large chosen-select"></select>
- <button title="${ _('Click on this button to add the field') }" class="btn plus-btn" data-bind="click: $root.collection.template.addFieldToVisual">
- <i class="fa fa-plus"></i>
- </button>
- <h5 class="editor-title" style="margin-top: 30px">${_('Available Functions')}</h5>
- <select id="visualFunctions" data-bind="value: $root.collection.template.selectedVisualFunction" class="input-large chosen-select">
- <option title="${ _('Formats date or timestamp in DD-MM-YYYY') }" value="{{#date}} {{/date}}">{{#date}}</option>
- <option title="${ _('Formats date or timestamp in HH:mm:ss') }" value="{{#time}} {{/time}}">{{#time}}</option>
- <option title="${ _('Formats date or timestamp in DD-MM-YYYY HH:mm:ss') }" value="{{#datetime}} {{/datetime}}">{{#datetime}}</option>
- <option title="${ _('Formats a date in the full format') }" value="{{#fulldate}} {{/fulldate}}">{{#fulldate}}</option>
- <option title="${ _('Formats a date as a Unix timestamp') }" value="{{#timestamp}} {{/timestamp}}">{{#timestamp}}</option>
- <option title="${ _('Formats a Unix timestamp as Ns, Nmin, Ndays... ago') }" value="{{#fromnow}} {{/fromnow}}">{{#fromnow}}</option>
- <option title="${ _('Downloads and embed the file in the browser') }" value="{{#embeddeddownload}} {{/embeddeddownload}}">{{#embeddeddownload}}</option>
- <option title="${ _('Downloads the linked file') }" value="{{#download}} {{/download}}">{{#download}}</option>
- <option title="${ _('Preview file in File Browser') }" value="{{#preview}} {{/preview}}">{{#preview}}</option>
- <option title="${ _('Truncate a value after 100 characters') }" value="{{#truncate100}} {{/truncate100}}">{{#truncate100}}</option>
- <option title="${ _('Truncate a value after 250 characters') }" value="{{#truncate250}} {{/truncate250}}">{{#truncate250}}</option>
- <option title="${ _('Truncate a value after 500 characters') }" value="{{#truncate500}} {{/truncate500}}">{{#truncate500}}</option>
- </select>
- <button title="${ _('Click on this button to add the function') }" class="btn plus-btn" data-bind="click: $root.collection.template.addFunctionToVisual">
- <i class="fa fa-plus"></i>
- </button>
- <p class="muted" style="margin-top: 10px"></p>
- </div>
- </div>
- </div>
- <div class="widget-section widget-html-section" style="display: none">
- <div class="row-fluid">
- <div class="span9">
- <textarea data-bind="codemirror: {data: $root.collection.template.template, lineNumbers: true, htmlMode: true, mode: 'text/html', stripScript: true }" data-template="true"></textarea>
- </div>
- <div class="span3">
- <h5 class="editor-title">${_('Available Fields')}</h5>
- <select data-bind="options: $root.collection.fields, optionsText: 'name', value: $root.collection.template.selectedSourceField" class="input-medium chosen-select"></select>
- <button title="${ _('Click on this button to add the field') }" class="btn plus-btn" data-bind="click: $root.collection.template.addFieldToSource">
- <i class="fa fa-plus"></i>
- </button>
- <h5 class="editor-title" style="margin-top: 30px">${_('Available Functions')}</h5>
- <select id="sourceFunctions" data-bind="value: $root.collection.template.selectedSourceFunction" class="input-medium chosen-select">
- <option title="${ _('Formats a date in the DD-MM-YYYY format') }" value="{{#date}} {{/date}}">{{#date}}</option>
- <option title="${ _('Formats a date in the HH:mm:ss format') }" value="{{#time}} {{/time}}">{{#time}}</option>
- <option title="${ _('Formats a date in the DD-MM-YYYY HH:mm:ss format') }" value="{{#datetime}} {{/datetime}}">{{#datetime}}</option>
- <option title="${ _('Formats a date in the full format') }" value="{{#fulldate}} {{/fulldate}}">{{#fulldate}}</option>
- <option title="${ _('Formats a date as a Unix timestamp') }" value="{{#timestamp}} {{/timestamp}}">{{#timestamp}}</option>
- <option title="${ _('Shows the relative time') }" value="{{#fromnow}} {{/fromnow}}">{{#fromnow}}</option>
- <option title="${ _('Downloads and embed the file in the browser') }" value="{{#embeddeddownload}} {{/embeddeddownload}}">{{#embeddeddownload}}</option>
- <option title="${ _('Downloads the linked file') }" value="{{#download}} {{/download}}">{{#download}}</option>
- <option title="${ _('Preview file in File Browser') }" value="{{#preview}} {{/preview}}">{{#preview}}</option>
- <option title="${ _('Truncate a value after 100 characters') }" value="{{#truncate100}} {{/truncate100}}">{{#truncate100}}</option>
- <option title="${ _('Truncate a value after 250 characters') }" value="{{#truncate250}} {{/truncate250}}">{{#truncate250}}</option>
- <option title="${ _('Truncate a value after 500 characters') }" value="{{#truncate500}} {{/truncate500}}">{{#truncate500}}</option>
- </select>
- <button title="${ _('Click on this button to add the function') }" class="btn plus-btn" data-bind="click: $root.collection.template.addFunctionToSource">
- <i class="fa fa-plus"></i>
- </button>
- <p class="muted" style="margin-top: 10px"></p>
- </div>
- </div>
- </div>
- <div class="widget-section widget-css-section" style="display: none">
- <textarea data-bind="codemirror: {data: $root.collection.template.extracode, lineNumbers: true, htmlMode: true, mode: 'text/html' }"></textarea>
- </div>
- <div class="widget-section widget-settings-section" style="display: none">
- <div style="overflow-x: scroll; min-height: 40px">
- <table>
- <tr class="result-sorting" data-bind="template: {name: 'result-sorting', data: $root.collection}">
- </tr>
- </table>
- </div>
- <br/>
- </div>
- <!-- /ko -->
- <div class="result-main" style="overflow-x: auto">
- <div data-bind="visible: $root.hasRetrievedResults() && $root.results().length == 0">
- <br/>
- ${ _('Your search did not match any documents.') }
- </div>
- <!-- ko if: $root.response().response && $root.results().length > 0 -->
- <div data-bind="template: {name: 'resultset-pagination', data: $root.response() }"></div>
- <!-- /ko -->
- <table class="result-container" data-bind="visible: $root.hasRetrievedResults()" style="margin-top: 0; width: 100%; border-collapse: initial">
- <thead>
- <tr>
- <th> </th>
- </tr>
- </thead>
- <tbody data-bind="foreach: {data: $root.results, as: 'doc'}" class="result-tbody">
- <tr data-bind="style: {'backgroundColor': $index() % 2 == 0 ? '#FFF': '#F6F6F6'}">
- <td><div data-bind="html: content" style="margin-bottom: -20px"></div></td>
- </tr>
- <tr>
- <td class="show-details-icon pointer" data-bind="click: toggleDocDetails">
- <i class="fa" data-bind="css: {'fa-caret-down' : ! doc.showDetails(), 'fa-caret-up': doc.showDetails()}"></i>
- </td>
- </tr>
- <tr data-bind="visible: doc.showDetails" class="show-details">
- <td data-bind="attr: {'colspan': $root.collection.template.fieldsSelected().length > 0 ? $root.collection.template.fieldsSelected().length + 1 : 2}">
- <span data-bind="template: {name: 'document-details', data: $data}"></span>
- </td>
- </tr>
- </tbody>
- </table>
- <div class="widget-spinner" data-bind="visible: ! $root.hasRetrievedResults()">
- <i class="fa fa-spinner fa-spin"></i>
- </div>
- </div>
- <!-- /ko -->
- </script>
- <script type="text/html" id="document-details">
- <!-- ko if: $data.details().length == 0 -->
- <i class="fa fa-spinner fa-spin"></i>
- <!-- /ko -->
- <!-- ko if: $data.details().length > 0 -->
- <div class="document-details-actions pull-left" data-bind="visible: ${ 'true' if can_edit_index else 'false' } || externalLink()">
- <a href="javascript:void(0)" data-bind="visible: ! showEdit(), click: function() { showEdit(true); }" title="${ _('Edit this document') }">
- <i class="fa fa-edit fa-fw"></i>
- </a>
- <a href="javascript:void(0)" data-bind="visible: showEdit(), click: function(data, e) { $(e.currentTarget).parent().css('marginTop', '8px'); $root.getDocument($data); showEdit(false); }" title="${ _('Undo changes') }">
- <i class="fa fa-undo fa-fw"></i>
- </a>
- <a href="javascript:void(0)" data-bind="visible: showEdit() && originalDetails() != ko.toJSON(details), click: $root.updateDocument" title="${ _('Update this document') }">
- <i class="fa fa-save fa-fw"></i>
- </a>
- <a href="javascript:void(0)" data-bind="visible: externalLink(), attr: { href: externalLink}" target="_blank" title="${ _('Show original document') }">
- <i class="fa fa-external-link fa-fw"></i>
- </a>
- </div>
- <div class="document-details pull-left">
- <table class="table table-condensed">
- <tbody data-bind="foreach: details">
- <tr data-bind="css: {'readonly': ! $parent.showEdit()}">
- <th class="grid-th" data-bind="text: key"></th>
- <td width="100%">
- <span data-bind="text: value, visible: ! $parent.showEdit()"></span>
- <input data-bind="value: value, visible: $parent.showEdit, valueUpdate: 'afterkeydown',
- click: function(detail, e){
- var target = $(e.currentTarget);
- target.parents('.show-details').find('.document-details-actions').animate({
- 'marginTop': (target.position().top - target.parents('table').position().top) + 'px'
- }, 200)
- }" class="input-xxlarge" style="width: 600px" />
- </td>
- </tr>
- </tbody>
- </table>
- <!-- ko if: doc.childDocuments != undefined -->
- <table class="result-container" data-bind="visible: $root.hasRetrievedResults()" style="margin-top: 0; width: 100%; border-collapse: initial">
- <thead>
- <tr data-bind="visible: $root.collection.template.fieldsSelected().length > 0, template: {name: 'result-sorting', data: $root.collection}">
- </tr>
- <tr data-bind="visible: $root.collection.template.fieldsSelected().length == 0">
- <th style="width: 18px"> </th>
- <th>${ _('Child Documents') }</th>
- </tr>
- </thead>
- <tbody data-bind="foreach: {data: childDocuments, as: 'doc'}" class="result-tbody">
- <tr class="result-row" data-bind="style: {'backgroundColor': $index() % 2 == 0 ? '#FFF': '#F6F6F6'}">
- <td>
- <a href="javascript:void(0)" data-bind="click: function() { doc.showDetails(! doc.showDetails()); }">
- <i class="fa" data-bind="css: {'fa-caret-right' : ! doc.showDetails(), 'fa-caret-down': doc.showDetails()}"></i>
- </a>
- </td>
- <!-- ko foreach: row -->
- <td data-bind="html: $data"></td>
- <!-- /ko -->
- </tr>
- <tr data-bind="visible: doc.showDetails" class="show-details">
- <td> </td>
- <td data-bind="attr: {'colspan': $root.collection.template.fieldsSelected().length > 0 ? $root.collection.template.fieldsSelected().length + 1 : 2}">
- <span data-bind="template: {name: 'document-details', data: $data}"></span>
- </td>
- </tr>
- </tbody>
- </table>
- <!-- /ko -->
- </div>
- <!-- /ko -->
- </script>
- <script type="text/html" id="result-sorting">
- <th style="width: 18px"> </th>
- <!-- ko foreach: template.fieldsSelected -->
- <th data-bind="with: $root.collection.getTemplateField($data, $parent.template.fields())" style="white-space: nowrap">
- <span data-bind="text: name, click: $root.collection.toggleSortColumnGridLayout" title="${ _('Click to sort') }"></span>
- <i class="fa fa-sort inactive-action margin-right-10 margin-left-5" data-bind="click: $root.collection.toggleSortColumnGridLayout, css: { 'blue': sort.direction() != null, 'fa-sort-down': sort.direction() == 'desc', 'fa-sort-up': sort.direction() == 'asc' }" title="${ _('Click to sort') }"></i>
- <!-- ko if: $root.isEditing -->
- <!-- ko if: $index() > 0 -->
- <i class="fa fa-caret-left inactive-action" data-bind="click: function(){ $root.collection.translateSelectedField($index(), 'left', $parents[1].template); }" title="${ _('Move to the left') }"></i>
- <!-- /ko -->
- <!-- ko if: $index() < $parents[1].template.fields().length - 1 -->
- <i class="fa fa-caret-right inactive-action" data-bind="click: function(){ $root.collection.translateSelectedField($index(), 'right', $parents[1].template); }" title="${ _('Move to the right') }"></i>
- <!-- /ko -->
- <!-- /ko -->
- </th>
- <!-- /ko -->
- </script>
- <script type="text/html" id="resultset-pagination">
- <div style="text-align: center; margin-top: 4px">
- <a href="javascript: void(0)" title="${ _('Previous') }">
- <span data-bind="click: $root.collection.toggleSortColumnGridLayout"></span>
- <i class="fa fa-chevron-left" data-bind="
- visible: $data.response.start * 1.0 >= ($parent.template ? $parent : $root.collection).template.rows() * 1.0,
- click: function() { $root.query.paginate('prev') }">
- </i>
- </a>
- ${ _('Showing') }
- <span data-bind="text: ($data.response.start + 1)"></span>
- ${ _('to') }
- <span data-bind="text: Math.min(($data.response.start + ($parent.template ? $parent : $root.collection).template.rows()), $data.response.numFound)"></span>
- ${ _('of') }
- <span data-bind="text: $data.response.numFound"></span>
- ${ _(' results') }
- <span data-bind="visible: $root.isEditing()">
- ${ _('Show') }
- <span class="spinedit-cnt">
- <input type="text" data-bind="spinedit: ($parent.template ? $parent : $root.collection).template.rows, valueUpdate:'afterkeydown'" style="text-align: center; margin-bottom: 0" />
- </span>
- ${ _('results per page') }
- </span>
- <a href="javascript: void(0)" title="${ _('Next') }">
- <span data-bind="click: $root.collection.toggleSortColumnGridLayout"></span>
- <i class="fa fa-chevron-right" data-bind="
- visible: (($parent.template ? $parent : $root.collection).template.rows() * 1.0 + $data.response.start * 1.0) < $data.response.numFound,
- click: function() { $root.query.paginate('next') }">
- </i>
- </a>
- </div>
- </script>
- <script type="text/html" id="histogram-widget">
- <div class="widget-spinner" data-bind="visible: isLoading()">
- <i class="fa fa-spinner fa-spin"></i>
- </div>
- <!-- ko if: $root.getFacetFromQuery(id()).has_data() -->
- <div class="row-fluid" data-bind="with: $root.getFacetFromQuery(id())">
- <div data-bind="visible: $root.isEditing, with: $root.collection.getFacetById($parent.id())" style="margin-bottom: 20px">
- <span data-bind="template: { name: 'facet-toggle' }">
- </span>
- </div>
- <div class="clearfix"></div>
- <div style="padding-bottom: 10px; text-align: right; padding-right: 20px" data-bind="visible: counts().length > 0">
- <span data-bind="with: $root.collection.getFacetById($parent.id())">
- <span class="facet-field-label">${ _('Chart Type') }</span>
- <select class="input-small" data-bind="options: $root.timelineChartTypes,
- optionsText: 'label',
- optionsValue: 'value',
- value: properties.timelineChartType">
- </select>
- <span class="facet-field-label">${ _('Interval') }</span>
- <select class="input-small" data-bind="options: $root.intervalOptions,
- optionsText: 'label',
- optionsValue: 'value',
- value: properties.gap">
- </select>
- </span>
- <span class="facet-field-label">${ _('Zoom') }</span>
- <a href="javascript:void(0)" data-bind="click: $root.collection.rangeZoomOut"><i class="fa fa-search-minus"></i> ${ _('reset') }</a>
- <span class="facet-field-label" data-bind="visible: $root.query.multiqs().length > 1">${ _('Group by') }</span>
- <select class="input-medium" data-bind="visible: $root.query.multiqs().length > 1, options: $root.query.multiqs, optionsValue: 'id', optionsText: 'label', value: $root.query.selectedMultiq"></select>
- </div>
- <!-- ko if: $root.collection.getFacetById($parent.id()) -->
- <div data-bind="timelineChart: {datum: {counts: counts(), extraSeries: extraSeries(), widget_id: $parent.id(), label: label()}, stacked: $root.collection.getFacetById($parent.id()).properties.stacked(), enableSelection: $root.collection.getFacetById($parent.id()).properties.enableSelection(), field: field, label: label(), transformer: timelineChartDataTransformer,
- type: $root.collection.getFacetById($parent.id()).properties.timelineChartType,
- fqs: $root.query.fqs,
- onSelectRange: function(from, to){ $root.collection.selectTimelineFacet({from: from, to: to, cat: field, widget_id: $parent.id()}) },
- onStateChange: function(state){ $root.collection.getFacetById($parent.id()).properties.stacked(state.stacked); $root.collection.getFacetById($parent.id()).properties.enableSelection(state.selectionEnabled); },
- onClick: function(d){ $root.query.selectRangeFacet({count: d.obj.value, widget_id: $parent.id(), from: d.obj.from, to: d.obj.to, cat: d.obj.field}) },
- onComplete: function(){ $root.getWidgetById($parent.id()).isLoading(false) }}" />
- <div class="clearfix"></div>
- <!-- /ko -->
- </div>
- <!-- /ko -->
- </script>
- <script type="text/html" id="timeline-widget">
- <div class="widget-spinner" data-bind="visible: isLoading()">
- <i class="fa fa-spinner fa-spin"></i>
- </div>
- <!-- ko if: $root.getFacetFromQuery(id()).has_data() -->
- <div class="row-fluid" data-bind="with: $root.getFacetFromQuery(id())">
- <!-- ko with: $root.collection.getFacetById($parent.id()) -->
- <div style="margin-bottom: 20px">
- <span data-bind="template: { name: 'facet-toggle2' }"></span>
- </div>
- <div style="padding-bottom: 10px; text-align: right; padding-right: 20px">
- <span data-bind="with: $root.collection.getFacetById($parent.id())">
- <span class="facet-field-label">${ _('Chart Type') }</span>
- <select class="input-small" data-bind="options: $root.timelineChartTypes,
- optionsText: 'label',
- optionsValue: 'value',
- value: properties.timelineChartType">
- </select>
- <span class="facet-field-label">${ _('Interval') }</span>
- <select class="input-small" data-bind="options: $root.intervalOptions,
- optionsText: 'label',
- optionsValue: 'value',
- value: properties.gap">
- </select>
- </span>
- <span class="facet-field-label">${ _('Zoom') }</span>
- <a href="javascript:void(0)" data-bind="click: $root.collection.rangeZoomOut"><i class="fa fa-search-minus"></i> ${ _('reset') }</a>
- <span class="facet-field-label" data-bind="visible: $root.query.multiqs().length > 1">${ _('Group by') }</span>
- <select class="input-medium" data-bind="visible: $root.query.multiqs().length > 1, options: $root.query.multiqs, optionsValue: 'id', optionsText: 'label', value: $root.query.selectedMultiq"></select>
- </div>
- <span data-bind="template: { name: 'data-grid' }"></span>
- <!-- /ko -->
- </div>
- <!-- /ko -->
- </script>
- <script type="text/html" id="bar-widget">
- <div class="widget-spinner" data-bind="visible: isLoading()">
- <i class="fa fa-spinner fa-spin"></i>
- </div>
- <!-- ko if: $root.getFacetFromQuery(id()).has_data() -->
- <div class="row-fluid" data-bind="with: $root.getFacetFromQuery(id())">
- <div data-bind="visible: $root.isEditing, with: $root.collection.getFacetById($parent.id())" style="margin-bottom: 20px">
- <span data-bind="template: { name: 'facet-toggle' }">
- </span>
- </div>
- <div class="clearfix"></div>
- <div data-bind="with: $root.collection.getFacetById($parent.id())">
- <!-- ko if: properties.canRange -->
- <div style="padding-bottom: 10px; text-align: right; padding-right: 20px">
- <span class="facet-field-label">${ _('Zoom') }</span>
- <a href="javascript:void(0)" data-bind="click: $root.collection.rangeZoomOut"><i class="fa fa-search-minus"></i> ${ _('reset') }</a>
- </div>
- <!-- /ko -->
- </div>
- <!-- ko if: $root.collection.getFacetById($parent.id()) -->
- <div data-bind="barChart: {datum: {counts: counts(), widget_id: $parent.id(), label: label()}, stacked: $root.collection.getFacetById($parent.id()).properties.stacked(), field: field, label: label(),
- fqs: $root.query.fqs,
- transformer: ($data.type == 'range-up' ? barChartRangeUpDataTransformer : barChartDataTransformer),
- onStateChange: function(state){ $root.collection.getFacetById($parent.id()).properties.stacked(state.stacked); },
- onClick: function(d) {
- if (d.obj.field != undefined) {
- if ($data.type == 'range-up') {
- searchViewModel.query.selectRangeUpFacet({count: d.obj.value, widget_id: d.obj.widget_id, from: d.obj.from, to: d.obj.to, cat: d.obj.field, 'exclude': false, is_up: d.obj.is_up});
- } else {
- searchViewModel.query.selectRangeFacet({count: d.obj.value, widget_id: d.obj.widget_id, from: d.obj.from, to: d.obj.to, cat: d.obj.field});
- }
- } else {
- searchViewModel.query.toggleFacet({facet: d.obj, widget_id: d.obj.widget_id});
- }
- },
- onSelectRange: function(from, to){ searchViewModel.collection.selectTimelineFacet({from: from, to: to, cat: field, widget_id: $parent.id()}) },
- onComplete: function(){ searchViewModel.getWidgetById($parent.id()).isLoading(false) } }"
- />
- <div class="clearfix"></div>
- <!-- /ko -->
- </div>
- <!-- /ko -->
- </script>
- <script type="text/html" id="data-grid">
- <div class="grid-row">
- <div class="grid-left-bar">
- <div>
- <div style="margin-top: 3px">
- <a class="grid-side-btn active" href="javascript: void(0)"
- data-bind="click: function(){ template.showChart(false); template.showGrid(true); }, css: {'active': template.showGrid() }" title="${_('Grid')}">
- <i class="fa fa-th fa-fw"></i>
- </a>
- </div>
- <div class="dropdown">
- <a class="grid-side-btn" style="padding-right:0" href="javascript:void(0)"
- data-bind="css: {'active': template.showChart() }, click: function(){ template.showChart(true); template.showGrid(false); huePubSub.publish('gridChartForceUpdate'); }">
- <i class="hcha hcha-bar-chart fa-fw" data-bind="visible: template.chartSettings.chartType() == ko.HUE_CHARTS.TYPES.BARCHART"></i>
- <i class="hcha hcha-line-chart fa-fw" data-bind="visible: template.chartSettings.chartType() == ko.HUE_CHARTS.TYPES.LINECHART" style="display: none;"></i>
- <i class="hcha hcha-pie-chart fa-fw" data-bind="visible: template.chartSettings.chartType() == ko.HUE_CHARTS.TYPES.PIECHART" style="display: none;"></i>
- <i class="fa fa-fw fa-line-chart" data-bind="visible: template.chartSettings.chartType() == ko.HUE_CHARTS.TYPES.TIMELINECHART" style="display: none;"></i>
- <i class="hcha hcha-map-chart fa-fw" data-bind="visible: template.chartSettings.chartType() == ko.HUE_CHARTS.TYPES.GRADIENTMAP" style="display: none;"></i>
- <i class="fa fa-fw fa-map-marker" data-bind="visible: template.chartSettings.chartType() == ko.HUE_CHARTS.TYPES.MAP" style="display: none;"></i>
- </a>
- <a class="dropdown-toggle grid-side-btn" style="padding:0" data-toggle="dropdown"
- href="javascript: void(0)" data-bind="css: {'active': template.showChart()}">
- <i class="fa fa-caret-down"></i>
- </a>
- <ul class="dropdown-menu">
- <li>
- <a href="javascript:void(0)"
- data-bind="css: {'active': template.chartSettings.chartType() == ko.HUE_CHARTS.TYPES.BARCHART}, click: function(){ template.showChart(true); template.chartSettings.chartType(ko.HUE_CHARTS.TYPES.BARCHART); template.showGrid(false); huePubSub.publish('gridChartForceUpdate');}"
- class="active">
- <i class="hcha hcha-bar-chart fa-fw"></i> ${_('Bars')}
- </a>
- </li>
- <li>
- <a href="javascript:void(0)"
- data-bind="css: {'active': template.chartSettings.chartType() == ko.HUE_CHARTS.TYPES.LINECHART}, click: function(){ template.showChart(true); template.chartSettings.chartType(ko.HUE_CHARTS.TYPES.LINECHART); template.showGrid(false); huePubSub.publish('gridChartForceUpdate');}">
- <i class="hcha hcha-line-chart fa-fw"></i> ${_('Lines')}
- </a>
- </li>
- <li>
- <a href="javascript:void(0)"
- data-bind="css: {'active': template.chartSettings.chartType() == ko.HUE_CHARTS.TYPES.PIECHART}, click: function(){ template.showChart(true); template.chartSettings.chartType(ko.HUE_CHARTS.TYPES.PIECHART); template.showGrid(false); huePubSub.publish('gridChartForceUpdate');}">
- <i class="hcha hcha-pie-chart fa-fw"></i> ${_('Pie')}
- </a>
- </li>
- ##<!-- ko if: widgetType() != 'resultset-widget' -->
- <li>
- <a href="javascript:void(0)"
- data-bind="css: {'active': template.chartSettings.chartType() == ko.HUE_CHARTS.TYPES.TIMELINECHART}, click: function(){ template.showChart(true); template.chartSettings.chartType(ko.HUE_CHARTS.TYPES.TIMELINECHART); template.showGrid(false); huePubSub.publish('gridChartForceUpdate');}">
- <i class="fa fa-fw fa-line-chart"></i> ${_('Timeline')}
- </a>
- </li>
- <li>
- <a href="javascript:void(0)"
- data-bind="css: {'active': template.chartSettings.chartType() == ko.HUE_CHARTS.TYPES.GRADIENTMAP}, click: function(){ template.showChart(true); template.chartSettings.chartType(ko.HUE_CHARTS.TYPES.GRADIENTMAP); template.showGrid(false); huePubSub.publish('gridChartForceUpdate');}">
- <i class="hcha fa-fw hcha-map-chart chart-icon"></i> ${_('Gradient Map')}
- </a>
- </li>
- <li>
- <a href="javascript:void(0)"
- data-bind="css: {'active': template.chartSettings.chartType() == ko.HUE_CHARTS.TYPES.MAP}, click: function(){ template.showChart(true); template.chartSettings.chartType(ko.HUE_CHARTS.TYPES.MAP); template.showGrid(false); huePubSub.publish('gridChartForceUpdate');}">
- <i class="fa fa-fw fa-map-marker chart-icon"></i> ${_('Marker Map')}
- </a>
- </li>
- </ul>
- </div>
- <div data-bind="visible: template.showGrid() || (template.showChart() && widgetType() === 'resultset-widget')">
- <a class="grid-side-btn" href="javascript:void(0)" data-bind="click: function(){ template.showFieldList(!template.showFieldList())}, css: { 'blue' : template.showFieldList() }">
- <!-- ko if: template.showFieldList() -->
- <i class="fa fa-fw fa-chevron-left"></i>
- <!-- /ko -->
- <!-- ko ifnot: template.showFieldList() -->
- <i class="fa fa-fw fa-columns"></i>
- <!-- /ko -->
- </a>
- </div>
- <!-- ko if: $root.collection.engine() != 'solr' -->
- <div data-bind="component: { name: 'downloadSnippetResults', params: { snippet: $data.queryResult(), notebook: {getContext: function() { return {type: $data.queryResult().type(), id: 1}; }} } }" style="display:inline-block;"></div>
- <!-- /ko -->
- <!-- ko if: $root.collection.engine() == 'solr' -->
- <form method="POST" action="${ url('dashboard:download') }" style="display:inline">
- ${ csrf_token(request) | n,unicode }
- <input type="hidden" name="collection" data-bind="value: ko.mapping.toJSON($root.collection)"/>
- <input type="hidden" name="query" data-bind="value: ko.mapping.toJSON($root.query)"/>
- <input type="hidden" name="download">
- <input type="hidden" name="type" value="">
- ## Similar to isGridLayout
- <!-- ko if: widgetType() != 'resultset-widget' -->
- <input type="hidden" name="facet" data-bind="value: ko.mapping.toJSON($data)">
- <!-- /ko -->
- <div class="dropdown">
- <a class="grid-side-btn dropdown-toggle" style="padding-left:7px" data-toggle="dropdown">
- <i class="fa fa-download fa-fw"></i>
- </a>
- <ul class="dropdown-menu">
- <li>
- <a class="download" href="javascript:void(0)" data-bind="click: function(widget, event){ var $f = $(event.currentTarget).parents('form'); $f.find('[name=\'type\']').val('csv'); $f.submit()}" title="${ _('Download first rows as CSV') }">
- <i class="hfo hfo-file-csv"></i> ${ _("CSV") }
- </a>
- </li>
- <li>
- <a class="download" href="javascript:void(0)" data-bind="click: function(widget, event){ var $f = $(event.currentTarget).parents('form'); $f.find('[name=\'type\']').val('xls'); $f.submit()}" title="${ _('Download first rows as XLS') }">
- <i class="hfo hfo-file-xls"></i> ${ _("Excel") }
- </a>
- </li>
- <li>
- <a class="download" href="javascript:void(0)" data-bind="click: function(widget, event){ var $f = $(event.currentTarget).parents('form'); $f.find('[name=\'type\']').val('json'); $f.submit()}" title="${ _('Download first rows as JSON') }">
- <i class="hfo hfo-file-json"></i> ${ _("JSON") }
- </a>
- </li>
- ##<li>
- ##<a class="download" href="javascript:void(0)" data-bind="click: function(widget, event){ var $f = $(event.currentTarget).parents('form'); $f.find('[name=\'type\']').val('json'); $f.submit()}" title="${ _('Export results to a dataset') }">
- ## <i class="fa fa-w fa-save"></i> ${_('Export')}
- ##</a>
- ##</li>
- </ul>
- </div>
- </form>
- <!-- /ko -->
- </div>
- </div>
- </div>
- <div class="grid-results">
- <span data-bind="visible: $parent.hasRetrievedResults() && $parent.response().response">
- <div data-bind="visible: template.showFieldList() && template.showGrid()" style="float:left; width:200px; margin-right:10px; background-color:#FFF; padding:5px;">
- <input type="text" data-bind="clearable: template.fieldsAttributesFilter, valueUpdate:'afterkeydown'" placeholder="${_('Filter fields')}" style="width:180px; margin-bottom:10px" />
- <div style="margin-bottom: 8px">
- <a href="javascript: void(0)" data-bind="click: function(){template.filteredAttributeFieldsAll(true)}, style: {'font-weight': template.filteredAttributeFieldsAll() ? 'bold': 'normal'}">${_('All')} (<span data-bind="text: template.fieldsAttributes().length"></span>)</a> / <a href="javascript: void(0)" data-bind="click: function(){template.filteredAttributeFieldsAll(false)}, style: {'font-weight': ! template.filteredAttributeFieldsAll() ? 'bold': 'normal'}">${_('Current')} (<span data-bind="text: template.fields().length"></span>)</a>
- </div>
- <div style="border-bottom: 1px solid #CCC; padding-bottom: 4px;">
- <a href="javascript: void(0)" class="btn btn-mini"
- data-bind="click: toggleGridFieldsSelection, css: { 'btn-inverse': template.fields().length > 0 }"
- style="margin-right: 2px;">
- <i class="fa fa-square-o"></i>
- </a>
- <strong>${_('Field Name')}</strong>
- </div>
- <div data-bind="visible: template.filteredAttributeFields().length == 0" style="padding-left:4px; padding-top:5px; color:#CCC">
- ${ _('No matches.') }
- </div>
- <div class="fields-list" data-bind="foreach: { data: template.filteredAttributeFields, afterRender: resizeFieldsListThrottled }">
- <div style="margin-bottom: 3px; white-space: nowrap; position:relative">
- <input type="checkbox" data-bind="checkedValue: name, checked: $parent.template.fieldsSelected" style="margin: 0" />
- <div data-bind="text: name, css:{'field-selector': true, 'hoverable': $parent.template.fieldsSelected.indexOf(name()) > -1}, click: highlightColumn, attr: {'title': name() + ' (' + type() + ')'}" style="margin-right:10px"></div>
- <i class="fa fa-question-circle muted pointer analysis" data-bind="click: function(data, e) { $root.fieldAnalysesName(name()); $root.showFieldAnalysis(data, e); }, attr: {'title': '${ _ko('Analyze') }'}, visible: type() != 'aggr'" style="position:absolute; left: 168px; background-color: #FFF"></i>
- </div>
- </div>
- </div>
- <div data-bind="visible: template.showFieldList() && template.showChart() && widgetType() === 'resultset-widget'" style="float:left; width:200px; margin-right:10px; background-color:#FFF; padding:5px;">
- <span data-bind="template: {name: 'grid-chart-settings', data: template.chartSettings}"></span>
- </div>
- </span>
- <div class="widget-spinner" data-bind="visible: ! $parent.hasRetrievedResults() || ! $parent.response().response">
- <i class="fa fa-spinner fa-spin"></i>
- </div>
- <div data-bind="visible: $parent.hasRetrievedResults() && $parent.results().length == 0 && $parent.response().response">
- <br/>
- ${ _('Your search did not match any documents.') }
- </div>
- <div data-bind="visible: $parent.hasRetrievedResults() && $parent.results().length > 0 && template.showGrid()">
- <!-- ko if: $parent.response().response -->
- <div data-bind="template: {name: 'resultset-pagination', data: $parent.response()}" style="padding:8px; color:#666"></div>
- <!-- /ko -->
- <div class="result-main" style="overflow-x: auto">
- <table class="result-container" data-bind="visible: $parent.hasRetrievedResults()" style="margin-top: 0; width: 100%; border-collapse: initial">
- <thead>
- <tr class="result-sorting" data-bind="visible: template.fieldsSelected().length > 0, template: {name: 'result-sorting', afterRender: throttledHeaderScroll}">
- </tr>
- <tr data-bind="visible: template.fieldsSelected().length == 0">
- <th style="width: 18px"> </th>
- <th>${ _('Document') }</th>
- </tr>
- </thead>
- <tbody data-bind="foreach: {data: $parent.results, as: 'doc'}" class="result-tbody">
- <tr class="result-row" data-bind="style: {'backgroundColor': $index() % 2 == 0 ? '#FFF': '#F6F6F6'}">
- <td>
- <a href="javascript:void(0)" data-bind="click: toggleDocDetails">
- <i class="fa" data-bind="css: {'fa-caret-right' : ! doc.showDetails(), 'fa-caret-down': doc.showDetails()}"></i>
- <!-- ko if: doc.childDocuments != undefined -->
-  (<span data-bind="text: doc.childDocuments().length"></span>)
- <!-- /ko -->
- </a>
- </td>
- <!-- ko foreach: row -->
- <td data-bind="html: $data"></td>
- <!-- /ko -->
- </tr>
- <tr data-bind="visible: doc.showDetails" class="show-details">
- <td> </td>
- <td data-bind="attr: {'colspan': $parent.template.fieldsSelected().length > 0 ? $parent.template.fieldsSelected().length + 1 : 2}">
- <span data-bind="template: {name: 'document-details', data: $data}"></span>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <div data-bind="visible: $parent.hasRetrievedResults() && $parent.results().length > 0 && template.showChart()">
- <div data-bind="visible: ! template.hasDataForChart()" style="padding: 10px">${ _('Please select the chart parameters on the left.') }</div>
- <div class="grid-chart-container" data-bind="visible: template.hasDataForChart" style="overflow-x: auto">
- <!-- ko if: widgetType() == 'bucket-widget' -->
- <!-- ko with: $parent -->
- <!-- ko if: dimension() == 1 -->
- <div data-bind="barChart: {datum: {counts: counts(), widget_id: $parent.id(), label: label()}, stacked: $root.collection.getFacetById($parent.id()).properties.stacked(), field: field, label: label(),
- fqs: $root.query.fqs,
- transformer: ($data.type == 'range-up' ? barChartRangeUpDataTransformer : barChartDataTransformer),
- onStateChange: function(state){ $root.collection.getFacetById($parent.id()).properties.stacked(state.stacked); },
- onClick: function(d) {
- if (d.obj.field != undefined) {
- if ($data.type == 'range-up') {
- searchViewModel.query.selectRangeUpFacet({count: d.obj.value, widget_id: d.obj.widget_id, from: d.obj.from, to: d.obj.to, cat: d.obj.field, 'exclude': false, is_up: d.obj.is_up});
- } else {
- searchViewModel.query.selectRangeFacet({count: d.obj.value, widget_id: d.obj.widget_id, from: d.obj.from, to: d.obj.to, cat: d.obj.field});
- }
- } else {
- searchViewModel.query.toggleFacet({facet: d.obj, widget_id: d.obj.widget_id});
- }
- },
- onSelectRange: function(from, to){ searchViewModel.collection.selectTimelineFacet({from: from, to: to, cat: field, widget_id: $parent.id()}) },
- onComplete: function(){ searchViewModel.getWidgetById($parent.id()).isLoading(false) } }"
- />
- <div class="clearfix"></div>
- <!-- /ko -->
- <!-- ko if: dimension() == 2 -->
- <div data-bind="barChart: {datum: {counts: counts(), widget_id: $parent.id(), label: label()}, stacked: $root.collection.getFacetById($parent.id()).properties.stacked(),
- isPivot: true,
- fqs: $root.query.fqs,
- transformer: pivotChartDataTransformer,
- onStateChange: function(state){ $root.collection.getFacetById($parent.id()).properties.stacked(state.stacked); },
- onClick: function(d) {
- $root.query.togglePivotFacet({facet: d.obj, widget_id: id()});
- },
- onComplete: function(){ searchViewModel.getWidgetById($parent.id()).isLoading(false) } }"
- />
- <div class="clearfix"></div>
- <!-- /ko -->
- <!-- ko if: dimension() == 3 -->
- <div data-bind="timelineChart: {datum: {counts: counts(), extraSeries: extraSeries(), widget_id: $parent.id(), label: label()}, stacked: $root.collection.getFacetById($parent.id()).properties.stacked(), field: field, label: label(), transformer: timelineChartDataTransformer,
- type: $root.collection.getFacetById($parent.id()).properties.timelineChartType,
- fqs: $root.query.fqs,
- onSelectRange: function(from, to){ $root.collection.selectTimelineFacet({from: from, to: to, cat: field, widget_id: $parent.id()}) },
- onStateChange: function(state){ $root.collection.getFacetById($parent.id()).properties.stacked(state.stacked); },
- onClick: function(d){ $root.query.selectRangeFacet({count: d.obj.value, widget_id: $parent.id(), from: d.obj.from, to: d.obj.to, cat: d.obj.field}) },
- onComplete: function(){ $root.getWidgetById($parent.id()).isLoading(false) }}" />
- <div class="clearfix"></div>
- <!-- /ko -->
- <!-- /ko -->
- <!-- /ko -->
- <!-- ko if: widgetType() == 'gradient-map-widget' -->
- <!-- ko with: $parent -->
- <div data-bind="mapChart: {data: {counts: counts(), scope: $parent.properties.scope()},
- transformer: gradientMapChartDataTransformer,
- maxWidth: 750,
- isScale: true,
- onClick: function(d) {
- $root.query.togglePivotFacet({facet: {'fq_fields': d.fields, 'fq_values': d.value}, widget_id: id()});
- },
- onComplete: function(){ var widget = searchViewModel.getWidgetById($parent.id()); if (widget != null) { widget.isLoading(false)}; } }" />
- <!-- /ko -->
- <!-- /ko -->
- <!-- ko if: widgetType() == 'timeline-widget' -->
- <!-- ko with: $parent -->
- <div data-bind="timelineChart: {datum: {counts: counts(), extraSeries: extraSeries(), widget_id: $parent.id(), label: label()}, stacked: $root.collection.getFacetById($parent.id()).properties.stacked(), field: field, label: label(), transformer: timelineChartDataTransformer,
- type: $root.collection.getFacetById($parent.id()).properties.timelineChartType,
- fqs: $root.query.fqs,
- onSelectRange: function(from, to){ $root.collection.selectTimelineFacet({from: from, to: to, cat: field, widget_id: $parent.id()}) },
- onStateChange: function(state){ $root.collection.getFacetById($parent.id()).properties.stacked(state.stacked); },
- onClick: function(d){ $root.query.selectRangeFacet({count: d.obj.value, widget_id: $parent.id(), from: d.obj.from, to: d.obj.to, cat: d.obj.field}) },
- onComplete: function(){ $root.getWidgetById($parent.id()).isLoading(false) }}" />
- <div class="clearfix"></div>
- <!-- /ko -->
- <!-- /ko -->
- <!-- ko if: widgetType() == 'pie2-widget' -->
- <!-- ko if: type() == 'range' -->
- <div data-bind="pieChart: {data: {counts: $parent.counts(), widget_id: $parent.id()}, field: field, fqs: $root.query.fqs,
- transformer: rangePieChartDataTransformer,
- maxWidth: 250,
- onClick: function(d){ searchViewModel.query.selectRangeFacet({count: d.data.obj.value, widget_id: d.data.obj.widget_id, from: d.data.obj.from, to: d.data.obj.to, cat: d.data.obj.field}) },
- onComplete: function(){ searchViewModel.getWidgetById($parent.id()).isLoading(false)} }" />
- <div class="clearfix"></div>
- <!-- /ko -->
- <!-- ko if: type() == 'range-up' -->
- <div data-bind="pieChart: {data: {counts: $parent.counts(), widget_id: $parent.id()}, field: field, fqs: $root.query.fqs,
- transformer: rangeUpPieChartDataTransformer,
- rangeUp: true,
- maxWidth: 250,
- onClick: function(d){ searchViewModel.query.selectRangeUpFacet({count: d.data.obj.value, widget_id: d.data.obj.widget_id, from: d.data.obj.from, to: d.data.obj.to, cat: d.data.obj.field, 'exclude': false, is_up: d.data.obj.is_up}) },
- onComplete: function(){ searchViewModel.getWidgetById($parent.id()).isLoading(false)} }" />
- <div class="clearfix"></div>
- <!-- /ko -->
- <!-- ko if: type().indexOf('range') == -1 -->
- <div data-bind="pieChart: {data: {counts: $parent.counts(), widget_id: $parent.id()}, field: field, fqs: $root.query.fqs,
- transformer: pieChartDataTransformer,
- maxWidth: 250,
- onClick: function(d){ searchViewModel.query.toggleFacet({facet: d.data.obj, widget_id: d.data.obj.widget_id}) },
- onComplete: function(){ searchViewModel.getWidgetById($parent.id()).isLoading(false)} }" />
- <div class="clearfix"></div>
- <!-- /ko -->
- <!-- /ko -->
- <!-- ko if: widgetType() == 'resultset-widget' -->
- <div data-bind="attr:{'id': 'pieChart_'+id()}, pieChart: {data: {counts: $root.results(), sorting: $root.collection.template.chartSettings.chartSorting(), snippet: $data}, fqs: ko.observableArray([]),
- transformer: pieChartDataTransformerGrid, maxWidth: 350, parentSelector: '.chart-container' }, visible: $root.collection.template.chartSettings.chartType() == ko.HUE_CHARTS.TYPES.PIECHART" class="chart"></div>
- <div data-bind="attr:{'id': 'barChart_'+id()}, barChart: {datum: {counts: $root.results(), sorting: $root.collection.template.chartSettings.chartSorting(), snippet: $data}, fqs: ko.observableArray([]), hideSelection: true,
- transformer: multiSerieDataTransformerGrid, stacked: false, showLegend: true}, stacked: true, showLegend: true, visible: $root.collection.template.chartSettings.chartType() == ko.HUE_CHARTS.TYPES.BARCHART" class="chart"></div>
- <div data-bind="attr:{'id': 'lineChart_'+id()}, lineChart: {datum: {counts: $root.results(), sorting: $root.collection.template.chartSettings.chartSorting(), snippet: $data},
- transformer: multiSerieDataTransformerGrid, showControls: false }, visible: $root.collection.template.chartSettings.chartType() == ko.HUE_CHARTS.TYPES.LINECHART" class="chart"></div>
- <div data-bind="attr: {'id': 'leafletMapChart_'+id()}, leafletMapChart: {datum: {counts: $root.results(), sorting: $root.collection.template.chartSettings.chartSorting(), snippet: $data},
- transformer: leafletMapChartDataTransformerGrid, showControls: false, height: 380, visible: $root.collection.template.chartSettings.chartType() == ko.HUE_CHARTS.TYPES.MAP, forceRedraw: true}" class="chart"></div>
- <div class="clearfix"></div>
- <!-- /ko -->
- </div>
- </div>
- </div>
- </div>
- </script>
- <script type="text/html" id="document-widget">
- ##<div class="widget-spinner" data-bind="visible: isLoading()">
- ## <i class="fa fa-spinner fa-spin"></i>
- ##</div>
- <!-- ko if: $root.getFacetFromQuery(id()).has_data() -->
- <div class="row-fluid" data-bind="with: $root.getFacetFromQuery(id())">
- <!-- ko with: $root.collection.getFacetById($parent.id()) -->
- <div>
- Name Uuid
-
- ## Get sub widget by ID
- ## <div data-bind="template: { name: function() { return widgetType(); }}" class="widget-main-section"></div>
-
- </div>
- <!-- /ko -->
- </div>
- <!-- /ko -->
- </script>
- <script type="text/html" id="bucket-widget">
- <div class="widget-spinner" data-bind="visible: isLoading()">
- <i class="fa fa-spinner fa-spin"></i>
- </div>
- <!-- ko if: $root.getFacetFromQuery(id()).has_data() -->
- <div class="row-fluid" data-bind="with: $root.getFacetFromQuery(id())">
- <!-- ko with: $root.collection.getFacetById($parent.id()) -->
- <div>
- <span data-bind="template: { name: 'facet-toggle2' }"></span>
- <div class="pull-right" style="margin-top: 40px">
- <!-- ko if: properties.isDate -->
- <div class="inline-block" style="padding-bottom: 10px; padding-right: 20px">
- <span class="facet-field-label">${ _('Chart Type') }</span>
- <select class="input-small" data-bind="options: $root.timelineChartTypes,
- optionsText: 'label',
- optionsValue: 'value',
- value: properties.timelineChartType">
- </select>
- </div>
- <div class="inline-block" style="padding-bottom: 10px; padding-right: 20px">
- <span class="facet-field-label">${ _('Interval') }</span>
- <select class="input-small" data-bind="options: $root.intervalOptions,
- optionsText: 'label',
- optionsValue: 'value',
- value: properties.gap">
- </select>
- </div>
- <!-- /ko -->
- <!-- ko if: properties.canRange -->
- <div class="inline-block" style="padding-bottom: 10px; padding-right: 20px">
- <span class="facet-field-label">${ _('Zoom') }</span>
- <a href="javascript:void(0)" data-bind="click: $root.collection.rangeZoomOut"><i class="fa fa-search-minus"></i> ${ _('reset') }</a>
- </div>
- <!-- /ko -->
- </div>
- <div class="clearfix"></div>
- </div>
- <span data-bind="template: { name: 'data-grid' }"></span>
- <!-- /ko -->
- </div>
- <!-- /ko -->
- </script>
- <script type="text/html" id="line-widget">
- <div class="widget-spinner" data-bind="visible: isLoading()">
- <i class="fa fa-spinner fa-spin"></i>
- </div>
- <!-- ko if: $root.getFacetFromQuery(id()).has_data() -->
- <div class="row-fluid" data-bind="with: $root.getFacetFromQuery(id())">
- <div data-bind="visible: $root.isEditing, with: $root.collection.getFacetById($parent.id())" style="margin-bottom: 20px">
- <span data-bind="template: { name: 'facet-toggle' }">
- </span>
- </div>
- <div class="clearfix"></div>
- <div style="padding-bottom: 10px; text-align: right; padding-right: 20px" data-bind="visible: counts.length > 0">
- <span class="facet-field-label">${ _('Zoom') }</span>
- <a href="javascript:void(0)" data-bind="click: $root.collection.rangeZoomOut"><i class="fa fa-search-minus"></i> ${ _('reset') }</a>
- </div>
- <div data-bind="lineChart: {datum: {counts: counts(), widget_id: $parent.id(), label: label()}, field: field, label: label(),
- transformer: lineChartDataTransformer,
- onClick: function(d){ searchViewModel.query.selectRangeFacet({count: d.obj.value, widget_id: d.obj.widget_id, from: d.obj.from, to: d.obj.to, cat: d.obj.field}) },
- onSelectRange: function(from, to){ searchViewModel.collection.selectTimelineFacet({from: from, to: to, cat: field, widget_id: $parent.id()}) },
- onComplete: function(){ searchViewModel.getWidgetById($parent.id()).isLoading(false) } }"
- />
- <div class="clearfix"></div>
- </div>
- <!-- /ko -->
- </script>
- <script type="text/html" id="pie-widget">
- <!-- ko if: $root.getFacetFromQuery(id()).has_data() -->
- <div class="row-fluid" data-bind="with: $root.getFacetFromQuery(id())">
- <div data-bind="visible: $root.isEditing, with: $root.collection.getFacetById($parent.id())" style="margin-bottom: 20px">
- <span data-bind="template: { name: 'facet-toggle' }">
- </span>
- </div>
- <div class="clearfix"></div>
- <div data-bind="with: $root.collection.getFacetById($parent.id())">
- <!-- ko if: type() == 'range' -->
- <div data-bind="pieChart: {data: {counts: $parent.counts(), widget_id: $parent.id()}, field: field, fqs: $root.query.fqs,
- transformer: rangePieChartDataTransformer,
- maxWidth: 250,
- onClick: function(d){ searchViewModel.query.selectRangeFacet({count: d.data.obj.value, widget_id: d.data.obj.widget_id, from: d.data.obj.from, to: d.data.obj.to, cat: d.data.obj.field}) },
- onComplete: function(){ searchViewModel.getWidgetById($parent.id()).isLoading(false)} }" />
- <div class="clearfix"></div>
- <!-- /ko -->
- <!-- ko if: type() == 'range-up' -->
- <div data-bind="pieChart: {data: {counts: $parent.counts(), widget_id: $parent.id()}, field: field, fqs: $root.query.fqs,
- transformer: rangeUpPieChartDataTransformer,
- rangeUp: true,
- maxWidth: 250,
- onClick: function(d){ searchViewModel.query.selectRangeUpFacet({count: d.data.obj.value, widget_id: d.data.obj.widget_id, from: d.data.obj.from, to: d.data.obj.to, cat: d.data.obj.field, 'exclude': false, is_up: d.data.obj.is_up}) },
- onComplete: function(){ searchViewModel.getWidgetById($parent.id()).isLoading(false)} }" />
- <div class="clearfix"></div>
- <!-- /ko -->
- <!-- ko if: type().indexOf('range') == -1 -->
- <div data-bind="pieChart: {data: {counts: $parent.counts(), widget_id: $parent.id()}, field: field, fqs: $root.query.fqs,
- transformer: pieChartDataTransformer,
- maxWidth: 250,
- onClick: function(d){ searchViewModel.query.toggleFacet({facet: d.data.obj, widget_id: d.data.obj.widget_id}) },
- onComplete: function(){ searchViewModel.getWidgetById($parent.id()).isLoading(false)} }" />
- <div class="clearfix"></div>
- <!-- /ko -->
- </div>
- </div>
- <!-- /ko -->
- <div class="widget-spinner" data-bind="visible: isLoading()">
- <i class="fa fa-spinner fa-spin"></i>
- </div>
- </script>
- <script type="text/html" id="pie2-widget">
- <!-- ko if: $root.getFacetFromQuery(id()).has_data() -->
- <div class="row-fluid" data-bind="with: $root.getFacetFromQuery(id())">
- <!-- ko with: $root.collection.getFacetById($parent.id()) -->
- <div style="margin-bottom: 20px">
- <span data-bind="template: { name: 'facet-toggle2' }"></span>
- </div>
- <span data-bind="template: { name: 'data-grid' }"></span>
- <!-- /ko -->
- </div>
- <!-- /ko -->
- <div class="widget-spinner" data-bind="visible: isLoading()">
- <i class="fa fa-spinner fa-spin"></i>
- </div>
- </script>
- <script type="text/html" id="tree-widget">
- <!-- ko if: $root.getFacetFromQuery(id()).has_data() -->
- <div class="row-fluid" data-bind="with: $root.getFacetFromQuery(id())">
- <div class="responsive-facet-toggle-section" data-bind="visible: $root.isEditing, with: $root.collection.getFacetById($parent.id())">
- <span data-bind="template: { name: 'facet-toggle', afterRender: function(){ $root.getWidgetById($parent.id()).isLoading(false); } }">
- </span>
- </div>
- <div class="clearfix"></div>
- <div data-bind="with: $root.collection.getFacetById($parent.id())">
- <div class="dimensions-header margin-bottom-10" data-bind="visible: $root.isEditing() && $data.properties.facets().length > 0">
- <span class="muted">${ _('Selected dimensions') }</span>
- </div>
- <div data-bind="foreach: $data.properties.facets, visible: $root.isEditing">
- <div class="filter-box">
- <div class="title">
- <a data-bind="click: function() { $root.collection.removePivotFacetValue({'pivot_facet': $parent, 'value': $data}); }" class="pull-right" href="javascript:void(0)">
- <i class="fa fa-times"></i>
- </a>
- <span data-bind="text: field"></span>
-
- </div>
- <div class="content">
- <div class="facet-field-cnt">
- <span class="spinedit-cnt">
- <span class="facet-field-label facet-field-label-fixed-width">
- ${ _('Limit') }
- </span>
- <input type="text" class="input-medium" data-bind="spinedit: limit"/>
- </span>
- </div>
- <div class="facet-field-cnt">
- <span class="spinedit-cnt">
- <span class="facet-field-label facet-field-label-fixed-width">
- ${ _('Min Count') }
- </span>
- <input type="text" class="input-medium" data-bind="spinedit: mincount"/>
- </span>
- </div>
- </div>
- </div>
- </div>
- <div class="clearfix"></div>
- <!-- ko if: properties.scope() == 'tree' -->
- <div data-bind="partitionChart: {datum: {counts: $parent.counts(), widget_id: $parent.id(), label: $parent.label()},
- fqs: $root.query.fqs,
- tooltip: '${ _ko('Click to zoom, double click to select') }',
- transformer: partitionChartDataTransformer,
- onStateChange: function(state){ },
- onClick: function(d) {
- $root.query.togglePivotFacet({facet: d.obj, widget_id: id()});
- },
- onComplete: function(){ searchViewModel.getWidgetById($parent.id()).isLoading(false) } }"
- />
- <div class="clearfix"></div>
- <!-- /ko -->
- </div>
- </div>
- <!-- /ko -->
- <div class="widget-spinner" data-bind="visible: isLoading()">
- <i class="fa fa-spinner fa-spin"></i>
- </div>
- </script>
- <script type="text/html" id="tree2-widget">
- <!-- ko if: $root.getFacetFromQuery(id()).has_data() -->
- <div class="row-fluid" data-bind="with: $root.getFacetFromQuery(id())">
- <div class="responsive-facet-toggle-section" data-bind="visible: $root.isEditing, with: $root.collection.getFacetById($parent.id())">
- <span data-bind="template: { name: 'facet-toggle2' }"></span>
- </div>
- <div class="clearfix"></div>
- <div data-bind="with: $root.collection.getFacetById($parent.id())">
- <!-- ko if: properties.scope() == 'tree' -->
- <div data-bind="partitionChart: {datum: {counts: $parent.counts(), widget_id: $parent.id(), label: $parent.label()},
- fqs: $root.query.fqs,
- tooltip: '${ _ko('Click to zoom, double click to select') }',
- transformer: partitionChartDataTransformer,
- onStateChange: function(state){ },
- onClick: function(d) {
- $root.query.togglePivotFacet({facet: d.obj, widget_id: id()});
- },
- onComplete: function(){ searchViewModel.getWidgetById($parent.id()).isLoading(false) } }"
- />
- <div class="clearfix"></div>
- <!-- /ko -->
- </div>
- </div>
- <!-- /ko -->
- <div class="widget-spinner" data-bind="visible: isLoading()">
- <i class="fa fa-spinner fa-spin"></i>
- </div>
- </script>
- <script type="text/html" id="heatmap-widget">
- <!-- ko if: $root.getFacetFromQuery(id()).has_data() -->
- <div class="row-fluid" data-bind="with: $root.getFacetFromQuery(id())">
- <div class="floating-facet-toggle-section" data-bind="visible: $root.isEditing, with: $root.collection.getFacetById($parent.id())">
- <span data-bind="template: { name: 'facet-toggle', afterRender: function(){ $root.getWidgetById($parent.id()).isLoading(false); } }">
- </span>
- </div>
- <div class="clearfix"></div>
- <div data-bind="with: $root.collection.getFacetById($parent.id())">
- <div class="dimensions-header margin-bottom-10" data-bind="visible: $root.isEditing() && $data.properties.facets().length > 0">
- <span class="muted">${ _('Selected dimension') }</span>
- </div>
- <div data-bind="foreach: $data.properties.facets, visible: $root.isEditing">
- <div class="filter-box">
- <div class="title">
- <a data-bind="click: function() { $root.collection.removePivotFacetValue({'pivot_facet': $parent, 'value': $data}); }" class="pull-right" href="javascript:void(0)">
- <i class="fa fa-times"></i>
- </a>
- <span data-bind="text: field"></span>
-
- </div>
- <div class="content">
- <div class="facet-field-cnt">
- <span class="spinedit-cnt">
- <span class="facet-field-label facet-field-label-fixed-width">
- ${ _('Limit') }
- </span>
- <input type="text" class="input-medium" data-bind="spinedit: limit"/>
- </span>
- </div>
- <div class="facet-field-cnt">
- <span class="spinedit-cnt">
- <span class="facet-field-label facet-field-label-fixed-width">
- ${ _('Min Count') }
- </span>
- <input type="text" class="input-medium" data-bind="spinedit: mincount"/>
- </span>
- </div>
- </div>
- </div>
- </div>
- <div class="clearfix"></div>
- <!-- ko if: properties.scope() == 'stack' -->
- <div data-bind="barChart: {datum: {counts: $parent.counts(), widget_id: $parent.id(), label: $parent.label()}, stacked: $root.collection.getFacetById($parent.id()).properties.stacked(),
- isPivot: true,
- fqs: $root.query.fqs,
- transformer: pivotChartDataTransformer,
- onStateChange: function(state){ $root.collection.getFacetById($parent.id()).properties.stacked(state.stacked); },
- onClick: function(d) {
- $root.query.togglePivotFacet({facet: d.obj, widget_id: id()});
- },
- onComplete: function(){ searchViewModel.getWidgetById($parent.id()).isLoading(false) } }"
- />
- <div class="clearfix"></div>
- <!-- /ko -->
- </div>
- </div>
- <!-- /ko -->
- <div class="widget-spinner" data-bind="visible: isLoading()">
- <i class="fa fa-spinner fa-spin"></i>
- </div>
- </script>
- <script type="text/html" id="hit-widget">
- <div class="widget-spinner" data-bind="visible: ! $root.hasRetrievedResults()">
- <i class="fa fa-spinner fa-spin"></i>
- </div>
- <!-- ko if: $root.getFacetFromQuery(id()).has_data() -->
- <div class="row-fluid" data-bind="with: $root.getFacetFromQuery(id())">
- <div data-bind="with: $root.collection.getFacetById($parent.id())">
- <span data-bind="template: { name: 'facet-toggle2' }"></span>
- ## TODO: Range if numeric
- </div>
- <span class="big-counter" data-bind="textSqueezer: counts"></span>
- </div>
- <!-- /ko -->
- </script>
- <script type="text/html" id="metric-form">
- ## Facet measure has a slightly different format
- <!-- ko with: typeof properties != "undefined" ? properties.aggregate : aggregate -->
- <!-- ko if: $root.isEditing -->
- <div>
- ## For Counter widget
- <!-- ko if: $data.function() != 'field' && $parent.properties -->
- <select data-bind="options: $parents[1].properties.facets_form.aggregate.metrics, optionsText: 'label', optionsValue: 'value', value: $data.function" class="input-small"></select>
- <!-- /ko -->
- <!-- ko if: $data.function() != 'field' -->
- <select data-bind="options: $parents[1].properties.facets_form.aggregate.metrics, optionsText: 'label', optionsValue: 'value', value: $data.function" class="input-small"></select>
- <!-- /ko -->
- <!-- ko if: $data.function() == 'percentile' -->
- <!-- ko foreach: percentiles() -->
- <input type="number" class="input-mini" data-bind="value: value"/>
- <a href="javascript: void(0)" data-bind="click: function() { $parent.percentiles.remove($data); }">
- <i class="fa fa-minus" title="${ _('Delete') }"></i>
- </a>
- <!-- /ko -->
- <a href="javascript: void(0)" data-bind="click: function() { percentiles.push(ko.mapping.fromJS({'value': 50})); }">
- <i class="fa fa-plus" title="${ _('Add') }"></i>
- </a>
- <!-- /ko -->
- <select data-bind="options: $root.collection.template.facetFieldsNames, value: $parent.field, optionsCaption: '${ _ko('Field...') }', selectize: $root.collection.template.facetFieldsNames" class="hit-options input-small" style="margin-bottom: 0"></select>
- <div class="clearfix"></div>
- <br/>
- <input data-bind="value: formula, visible: $parent.field() == 'formula', valueUpdate: 'afterkeydown'"></input>
- <input data-bind="value: plain_formula" type="hidden"></input>
- <!-- ko if: $data.function() != 'field' && $parents[1].widgetType() != 'hit-widget' -->
- <div class="facet-field-cnt">
- <span class="facet-field-label facet-field-label-fixed-width">${ _('Sorting') }</span>
- <a href="javascript: void(0)" title="${ _('Toggle sort order') }" data-bind="click: function() { $root.collection.toggleSortFacet2($parents[1], $parent); }">
- <i class="fa" data-bind="css: { 'fa-caret-down': $parent.sort() == 'desc', 'fa-caret-up': $parent.sort() == 'asc', 'fa-sort': $parent.sort() == 'default' }"></i>
- <span data-bind="visible: $parent.sort() == 'desc'">${_('descending')}</span>
- <span data-bind="visible: $parent.sort() == 'asc'">${_('ascending')}</span>
- <span data-bind="visible: $parent.sort() == 'default'">${_('default')}</span>
- </a>
- </div>
- <div class="facet-field-cnt" data-bind="visible: $data.function() == 'count'">
- <span class="spinedit-cnt">
- <span class="facet-field-label">
- ${ _('Limit') }
- </span>
- <input type="text" class="input-medium" data-bind="spinedit: $parent.limit"/>
- </span>
- </div>
- <div class="facet-field-cnt" data-bind="visible: $data.function() == 'count'">
- <span class="spinedit-cnt">
- <span class="facet-field-label">
- ${ _('Min Count') }
- </span>
- <input type="text" class="input-medium" data-bind="spinedit: $parent.mincount"/>
- </span>
- </div>
- <!-- /ko -->
- </div>
- <!-- /ko -->
- <!-- ko if: !$root.isEditing() -->
- <div class="content" style="border: 1px solid #d8d8d8;">
- <div data-bind="text: getPrettyMetric($data)" class="muted"></div>
- <!-- ko if: $data.function() != 'field' && $data.metrics -->
- <i class="fa" data-bind="css: { 'fa-long-arrow-down': $parent.sort() == 'desc', 'fa-long-arrow-up': $parent.sort() == 'asc' }"></i>
- <!-- /ko -->
- </div>
- <!-- /ko -->
- <!-- /ko -->
- </script>
- <script type="text/html" id="filter-widget">
- <div data-bind="visible: $root.query.fqs().length == 0" style="margin-top: 10px; min-height: 87px">
- ${ _('There are currently no filters applied.') }
- </div>
- <div data-bind="foreach: { data: $root.query.fqs, afterRender: function(){ isLoading(false); } }">
- <!-- ko if: $data.type() == 'field' -->
- <div class="filter-box">
- <div class="title">
- <a href="javascript:void(0)" class="pull-right" data-bind="click: function() { chartsUpdatingState(); $root.query.removeFilter($data); $root.search(); }">
- <i class="fa fa-times"></i>
- </a>
- <span data-bind="text: $data.field"></span>
-
- </div>
- <div class="content">
- <strong>${_('selected')}</strong>
- <span data-bind="foreach: $data.filter">
- <span class="label label-info" style="margin-left: 4px" data-bind="visible: ! $data.exclude(), html: prettifyDate($data.value()), attr: {'title': $data.value()}"></span>
- </span>
- <br/>
- <strong>${_('excluded')}</strong>
- <span data-bind="foreach: $data.filter">
- <span class="label label-important" style="margin-left: 4px" data-bind="visible: $data.exclude(), html: prettifyDate($data.value()), attr: {'title': $data.value()}"></span>
- </span>
- </div>
- </div>
- <!-- /ko -->
- <!-- ko if: $data.type() == 'range' || $data.type() == 'range-up' -->
- <div class="filter-box">
- <div class="title">
- <a href="javascript:void(0)" class="pull-right" data-bind="click: function(){ chartsUpdatingState(); $root.query.removeFilter($data); $root.search() }">
- <i class="fa fa-times"></i>
- </a>
- <span data-bind="text: $data.field"></span>
-
- </div>
- <div class="content">
- <strong>${_('selected')}</strong>
- <span data-bind="foreach: $data.properties" style="font-weight: normal">
- <!-- ko if: $.grep($parent.filter(), function(f) { return f.value() == $data.from() && ! f.exclude() }).length > 0 -->
- <span class="label label-info">
- <!-- ko if: $parent.type() == 'range' -->
- <span data-bind="html: prettifyDateRange($data.from(), $data.to(), null, true), attr: {'title': $data.from() + ' -> ' + $data.to()}"></span>
- <!-- /ko -->
- <!-- ko if: $parent.type() == 'range-up' -->
- <strong data-bind="visible: ! $parent.is_up()">${ _('Until') }</strong>
- <span data-bind="html: prettifyDate($data.from()), attr: {'title': $data.from()}"></span>
- <strong data-bind="visible: $parent.is_up()"> & Up</strong>
- <!-- /ko -->
- </span>
- <!-- /ko -->
- </span>
- <br/>
- <strong>${_('excluded')}</strong>
- <span data-bind="foreach: $data.properties" style="font-weight: normal" class="excluded">
- <!-- ko if: $.grep($parent.filter(), function(f) { return f.value() == $data.from() && f.exclude() }).length > 0 -->
- <span class="label label-important">
- <span data-bind="html: prettifyDateRange($data.from(), $data.to(), null, true), attr: {'title': $data.from() + ' -> ' + $data.to()}"></span>
- </span>
- <!-- /ko -->
- </span>
- </div>
- </div>
- <!-- /ko -->
- <!-- ko if: $data.type() == 'map' -->
- <div class="filter-box">
- <div class="title">
- <a href="javascript:void(0)" class="pull-right" data-bind="click: function(){ chartsUpdatingState(); $root.query.removeFilter($data); $root.search() }">
- <i class="fa fa-times"></i>
- </a>
- <span data-bind="text: $data.lat"></span>, <span data-bind="text: $data.lon"></span>
-
- </div>
- <div class="content">
- <strong>${_('selected')}</strong>
- <span class="label label-info">
- [
- <span class="label label-info" style="margin-left: 4px" data-bind="text: $data.properties.lat_sw, attr: {'title': '${ _ko('Latitude South West') }'"></span>
- <span class="label label-info" style="margin-left: 4px" data-bind="text: $data.properties.lon_sw, attr: {'title': '${ _ko('Longitude South West') }'"></span>
- ]
- ${ _("TO") }
- [
- <span class="label label-info" style="margin-left: 4px" data-bind="text: $data.properties.lat_ne, attr: {'title': '${ _ko('Latitude North East') }'"></span>
- <span class="label label-info" style="margin-left: 4px" data-bind="text: $data.properties.lon_ne, attr: {'title': '${ _ko('Longitude North East') }'"></span>
- ]
- </span>
- </div>
- </div>
- <!-- /ko -->
- </div>
- <div class="clearfix"></div>
- <div class="widget-spinner" data-bind="visible: isLoading() && $root.query.fqs().length > 0">
- <i class="fa fa-spinner fa-spin"></i>
- </div>
- </script>
- <script type="text/html" id="map-widget">
- <!-- ko if: $root.getFacetFromQuery(id()).has_data() -->
- <div class="row-fluid" data-bind="with: $root.getFacetFromQuery(id())">
- <div data-bind="visible: $root.isEditing, with: $root.collection.getFacetById($parent.id())" style="margin-bottom: 20px">
- <div class="floating-facet-toggle-section">
- <span data-bind="template: { name: 'facet-toggle', afterRender: function(){ $root.getWidgetById($parent.id()).isLoading(false); } }">
- </span>
- </div>
- <div class="dimensions-header margin-bottom-10" data-bind="visible: $root.isEditing() && $data.properties.facets().length > 0">
- <span class="muted">${ _('Selected dimension') }</span>
- </div>
- <div data-bind="foreach: $data.properties.facets, visible: $root.isEditing">
- <div class="filter-box">
- <div class="title">
- <a data-bind="click: function() { $root.collection.removePivotFacetValue({'pivot_facet': $parent, 'value': $data}); }" class="pull-right" href="javascript:void(0)">
- <i class="fa fa-times"></i>
- </a>
- <span data-bind="text: field"></span>
-
- </div>
- <div class="content">
- <div class="facet-field-cnt">
- <span class="spinedit-cnt">
- <span class="facet-field-label facet-field-label-fixed-width">
- ${ _('Limit') }
- </span>
- <input type="text" class="input-medium" data-bind="spinedit: limit"/>
- </span>
- </div>
- <div class="facet-field-cnt">
- <span class="spinedit-cnt">
- <span class="facet-field-label facet-field-label-fixed-width">
- ${ _('Min Count') }
- </span>
- <input type="text" class="input-medium" data-bind="spinedit: mincount"/>
- </span>
- </div>
- </div>
- </div>
- </div>
- <div class="clearfix"></div>
- </div>
- <div class="margin-bottom-10" data-bind="visible: ! $root.isEditing()">
- <div data-bind="with: $root.collection.getFacetById($parent.id())">
- <!-- ko if: $data.properties.facets().length == 1 -->
- <div class="margin-bottom-10">
- <span data-bind="text: $data.properties.facets()[0].field"></span>
- </div>
- <!-- /ko -->
- </div>
- </div>
- <div data-bind="with: $root.collection.getFacetById($parent.id())">
- <div data-bind="mapChart: {data: {counts: $parent.counts(), scope: $root.collection.getFacetById($parent.id()).properties.scope()},
- transformer: mapChartDataTransformer,
- maxWidth: 750,
- isScale: true,
- onClick: function(d) {
- $root.query.togglePivotFacet({facet: {'fq_fields': d.fields, 'fq_values': d.value}, widget_id: id()});
- },
- onComplete: function(){ var widget = searchViewModel.getWidgetById($parent.id()); if (widget != null) { widget.isLoading(false)}; } }" />
- <div class="clearfix"></div>
- </div>
- </div>
- <!-- /ko -->
- <div class="widget-spinner" data-bind="visible: isLoading()">
- <i class="fa fa-spinner fa-spin"></i>
- </div>
- </script>
- <script type="text/html" id="gradient-map-widget">
- <!-- ko if: $root.getFacetFromQuery(id()).has_data() -->
- <div class="row-fluid" data-bind="with: $root.getFacetFromQuery(id())">
- <div data-bind="with: $root.collection.getFacetById($parent.id())" style="margin-bottom: 20px">
- <span data-bind="template: { name: 'facet-toggle2' }"></span>
- </div>
- <!-- ko with: $root.collection.getFacetById($parent.id()) -->
- <div class="margin-bottom-10" data-bind="visible: ! $root.isEditing()">
- <!-- ko if: $data.properties.facets().length == 1 -->
- <div class="margin-bottom-10">
- <span data-bind="text: $data.properties.facets()[0].field"></span>
- </div>
- <!-- /ko -->
- </div>
- <span data-bind="template: { name: 'data-grid' }"></span>
- <!-- /ko -->
- </div>
- <!-- /ko -->
- <div class="widget-spinner" data-bind="visible: isLoading()">
- <i class="fa fa-spinner fa-spin"></i>
- </div>
- </script>
- <script type="text/html" id="leafletmap-widget">
- <div class="row-fluid">
- <div data-bind="visible: $root.isEditing" style="margin-top: 10px; margin-bottom: 20px;" class="leaflet-align">
- <span class="facet-field-label">${_('Latitude')}</span><div class="break-on-small-column"></div>
- <select data-bind="options: $root.collection.template.sortedGeogFieldsNames, value: $root.collection.template.leafletmap.latitudeField, optionsCaption: '${ _ko('Choose...') }', selectize: $root.collection.template.sortedGeogFieldsNames"></select>
-
- <div class="break-on-small-column"></div>
- <span class="facet-field-label">${_('Longitude')}</span><div class="break-on-small-column"></div>
- <select data-bind="options: $root.collection.template.sortedGeogFieldsNames, value: $root.collection.template.leafletmap.longitudeField, optionsCaption: '${ _ko('Choose...') }', selectize: $root.collection.template.sortedGeogFieldsNames"></select>
-
- <div class="break-on-small-column"></div>
- <span class="facet-field-label">${_('Label')}</span><div class="break-on-small-column"></div>
- <select data-bind="value: $root.collection.template.leafletmap.labelField, optionsCaption: '${ _ko('Choose...') }', selectize: $root.collection.template.fieldsNames"></select>
- </div>
- <div data-bind="leafletMapChart: {showMoveCheckbox: true, moveCheckboxLabel: '${ _ko('Search as I move the map') }', visible: $root.hasRetrievedResults() && $root.collection.template.leafletmapOn(), isLoading: isLoading(), datum: {counts: $root.response()},
- transformer: leafletMapChartDataTransformer,
- onRegionChange: function(bounds){ $root.query.selectMapRegionFacet({widget_id: id(), 'bounds': ko.toJS(bounds, null, 2), lat: $root.collection.template.leafletmap.latitudeField(), lon: $root.collection.template.leafletmap.longitudeField()}); },
- onComplete: function(){ var widget = searchViewModel.getWidgetById(id()); if (widget != null) { widget.isLoading(false)}; } }">
- </div>
- <div class="clearfix"></div>
- </div>
- <div class="widget-spinner" data-bind="visible: isLoading()">
- <i class="fa fa-spinner fa-spin"></i>
- </div>
- </script>
- <script type="text/html" id="analysis-window">
- <!-- ko if: $root.fieldAnalysesName() -->
- <div data-bind="with: $root.getFieldAnalysis()">
- <div class="pull-right">
- <input type="text" data-bind="visible: section() == 'terms', clearable: terms.prefix, valueUpdate:'afterkeydown'" placeholder="${ _('Prefix filter...') }"/>
- <input type="text" data-bind="visible: section() == 'stats', clearable: stats.facet, typeahead: { target: stats.facet, source: $root.fieldsAnalysisAttributesNames, triggerOnFocus: true }" placeholder="${ _('Field name...') }"/>
- </div>
- <ul class="nav nav-tabs" role="tablist">
- <li class="active"><a href="#analysis-terms" role="tab" data-toggle="tab" data-bind="click: function() { section('terms'); }">${ _('Terms') }</a></li>
- <li><a href="#analysis-stats" role="tab" data-toggle="tab" data-bind="click: function() { section('stats'); }">${ _('Stats') }</a></li>
- </ul>
- <div class="tab-content" style="max-height: 370px; height: 370px">
- <div class="tab-pane active" id="analysis-terms" data-bind="with: terms">
- <div class="widget-spinner" data-bind="visible: $parent.isLoading()">
- <i class="fa fa-spinner fa-spin"></i>
- </div>
- <div class="alert" data-bind="visible: ! $parent.isLoading() && $data.data().length == 0">${ _('There are no terms to be shown') }</div>
- <table style="width: 100%" data-bind="visible: ! $parent.isLoading() && $data.data().length > 0" class="table table-condensed">
- <tbody data-bind="foreach: $data.data">
- <tr>
- <td data-bind="text: val.value"></td>
- <td style="width: 22px" data-bind="click: $root.query.addSingleTermFacet">
- <a href="javascript: void(0)"><i class="fa fa-plus" title="${ _('Select this value') }"></i></a>
- </td>
- <td style="width: 22px" data-bind="click: $root.query.removeSingleTermFacet">
- <a href="javascript: void(0)"><i class="fa fa-minus" title="${ _('Exclude this value') }"></i></a>
- </td>
- <td style="width: 40px">
- <div class="progress">
- <div class="bar-label" data-bind="text:val.count"></div>
- <div class="bar bar-info" style="margin-top:-20px;" data-bind="style: {'width': ((val.count / $parent.data()[0].val.count) * 100) + '%'}"></div>
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <div class="tab-pane" id="analysis-stats" data-bind="with: stats">
- <div class="widget-spinner" data-bind="visible: $parent.isLoading()">
- <i class="fa fa-spinner fa-spin"></i>
- </div>
- <div class="alert" data-bind="visible: ! $parent.isLoading() && $data.data().length > 0 && $data.data()[0].key.toLowerCase() == 'error'">${ _('This field does not support stats') }</div>
- <div class="alert" data-bind="visible: ! $parent.isLoading() && $data.data().length == 0">${ _('There are no stats to be shown') }</div>
- <table style="width: 100%" data-bind="visible: ! $parent.isLoading() && $data.data().length > 0 && $data.data()[0].key.toLowerCase() != 'error'" class="table table-condensed">
- <tbody data-bind="foreach: $data.data">
- <tr>
- <td style="vertical-align: top"><strong data-bind="text: key"></strong></td>
- <!-- ko if: key == 'facets' -->
- <td>
- <!-- ko if: val[Object.keys(val)[0]] != null -->
- <table style="width: 400px">
- <tbody data-bind="foreach: Object.keys(val[Object.keys(val)[0]])">
- <tr>
- <td style="vertical-align: top; padding-left: 4px; padding-right: 4px"><strong data-bind="text: $data"></strong></td>
- <td data-bind="template: 'stats-facets'"></td>
- </tr>
- </tbody>
- </table>
- <!-- /ko -->
- <!-- ko ifnot: val[Object.keys(val)[0]] != null -->
- ${ _('Not available') }
- <!-- /ko -->
- </td>
- <!-- /ko -->
- <!-- ko ifnot: key == 'facets' -->
- <td data-bind="text: val"></td>
- <!-- /ko -->
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- </div>
- <!-- /ko -->
- </script>
- <script type="text/html" id="stats-facets">
- <table style="width: 100%">
- <tbody data-bind="foreach: Object.keys($parent.val[Object.keys($parent.val)[0]][$data])">
- <tr>
- <td style="vertical-align: top; padding-left: 4px; padding-right: 4px"><strong data-bind="text: $data"></strong></td>
- <!-- ko ifnot: $data == 'facets' -->
- <td style="vertical-align: top" data-bind="text: $parents[1].val[Object.keys($parents[1].val)[0]][$parent][$data]"></td>
- <!-- /ko -->
- </tr>
- </tbody>
- </table>
- </script>
- <div id="addFacetDemiModal" class="demi-modal fade" data-backdrop="false">
- <div class="modal-body">
- <a href="javascript: void(0)" data-dismiss="modal" data-bind="click: addFacetDemiModalFieldCancel" class="pull-right"><i class="fa fa-times"></i></a>
- <div style="float: left; margin-right: 10px;">
- <input id="addFacetInput" type="text" data-bind="clearable: $root.collection.template.fieldsModalFilter, valueUpdate:'afterkeydown'" placeholder="${_('Filter fields')}" class="input" style="float: left" /><br/>
- </div>
- <div>
- <ul data-bind="foreach: $root.collection.template.filteredModalFields().sort(function (l, r) { return l.name() > r.name() ? 1 : -1 }), visible: $root.collection.template.filteredModalFields().length > 0"
- class="unstyled inline fields-chooser" style="height: 100px; overflow-y: auto">
- <li data-bind="click: addFacetDemiModalFieldPreview">
- <span class="badge badge-info"><span data-bind="text: name(), attr: {'title': type()}"></span>
- </span>
- </li>
- </ul>
- <div class="alert alert-info inline" data-bind="visible: $root.collection.template.filteredModalFields().length == 0" style="margin-left: 250px; margin-right: 50px; height: 42px;line-height: 42px">
- ${_('There are no fields matching your search term.')}
- </div>
- </div>
- </div>
- <div><a class="pointer demi-modal-chevron" data-dismiss="modal" data-bind="click: addFacetDemiModalFieldCancel"><i class="fa fa-chevron-up"></i></a></div>
- </div>
- <div id="settingsDemiModal" class="demi-modal fade" data-backdrop="false">
- <a href="javascript: void(0)" data-dismiss="modal" class="pull-right" style="margin: 10px"><i class="fa fa-times"></i></a>
- <div class="modal-body">
- <div class="row-fluid">
- <div class="span12">
- <form class="form-horizontal">
- <fieldset>
- <legend><i class="fa fa-cogs"></i> ${ _('General settings') }</legend>
- <!-- ko if: $root.initial.inited() -->
- <!-- ko if: $root.collection.engine() == 'solr' -->
- <div class="control-group">
- <label class="control-label" for="settingssolrindex">${ _('Solr index') }</label>
- <div class="controls">
- <select id="settingssolrindex" data-bind="options: $root.initial.collections, value: $root.collection.name"></select>
- </div>
- </div>
- <!-- /ko -->
- <!-- ko if: $root.collection.engine() != 'solr' -->
- <div class="control-group">
- <label class="control-label" for="settingssolrindex">${ _('Solr index') }</label>
- <div class="controls">
- <input type="text" class="no-margin" data-bind="value: $root.collection.name, hivechooser: $root.collection.name, skipColumns: true" placeholder="${ _('Table name or <database>.<table>') }">
- </div>
- </div>
- <!-- /ko -->
- <div class="control-group">
- <label class="control-label" for="settingsdescription">${ _('Description') }</label>
- <div class="controls">
- <input id="settingsdescription" type="text" class="input-xlarge" data-bind="textInput: $root.collection.description, tagsNotAllowed" style="margin-bottom: 0" />
- </div>
- </div>
- <!-- ko if: $root.collection.engine() == 'solr' -->
- <div class="control-group">
- <label class="control-label">${ _('Autocomplete') }</label>
- <div class="controls">
- <label class="checkbox" style="padding-top:0">
- <input type="checkbox" style="margin-right: 4px; margin-top: 9px" data-bind="checked: $root.collection.suggest.enabled">
- <span data-bind="visible: $root.collection.suggest.enabled">
- ${ _('Dictionary') } <input type="text" class="input-xlarge" style="margin-bottom: 0; margin-left: 6px;" data-bind="textInput: $root.collection.suggest.dictionary, tagsNotAllowed" placeholder="${ _('Dictionary name or blank for default') }">
- </span>
- </label>
- </div>
- </div>
- <!-- ko if: $root.collection.supportAnalytics -->
- <div class="control-group">
- <label class="control-label">${ _('Nested documents') }</label>
- <div class="controls">
- <label class="checkbox" style="padding-top:0">
- <input type="checkbox" style="margin-right: 4px; margin-top: 9px" data-bind="checked: $root.collection.nested.enabled"/>
- <span data-bind="visible: $root.collection.nested.enabled">
- ${ _('Schema') }
- <span data-bind="template: {name: 'nested-document-schema-level', data: $root.collection.nested.schema()}"></span>
- </span>
- </label>
- </div>
- </div>
- <!-- /ko -->
- <!-- /ko -->
- <!-- /ko -->
- </fieldset>
- </form>
- </div>
- </div>
- </div>
- <div><a class="pointer demi-modal-chevron" data-dismiss="modal"><i class="fa fa-chevron-up"></i></a></div>
- </div>
- <div id="qdefinitionsDemiModal" class="demi-modal fade" data-backdrop="false">
- <a href="javascript: void(0)" data-dismiss="modal" class="pull-right" style="margin: 10px"><i class="fa fa-times"></i></a>
- <div class="modal-body">
- <div class="row-fluid">
- <div class="span12">
- <form class="form-inline">
- <fieldset>
- <legend><i class="fa fa-bookmark-o"></i> ${ _('Query definitions') }
- <div class="input-append" style="margin-left: 30px; margin-top: 4px">
- <input id="newqname" type="text" class="input-xxlarge" data-bind="textInput: $root.collection.newQDefinitionName, valueUpdate:'afterkeydown', tagsNotAllowed" style="margin-bottom: 0" placeholder="${ _('Add current query as...') }" />
- <a title="${ _('Click on this button to add the currenty query as a new definition') }" class="btn plus-btn" data-bind="click: $root.collection.addQDefinition, css:{'disabled': $.trim($root.collection.newQDefinitionName()) == ''}" style="margin-top: 1px">
- <i class="fa fa-plus"></i>
- </a>
- </div>
- </legend>
- <div class="control-group" data-bind="visible: $root.collection.qdefinitions().length > 0" style="margin-top: 0">
- <div class="controls">
- <ul class="unstyled airy qdefinitions" data-bind="foreach: $root.collection.qdefinitions">
- <li>
- <span class="badge badge-info badge-left pointer">
- <span data-bind="text: name, attr:{'title': ko.mapping.toJSON(data, null, 2)}, click: $root.collection.loadQDefinition"></span>
- </span><span class="badge badge-right trash-share" data-bind="click: $root.collection.removeQDefinition"> <i class="fa fa-times"></i></span>
- </li>
- </ul>
- </div>
- </div>
- <div class="control-group" data-bind="visible: $root.collection.qdefinitions().length == 0">
- <div class="controls">
- <h4>${ _('There are currently no query definitions.') }</h4>
- </div>
- </div>
- </fieldset>
- </form>
- </div>
- </div>
- </div>
- <div><a class="pointer demi-modal-chevron" data-dismiss="modal"><i class="fa fa-chevron-up"></i></a></div>
- </div>
- <script type="text/html" id="nested-document-schema-level">
- <ul class="unstyled airy" data-bind="foreach: $data">
- <li>
- <input type="text" data-bind="value: filter" placeholder="e.g. type_s:books"/>
- <input type="checkbox" data-bind="checked: selected"/>
- <!-- ko if: values().length == 0 -->
- <a data-bind="click: function() { $root.collection.nestedAddLeaf(values); }" href="javascript:void(0)">
- <i class="fa fa-plus"></i>
- </a>
- <a data-bind="click: function() { $parent.pop($data); $root.collection.nested.schema.valueHasMutated(); }" href="javascript:void(0)">
- <i class="fa fa-minus"></i>
- </a>
- <!-- /ko -->
- <!-- ko if: values().length > 0 -->
- <span data-bind="template: {name: 'nested-document-schema-level', data: values()}"></span>
- <!-- /ko -->
- </li>
- </ul>
- <a data-bind="click: function() { $root.collection.nestedAddLeaf($data); $root.collection.nested.schema.valueHasMutated(); }" href="javascript:void(0)">
- <i class="fa fa-plus"></i> ${ _('Level') }
- </a>
- <br/>
- </script>
- <script type="text/html" id="time-filter">
- <span data-bind="visible: $root.availableDateFields().length > 0" >
- <span data-bind="template: {name: 'time-filter-select'}"></span>
- <a class="btn pointer" title="${ _('Time Settings') }" rel="tooltip" data-placement="bottom" data-toggle="modal" data-target="#timeSettingsDemiModal">
- <i class="fa fa-calendar"></i>
- </a>
- </span>
- </script>
- <script type="text/html" id="time-fixed-filter">
- <span data-bind="visible: $root.availableDateFields().length > 0" class="muted" title="${ _('Time Settings') }" rel="tooltip" data-placement="bottom" data-toggle="modal" data-target="#timeSettingsDemiModal" style="cursor:pointer">
-
- <span data-bind="text: moment($root.collection.timeFilter.from()).utc().format('YYYY-MM-DD HH:mm:SS')"></span>
- <i class="fa fa-long-arrow-right"></i>
- <span data-bind="text: moment($root.collection.timeFilter.to()).utc().format('YYYY-MM-DD HH:mm:SS')"></span>
- </span>
- </script>
- <script type="text/html" id="time-filter-select">
- <select id="settingstimeinterval" data-bind="value: collection.timeFilter.value" class="input-small" style="margin-right: 4px">
- <option value="all">${ _('All') }</option>
- <option value="5MINUTES">${ _('Past 5 Minutes') }</option>
- <option value="30MINUTES">${ _('Past 30 Minutes') }</option>
- <option value="1HOURS">${ _('Past 1 Hour') }</option>
- <option value="12HOURS">${ _('Past 12 Hours') }</option>
- <option value="1DAYS">${ _('Past day') }</option>
- <option value="2DAYS">${ _('Past 2 days') }</option>
- <option value="7DAYS">${ _('Past 7 days') }</option>
- <option value="1MONTHS">${ _('Past 1 Month') }</option>
- <option value="3MONTHS">${ _('Past 3 Months') }</option>
- <option value="1YEARS">${ _('Past Year') }</option>
- <option value="2YEARS">${ _('Past 2 Years') }</option>
- <option value="10YEARS">${ _('Past 10 Years') }</option>
- </select>
- </script>
- <div id="timeSettingsDemiModal" class="demi-modal fade" data-backdrop="false">
- <a href="javascript: void(0)" data-dismiss="modal" class="pull-right" style="margin: 10px"><i class="fa fa-times"></i></a>
- <div class="modal-body">
- <div class="row-fluid">
- <div class="span12">
- <form class="form-horizontal">
- <fieldset>
- <legend><i class="fa fa-calendar"></i> ${ _('Time settings') }</legend>
- <span data-bind="visible: $root.availableDateFields().length > 0">
- <div class="control-group">
- <label class="control-label" for="settingstimefield">${ _('Date/time field') }</label>
- <div class="controls">
- <select id="settingstimefield" data-bind="options: $root.availableDateFields, value: collection.timeFilter.field, optionsValue: 'name'" class="input-medium"></select>
- </div>
- </div>
- <div class="control-group">
- <label class="control-label" for="settingstimetype">${ _('Type') }</label>
- <div class="controls">
- <label class="radio inline"><input type="radio" name="settingstimetype" value="rolling" data-bind="checked: collection.timeFilter.type" /> ${ _('Rolling') }</label>
- <label class="radio inline"><input type="radio" name="settingstimetype" value="fixed" data-bind="checked: collection.timeFilter.type" /> ${ _('Fixed') }</label>
- </div>
- </div>
- <div class="control-group" data-bind="visible: collection.timeFilter.type() == 'rolling'">
- <label class="control-label" for="settingstimeinterval">${ _('Interval') }</label>
- <div class="controls">
- <span data-bind="template: {name: 'time-filter-select'}"></span>
- </div>
- </div>
- <div class="control-group" data-bind="visible: collection.timeFilter.type() == 'fixed'">
- <label class="control-label" for="settingstimestart">${ _('Start date/time') }</label>
- <div class="controls">
- <input id="settingstimestart" type="text" data-bind="value: collection.timeFilter.from, datepicker: {momentFormat: 'YYYY-MM-DD[T]HH:mm:SS[Z]', disableUTC: true}" />
- </div>
- </div>
- <div class="control-group" data-bind="visible: collection.timeFilter.type() == 'fixed'">
- <label class="control-label" for="settingstimeend">${ _('End date/time') }</label>
- <div class="controls">
- <input id="settingstimeend" type="text" data-bind="value: collection.timeFilter.to, datepicker: {momentFormat: 'YYYY-MM-DD[T]HH:mm:SS[Z]', disableUTC: true}" />
- </div>
- </div>
- <!-- ko if: collection.timeFilter.type() == 'rolling' -->
- <div class="control-group">
- <div class="controls">
- <label class="checkbox inline-block">
- <input type="checkbox" style="margin-right: 4px; margin-top: 9px" data-bind="checked: $root.collection.autorefresh"/> ${ _('Auto-refresh every') } <input type="number" class="input-mini" style="margin-bottom: 0; margin-left: 6px; margin-right: 6px; width: 46px; text-align:center" data-bind="textInput: $root.collection.autorefreshSeconds"/> ${ _('seconds') }
- </label>
- </div>
- </div>
- <!-- /ko -->
- </span>
- <!-- ko if: $root.availableDateFields().length == 0 -->
- <label class="checkbox inline-block">
- <input type="checkbox" style="margin-right: 4px; margin-top: 9px" data-bind="checked: $root.collection.autorefresh"/> ${ _('Auto-refresh every') } <input type="number" class="input-mini" style="margin-bottom: 0; margin-left: 6px; margin-right: 6px; width: 46px; text-align:center" data-bind="textInput: $root.collection.autorefreshSeconds"/> ${ _('seconds') }
- </label>
- <!-- /ko -->
- </fieldset>
- </form>
- </div>
- </div>
- </div>
- <div><a class="pointer demi-modal-chevron" data-dismiss="modal"><i class="fa fa-chevron-up"></i></a></div>
- </div>
- <script type="text/html" id="nested-document-filter">
- <!-- ko if: $root.collection.supportAnalytics -->
- <span data-bind="visible: $root.collection.nested.enabled" >
- <a class="btn pointer" title="${ _('Nested schema') }" rel="tooltip" data-placement="bottom" data-toggle="modal" data-target="#settingsDemiModal">
- <i class="fa fa-sitemap"></i>
- </a>
- </span>
- <!-- /ko -->
- </script>
- <div id="fieldAnalysis" class="popover mega-popover right">
- <div class="arrow"></div>
- <h3 class="popover-title" style="text-align: left">
- <a class="pull-right pointer" data-bind="click: function(){ $('#fieldAnalysis').hide(); $root.fieldAnalysesName(''); }"><i class="fa fa-times"></i></a>
- <strong data-bind="text: $root.fieldAnalysesName"></strong>
- <!-- ko if: $root.getFieldAnalysis() -->
- (<span data-bind="text: $root.getFieldAnalysis().type"></span>)
- <!-- /ko -->
- </h3>
- <div class="popover-content" data-bind="template: { name: 'analysis-window' }" style="text-align: left"></div>
- </div>
- ## Extra code for style and custom JS
- <span id="extra" data-bind="augmenthtml: $root.collection.template.extracode"></span>
- <link rel="stylesheet" href="${ static('dashboard/css/search.css') }">
- %if is_mobile:
- <link rel="stylesheet" href="${ static('dashboard/css/search_mobile.css') }">
- %endif
- <link rel="stylesheet" href="${ static('desktop/ext/css/hue-filetypes.css') }">
- <link rel="stylesheet" href="${ static('desktop/ext/css/hue-charts.css') }">
- <link rel="stylesheet" href="${ static('desktop/ext/chosen/chosen.min.css') }">
- <link rel="stylesheet" href="${ static('desktop/ext/select2/select2.css') }">
- <link rel="stylesheet" href="${ static('desktop/ext/css/selectize.css') }">
- %if USE_GRIDSTER.get():
- <link rel="stylesheet" href="${ static('desktop/ext/css/jquery.gridster.min.css') }">
- %endif
- <script src="${ static('desktop/js/hue.json.js') }" type="text/javascript" charset="utf-8"></script>
- ${ dashboard.import_layout(True) }
- % if not is_embeddable:
- <script src="${ static('desktop/js/share2.vm.js') }"></script>
- % endif
- <script src="${ static('dashboard/js/search.utils.js') }" type="text/javascript" charset="utf-8"></script>
- <script src="${ static('desktop/js/jquery.textsqueezer.js') }" type="text/javascript" charset="utf-8"></script>
- <script src="${ static('desktop/ext/js/bootstrap-editable.min.js') }" type="text/javascript" charset="utf-8"></script>
- <script src="${ static('desktop/js/ko.editable.js') }" type="text/javascript" charset="utf-8"></script>
- <script src="${ static('desktop/ext/js/shortcut.js') }" type="text/javascript" charset="utf-8"></script>
- <script src="${ static('desktop/ext/js/mustache.js') }" type="text/javascript" charset="utf-8"></script>
- <script src="${ static('desktop/ext/chosen/chosen.jquery.min.js') }" type="text/javascript" charset="utf-8"></script>
- <script src="${ static('desktop/ext/js/jquery/plugins/jquery.hotkeys.js') }"></script>
- <script src="${ static('desktop/ext/select2/select2.min.js') }" type="text/javascript" charset="utf-8"></script>
- <script src="${ static('desktop/ext/js/selectize.min.js') }"></script>
- <script src="${ static('desktop/js/ko.selectize.js') }"></script>
- <script src="${ static('dashboard/js/search.ko.js') }" type="text/javascript" charset="utf-8"></script>
- %if USE_GRIDSTER.get():
- <script src="${ static('desktop/ext/js/jquery/plugins/jquery.gridster.with-extras.min.js') }"></script>
- <script src="${ static('desktop/ext/js/gridster-knockout.min.js') }"></script>
- %endif
- ${ dashboard.import_bindings() }
- <style type="text/css">
- % if conf.CUSTOM.BANNER_TOP_HTML.get():
- .search-bar {
- top: 58px!important;
- }
- .card-toolbar {
- top: 100px!important;
- }
- #emptyDashboardEditing {
- top: 190px!important;
- }
- .dashboard {
- margin-top: 20px;
- }
- .dashboard.with-top-margin {
- margin-top: 80px;
- }
- % endif
- </style>
- <script type="text/javascript">
- var searchViewModel;
- moment.suppressDeprecationWarnings = true;
- var NUMERIC_HIT_OPTIONS = [
- { value: "count", label: "${ _('Group by') }" },
- ## { value: "counts", label: "Count" },
- { value: "unique", label: "${ _('Unique') }" },
- { value: "avg", label: "${ _('Average') }" },
- { value: "sum", label: "${ _('Sum') }" },
- { value: "min", label: "${ _('Min') }" },
- { value: "max", label: "${ _('Max') }" },
- { value: "median", label: "${ _('Median') }" },
- { value: "percentile", label: "${ _('Percentiles') }" },
- { value: "stddev", label: "${ _('Stddev') }" },
- { value: "variance", label: "${ _('Variance') }" }
- ];
- var DATETIME_HIT_OPTIONS = [
- { value: "count", label: "${ _('Group by') }" },
- ## { value: "counts", label: "Count" },
- { value: "unique", label: "${ _('Unique') }" },
- ];
- var ALPHA_HIT_COUNTER_OPTIONS = [
- ##{ value: "count", label: "${ _('Group by') }" },
- ##{ value: "counts", label: "Count" },
- { value: "unique", label: "${ _('Unique') }" },
- { value: "min", label: "${ _('Min') }" },
- { value: "max", label: "${ _('Max') }" }
- ];
- var ALPHA_HIT_OPTIONS = [
- { value: "count", label: "${ _('Group by') }" },
- ## { value: "counts", label: "Count" },
- { value: "unique", label: "${ _('Unique') }" },
- { value: "min", label: "${ _('Min') }" },
- { value: "max", label: "${ _('Max') }" }
- ];
- var HIT_OPTIONS = NUMERIC_HIT_OPTIONS
- ;
- function prepareShareModal() {
- shareViewModel.setDocUuid(this.collection.uuid());
- openShareModal();
- }
- function getHitOption(value) {
- for (var i=0; i < HIT_OPTIONS.length; i++){
- if (HIT_OPTIONS[i].value == value){
- return HIT_OPTIONS[i].label;
- }
- }
- return value;
- }
- function getPrettyMetric(facet) {
- return getHitOption(facet.function());
- }
- function prettifyDate(from, widget, to) {
- if (typeof from == "undefined" || $.isNumeric(from)) {
- return from;
- }
- if (typeof to != "undefined" && !$.isNumeric(to)) {
- return prettifyDateRange(from, to, widget);
- }
- var _mFrom = moment(from);
- if (_mFrom.isValid()) {
- var _format = "YYYY-MM-DD HH:mm:ss";
- var _minMaxDiff = 0;
- if (widget && widget.properties && widget.properties.min && widget.properties.min()) {
- _minMaxDiff = moment(widget.properties.max()).diff(moment(widget.properties.min()), 'seconds');
- if (moment(widget.properties.max()).seconds() == 0 && moment(widget.properties.min()).seconds() == 0) {
- _format = _format.substring(0, 16); // gets rid of :00 seconds
- }
- }
- _format = getFormat(_format, _minMaxDiff, widget);
- return _mFrom.utc().format(_format);
- }
- else {
- return from;
- }
- }
- function prettifyDateRange(from, to, widget, withCommon) {
- if (typeof from == "undefined" || $.isNumeric(from)) {
- return from + " - " + to;
- }
- var _mFrom = moment(from);
- var _mTo = moment(to);
- if (_mFrom.isValid() && _mTo.isValid()) {
- var _mFromFormatted = _mFrom.utc().format("YYYY-MM-DD HH:mm:ss");
- var _mToFormatted = _mTo.utc().format("YYYY-MM-DD HH:mm:ss");
- var _lastEqual = _mFromFormatted.length - 1;
- for (var i = _mFromFormatted.length - 1; i >= 0; i--) {
- if (_mFromFormatted[i] == _mToFormatted[i] && (_mFromFormatted[i] == "0" || _mFromFormatted[i] == ":")) {
- _lastEqual = i;
- }
- else break;
- }
- var _minMaxDiff = moment(to).diff(moment(from), 'seconds');
- var _format = "YYYY-MM-DD HH:mm:ss".substr(0, _lastEqual);
- if (_format.length == 13){
- _format += ":mm"; // hours without minutes are weird
- }
- var _formatWithCommon = _format.substring(10, _format.length);
- var _common = "YYYY-MM-DD";
- if (widget && widget.properties && widget.properties.min && widget.properties.min()) {
- _minMaxDiff = moment(widget.properties.max()).diff(moment(widget.properties.min()), 'seconds');
- }
- if (withCommon && _mTo.diff(_mFrom, 'days') >= 365){
- withCommon = false;
- _format = _common;
- }
- else {
- _format = getFormat(_format, _minMaxDiff, widget);
- }
- return ((_common != "" && withCommon) ? _mFrom.utc().format(_common) + " " : "") + _mFrom.utc().format(withCommon ? _formatWithCommon : _format) + " <i class='fa fa-long-arrow-right'></i> " + ((_common != "" && withCommon) ? _mTo.utc().format(_common) + " " : "") + _mTo.utc().format(withCommon ? _formatWithCommon : _format);
- }
- else {
- return from + " - " + to;
- }
- }
- function getFormat(format, minMaxDiff, widget) {
- var _hasWidget = widget && widget.properties && widget.properties.min && widget.properties.min();
- if (minMaxDiff > 0 && minMaxDiff <= 86400) { // max 1 day
- if (_hasWidget && moment(widget.properties.max()).date() != moment(widget.properties.min()).date()) {
- format = format.substring(5, format.length);
- }
- else {
- format = format.substring(10, format.length);
- }
- }
- if (minMaxDiff > 86400 && minMaxDiff <= 22464000) { // max 360 days
- format = format.substring(5, format.length);
- }
- if (minMaxDiff > 22464000){
- format = format.substr(0, 10);
- }
- if (format.indexOf("MM") == 0) {
- format = "MMM " + format.substr(3);
- }
- return format;
- }
- var lastWindowScrollPosition = 0;
- function pieChartDataTransformer(data) {
- var _data = [];
- $(data.counts).each(function (cnt, item) {
- item.widget_id = data.widget_id;
- _data.push({
- label: item.value,
- value: item.count,
- obj: item
- });
- });
- return _data;
- }
- function _rangePieChartDataTransformer(data, isUp) {
- var _data = [];
- $(data.counts).each(function (cnt, item) {
- item.widget_id = data.widget_id;
- var _label = isUp ? (item.from + (item.is_up ? ' & ${ _('Up') }' : ' & ${ _('Less') }')) : (item.from + ' - ' + item.to);
- _data.push({
- label: _label,
- from: item.from,
- to: item.to,
- value: item.value,
- obj: item
- });
- });
- return _data;
- }
- function rangePieChartDataTransformer(data) {
- return _rangePieChartDataTransformer(data, false);
- }
- function rangeUpPieChartDataTransformer(data) {
- return _rangePieChartDataTransformer(data, true);
- }
- function pieChartDataTransformerGrid(data) {
- var _data = [];
- var chartX = searchViewModel.collection.template.chartSettings.chartX();
- var chartY = searchViewModel.collection.template.chartSettings.chartYSingle();
- $(data.counts).each(function (cnt, item) {
- item.widget_id = data.widget_id;
- if (chartX != "" && item.item[chartX] && chartY != "" && item.item[chartY]) {
- _data.push({
- label: item.item[chartX](),
- value: item.item[chartY](),
- obj: item
- });
- }
- });
- return _data;
- }
- function _barChartDataTransformer(rawDatum, isUp) {
- var _datum = [];
- var _data = [];
- $(rawDatum.counts).each(function (cnt, item) {
- item.widget_id = rawDatum.widget_id;
- if (typeof item.from != "undefined") {
- if (isUp){
- _data.push({
- series: 0,
- x: item.from + (item.is_up ? ' & ${ _('Up') }' : ' & ${ _('Less') }'),
- y: item.value,
- obj: item
- });
- }
- else {
- _data.push({
- series: 0,
- x: item.from,
- x_end: item.to,
- y: item.value,
- obj: item
- });
- }
- }
- else {
- _data.push({
- series: 0,
- x: item.value,
- y: item.count,
- obj: item
- });
- }
- });
- _datum.push({
- key: rawDatum.label,
- values: _data
- });
- return _datum;
- }
- function barChartDataTransformer(rawDatum) {
- return _barChartDataTransformer(rawDatum, false);
- }
- function barChartRangeUpDataTransformer(rawDatum) {
- return _barChartDataTransformer(rawDatum, true);
- }
- function _partitionChartDataTransformer(counts) {
- var _categories = [];
- $(counts).each(function (cnt, item) {
- var _category = null;
- _categories.forEach(function (category) {
- if (category.name == item.value) {
- _category = category;
- }
- });
- if (_category == null) {
- _category = {
- name: item.value,
- size: item.count,
- obj: item,
- children: []
- }
- _categories.push(_category);
- }
- if (item.pivot != undefined) {
- var children = []
- $(item.pivot).each(function (cnt, child) {
- children = children.concat(_partitionChartDataTransformer(child));
- });
- _category.children = children;
- }
- });
- return _categories;
- }
- function partitionChartDataTransformer(rawDatum) {
- var _partitionData = {
- name: "${ _('Total') }",
- children: []
- }
- _partitionData.children = _partitionChartDataTransformer(rawDatum.counts);
- return _partitionData;
- }
- function pivotChartDataTransformer(rawDatum) {
- var _categories = [];
- $(rawDatum.counts).each(function (cnt, item) {
- item.widget_id = rawDatum.widget_id;
- var _key = Array.isArray(item.value) ? item.value[1] : item.value;
- var _category = null;
- _categories.forEach(function (category) {
- if (category.key == _key) {
- _category = category;
- }
- });
- if (_category == null) {
- _category = {
- key: _key,
- values: []
- };
- _categories.push(_category);
- }
- _category.values.push({
- series: 0,
- x: item.cat,
- y: item.count,
- obj: item
- });
- });
- return _categories;
- }
- function lineChartDataTransformer(rawDatum) {
- var _datum = [];
- var _data = [];
- $(rawDatum.counts).each(function (cnt, item) {
- item.widget_id = rawDatum.widget_id;
- if (typeof item.from != "undefined") {
- _data.push({
- series: 0,
- x: item.from,
- x_end: item.to,
- y: item.value,
- obj: item
- });
- }
- else {
- _data.push({
- series: 0,
- x: item.value,
- y: item.count,
- obj: item
- });
- }
- });
- _datum.push({
- key: rawDatum.label,
- values: _data
- });
- return _datum;
- }
- function timelineChartDataTransformer(rawDatum) {
- var _datum = [];
- var _data = [];
- $(rawDatum.counts).each(function (cnt, item) {
- _data.push({
- series: 0,
- x: new Date(moment(item.from).valueOf()),
- y: item.value,
- obj: item
- });
- });
- _datum.push({
- key: rawDatum.label,
- values: _data
- });
- // If multi query
- $(rawDatum.extraSeries).each(function (cnt, item) {
- if (cnt == 0) {
- _datum = [];
- }
- var _data = [];
- $(item.counts).each(function (cnt, item) {
- _data.push({
- series: cnt + 1,
- x: new Date(moment(item.from).valueOf()),
- y: item.value,
- obj: item
- });
- });
- _datum.push({
- key: item.label,
- values: _data
- });
- });
- return _datum;
- }
- function mapChartDataTransformer(data) {
- var _data = [];
- $(data.counts).each(function (cnt, item) {
- item.fields = item.pivot ? item.pivot[0].fq_fields : item.fq_fields;
- item.values = item.pivot ? item.pivot[0].fq_values : item.fq_values;
- item.counts = item.pivot ? item.pivot[0].count : item.count; // unused yet
- item.is2d = item.pivot ? true : false; // unused yet
- if (item.value != null && item.value != "" && item.value.length < 4) {
- var _label = data.scope == "world" ? HueGeo.getISOAlpha3(item.value) : item.value.toUpperCase();
- var _found = false;
- for (var i = 0; i < _data.length; i++) { // we group lower and upper cases together
- if (_data[i].label == _label) {
- _data[i].value += item.pivot ? item.pivot[0].fq_values : item.count;
- _found = true;
- break;
- }
- }
- if (!_found) {
- _data.push({
- label: _label,
- value: item.pivot ? item.pivot[0].fq_values : item.count,
- obj: item
- });
- }
- }
- });
- return _data;
- }
- function gradientMapChartDataTransformer(data) {
- var _data = [];
- $(data.counts).each(function (cnt, item) {
- item.is2d = item.fq_fields ? true : false;
- item.fields = item.is2d ? item.fq_fields : [item.cat];
- item.values = item.is2d ? item.fq_values : [item.value];
- item.counts = item.count;
- item.value = item.is2d ? item.fq_values[0] : item.value;
- item.pivot = [];
- if (item.value != null && item.value != "" && item.value.length < 4) {
- var _label = data.scope == "world" ? HueGeo.getISOAlpha3(item.value) : item.value.toUpperCase();
- var _found = false;
- for (var i = 0; i < _data.length; i++) { // we group lower and upper cases together
- if (_data[i].label == _label) {
- _data[i].value += item.counts;
- _data[i].obj.pivot.push({count: item.counts, value: item.is2d ? (/\)/.test(item.cat) ? item.cat : item.fq_values[item.fq_values.length - 1]) : item.value});
- _found = true;
- break;
- }
- }
- if (! _found) {
- item.pivot = [{count: item.count, value: item.is2d ? (/\)/.test(item.cat) ? item.cat : item.fq_values[item.fq_values.length - 1]) : item.value}];
- _data.push({
- label: _label,
- value: item.counts,
- obj: item
- });
- }
- }
- });
- return _data;
- }
- function leafletMapChartDataTransformer(data) {
- var _data = [];
- if (!$.isEmptyObject(data.counts) && data.counts.response.docs && searchViewModel.collection.template.leafletmap.latitudeField() != "" && searchViewModel.collection.template.leafletmap.longitudeField() != "") {
- data.counts.response.docs.forEach(function (record) {
- var _obj = {
- lat: record[searchViewModel.collection.template.leafletmap.latitudeField()],
- lng: record[searchViewModel.collection.template.leafletmap.longitudeField()]
- }
- if (searchViewModel.collection.template.leafletmap.labelField() != "") {
- _obj.label = record[searchViewModel.collection.template.leafletmap.labelField()];
- }
- _data.push(_obj);
- });
- }
- return _data;
- }
- function leafletMapChartDataTransformerGrid(data) {
- var _data = [];
- $(data.counts).each(function (cnt, item) {
- var chartX = searchViewModel.collection.template.chartSettings.chartX();
- var chartY = searchViewModel.collection.template.chartSettings.chartYSingle();
- var chartMapLabel = searchViewModel.collection.template.chartSettings.chartMapLabel();
- if (chartX != "" && item.item[chartX] && chartY != "" && item.item[chartY]) {
- var _obj = {
- lat: item.item[chartX](),
- lng: item.item[chartY]()
- }
- if (chartMapLabel != "" && item.item[chartMapLabel]) {
- _obj.label = item.item[chartMapLabel]();
- }
- _data.push(_obj);
- }
- });
- return _data;
- }
- function multiSerieDataTransformer(rawDatum) {
- var _datum = [];
- if (rawDatum.snippet.chartX() != null && rawDatum.snippet.chartYMulti().length > 0) {
- var _plottedSerie = 0;
- rawDatum.snippet.chartYMulti().forEach(function (col) {
- var _idxValue = -1;
- var _idxLabel = -1;
- rawDatum.snippet.result.meta().forEach(function (icol, idx) {
- if (icol.name == rawDatum.snippet.chartX()) {
- _idxLabel = idx;
- }
- if (icol.name == col) {
- _idxValue = idx;
- }
- });
- if (_idxValue > -1) {
- var _data = [];
- $(rawDatum.counts()).each(function (cnt, item) {
- _data.push({
- series: _plottedSerie,
- x: item[_idxLabel],
- y: item[_idxValue],
- obj: item
- });
- });
- if (rawDatum.sorting == "asc") {
- _data.sort(function (a, b) {
- return a.y - b.y
- });
- }
- if (rawDatum.sorting == "desc") {
- _data.sort(function (a, b) {
- return b.y - a.y
- });
- }
- _datum.push({
- key: col,
- values: _data
- });
- _plottedSerie++;
- }
- });
- }
- return _datum;
- }
- function multiSerieDataTransformerGrid(rawDatum) {
- var _datum = [];
- var chartX = searchViewModel.collection.template.chartSettings.chartX();
- var chartY = searchViewModel.collection.template.chartSettings.chartYMulti();
- if (chartX != null && chartY.length > 0 && rawDatum.counts.length > 0) {
- var _plottedSerie = 0;
- chartY.forEach(function (col) {
- var _data = [];
- $(rawDatum.counts).each(function (cnt, item) {
- if (item.item[chartX] && item.item[col]) {
- _data.push({
- series: _plottedSerie,
- x: item.item[chartX](),
- y: item.item[col](),
- obj: item.item
- });
- }
- });
- if (rawDatum.sorting == "asc") {
- _data.sort(function (a, b) {
- return a.y - b.y
- });
- }
- if (rawDatum.sorting == "desc") {
- _data.sort(function (a, b) {
- return b.y - a.y
- });
- }
- _datum.push({
- key: col,
- values: _data
- });
- _plottedSerie++;
- });
- }
- return _datum;
- }
- function resizeFieldsListCallback() {
- $('.fields-list').each(function(){
- $fieldsList = $(this);
- var $resultContainer = $fieldsList.parents('.card-widget').find('.result-container');
- $fieldsList.css("max-height", Math.max($resultContainer.height(), 230));
- window.setTimeout(function () {
- var _fillHeight = $resultContainer.height() - 40;
- if ($fieldsList.height() < _fillHeight) {
- $fieldsList.height(_fillHeight);
- $fieldsList.css("max-height", _fillHeight);
- }
- }, 100);
- var positionInfo = function () {
- var leftPos = 184;
- if ($fieldsList.get(0).scrollHeight > $fieldsList.height()) {
- leftPos -= hueUtils.scrollbarWidth();
- }
- $fieldsList.find('i').css('left', (leftPos + $fieldsList.scrollLeft()) + 'px');
- }
- var checkHeight = function () {
- if ($fieldsList.height() > 0) {
- positionInfo();
- } else {
- window.setTimeout(checkHeight, 100);
- }
- }
- checkHeight();
- $fieldsList.off('scroll');
- $fieldsList.on('scroll', positionInfo);
- });
- }
- var resizeTimeout = -1;
- function resizeFieldsListThrottled() {
- window.clearTimeout(resizeTimeout);
- resizeTimeout = window.setTimeout(resizeFieldsListCallback, 200);
- }
- function resizeFieldsList() {
- resizeFieldsListCallback();
- }
- function toggleDocDetails(doc) {
- doc.showDetails(! doc.showDetails());
- if (doc.details().length == 0) {
- searchViewModel.getDocument(doc, resizeFieldsList);
- }
- else {
- resizeFieldsListThrottled();
- }
- }
- function queryTypeahead(query, process) {
- var _source = searchViewModel.collection.template.fieldsNames();
- _source = _source.concat("AND OR TO".split(" "))
- if (searchViewModel.collection.suggest.enabled()) {
- searchViewModel.suggest(query, function (data) {
- var _tmp = [];
- if (typeof data != "undefined" && data.response && data.response.suggest && data.response.suggest[searchViewModel.collection.suggest.dictionary()]) {
- var suggestions = data.response.suggest[searchViewModel.collection.suggest.dictionary()][query].suggestions;
- suggestions.forEach(function (sugg) {
- _tmp.push(sugg.term + "<i class='muted fa fa-search'></i>");
- });
- }
- process(_tmp.concat(_source));
- });
- }
- else {
- return _source;
- }
- }
- function newSearch() {
- $.getJSON('/search/new_search?format=json', function(data){
- searchViewModel.collectionJson = data.collection;
- searchViewModel.queryJson = data.query;
- searchViewModel.initialJson = data.initial;
- searchViewModel.reset();
- });
- }
- function loadSearch(collection, query, initial) {
- searchViewModel = new SearchViewModel(collection, query, initial);
- ko.applyBindings(searchViewModel, $('#searchComponents')[0]);
- searchViewModel.timelineChartTypes = ko.observableArray([
- {
- value: "line",
- label: "${ _('Lines')}"
- },
- {
- value: "bar",
- label: "${ _('Bars')}"
- }
- ]);
- searchViewModel.init(function(data){
- $(".chosen-select").trigger("chosen:updated");
- });
- searchViewModel.isRetrievingResults.subscribe(function(value){
- if (! value){
- resizeFieldsList();
- }
- });
- searchViewModel.isEditing.subscribe(function(value){
- if (value){
- window.setTimeout(function(){
- if ($(".slider-cnt").length > 0 && $(".slider-cnt").data("slider")){
- $(".slider-cnt").slider("redraw");
- }
- }, 300);
- }
- });
- searchViewModel.isPlayerMode.subscribe(function(value) {
- if (value){
- $(".navigator").hide();
- $("body").css("paddingTop", "40px");
- }
- else {
- $(".navigator").show();
- $("body").css("paddingTop", "80px");
- }
- });
- var _refreshTimeout = null;
- var refresh = function () {
- _refreshTimeout = window.setTimeout(function () {
- if (searchViewModel.collection.autorefresh()) {
- searchViewModel.search(refresh);
- }
- }, ($.isNumeric(searchViewModel.collection.autorefreshSeconds()) ? searchViewModel.collection.autorefreshSeconds() * 1 : 60) * 1000)
- }
- var checkAutoRefresh = function () {
- if (searchViewModel.collection.autorefresh()) {
- window.clearTimeout(_refreshTimeout);
- refresh();
- }
- }
- if (searchViewModel.collection.autorefresh()) {
- refresh();
- }
- huePubSub.subscribe('check.autorefresh', function () {
- checkAutoRefresh();
- });
- searchViewModel.collection.autorefresh.subscribe(function (value) {
- if (value) {
- refresh();
- }
- else {
- window.clearTimeout(_refreshTimeout);
- }
- });
- searchViewModel.collection.autorefreshSeconds.subscribe(function (value) {
- checkAutoRefresh();
- });
- }
- $(document).ready(function () {
- var _resizeTimeout = -1;
- $(window).resize(function(){
- window.clearTimeout(_resizeTimeout);
- window.setTimeout(function(){
- resizeFieldsList();
- }, 200);
- });
- %if USE_GRIDSTER.get():
- var WIDGET_BASE_HEIGHT = 50;
- $(".gridster>ul").gridster({
- widget_margins: [5, 5],
- widget_base_dimensions: ['auto', WIDGET_BASE_HEIGHT],
- avoid_overlapped_widgets: true,
- max_cols: 12,
- max_rows: 60,
- ## draggable: {
- ## handle: '.move-gridster-widget'
- ## },
- resize: {
- enabled: true,
- stop: function (event, ui, $widget) {
- huePubSub.publish('resize.plotly.chart');
- },
- }
- });
- function resizeGridsterWidget($el){
- $(".gridster>ul").data('gridster').resize_widget($el, $el.data('sizex'), Math.ceil($el.find('.card-widget').height() / WIDGET_BASE_HEIGHT));
- }
- huePubSub.subscribeOnce('calculate.gridster.heights', function () {
- $('.gridster ul li.gs-w').each(function () {
- resizeGridsterWidget($(this));
- });
- }, 'dashboard');
- // there's no elegant way to do this because it doesn't work with knockout afterrender events
- var previousWidgetsHeights = 0;
- var toleranceCycles = 0;
- var renderingCheckInterval = window.setInterval(function () {
- if (toleranceCycles === 5) {
- window.clearInterval(renderingCheckInterval);
- huePubSub.publish('calculate.gridster.heights');
- }
- var latestWidgetsHeights = 0;
- $('.gridster ul li.gs-w .card-widget').each(function () {
- latestWidgetsHeights += $(this).height();
- });
- if (latestWidgetsHeights !== previousWidgetsHeights) {
- previousWidgetsHeights = latestWidgetsHeights;
- toleranceCycles = 0;
- }
- else {
- toleranceCycles++;
- }
- }, 200);
- huePubSub.subscribe('plotly.afterplot', function (element){
- resizeGridsterWidget($(element).parents('li.gs-w'));
- }, 'dashboard');
- huePubSub.subscribe('leaflet.afterplot', function (element){
- resizeGridsterWidget($(element).parents('li.gs-w'));
- }, 'dashboard');
- %endif
- $(document).on("click", ".widget-settings-pill", function(){
- $(this).parents(".card-body").find(".widget-section").hide();
- selectAllCollectionFields(); // Make sure all the collection fields appear
- $(this).parents(".card-body").find(".widget-settings-section").show();
- $(this).parent().siblings().removeClass("active");
- $(this).parent().addClass("active");
- });
- $(document).on("click", ".widget-editor-pill", function(){
- $(this).parents(".card-body").find(".widget-section").hide();
- $(this).parents(".card-body").find(".widget-editor-section").show();
- $(this).parent().siblings().removeClass("active");
- $(this).parent().addClass("active");
- });
- $(document).on("click", ".widget-html-pill", function(){
- $(this).parents(".card-body").find(".widget-section").hide();
- $(this).parents(".card-body").find(".widget-html-section").show();
- $(document).trigger("refreshCodemirror");
- $(this).parent().siblings().removeClass("active");
- $(this).parent().addClass("active");
- });
- $(document).on("click", ".widget-css-pill", function(){
- $(this).parents(".card-body").find(".widget-section").hide();
- $(this).parents(".card-body").find(".widget-css-section").show();
- $(document).trigger("refreshCodemirror");
- $(this).parent().siblings().removeClass("active");
- $(this).parent().addClass("active");
- });
- $(document).on("magicSearchLayout", function(){
- resizeFieldsList();
- });
- $(document).on("setLayout", function(){
- resizeFieldsList();
- });
- huePubSub.subscribe('gridChartForceUpdate', function () {
- window.setTimeout(function () {
- $('.grid-chart-container').children().trigger('forceUpdate')
- }, 200);
- });
- var _query = ${ query | n,unicode };
- loadSearch(${ collection.get_json(user) | n,unicode }, ${ query | n,unicode }, ${ initial | n,unicode });
- $("#addFacetDemiModal").on("hidden", function () {
- if (typeof selectedWidget.hasBeenSelected == "undefined"){
- addFacetDemiModalFieldCancel();
- }
- });
- $(document).off("shownAnalysis");
- $(document).on("shownAnalysis", function (e, originalEvent) {
- if (originalEvent.pageX == null && originalEvent.clientX != null) {
- var doc = document.documentElement, body = document.body;
- originalEvent.pageX = originalEvent.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
- originalEvent.pageY = originalEvent.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
- }
- if ($('#searchComponents').offset().left > 0) {
- originalEvent.pageX = originalEvent.pageX - $('#searchComponents').offset().left;
- originalEvent.pageY = originalEvent.pageY - $('#searchComponents').offset().top;
- }
- $("#fieldAnalysis").show().css({
- top: Math.max(0, originalEvent.pageY - $("#fieldAnalysis").outerHeight() / 2),
- left: originalEvent.pageX
- })
- });
- % if is_owner:
- $(window).bind("keydown", "ctrl+s alt+s meta+s", function(e){
- e.preventDefault();
- searchViewModel.save();
- return false;
- });
- % endif
- $(window).bind("keydown", "esc", function () {
- if ($(".demi-modal.fade.in").length > 0) {
- $(".demi-modal.fade.in .demi-modal-chevron").click();
- }
- });
- $("#newqname").bind("keydown", "return", function (e) {
- e.preventDefault();
- searchViewModel.collection.addQDefinition();
- });
- $(document).on("loadedQDefinition", function() {
- if ($(".demi-modal.fade.in").length > 0) {
- $(".demi-modal.fade.in .demi-modal-chevron").click();
- }
- });
- function loadQueryDefinition(id) {
- var _qdef = searchViewModel.collection.getQDefinition(id);
- if (_qdef != null) {
- searchViewModel.collection.loadQDefinition(_qdef);
- }
- }
- if (window.location.hash != "" && window.location.hash.indexOf("qd=") > -1) {
- loadQueryDefinition(window.location.hash.substr(1).replace(/(<([^>]+)>)/ig, "").split("=")[1]);
- }
- else if (_query.qd) {
- loadQueryDefinition(_query.qd);
- }
- });
- function throttledHeaderPadding(e) {
- $resultMain = $(e.target);
- $resultMain.find("thead>tr th").each(function () {
- var leftPosition = $(this).position().left - $resultMain.position().left;
- if (leftPosition + $(this).outerWidth() > 0 && leftPosition < 0) {
- if ($(this).find('span').width() + -leftPosition < $(this).outerWidth() - 20) { // 20 is the sorting css width
- $(this).find('span').css('paddingLeft', -leftPosition);
- }
- }
- else {
- $(this).find('span').css('paddingLeft', 0);
- }
- });
- }
- var throttledScrollTimeout = -1;
- function throttledHeaderScroll() {
- window.clearTimeout(throttledScrollTimeout);
- throttledScrollTimeout = window.setTimeout(function(){
- var scrollTimeout = -1;
- $('.result-main').off('scroll');
- $('.result-main').on('scroll', function (e) {
- window.clearTimeout(scrollTimeout);
- scrollTimeout = window.setTimeout(function(){
- throttledHeaderPadding(e);
- }, 200);
- });
- }, 200);
- }
- function toggleGridFieldsSelection(widget) {
- if (widget.widgetType() == 'resultset-widget') {
- searchViewModel.resultsHash = '';
- } else {
- widget.resultsHash = '';
- }
- if (widget.template.fields().length > 0) {
- widget.template.fieldsSelected.removeAll();
- }
- else {
- selectAllCollectionFields(widget);
- }
- }
- function selectAllCollectionFields(widget) {
- if (! widget) {
- widget = searchViewModel.collection;
- }
- var _fields = [];
- $.each(widget.fields(), function (index, field) {
- _fields.push(field.name());
- });
- widget.template.fieldsSelected(_fields);
- }
- function columnDropAdditionalHandler(widget) {
- if (searchViewModel.collection.getFacetById(widget.id()) == null) {
- showAddFacetDemiModal(widget);
- }
- searchViewModel.search();
- }
- function widgetDraggedAdditionalHandler(widget, row) {
- showAddFacetDemiModal(widget, row);
- }
- function distributeRowWidgetsSize(row, waitForIt) {
- if (row) {
- if (waitForIt) {
- var _initial = row.widgets().length;
- var _widgetDropInterval = window.setInterval(function () {
- if (row.widgets().length != _initial) {
- window.clearInterval(_widgetDropInterval);
- row.autosizeWidgets();
- }
- }, 100, 'search')
- }
- else {
- row.autosizeWidgets();
- }
- }
- }
- var selectedWidget = null;
- var selectedRow = null;
- function showAddFacetDemiModal(widget, row) {
- if (["resultset-widget", "html-resultset-widget", "filter-widget", "leafletmap-widget"].indexOf(widget.widgetType()) == -1) {
- searchViewModel.collection.template.fieldsModalFilter("");
- searchViewModel.collection.template.fieldsModalType(widget.widgetType());
- selectedWidget = widget;
- selectedRow = row;
- if (searchViewModel.collection.template.availableWidgetFields().length == 1){
- addFacetDemiModalFieldPreview(searchViewModel.collection.template.availableWidgetFields()[0]);
- }
- else {
- $('#addFacetInput').typeahead({
- 'source': searchViewModel.collection.template.availableWidgetFieldsNames(),
- 'updater': function (item) {
- addFacetDemiModalFieldPreview({'name': function () {
- return item
- }});
- return item;
- }
- });
- $("#addFacetDemiModal").modal("show");
- $("#addFacetDemiModal input[type='text']").focus();
- }
- }
- else {
- distributeRowWidgetsSize(row, true);
- }
- }
- function addFacetDemiModalFieldPreview(field) {
- var _existingFacet = searchViewModel.collection.getFacetById(selectedWidget.id());
- if (selectedWidget != null) {
- selectedWidget.hasBeenSelected = true;
- selectedWidget.isLoading(true);
- searchViewModel.collection.addFacet({'name': field.name(), 'widget_id': selectedWidget.id(), 'widgetType': selectedWidget.widgetType()});
- if (_existingFacet != null) {
- _existingFacet.label(field.name());
- _existingFacet.field(field.name());
- }
- $("#addFacetDemiModal").modal("hide");
- if (selectedRow != null) {
- distributeRowWidgetsSize(selectedRow);
- }
- }
- }
- function addFacetDemiModalFieldCancel() {
- searchViewModel.removeWidget(selectedWidget);
- selectedRow = null;
- }
- $(document).on("setResultsHeight", function () {
- $('.result-main').each(function(){
- $resultMain = $(this);
- $resultMain.height($resultMain.parents('.card-widget').find('.result-container').outerHeight() + 30);
- });
- resizeFieldsList();
- });
- function highlightColumn(column, e) {
- var $resultContainer = $(e.target).parents('.card-widget').find('.result-container');
- var _colName = $.trim(column.name());
- if (searchViewModel.collection.template.fieldsSelected.indexOf(_colName) > -1) {
- var _t = $resultContainer;
- var _col = _t.find("th").filter(function () {
- return $.trim($(this).text()) == _colName;
- });
- if (_t.find("tr td:nth-child(" + (_col.index() + 1) + ").columnSelected").length == 0) {
- _t.find(".columnSelected").removeClass("columnSelected");
- _t.find("tr td:nth-child(" + (_col.index() + 1) + ")").addClass("columnSelected");
- _t.parent().animate({
- scrollLeft: _t.find("tr td:nth-child(" + (_col.index() + 1) + ")").position().left + _t.parent().scrollLeft() - _t.parent().offset().left - 30
- }, 300);
- }
- else {
- _t.find(".columnSelected").removeClass("columnSelected");
- }
- }
- }
- function checkResultHighlightingAvailability() {
- if (! searchViewModel.collection.idField()) {
- $(document).trigger("warn", "${ _('Result highlighting is unavailable: the collection does not have an index field') }");
- }
- }
- </script>
- </%def>
|