SOLR-7666 A motley collection of bugs in angular UI

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1703379 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Upayavira 2015-09-16 10:13:45 +00:00
parent b75b8f1baa
commit 1b01528b95
11 changed files with 82 additions and 38 deletions

View File

@ -194,10 +194,8 @@ solrAdminApp.config([
browser.locale = match[1] + '_' + match[3];
}
var result= ( input || 0 ).toString().replace(/\B(?=(\d{3})+(?!\d))/g,
return ( input || 0 ).toString().replace(/\B(?=(\d{3})+(?!\d))/g,
sep[ browser.locale ] || sep[ browser.language ] || sep['_']);
console.log(result);
return result;
};
})
.filter('orderObjectBy', function() {

View File

@ -192,6 +192,11 @@ solrAdminApp.controller('DataImportController',
$cookies.dataimport_autorefresh = $scope.autorefresh ? true : null;
if ($scope.autorefresh) {
$scope.refreshTimeout = $interval($scope.refreshStatus, dataimport_timeout);
var onRouteChangeOff = $scope.$on('$routeChangeStart', function() {
$interval.cancel($scope.refreshTimeout);
onRouteChangeOff();
});
} else if ($scope.refreshTimeout) {
$interval.cancel($scope.refreshTimeout);
}

View File

@ -116,7 +116,7 @@ solrAdminApp.controller('DocumentsController',
$scope.responseStatus = failure;
};
if (contentType == "json") {
Update.postJson(params, postData, callack, failure);
Update.postJson(params, postData, callback, failure);
} else if (contentType == "xml") {
Update.postXml(params, postData, callback, failure);
} else if (contentType == "csv") {

View File

@ -71,7 +71,11 @@ solrAdminApp.controller('LoggingController',
}
*/
});
$timeout($scope.refresh, 10000);
$scope.timeout = $timeout($scope.refresh, 10000);
var onRouteChangeOff = $scope.$on('$routeChangeStart', function() {
$timeout.cancel($scope.timeout);
onRouteChangeOff();
});
};
$scope.refresh();

View File

@ -20,16 +20,20 @@ solrAdminApp.controller('QueryController',
$scope.resetMenu("query", Constants.IS_COLLECTION_PAGE);
// @todo read URL parameters into scope
$scope.query = {wt: 'json', q:'*:*', indent:'on'};
$scope.query = {wt: 'json', q:'*:*', indent:'true'};
$scope.filters = [{fq:""}];
$scope.dismax = {defType: "dismax"};
$scope.edismax = {defType: "edismax", stopwords: true, lowercaseOperators: true};
$scope.hl = {hl:"on"};
$scope.facet = {facet: "on"};
$scope.hl = {hl:"true"};
$scope.facet = {facet: "true"};
$scope.spatial = {};
$scope.spellcheck = {spellcheck:"on"};
$scope.spellcheck = {spellcheck:"true"};
$scope.qt = "/select";
if ($location.search().q) {
$scope.query.q = $location.search()["q"];
}
$scope.doQuery = function() {
var params = {};
@ -74,7 +78,7 @@ solrAdminApp.controller('QueryController',
params.doNotIntercept=true;
params.core = $routeParams.core;
params.handler = qt;
var url = "/solr/" + $routeParams.core + qt + "?" + Query.url(params);
var url = Query.url(params);
Query.query(params, function(data) {
$scope.lang = $scope.query.wt;
$scope.response = data;

View File

@ -23,6 +23,8 @@ solrAdminApp.controller('ReplicationController',
$scope.refresh = function() {
Replication.details({core:$routeParams.core}, function(response) {
var timeout;
var interval;
if ($scope.interval) $interval.cancel($scope.interval);
$scope.isSlave = (response.details.isSlave === 'true');
if ($scope.isSlave) {
@ -31,17 +33,23 @@ solrAdminApp.controller('ReplicationController',
$scope.versions = getSlaveVersions(response.details);
$scope.settings = getSlaveSettings(response.details);
if ($scope.settings.isReplicating) {
$timeout($scope.refresh, 1000);
timeout = $timeout($scope.refresh, 1000);
} else if(!$scope.settings.isPollingDisabled && $scope.settings.pollInterval) {
$scope.interval = $interval(function() {
interval = $scope.interval = $interval(function() {
$scope.settings.tick--;
}, 1000, $scope.settings.tick);
$timeout($scope.refresh, 1000*(1+$scope.settings.tick));
timeout = $timeout($scope.refresh, 1000*(1+$scope.settings.tick));
}
} else {
$scope.versions = getMasterVersions(response.details);
}
$scope.master = getMasterSettings(response.details, $scope.isSlave);
var onRouteChangeOff = $scope.$on('$routeChangeStart', function() {
if (interval) $interval.cancel(interval);
if (timeout) $timeout.cancel(timeout);
onRouteChangeOff();
});
});
};

View File

@ -125,25 +125,28 @@ solrAdminApp.controller('SchemaBrowserController',
var getFieldsAndTypes = function(data) {
var fieldsAndTypes = [];
for (var field in data.fields) {
var fields = Object.keys(data.fields).sort();
for (var i in fields) {
fieldsAndTypes.push({
group: "Fields",
value: "field=" + field,
label: field
value: "field=" + fields[i],
label: fields[i]
});
}
for (var field in data.dynamic_fields) {
var dynamic_fields = Object.keys(data.dynamic_fields).sort();
for (var i in dynamic_fields) {
fieldsAndTypes.push({
group: "Dynamic Fields",
value: "dynamic-field=" + field,
label: field
value: "dynamic-field=" + dynamic_fields[i],
label: dynamic_fields[i]
});
}
for (var type in data.types) {
var types = Object.keys(data.types).sort();
for (var i in types) {
fieldsAndTypes.push({
group: "Types",
value: "type=" + type,
label: type
value: "type=" + types[i],
label: types[i]
});
}
return fieldsAndTypes;

View File

@ -59,6 +59,11 @@ solrAdminApp.controller('SegmentsController', function($scope, $routeParams, $in
$scope.autorefresh = !$scope.autorefresh;
if ($scope.autorefresh) {
$scope.interval = $interval($scope.refresh, 1000);
var onRouteChangeOff = $scope.$on('$routeChangeStart', function() {
$interval.cancel($scope.interval);
onRouteChangeOff();
});
} else if ($scope.interval) {
$interval.cancel($scope.interval);
}

View File

@ -21,6 +21,21 @@ solrAdminServices.factory('System',
['$resource', function($resource) {
return $resource('/solr/admin/info/system', {"wt":"json", "_":Date.now()});
}])
.factory('Collections',
['$resource', function($resource) {
return $resource('/solr/admin/collections',
{'wt':'json', '_':Date.now()}, {
"list": {params:{action: "LIST"}},
"status": {params:{action: "CLUSTERSTATUS"}},
"add": {params:{action: "CREATE"}},
"delete": {params:{action: "DELETE"}},
"rename": {params:{action: "RENAME"}},
"createAlias": {params:{action: "CREATEALIAS"}},
"deleteAlias": {params:{action: "DELETEALIAS"}},
"reload": {method: "GET", params:{action:"RELOAD", core: "@core"}},
"optimize": {params:{}}
});
}])
.factory('Cores',
['$resource', function($resource) {
return $resource('/solr/admin/cores',
@ -35,15 +50,6 @@ solrAdminServices.factory('System',
"optimize": {params:{}}
});
}])
.factory('Collections',
['$resource', function($resource) {
return $resource('/solr/admin/collections',
{wt: 'json', _:Date.now()}, {
"list": {params:{action: "LIST"}},
"status": {params:{action: "CLUSTERSTATUS"}}
}
)
}])
.factory('Logging',
['$resource', function($resource) {
return $resource('/solr/admin/info/logging', {'wt':'json', '_':Date.now()}, {
@ -59,7 +65,16 @@ solrAdminServices.factory('System',
"dump": {params: {dump: "true"}},
"liveNodes": {params: {path: '/live_nodes'}},
"clusterState": {params: {detail: "true", path: "/clusterstate.json"}},
"detail": {params: {detail: "true", path: "@path"}}
"detail": {params: {detail: "true", path: "@path"}},
"configs": {params: {detail:false, path: "/configs/"}},
"aliases": {params: {detail: "true", path: "/aliases.json"}, transformResponse:function(data) {
var znode = $.parseJSON(data).znode;
if (znode.data) {
return {aliases: $.parseJSON(znode.data).collection};
} else {
return {aliases: {}};
}
}}
});
}])
.factory('Properties',
@ -194,7 +209,7 @@ solrAdminServices.factory('System',
}])
.factory('Query',
['$resource', function($resource) {
var resource = $resource('/solr/:core:handler', {core: '@core', handler: '@handler'}, {
var resource = $resource('/solr/:core:handler', {core: '@core', handler: '@handler', '_':Date.now()}, {
"query": {
method: "GET", transformResponse: function (data) {
return {data: data}
@ -210,7 +225,7 @@ solrAdminServices.factory('System',
}
}
}
return "/solr/" + params.core + params.handler + "?" + qs.join("&");
return "/solr/" + params.core + params.handler + "?" + qs.sort().join("&");
}
return resource;
}])

View File

@ -68,8 +68,10 @@ limitations under the License.
<dl ng-show="replica.show">
<dt>Base URL: </dt><dd>{{replica.base_url}}</dd>
<dt>Core: </dt><dd><a href="{{replica.base_url}}/{{replica.core}}">{{replica.core}}</a></dd>
<dt>Active: </dt>
<dd class="ico value" ng-class="replica.state == 'active' ? 'ico-1' : 'ico-0'"><span>yes</span></dd>
<dt>Leader: </dt>
<dd class="ico value" ng-class="selectedCollection.autoAddReplicas ? 'ico-1' : 'ico-0'"><span>yes</span></dd>
<dd class="ico value" ng-class="replica.leader == 'true' ? 'ico-1' : 'ico-0'"><span>yes</span></dd>
</dl>
</div>

View File

@ -48,7 +48,7 @@ limitations under the License.
<label for="sort" title="Sort field or function with asc|desc.">
<a rel="help">sort</a>
</label>
<input type="text" id="sort" name="sort" title="Sort field or function with asc|desc.">
<input type="text" ng-model="query.sort" id="sort" name="sort" title="Sort field or function with asc|desc.">
<label for="start" title="Number of leading documents to skip and number of documents to return after 'start'. (Integers)">
<a rel="help">start</a>,
@ -87,12 +87,12 @@ limitations under the License.
</select>
<label for="indent" class="checkbox" title="Indent results.">
<input type="checkbox" ng-model="query.indent" name="indent" id="indent" value="true" title="Indent results." checked="checked">
<input type="checkbox" ng-model="query.indent" name="indent" id="indent" title="Indent results." ng-true-value="'true'" ng-false-value="'false'">
<a rel="help">indent</a>
</label>
<label for="debugQuery" class="checkbox" title="Show timing and diagnostics.">
<input type="checkbox" ng-model="query.debugQuery" name="debugQuery" id="debugQuery" value="true" title="Show timing and diagnostics.">
<input type="checkbox" ng-model="query.debugQuery" name="debugQuery" id="debugQuery" title="Show timing and diagnostics." ng-true-value="'true'" ng-false-value="'false'">
<a rel="help">debugQuery</a>
</label>