Commit 37343d6c by Steve Oakey Committed by Johannes Edmeier

Adds Liquibase Support

Adds an application view that displays a list of Liquibase migrations as retrieved from the /liquibase Actuator endpoint. The module is conditional on this endpoint being available.
parent 2f0a896b
/*
* Copyright 2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
module.exports = {
bindings: {
entry: '<changeLogEntry'
},
controller: function () {
var ctrl = this;
ctrl.getExecutionClass = function () {
switch (ctrl.entry.EXECTYPE) {
case 'EXECUTED':
return 'label-success';
case 'FAILED':
return 'label-important';
case 'SKIPPED':
return '';
case 'RAN':
case 'MARK_RAN':
return 'label-warning';
default:
return 'label-info';
}
};
},
template: require('./liquibaseChangeLogEntry.tpl.html')
};
<sba-accordion>
<sba-accordion-group>
<sba-accordion-heading>
<small class="muted" ng-bind="$ctrl.entry.FILENAME.split('/').pop()"></small> {{$ctrl.entry.ID}}
<span class="label {{$ctrl.getExecutionClass()}} pull-right" ng-bind="$ctrl.entry.EXECTYPE"></span>
</sba-accordion-heading>
<sba-accordion-body>
<table class="table">
<tr>
<td>Id</td>
<td ng-bind="$ctrl.entry.ID"></td>
</tr>
<tr>
<td>Author</td>
<td ng-bind="$ctrl.entry.AUTHOR"></td>
</tr>
<tr>
<td>File</td>
<td ng-bind="$ctrl.entry.FILENAME"></td>
</tr>
<tr>
<td>Execution Date</td>
<td ng-bind="$ctrl.entry.DATEEXECUTED | date:'dd.MM.yyyy HH:mm:ss.sss'"></td>
</tr>
<tr>
<td>Execution Order</td>
<td ng-bind="$ctrl.entry.ORDEREXECUTED"></td>
</tr>
<tr>
<td>Execution</td>
<td ng-bind="$ctrl.entry.EXECTYPE"></td>
</tr>
<tr>
<td>Checksum</td>
<td ng-bind="$ctrl.entry.MD5SUM"></td>
</tr>
<tr>
<td>Description</td>
<td ng-bind="$ctrl.entry.DESCRIPTION"></td>
</tr>
<tr ng-if="$ctrl.entry.COMMENTS">
<td>Comments</td>
<td ng-bind="$ctrl.entry.COMMENTS"></td>
</tr>
<tr>
<td>Deployment Id</td>
<td ng-bind="$ctrl.entry.DEPLOYMENT_ID"></td>
</tr>
<tr>
<td>Tag</td>
<td ng-bind="$ctrl.entry.TAG || '-'"></td>
</tr>
<tr ng-if="$ctrl.entry.CONTEXTS">
<td>Contexts</td>
<td ng-bind="$ctrl.entry.CONTEXTS"></td>
</tr>
<tr ng-if="$ctrl.entry.LABELS">
<td>Labels</td>
<td>
<span ng-repeat="label in $ctrl.entry.LABELS.split(',')"><span class="label" ng-bind="label"></span> </span>
</td>
</tr>
<tr>
<td>Liquibase Version</td>
<td ng-bind="$ctrl.entry.LIQUIBASE"></td>
</tr>
</table>
</sba-accordion-body>
</sba-accordion-group>
</sba-accordion>
/*
* Copyright 2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
module.exports = function ($scope, $http, application) {
'ngInject';
$scope.changeLog = [];
$scope.searchFilter = null;
$scope.refresh = function () {
$http.get('/api/applications/' + application.id + '/liquibase').then(function (response) {
$scope.changeLog = response.data;
});
};
$scope.refresh();
};
/*
* Copyright 2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
var angular = require('angular');
var module = angular.module('sba-applications-liquibase', ['sba-applications']);
global.sbaModules.push(module.name);
module.controller('liquibaseCtrl', require('./controllers/liquibaseCtrl.js'));
module.component('sbaLiquibaseChangeLogEntry', require('./components/liquibaseChangeLogEntry.js'));
module.config(function ($stateProvider) {
$stateProvider.state('applications.liquibase', {
url: '/liquibase',
templateUrl: 'applications-liquibase/views/liquibase.html',
controller: 'liquibaseCtrl'
});
});
module.run(function (ApplicationViews, $http, $sce) {
ApplicationViews.register({
order: 100,
title: $sce.trustAsHtml('<i class="fa fa-database fa-fw"></i>Liquibase'),
state: 'applications.liquibase',
show: function (application) {
if (!application.managementUrl || !application.statusInfo.status || application.statusInfo.status === 'OFFLINE') {
return false;
}
return $http.head('api/applications/' + application.id + '/liquibase').then(function () {
return true;
}).catch(function () {
return false;
});
}
});
});
<div class="input-append">
<input placeholder="Filter" class="input-xxlarge" type="search" ng-model="searchFilter" />
<button class="btn" title="reload list" ng-click="refresh()"><i class="fa fa-repeat"></i></button>
</div>
<sba-liquibase-change-log-entry ng-repeat="entry in changeLog" change-log-entry="entry" />
......@@ -49,7 +49,7 @@ public class ApplicationRouteLocator implements RefreshableRouteLocator {
private String prefix;
private String servletPath;
private String[] proxyEndpoints = { "env", "metrics", "trace", "dump", "jolokia", "info",
"configprops", "trace", "activiti", "logfile", "refresh", "flyway" };
"configprops", "trace", "activiti", "logfile", "refresh", "flyway", "liquibase" };
public ApplicationRouteLocator(String servletPath, ApplicationRegistry registry,
String prefix) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment