mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 08:55:44 +01:00
show url and creationdate on gui
This commit is contained in:
@@ -9,6 +9,7 @@ package sonia.scm.repository;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import sonia.scm.util.DateAdapter;
|
||||
import sonia.scm.util.Util;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
@@ -20,14 +21,18 @@ import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@XmlRootElement(name = "repositories")
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(propOrder =
|
||||
{
|
||||
"id", "type", "name", "contact", "description", "creationDate", "url",
|
||||
@@ -277,6 +282,7 @@ public class Repository implements Serializable
|
||||
private String contact;
|
||||
|
||||
/** Field description */
|
||||
@XmlJavaTypeAdapter(DateAdapter.class)
|
||||
private Date creationDate;
|
||||
|
||||
/** Field description */
|
||||
|
||||
54
scm-core/src/main/java/sonia/scm/util/DateAdapter.java
Normal file
54
scm-core/src/main/java/sonia/scm/util/DateAdapter.java
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.util;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import javax.xml.bind.annotation.adapters.XmlAdapter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class DateAdapter extends XmlAdapter<String, Date>
|
||||
{
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param data
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public String marshal(Date data) throws Exception
|
||||
{
|
||||
return Util.formatDate(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param string
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public Date unmarshal(String string) throws Exception
|
||||
{
|
||||
return Util.parseDate(string);
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,19 @@
|
||||
Syntax recommendation http://www.w3.org/TR/REC-CSS2/
|
||||
*/
|
||||
|
||||
a {
|
||||
color: #004077;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #004077;
|
||||
}
|
||||
|
||||
a:visited {
|
||||
color: #004077;
|
||||
}
|
||||
|
||||
#header {
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
@@ -48,12 +48,14 @@ Ext.reg('repositoryEditForm', Sonia.repository.EditForm);
|
||||
|
||||
Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, {
|
||||
|
||||
urlTemplate: '<a href="{0}" target="_blank">{0}</a>',
|
||||
|
||||
initComponent: function(){
|
||||
|
||||
var repositoryStore = new Sonia.rest.JsonStore({
|
||||
url: restUrl + 'repositories.json',
|
||||
root: 'repositories',
|
||||
fields: [ 'id', 'name', 'type', 'contact', 'description' ],
|
||||
fields: [ 'id', 'name', 'type', 'contact', 'description', 'creationDate', 'url' ],
|
||||
sortInfo: {
|
||||
field: 'name'
|
||||
}
|
||||
@@ -64,7 +66,9 @@ Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, {
|
||||
{header: 'Name', sortable: true, width: 100, dataIndex: 'name'},
|
||||
{header: 'Type', sortable: true, width: 50, dataIndex: 'type'},
|
||||
{header: 'Contact', sortable: true, width: 100, dataIndex: 'contact'},
|
||||
{header: 'Description', sortable: true, dataIndex: 'description'}
|
||||
{header: 'Description', sortable: true, dataIndex: 'description'},
|
||||
{header: 'Creation date', sortable: true, dataIndex: 'creationDate'},
|
||||
{header: 'Url', sortable: true, dataIndex: 'url', scope: this, renderer: this.renderUrl }
|
||||
]
|
||||
});
|
||||
|
||||
@@ -82,6 +86,10 @@ Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, {
|
||||
|
||||
Ext.apply(this, Ext.apply(this.initialConfig, config));
|
||||
Sonia.repository.Grid.superclass.initComponent.apply(this, arguments);
|
||||
},
|
||||
|
||||
renderUrl: function(url){
|
||||
return String.format( this.urlTemplate, url );
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user