Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SOLR-15853 Solr paramset impl #594

Closed
wants to merge 13 commits into from
1 change: 1 addition & 0 deletions solr/webapp/web/css/angular/menu.css
Expand Up @@ -289,6 +289,7 @@ limitations under the License.
.sub-menu .stream a { background-image: url( ../../img/ico/node.png ); }
.sub-menu .analysis a { background-image: url( ../../img/ico/funnel.png ); }
.sub-menu .documents a { background-image: url( ../../img/ico/documents-stack.png ); }
.sub-menu .paramsets a { background-image: url( ../../img/ico/paramset.png ); }
.sub-menu .files a { background-image: url( ../../img/ico/folder.png ); }
.sub-menu .schema a { background-image: url( ../../img/ico/book-open-text.png ); }
.sub-menu .replication a { background-image: url( ../../img/ico/node.png ); }
Expand Down
194 changes: 194 additions & 0 deletions solr/webapp/web/css/angular/paramsets.css
@@ -0,0 +1,194 @@
/*

Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF 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.

*/

#content #paramsets
{
background-image: url( ../../img/div.gif );
background-position: 45% 0;
background-repeat: repeat-y;
}

#content #paramsets #form
{
float: left;
/*width: 21%;*/
}
#content #paramsets #form fieldset legend, #content #paramsets #form .optional.expanded legend {
display: block;
margin-left: 10px;
padding: 0px 5px;
}

legend {
display: block;
padding-inline-start: 2px;
padding-inline-end: 2px;
border-width: initial;
border-style: none;
border-color: initial;
border-image: initial;
}

#content #paramsets #form label
{
cursor: pointer;
display: block;
margin-top: 5px;
}

#content #paramsets #form input,
#content #paramsets #form select,
#content #paramsets #form textarea
{
margin-bottom: 2px;
/*width: 100%;*/
}

#content #paramsets #form input,
#content #paramsets #form textarea
{
margin-bottom: 2px;
/*width: 98%;*/
}

#content #paramsets #form #start
{
float: left;
/*width: 45%;*/
}

#content #paramsets #form #rows
{
float: right;
/* width: 45%;*/
}

#content #paramsets #form .checkbox input
{
margin-bottom: 0;
width: auto;
}

#content #paramsets #form fieldset,
#content #paramsets #form .optional.expanded
{
border: 1px solid #fff;
border-top: 1px solid #c0c0c0;
margin-bottom: 5px;
}

#content #paramsets #form fieldset.common
{
margin-top: 10px;
}

#content #paramsets #form fieldset legend,
#content #paramsets #form .optional.expanded legend
{
display: block;
margin-left: 10px;
padding: 0px 5px;
}

#content #paramsets #form fieldset legend label
{
margin-top: 0;
}

#content #paramsets #form fieldset .fieldset
{
border-bottom: 1px solid #f0f0f0;
margin-bottom: 5px;
padding-bottom: 10px;
}

#content #paramsets #form .optional
{
border: 0;
}

#content #paramsets #form .optional legend
{
margin-left: 0;
padding-left: 0;
}

#content #paramsets #form .optional.expanded .fieldset
{
display: block;
}

#content #paramsets #result
{
float: right;
width: 54%;
}

#content #paramsets #result #url
{
margin-bottom: 10px;
background-image: url( ../../img/ico/ui-address-bar.png );
background-position: 5px 50%;
border: 1px solid #f0f0f0;
box-shadow: 1px 1px 0 #f0f0f0;
-moz-box-shadow: 1px 1px 0 #f0f0f0;
-webkit-box-shadow: 1px 1px 0 #f0f0f0;
color: #c0c0c0;
display: block;
overflow: hidden;
padding: 5px;
padding-left: 26px;
white-space: nowrap;
}

#content #paramsets #result #url:focus,
#content #paramsets #result #url:hover
{
border-color: #c0c0c0;
box-shadow: 1px 1px 0 #d8d8d8;
-moz-box-shadow: 1px 1px 0 #d8d8d8;
-webkit-box-shadow: 1px 1px 0 #d8d8d8;
color: #333;
}

#content #paramsets #result #response
{
}

#content #paramsets #result #response pre
{
padding-left: 20px;
}

.description{
font-weight: bold;
}

#document-type{
padding-bottom: 5px;
}

#wizard-fields div{
padding-top: 5px;
padding-bottom: 5px;
}

