Replacement refactor. (#631)

* Deprecating replacement keyword.

* Def renaming.
This commit is contained in:
kevgliss
2016-12-26 11:09:50 -08:00
committed by GitHub
parent 46f8ebd136
commit ce75bba2c3
8 changed files with 47 additions and 37 deletions

View File

@ -328,7 +328,6 @@ angular.module('lemur')
}
];
PluginService.getByType('destination').then(function (plugins) {
$scope.plugins = plugins;
});

View File

@ -4,23 +4,23 @@
</label>
<div class="col-sm-10">
<div class="input-group">
<input type="text" ng-model="certificate.selectedReplacement" placeholder="Certificate123..."
<input type="text" ng-model="certificate.selectedReplaces" placeholder="Certificate123..."
uib-typeahead="certificate.name for certificate in certificateService.findCertificatesByName($viewValue)" typeahead-loading="loadingCertificates"
class="form-control input-md" typeahead-on-select="certificate.attachReplacement($item)"
class="form-control input-md" typeahead-on-select="certificate.attachReplaces($item)"
uib-tooltip="Lemur will mark any certificates being replaced as 'inactive'"
uib-tooltip-trigger="focus" uib-tooltip-placement="top" typeahead-wait-ms="500">
<span class="input-group-btn">
<button ng-model="replacements.show" class="btn btn-md btn-default" uib-btn-checkbox btn-checkbox-true="1" btn-checkbox-false="0">
<span class="badge">{{ certificate.replacements.length || 0 }}</span>
<button ng-model="replaces.show" class="btn btn-md btn-default" uib-btn-checkbox btn-checkbox-true="1" btn-checkbox-false="0">
<span class="badge">{{ certificate.replaces.length || 0 }}</span>
</button>
</span>
</div>
<table class="table">
<tr ng-repeat="replacement in certificate.replacements track by $index">
<td><a class="btn btn-sm btn-info">{{ replacement.name }}</a></td>
<td><span class="text-muted">{{ replacement.description }}</span></td>
<tr ng-repeat="replaces in certificate.replaces track by $index">
<td><a class="btn btn-sm btn-info">{{ replaces.name }}</a></td>
<td><span class="text-muted">{{ replaces.description }}</span></td>
<td>
<button type="button" ng-click="certificate.removeReplacement($index)" class="btn btn-danger btn-sm pull-right">Remove</button>
<button type="button" ng-click="certificate.removeReplaces($index)" class="btn btn-danger btn-sm pull-right">Remove</button>
</td>
</tr>
</table>

View File

@ -81,15 +81,15 @@ angular.module('lemur')
removeDestination: function (index) {
this.destinations.splice(index, 1);
},
attachReplacement: function (replacement) {
this.selectedReplacement = null;
if (this.replacements === undefined) {
this.replacements = [];
attachReplaces: function (replaces) {
this.selectedReplaces = null;
if (this.replaces === undefined) {
this.replaces = [];
}
this.replacements.push(replacement);
this.replaces.push(replaces);
},
removeReplacement: function (index) {
this.replacements.splice(index, 1);
removeReplaces: function (index) {
this.replaces.splice(index, 1);
},
attachNotification: function (notification) {
this.selectedNotification = null;
@ -169,9 +169,9 @@ angular.module('lemur')
});
};
CertificateService.getReplacements = function (certificate) {
return certificate.getList('replacements').then(function (replacements) {
certificate.replacements = replacements;
CertificateService.getReplaces = function (certificate) {
return certificate.getList('replaces').then(function (replaces) {
certificate.replaces = replaces;
});
};

View File

@ -170,9 +170,9 @@
<uib-tab>
<uib-tab-heading>Replaces</uib-tab-heading>
<ul class="list-group">
<li class="list-group-item" ng-repeat="replacement in certificate.replaces">
<strong>{{ replacement.name }}</strong>
<p>{{ replacement.description}}</p>
<li class="list-group-item" ng-repeat="replaces in certificate.replaces">
<strong>{{ replaces.name }}</strong>
<p>{{ replaces.description}}</p>
</li>
</ul>
</uib-tab>