forked from D-Net/dnet-hadoop
This commit is contained in:
parent
e2f1013b3d
commit
6f813fbc8e
|
@ -43,7 +43,7 @@ FROM
|
|||
mdstores md
|
||||
LEFT OUTER JOIN mdstore_current_versions cv ON (md.id = cv.mdstore)
|
||||
LEFT OUTER JOIN mdstore_versions v1 ON (cv.current_version = v1.id)
|
||||
LEFT OUTER JOIN mdstore_versions v2 ON (md.id = v2.id)
|
||||
LEFT OUTER JOIN mdstore_versions v2 ON (md.id = v2.mdstore)
|
||||
GROUP BY md.id,
|
||||
md.format,
|
||||
md.layout,
|
||||
|
|
|
@ -13,16 +13,22 @@
|
|||
|
||||
<body ng-app="mdstoreManagerApp" ng-controller="mdstoreManagerController">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-offset-1 col-md-10">
|
||||
<h1>Metadata Store Manager</h1>
|
||||
|
||||
<hr />
|
||||
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Format / Layout / Interpretation</th>
|
||||
<th>Datasource</th>
|
||||
<th>Current Version</th>
|
||||
<th class="text-right">All versions</th>
|
||||
<th class="text-center">Last Update</th>
|
||||
<th class="text-right">Size</th>
|
||||
<th class="col-xs-3">ID</th>
|
||||
<th class="col-xs-2">Format / Layout / Interpretation</th>
|
||||
<th class="col-xs-3">Datasource</th>
|
||||
<th class="col-xs-1 text-center">Last Update</th>
|
||||
<th class="col-xs-1 text-right">Size</th>
|
||||
<th class="col-xs-1 text-right">Versions</th>
|
||||
<th class="col-xs-1 text-right">Operations</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -38,13 +44,65 @@
|
|||
</small>
|
||||
</span>
|
||||
</td>
|
||||
<td>{{md.apiId}}</td>
|
||||
<td>{{md.currentVersion}}</td>
|
||||
<td class="text-right">{{md.numberOfVersions}}</td>
|
||||
<td class="text-center">{{md.lastUpdate}}</td>
|
||||
<td class="text-center" title="{{md.lastUpdate}}">{{md.lastUpdate | date:"MMM dd, yyyy 'at' HH:mm"}}</td>
|
||||
<td class="text-right">{{md.size}}</td>
|
||||
<td class="text-right">
|
||||
<a href="javascript:void(0)" ng-click="listVersions(md.id, md.currentVersion)" data-toggle="modal" data-target="#versionsModal" title="Current: {{md.currentVersion}}">{{md.numberOfVersions}} version(s)</a>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<button class="btn btn-sm btn-primary" ng-click="prepareVersion(md.id, md.currentVersion)" data-toggle="modal" data-target="#versionsModal">new version</button>
|
||||
<button class="btn btn-sm btn-danger" ng-click="deleteMdstore(md.id)">delete</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" tabindex="-1" id="versionsModal">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title">Versions</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="checkbox text-right">
|
||||
<label>
|
||||
<input type="checkbox" ng-model="forceVersionDelete" /> Force delete
|
||||
</label>
|
||||
</div>
|
||||
<small>
|
||||
<table class="table table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th class="text-center">Read Count</th>
|
||||
<th class="text-center">Last Update</th>
|
||||
<th class="text-right">Size</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="v in versions">
|
||||
<td ng-class="{'text-success': v.current}"><span class="glyphicon glyphicon-pencil" ng-if="v.writing" title="writing..."></span> {{v.id}}</td>
|
||||
<td class="text-center">{{v.readCount}}</td>
|
||||
<td class="text-center" title="{{v.lastUpdate}}">{{v.lastUpdate | date:"MMM dd, yyyy 'at' HH:mm"}}</td>
|
||||
<td class="text-right">{{v.size}}</td>
|
||||
<td class="text-right">
|
||||
<button class="btn btn-sm btn-primary" ng-if="v.writing" ng-click="commitVersion(v.id)">commit</button>
|
||||
<button class="btn btn-sm btn-danger" ng-disabled="v.current" ng-click="deleteVersion(v.id, forceVersionDelete)">delete</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</small>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -2,11 +2,89 @@ var app = angular.module('mdstoreManagerApp', []);
|
|||
|
||||
app.controller('mdstoreManagerController', function($scope, $http) {
|
||||
$scope.mdstores = [];
|
||||
$scope.versions = [];
|
||||
$scope.forceVersionDelete = false;
|
||||
|
||||
$scope.reload = function() {
|
||||
$http.get('/mdstores/').success(function(data) {
|
||||
$scope.mdstores = data;
|
||||
}).error(function() {
|
||||
alert("error");
|
||||
});
|
||||
};
|
||||
|
||||
$scope.listVersions = function(mdId, current) {
|
||||
$scope.versions = [];
|
||||
$http.get('/mdstores/mdstore/' + mdId + '/versions').success(function(data) {
|
||||
angular.forEach(data, function(value, key) {
|
||||
value.current = (value.id == current);
|
||||
});
|
||||
$scope.versions = data;
|
||||
}).error(function() {
|
||||
alert("error");
|
||||
});
|
||||
};
|
||||
|
||||
$scope.deleteMdstore = function(mdId) {
|
||||
if (confirm("Are you sure ?")) {
|
||||
$http.delete('/mdstores/mdstore/' + mdId).success(function(data) {
|
||||
$scope.reload();
|
||||
}).error(function() {
|
||||
alert("error");
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.prepareVersion = function(mdId, currentVersion) {
|
||||
$scope.versions = [];
|
||||
$http.get('/mdstores/mdstore/' + mdId + '/newVersion').success(function(data) {
|
||||
$scope.reload();
|
||||
$scope.listVersions(mdId, currentVersion);
|
||||
}).error(function() {
|
||||
alert("error");
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
$scope.commitVersion = function(versionId) {
|
||||
var size = parseInt(prompt("New Size", "0"));
|
||||
if (size >= 0) {
|
||||
$http.get("/mdstores/version/" + versionId + "/commit/" + size).success(function(data) {
|
||||
angular.forEach($scope.versions, function(value, key) {
|
||||
if (value.id == versionId) {
|
||||
value.current = true;
|
||||
value.writing = false;
|
||||
value.size = size;
|
||||
} else {
|
||||
value.current = false;
|
||||
}
|
||||
});
|
||||
}).error(function() {
|
||||
alert("error");
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$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) {
|
||||
var nv = [];
|
||||
angular.forEach($scope.versions, function(value, key) {
|
||||
if (value.id != versionId) {
|
||||
nv.push(value);
|
||||
}
|
||||
});
|
||||
$scope.versions = nv;
|
||||
}).error(function() {
|
||||
alert("error");
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.reload();
|
||||
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue