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!
Pārlūkot izejas kodu

Owner column in project listing - added WBNameAndUuid controls

pull/1/head
Stanislaw Adaszewski pirms 4 gadiem
vecāks
revīzija
f2cb003915
5 mainītis faili ar 30 papildinājumiem un 16 dzēšanām
  1. +10
    -2
      frontend/src/js/component/wb-collection-fields.js
  2. +8
    -12
      frontend/src/js/component/wb-common-fields.js
  3. +1
    -1
      frontend/src/js/component/wb-name-and-uuid.js
  4. +2
    -1
      frontend/src/js/component/wb-project-listing.js
  5. +9
    -0
      frontend/src/js/misc/wb-format-special-value.js

+ 10
- 2
frontend/src/js/component/wb-collection-fields.js Parādīt failu

@@ -8,6 +8,14 @@ import wbFormatDate from 'wb-format-date';
import WBNameAndUuid from 'wb-name-and-uuid';
import WBAccordion from 'wb-accordion';
function formatSpecialValue(value) {
if (value === null) return (<i>null</i>);
if (value === undefined) return (<i>undefined</i>);
if (typeof(value) === 'boolean') return (<i>{ String(value) }</i>);
if (value === '') return '-';
return String(value);
}
class WBCollectionFields extends Component {
componentDidMount() {
this.prepareRows();
@@ -25,7 +33,7 @@ class WBCollectionFields extends Component {
const filters = [
['uuid', '=', uuid]
];
let prom = makeArvadosRequest(arvHost, arvToken,
'/arvados/v1/collections?filters=' + encodeURIComponent(JSON.stringify(filters)));
@@ -35,7 +43,7 @@ class WBCollectionFields extends Component {
throw Error('Item not found');
let rows = [
[ 'Name', item.name ],
[ 'Description', item.description || (<i>{ String(item.description) }</i>) ],
[ 'Description', formatSpecialValue(item.description) ],
[ 'Properties', (
<WBAccordion names={ ['Properties'] } cardHeaderClass="card-header-sm">
<pre class="word-wrap">{ JSON.stringify(item.properties, null, 2) }</pre>


+ 8
- 12
frontend/src/js/component/wb-common-fields.js Parādīt failu

@@ -22,18 +22,14 @@ class WBCommonFields extends Component {
let { uuid, app } = this.props;
let { arvHost, arvToken } = app.state;
const filters = [
['uuid', '=', uuid]
];
const typeName = arvadosTypeName(uuid);
let prom = makeArvadosRequest(arvHost, arvToken,
'/arvados/v1/' + arvadosTypeName(uuid) +
's?filters=' + encodeURIComponent(JSON.stringify(filters)));
'/arvados/v1/' + typeName + 's/' +
encodeURIComponent(uuid));
prom = prom.then(xhr => {
const item = xhr.response.items[0];
if (!item)
throw Error('Item not found');
const item = xhr.response;
let rows = [
[ 'UUID', item.uuid ],
[ 'Kind', item.kind ],
@@ -43,14 +39,14 @@ class WBCommonFields extends Component {
[ 'Created at', wbFormatDate(item.created_at) ],
[ 'Modified at', wbFormatDate(item.modified_at) ],
[ 'Modified by User', (
<WBNameAndUuid app={ app } uuid={ item.modified_by_user_uuid } />
item.modified_by_user_uuid ? (<WBNameAndUuid app={ app } uuid={ item.modified_by_user_uuid } />) : '-'
) ],
[ 'Modified by Client', (
<WBNameAndUuid app={ app } uuid={ item.modified_by_client_uuid } />
item.modified_by_client_uuid ? (<WBNameAndUuid app={ app } uuid={ item.modified_by_client_uuid } />) : '-'
) ],
[ 'API Url', (
<a href={ 'https://' + app.state.arvHost + '/arvados/v1' + item.href }>
{ 'https://' + app.state.arvHost + '/arvados/v1' + item.href }
<a href={ 'https://' + app.state.arvHost + '/arvados/v1/' + typeName + 's/' + uuid }>
{ 'https://' + app.state.arvHost + '/arvados/v1/' + typeName + 's/' + uuid }
</a>
) ],
[ 'ETag', item.etag ]


+ 1
- 1
frontend/src/js/component/wb-name-and-uuid.js Parādīt failu

@@ -87,7 +87,7 @@ class WBNameAndUuid extends Component {
return;
if (nextProps.lazy) {
this.setState({ item: { uuid: nextProps.uuid }});
this.setState({ item: null });
} else {
this.props = nextProps;


+ 2
- 1
frontend/src/js/component/wb-project-listing.js Parādīt failu

@@ -3,6 +3,7 @@ import { route } from 'preact-router';
import makeArvadosRequest from 'make-arvados-request';
import WBTable from 'wb-table';
import WBPagination from 'wb-pagination';
import WBNameAndUuid from 'wb-name-and-uuid';
class WBProjectListing extends Component {
@@ -34,7 +35,7 @@ class WBProjectListing extends Component {
(<div>
{ item['description'] } { renderEditDescription(item, () => this.fetchItems()) }
</div>),
item['owner_uuid'],
( <WBNameAndUuid app={ app } uuid={ item['owner_uuid'] } lazy={ true } /> ),
(<div>
{ renderDeleteButton(item, () => this.fetchItems()) }
{ renderSharingButton(item) }


+ 9
- 0
frontend/src/js/misc/wb-format-special-value.js Parādīt failu

@@ -0,0 +1,9 @@
function wbFormatSpecialValue(value) {
if (value === null) return (<i>null</i>);
if (value === undefined) return (<i>undefined</i>);
if (typeof(value) === 'boolean') return (<i>{ String(value) }</i>);
if (value === '') return '-';
return String(value);
}
export default wbFormatSpecialValue;

Notiek ielāde…
Atcelt
Saglabāt