Adding UI elements
This commit is contained in:
@ -1,6 +1,39 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('lemur')
|
||||
.controller('CertificateExportController', function ($scope, $modalInstance, CertificateApi, CertificateService, PluginService, toaster, editId) {
|
||||
CertificateApi.get(editId).then(function (certificate) {
|
||||
$scope.certificate = certificate;
|
||||
});
|
||||
|
||||
PluginService.getByType('export').then(function (plugins) {
|
||||
$scope.plugins = plugins;
|
||||
});
|
||||
|
||||
$scope.cancel = function () {
|
||||
$modalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$scope.save = function (certificate) {
|
||||
CertificateService.export(certificate).then(
|
||||
function () {
|
||||
toaster.pop({
|
||||
type: 'success',
|
||||
title: certificate.name,
|
||||
body: 'Successfully exported!'
|
||||
});
|
||||
$modalInstance.close();
|
||||
},
|
||||
function (response) {
|
||||
toaster.pop({
|
||||
type: 'error',
|
||||
title: certificate.name,
|
||||
body: 'Failed to export ' + response.data.message,
|
||||
timeout: 100000
|
||||
});
|
||||
});
|
||||
};
|
||||
})
|
||||
.controller('CertificateEditController', function ($scope, $modalInstance, CertificateApi, CertificateService, DestinationService, NotificationService, toaster, editId) {
|
||||
CertificateApi.get(editId).then(function (certificate) {
|
||||
CertificateService.getNotifications(certificate);
|
||||
|
@ -183,5 +183,9 @@ angular.module('lemur')
|
||||
return certificate.put();
|
||||
};
|
||||
|
||||
CertificateService.export = function (certificate) {
|
||||
return certificate.customPOST(certificate.exportOptions, 'export');
|
||||
};
|
||||
|
||||
return CertificateService;
|
||||
});
|
||||
|
@ -163,4 +163,18 @@ angular.module('lemur')
|
||||
$scope.certificateTable.reload();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.export = function (certificateId) {
|
||||
var modalInstance = $modal.open({
|
||||
animation: true,
|
||||
controller: 'CertificateExportController',
|
||||
templateUrl: '/angular/certificates/certificate/export.tpl.html',
|
||||
size: 'lg',
|
||||
resolve: {
|
||||
editId: function () {
|
||||
return certificateId;
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
|
@ -5,12 +5,10 @@
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<div class="btn-group pull-right">
|
||||
<button data-placement="left" data-title="Create Certificate" bs-tooltip ng-click="create()"
|
||||
class="btn btn-primary">
|
||||
<button ng-click="create()" class="btn btn-primary">
|
||||
Create
|
||||
</button>
|
||||
<button data-placement="left" data-title="Import Certificate" bs-tooltip ng-click="import()"
|
||||
class="btn btn-info">
|
||||
<button ng-click="import()" class="btn btn-info">
|
||||
Import
|
||||
</button>
|
||||
</div>
|
||||
@ -48,6 +46,9 @@
|
||||
<button ng-model="certificate.toggle" class="btn btn-sm btn-info" btn-checkbox btn-checkbox-true="1"
|
||||
butn-checkbox-false="0">More
|
||||
</button>
|
||||
<button ng-click="export(certificate.id)" class="btn btn-sm btn-success">
|
||||
Export
|
||||
</button>
|
||||
<button class="btn btn-sm btn-warning" ng-click="edit(certificate.id)">Edit</button>
|
||||
</div>
|
||||
</td>
|
||||
|
Reference in New Issue
Block a user