IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
Browse Source

Improvements to field tables.

pull/1/head
parent
commit
7b317f169d
4 changed files with 16 additions and 6 deletions
  1. +2
    -0
      frontend/src/js/component/wb-common-fields.js
  2. +2
    -1
      frontend/src/js/component/wb-container-request-fields.js
  3. +6
    -3
      frontend/src/js/component/wb-name-and-uuid.js
  4. +6
    -2
      frontend/src/js/widget/wb-table.js

+ 2
- 0
frontend/src/js/component/wb-common-fields.js View File

@@ -84,6 +84,8 @@ class WBCommonFields extends Component {
return ( return (
rows ? ( rows ? (
<WBTable columns={ [ "Name", "Value" ] } <WBTable columns={ [ "Name", "Value" ] }
headerClasses={ [ "col-sm-2", "col-sm-4" ] }
verticalHeader={ true }
rows={ rows } /> rows={ rows } />
) : ( ) : (
<div>Loading...</div> <div>Loading...</div>


+ 2
- 1
frontend/src/js/component/wb-container-request-fields.js View File

@@ -113,7 +113,8 @@ class WBContainerRequestFields extends Component {
rows ? ( rows ? (
<WBTable columns={ [ "Name", "Value" ] } <WBTable columns={ [ "Name", "Value" ] }
headerClasses={ [ "col-sm-2", "col-sm-4" ] } headerClasses={ [ "col-sm-2", "col-sm-4" ] }
rows={ rows } />
rows={ rows }
verticalHeader={ true } />
) : ( ) : (
<div>Loading...</div> <div>Loading...</div>
) )


+ 6
- 3
frontend/src/js/component/wb-name-and-uuid.js View File

@@ -44,6 +44,9 @@ class WBNameAndUuid extends Component {
prom = prom.then(xhr => this.setState({ prom = prom.then(xhr => this.setState({
'item': xhr.response 'item': xhr.response
})); }));
prom = prom.catch(xhr => this.setState({
'error': 'Unable to retrieve: ' + xhr.status + ' (' + xhr.statusText + ')'
}));
} else { } else {
this.setState({ this.setState({
@@ -54,7 +57,7 @@ class WBNameAndUuid extends Component {
} }
} }
render({ uuid }, { item }) {
render({ uuid }, { error, item }) {
if (!uuid) if (!uuid)
return ( return (
<div><i>{ String(uuid) }</i></div> <div><i>{ String(uuid) }</i></div>
@@ -63,9 +66,9 @@ class WBNameAndUuid extends Component {
return ( return (
<div> <div>
<div> <div>
{ item ? (
{ error ? error : (item ? (
<a href={ urlForObject(item) }>{ arvadosObjectName(item) }</a> <a href={ urlForObject(item) }>{ arvadosObjectName(item) }</a>
) : 'Loading...' }
) : 'Loading...') }
</div> </div>
<div> <div>
{ uuid } { uuid }


+ 6
- 2
frontend/src/js/widget/wb-table.js View File

@@ -1,7 +1,7 @@
import { h, Component } from 'preact'; import { h, Component } from 'preact';
class WBTable extends Component { class WBTable extends Component {
render({ columns, rows, headerClasses }) {
render({ columns, rows, headerClasses, verticalHeader }) {
return ( return (
<table class="table table-striped table-hover"> <table class="table table-striped table-hover">
<thead class="thead-light"> <thead class="thead-light">
@@ -13,7 +13,11 @@ class WBTable extends Component {
{ rows.map(r => ( { rows.map(r => (
<tr> <tr>
{ columns.map((_, idx) => ( { columns.map((_, idx) => (
<td>{ r[idx] }</td>
(idx == 0 && verticalHeader) ? (
<th scope="row">{ r[idx] }</th>
) : (
<td>{ r[idx] }</td>
)
)) } )) }
</tr> </tr>
)) } )) }


Loading…
Cancel
Save