mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-09 15:05:44 +01:00
display failed health checks in user interface
This commit is contained in:
@@ -559,7 +559,7 @@ public class Repository extends BasicPropertiesAware implements ModelObject
|
|||||||
*
|
*
|
||||||
* @since 1.36
|
* @since 1.36
|
||||||
*/
|
*/
|
||||||
void setHealthCheckFailures(List<HealthCheckFailure> healthCheckFailures)
|
public void setHealthCheckFailures(List<HealthCheckFailure> healthCheckFailures)
|
||||||
{
|
{
|
||||||
this.healthCheckFailures = healthCheckFailures;
|
this.healthCheckFailures = healthCheckFailures;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1032,6 +1032,7 @@ public class RepositoryResource
|
|||||||
|
|
||||||
repository.setProperties(null);
|
repository.setProperties(null);
|
||||||
repository.setPermissions(null);
|
repository.setPermissions(null);
|
||||||
|
repository.setHealthCheckFailures(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
return repository;
|
return repository;
|
||||||
@@ -1118,11 +1119,11 @@ public class RepositoryResource
|
|||||||
//~--- fields ---------------------------------------------------------------
|
//~--- fields ---------------------------------------------------------------
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private ScmConfiguration configuration;
|
private final ScmConfiguration configuration;
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private RepositoryManager repositoryManager;
|
private final RepositoryManager repositoryManager;
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private RepositoryServiceFactory servicefactory;
|
private final RepositoryServiceFactory servicefactory;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,6 +131,7 @@
|
|||||||
<script type="text/javascript" src="resources/js/repository/sonia.repository.importwindow.js"></script>
|
<script type="text/javascript" src="resources/js/repository/sonia.repository.importwindow.js"></script>
|
||||||
<script type="text/javascript" src="resources/js/repository/sonia.repository.commitpanel.js"></script>
|
<script type="text/javascript" src="resources/js/repository/sonia.repository.commitpanel.js"></script>
|
||||||
<script type="text/javascript" src="resources/js/repository/sonia.repository.changesetpanel.js"></script>
|
<script type="text/javascript" src="resources/js/repository/sonia.repository.changesetpanel.js"></script>
|
||||||
|
<script type="text/javascript" src="resources/js/repository/sonia.repository.healthcheckfailure.js"></script>
|
||||||
|
|
||||||
<!-- sonia.user -->
|
<!-- sonia.user -->
|
||||||
<script type="text/javascript" src="resources/js/user/sonia.user.js"></script>
|
<script type="text/javascript" src="resources/js/user/sonia.user.js"></script>
|
||||||
|
|||||||
@@ -234,3 +234,7 @@ div.noscript-container h1 {
|
|||||||
.upload-icon {
|
.upload-icon {
|
||||||
background: url('../images/add.png') no-repeat 0 0 !important;
|
background: url('../images/add.png') no-repeat 0 0 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.unhealthy {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
|||||||
BIN
scm-webapp/src/main/webapp/resources/images/warning.png
Executable file
BIN
scm-webapp/src/main/webapp/resources/images/warning.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 666 B |
@@ -45,6 +45,7 @@ Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, {
|
|||||||
unknownType: 'Unknown',
|
unknownType: 'Unknown',
|
||||||
|
|
||||||
archiveIcon: 'resources/images/archive.png',
|
archiveIcon: 'resources/images/archive.png',
|
||||||
|
warningIcon: 'resources/images/warning.png',
|
||||||
|
|
||||||
filterRequest: null,
|
filterRequest: null,
|
||||||
|
|
||||||
@@ -97,6 +98,8 @@ Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, {
|
|||||||
name: 'properties'
|
name: 'properties'
|
||||||
},{
|
},{
|
||||||
name: 'archived'
|
name: 'archived'
|
||||||
|
},{
|
||||||
|
name: 'healthCheckFailures'
|
||||||
}]
|
}]
|
||||||
}),
|
}),
|
||||||
sortInfo: {
|
sortInfo: {
|
||||||
@@ -215,7 +218,15 @@ Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, {
|
|||||||
forceFit: true,
|
forceFit: true,
|
||||||
groupMode: 'value',
|
groupMode: 'value',
|
||||||
enableGroupingMenu: false,
|
enableGroupingMenu: false,
|
||||||
groupTextTpl: '{group} ({[values.rs.length]} {[values.rs.length > 1 ? "Repositories" : "Repository"]})'
|
groupTextTpl: '{group} ({[values.rs.length]} {[values.rs.length > 1 ? "Repositories" : "Repository"]})',
|
||||||
|
getRowClass: function(record){
|
||||||
|
var rowClass = '';
|
||||||
|
var healthFailures = record.get('healthCheckFailures');
|
||||||
|
if (healthFailures && healthFailures.length > 0){
|
||||||
|
rowClass = 'unhealthy';
|
||||||
|
}
|
||||||
|
return rowClass;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -229,8 +240,21 @@ Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
renderTypeIcon: function(type){
|
renderTypeIcon: function(type, meta, record){
|
||||||
var result = '';
|
var result;
|
||||||
|
if ( record ){
|
||||||
|
var healthFailures = record.get('healthCheckFailures');
|
||||||
|
if (healthFailures && healthFailures.length > 0){
|
||||||
|
result = String.format(this.typeIconTemplate, this.warningIcon, type, type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!result){
|
||||||
|
result = this.getTypeIcon(type);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
|
||||||
|
getTypeIcon: function(type){
|
||||||
var icon = Sonia.repository.getTypeIcon(type);
|
var icon = Sonia.repository.getTypeIcon(type);
|
||||||
if ( icon ){
|
if ( icon ){
|
||||||
var displayName = type;
|
var displayName = type;
|
||||||
@@ -429,6 +453,13 @@ Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, {
|
|||||||
Ext.getCmp('repoRmButton').setDisabled(true);
|
Ext.getCmp('repoRmButton').setDisabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (admin && item.healthCheckFailures && item.healthCheckFailures.length > 0){
|
||||||
|
panels.push({
|
||||||
|
xtype: 'repositoryHealthCheckFailurePanel',
|
||||||
|
healthCheckFailures: item.healthCheckFailures
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// call open listeners
|
// call open listeners
|
||||||
Ext.each(Sonia.repository.openListeners, function(listener){
|
Ext.each(Sonia.repository.openListeners, function(listener){
|
||||||
if (Ext.isFunction(listener)){
|
if (Ext.isFunction(listener)){
|
||||||
|
|||||||
@@ -0,0 +1,108 @@
|
|||||||
|
/* *
|
||||||
|
* Copyright (c) 2010, Sebastian Sdorra
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||||
|
* contributors may be used to endorse or promote products derived from this
|
||||||
|
* software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* http://bitbucket.org/sdorra/scm-manager
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
Sonia.repository.HealthCheckFailure = Ext.extend(Ext.Panel, {
|
||||||
|
|
||||||
|
title: 'Health check',
|
||||||
|
linkTemplate: '<a target="_blank" href="{0}">{0}</a>',
|
||||||
|
|
||||||
|
initComponent: function(){
|
||||||
|
var items = [];
|
||||||
|
|
||||||
|
if ( this.healthCheckFailures && this.healthCheckFailures.length > 0 ){
|
||||||
|
for (var i=0; i<this.healthCheckFailures.length; i++){
|
||||||
|
if (i>0){
|
||||||
|
this.appendSpacer(items);
|
||||||
|
}
|
||||||
|
this.appendHealthCheckFailures(items,this.healthCheckFailures[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
title: this.title,
|
||||||
|
padding: 5,
|
||||||
|
bodyCssClass: 'x-panel-mc',
|
||||||
|
layout: 'table',
|
||||||
|
layoutConfig: {
|
||||||
|
columns: 2,
|
||||||
|
tableAttrs: {
|
||||||
|
style: 'width: 80%;'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
defaults: {
|
||||||
|
style: 'font-size: 12px'
|
||||||
|
},
|
||||||
|
items: items
|
||||||
|
};
|
||||||
|
Ext.apply(this, Ext.apply(this.initialConfig, config));
|
||||||
|
Sonia.repository.HealthCheckFailure.superclass.initComponent.apply(this, arguments);
|
||||||
|
},
|
||||||
|
|
||||||
|
appendSpacer: function(items){
|
||||||
|
items.push({
|
||||||
|
xtype: 'box',
|
||||||
|
height: 10,
|
||||||
|
colspan: 2
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
appendHealthCheckFailures: function(items, hcf){
|
||||||
|
items.push({
|
||||||
|
xtype: 'label',
|
||||||
|
text: 'Summary:'
|
||||||
|
},{
|
||||||
|
xtype: 'label',
|
||||||
|
text: hcf.summary
|
||||||
|
});
|
||||||
|
if ( hcf.url ){
|
||||||
|
items.push({
|
||||||
|
xtype: 'label',
|
||||||
|
text: 'Url:'
|
||||||
|
},{
|
||||||
|
xtype: 'box',
|
||||||
|
html: String.format(this.linkTemplate, hcf.url)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if ( hcf.description ){
|
||||||
|
items.push({
|
||||||
|
xtype: 'label',
|
||||||
|
text: 'Description:'
|
||||||
|
},{
|
||||||
|
xtype: 'label',
|
||||||
|
text: hcf.description
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
Ext.reg('repositoryHealthCheckFailurePanel', Sonia.repository.HealthCheckFailure);
|
||||||
Reference in New Issue
Block a user