#wiz-field-data, #wiz-field-data span{
vertical-align: top;
}
Binary file added solr/webapp/web/img/ico/paramset.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions solr/webapp/web/index.html
Expand Up @@ -40,6 +40,7 @@
<link rel="stylesheet" type="text/css" href="css/angular/menu.css?_=${version}">
<link rel="stylesheet" type="text/css" href="css/angular/plugins.css?_=${version}">
<link rel="stylesheet" type="text/css" href="css/angular/documents.css?_=${version}">
<link rel="stylesheet" type="text/css" href="css/angular/paramsets.css?_=${version}">
<link rel="stylesheet" type="text/css" href="css/angular/query.css?_=${version}">
<link rel="stylesheet" type="text/css" href="css/angular/stream.css?_=${version}">
<link rel="stylesheet" type="text/css" href="css/angular/replication.css?_=${version}">
Expand Down Expand Up @@ -84,6 +85,7 @@
<script src="js/angular/controllers/collection-overview.js?_=${version}"></script>
<script src="js/angular/controllers/analysis.js?_=${version}"></script>
<script src="js/angular/controllers/documents.js?_=${version}"></script>
<script src="js/angular/controllers/paramsets.js?_=${version}"></script>
<script src="js/angular/controllers/files.js?_=${version}"></script>
<script src="js/angular/controllers/query.js?_=${version}"></script>
<script src="js/angular/controllers/stream.js?_=${version}"></script>
Expand Down Expand Up @@ -204,6 +206,7 @@ <h2>Connection recovered...</h2>
<li class="overview" ng-show="currentCollection.type === 'alias'" ng-class="{active:page=='alias-overview'}"><a href="#/{{currentCollection.name}}/alias-overview"><span>Overview</span></a></li>
<li class="analysis" ng-show="!isMultiDestAlias(currentCollection)" ng-class="{active:page=='analysis'}"><a href="#/{{currentCollection.name}}/analysis"><span>Analysis</span></a></li>
<li class="documents" ng-show="!isMultiDestAlias(currentCollection)" ng-class="{active:page=='documents'}"><a href="#/{{currentCollection.name}}/documents"><span>Documents</span></a></li>
<li class="paramsets" ng-show="!isMultiDestAlias(currentCollection)" ng-class="{active:page=='paramsets'}"><a href="#/{{currentCollection.name}}/paramsets"><span>Paramsets</span></a></li>
<li class="files" ng-show="!isMultiDestAlias(currentCollection)" ng-class="{active:page=='files'}"><a href="#/{{currentCollection.name}}/files"><span>Files</span></a></li>
<li class="query" ng-class="{active:page=='query'}"><a href="#/{{currentCollection.name}}/query"><span>Query</span></a></li>
<li class="stream" ng-class="{active:page=='stream'}"><a href="#/{{currentCollection.name}}/stream"><span>Stream</span></a></li>
Expand All @@ -229,6 +232,7 @@ <h2>Connection recovered...</h2>
<li class="overview" ng-class="{active:page=='overview'}"><a href="#/{{currentCore.name}}/core-overview"><span>Overview</span></a></li>
<li ng-hide="isCloudEnabled" class="analysis" ng-class="{active:page=='analysis'}"><a href="#/{{currentCore.name}}/analysis"><span>Analysis</span></a></li>
<li ng-hide="isCloudEnabled" class="documents" ng-class="{active:page=='documents'}"><a href="#/{{currentCore.name}}/documents"><span>Documents</span></a></li>
<li ng-hide="isCloudEnabled" class="paramsets" ng-class="{active:page=='paramsets'}"><a href="#/{{currentCore.name}}/paramsets"><span>Paramsets</span></a></li>
<li ng-hide="isCloudEnabled" class="files" ng-class="{active:page=='files'}"><a href="#/{{currentCore.name}}/files"><span>Files</span></a></li>
<li class="ping" ng-class="{active:page=='ping'}"><a ng-click="ping()"><span>Ping</span><small class="qtime" ng-show="showPing"> (<span>{{pingMS}}ms</span>)</small></a></li>
<li class="plugins" ng-class="{active:page=='plugins'}"><a href="#/{{currentCore.name}}/plugins"><span>Plugins / Stats</span></a></li>
Expand Down
4 changes: 4 additions & 0 deletions solr/webapp/web/js/angular/app.js
Expand Up @@ -135,6 +135,10 @@ solrAdminApp.config([
templateUrl: 'partials/documents.html',
controller: 'DocumentsController'
}).
when('/:core/paramsets', {
templateUrl: 'partials/paramsets.html',
controller: 'ParamSetsController'
}).
when('/:core/files', {
templateUrl: 'partials/files.html',
controller: 'FilesController'
Expand Down
85 changes: 85 additions & 0 deletions solr/webapp/web/js/angular/controllers/paramsets.js
@@ -0,0 +1,85 @@
/*
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF 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.
*/
//helper for formatting JSON and others

solrAdminApp.controller('ParamSetsController',
function($scope, $routeParams, ParamSet, Constants) {
$scope.resetMenu("paramsets", Constants.IS_COLLECTION_PAGE);

$scope.refresh = function () {
$scope.commitWithin = 1000;
$scope.overwrite = true;
$scope.paramsetContent = "";
$scope.placeholder = "{\n" +
" \"set\": {\n" +
" \"myQueries\": {\n" +
" \"defType\": \"edismax\",\n" +
" \"rows\": \"5\",\n" +
" \"df\": \"text_all\"\n" +
" }\n" +
" }\n" +
"}"
};
$scope.refresh();

$scope.submit = function () {
var params = {};

params.commitWithin = $scope.commitWithin;
params.overwrite = $scope.overwrite;
params.core = $routeParams.core;
params.wt = "json";

ParamSet.submit(params, $scope.paramsetContent, callback, failure);

///////
function callback(success) {
$scope.responseStatus = "success";
delete success.$promise;
delete success.$resolved;
$scope.response = JSON.stringify(success, null, ' ');
}
function failure (failure) {
$scope.responseStatus = failure;
}
}

$scope.getParamsets = function () {
$scope.refresh();

var params = {};
params.core = $routeParams.core;
params.wt = "json";
params.name = $scope.name;

ParamSet.get(params, callback, failure);

///////

function callback(success) {
$scope.responseStatus = "success";
delete success.$promise;
delete success.$resolved;
$scope.response = JSON.stringify(success, null, ' ');
}

function failure (failure) {
$scope.responseStatus = failure;
}
}
});