rrcovered a JS file and minors
This commit is contained in:
parent
1004273907
commit
8b2efcf378
|
@ -1,48 +0,0 @@
|
|||
// Spinner show/hide methods ~ Andrea Mannocci
|
||||
var spinnerOpts = {
|
||||
lines: 15,
|
||||
length: 16,
|
||||
width: 5,
|
||||
radius: 25,
|
||||
color: '#eeeeee',
|
||||
className: 'spinner',
|
||||
top: '40%'
|
||||
};
|
||||
|
||||
var spinnerTarget = document.getElementById('spinnerdiv');
|
||||
|
||||
var spinner;
|
||||
|
||||
function showSpinner() {
|
||||
spinner = new Spinner(spinnerOpts).spin(spinnerTarget);
|
||||
spinnerTarget.style.visibility = 'visible';
|
||||
}
|
||||
|
||||
function hideSpinner() {
|
||||
spinnerTarget.style.visibility = 'hidden';
|
||||
spinner.stop();
|
||||
}
|
||||
|
||||
|
||||
var app = angular.module('mdInspectorApp', []);
|
||||
|
||||
app.controller('mdInspectorController', function($scope, $http) {
|
||||
$scope.records = [];
|
||||
$scope.versionId = versionId();
|
||||
$scope.limit = limit();
|
||||
|
||||
$scope.reload = function() {
|
||||
showSpinner();
|
||||
$http.get('../../mdstores/version/' + $scope.versionId + '/parquet/content/' + $scope.limit + '/?' + $.now()).success(function(data) {
|
||||
hideSpinner();
|
||||
$scope.records = data;
|
||||
}).error(function(err) {
|
||||
hideSpinner();
|
||||
alert('ERROR: ' + err.message);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.reload();
|
||||
|
||||
});
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
var app = angular.module('mdstoreManagerApp', []);
|
||||
|
||||
app.controller('mdstoreManagerController', function($scope, $http) {
|
||||
$scope.mdstores = [];
|
||||
$scope.versions = [];
|
||||
$scope.openMdstore = '';
|
||||
$scope.openCurrentVersion = ''
|
||||
|
||||
$scope.forceVersionDelete = false;
|
||||
|
||||
$scope.reload = function() {
|
||||
$http.get('./mdstores/?' + $.now()).success(function(data) {
|
||||
$scope.mdstores = data;
|
||||
}).error(function(err) {
|
||||
alert('ERROR: ' + err.message);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.newMdstore = function(format, layout, interpretation, dsName, dsId, apiId) {
|
||||
var url = './mdstores/new/' + encodeURIComponent(format) + '/' + encodeURIComponent(layout) + '/' + encodeURIComponent(interpretation);
|
||||
if (dsName || dsId || apiId) {
|
||||
url += '?dsName=' + encodeURIComponent(dsName) + '&dsId=' + encodeURIComponent(dsId) + '&apiId=' + encodeURIComponent(apiId);
|
||||
}
|
||||
$http.get(url).success(function(data) {
|
||||
$scope.reload();
|
||||
}).error(function(err) {
|
||||
alert('ERROR: ' + err.message);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.deleteMdstore = function(mdId) {
|
||||
if (confirm("Are you sure ?")) {
|
||||
$http.delete('./mdstores/mdstore/' + mdId).success(function(data) {
|
||||
$scope.reload();
|
||||
}).error(function(err) {
|
||||
alert('ERROR: ' + err.message);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.prepareVersion = function(mdId, currentVersion) {
|
||||
$scope.versions = [];
|
||||
$http.get('./mdstores/mdstore/' + mdId + '/newVersion?' + $.now()).success(function(data) {
|
||||
$scope.reload();
|
||||
$scope.listVersions(mdId, currentVersion);
|
||||
}).error(function(err) {
|
||||
alert('ERROR: ' + err.message);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.commitVersion = function(versionId) {
|
||||
var size = parseInt(prompt("New Size", "0"));
|
||||
if (size >= 0) {
|
||||
$http.get("./mdstores/version/" + versionId + "/commit/" + size + '?' + $.now()).success(function(data) {
|
||||
$scope.reload();
|
||||
$scope.openCurrentVersion = versionId;
|
||||
$scope.refreshVersions();
|
||||
}).error(function(err) {
|
||||
alert('ERROR: ' + err.message);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.abortVersion = function(versionId) {
|
||||
$http.get("./mdstores/version/" + versionId + "/abort?" + $.now()).success(function(data) {
|
||||
$scope.reload();
|
||||
$scope.refreshVersions();
|
||||
}).error(function(err) {
|
||||
alert('ERROR: ' + err.message);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.resetReading = function(versionId) {
|
||||
$http.get("./mdstores/version/" + versionId + "/resetReading" + '?' + $.now()).success(function(data) {
|
||||
$scope.reload();
|
||||
$scope.refreshVersions();
|
||||
}).error(function(err) {
|
||||
alert('ERROR: ' + err.message);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.listVersions = function(mdId, current) {
|
||||
$scope.openMdstore = mdId;
|
||||
$scope.openCurrentVersion = current;
|
||||
$scope.versions = [];
|
||||
$scope.refreshVersions();
|
||||
};
|
||||
|
||||
$scope.refreshVersions = function() {
|
||||
$http.get('./mdstores/mdstore/' + $scope.openMdstore + '/versions?' + $.now()).success(function(data) {
|
||||
angular.forEach(data, function(value, key) {
|
||||
value.current = (value.id == $scope.openCurrentVersion);
|
||||
});
|
||||
$scope.versions = data;
|
||||
}).error(function(err) {
|
||||
alert('ERROR: ' + err.message);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.deleteVersion = function(versionId, force) {
|
||||
if (confirm("Are you sure ?")) {
|
||||
var url = './mdstores/version/' + versionId;
|
||||
if (force) { url += '?force=true'; }
|
||||
|
||||
$http.delete(url).success(function(data) {
|
||||
$scope.reload();
|
||||
$scope.refreshVersions();
|
||||
}).error(function(err) {
|
||||
alert('ERROR: ' + err.message);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.reload();
|
||||
|
||||
});
|
|
@ -119,8 +119,8 @@
|
|||
<div class="panel-heading small">{{rec.id}}</div>
|
||||
<table class="table table-condensed table-striped small">
|
||||
<tr>
|
||||
<th class="col-xs-4">Original Id</th>
|
||||
<td class="col-xs-8">{{rec.originalId}}</td>
|
||||
<th class="col-xs-3">Original Id</th>
|
||||
<td class="col-xs-9">{{rec.originalId}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Collected on</th>
|
||||
|
@ -132,7 +132,11 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<th>Provenance</th>
|
||||
<td>{{rec.provenance}}</td>
|
||||
<td class="small">
|
||||
<span ng-show="rec.provenance.datasourceName"><b>Datasource Name</b>: {{rec.provenance.datasourceName}}<br /></span>
|
||||
<span ng-show="rec.provenance.datasourceId"><b>Datasource ID</b>: {{rec.provenance.datasourceId}}<br /></span>
|
||||
<span ng-show="rec.provenance.nsPrefix"><b>Prefix</b>: {{rec.provenance.nsPrefix}}<br /></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="panel-body">
|
||||
|
@ -185,6 +189,10 @@
|
|||
$http.get('../../mdstores/version/' + $scope.versionId + '/parquet/content/' + $scope.limit + '/?' + $.now()).success(function(data) {
|
||||
hideSpinner();
|
||||
$scope.records = data;
|
||||
|
||||
angular.forEach($scope.records, function(map) {
|
||||
map.provenance = JSON.parse(map.provenance);
|
||||
});
|
||||
}).error(function(err) {
|
||||
hideSpinner();
|
||||
alert('ERROR: ' + err.message);
|
||||
|
|
Loading…
Reference in New Issue