Skip to content

Commit

Permalink
render meta field in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
drewbanin committed Mar 2, 2020
1 parent b50b835 commit db38076
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 21 deletions.
16 changes: 15 additions & 1 deletion src/app/components/column_details/column_details.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,21 @@
<tr ng-repeat-end ng-show="column.expanded" style="background-color: white; padding: 10px">
<td colspan="5" class="column-expanded">
<div style="padding: 5px 20px">
<div style="margin-bottom: 15px">
<div ng-show="column.meta">
<h5>Details</h5>
<div class="detail-group" style="padding-bottom: 0">
<div class="detail-body" style="padding-left: 0">
<dl class="detail"
ng-style="{'padding-left': $index == 0 ? 0 : 'auto'}"
ng-repeat="(k, v) in column.meta">
<dt class="detail-label">{{ k }}</dt>
<dd class="detail-value">{{ v }}</dd>
</dl>
</div>
</div>
</div>

<div style="margin-bottom: 15px" ng-if="column.description.length">
<h5>Description</h5>
<span marked="column.description"></span>
</div>
Expand Down
3 changes: 2 additions & 1 deletion src/app/components/column_details/column_details.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ angular
scope.has_more_info = function(column) {
var tests = (column.tests || []);
var description = (column.description || "");
var meta = (column.meta || {});

return tests.length || description.length;
return tests.length || description.length || !_.isEmpty(meta);
}

scope.toggle_column_expanded = function(column) {
Expand Down
28 changes: 10 additions & 18 deletions src/app/components/table_details/table_details.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ <h6>Details</h6>
<div class="panel-body">
<div class="details">
<div class="details-content">
<div class="detail-group">
<!--
<div class="detail-header">
<h6 class="detail-label">Details</h6>
<div class="detail-group" ng-if="hasData(meta)">
<div class="detail-body">
<dl class="detail"
ng-repeat="(k, v) in meta">
<dt class="detail-label">{{ k }}</dt>
<dd class="detail-value">{{ v }}</dd>
</dl>
</div>
-->
</div>
<div class="detail-group">
<div class="detail-body">
<dl class='detail' ng-if="model.tags != undefined">
<dt class="detail-label">Tags</dt>
Expand All @@ -23,21 +27,9 @@ <h6 class="detail-label">Details</h6>
<dt class="detail-label">{{ item.name }}</dt>
<dd class="detail-value">{{ item.value }}</dd>
</dl>
<dl class="detail" ng-if="show_extended">
<dt class="detail-label">Advanced</dt>
<dd class="detail-value">
<a ng-show="!show_expanded()" ng-click="show_expanded(true)">Show</a>
<a ng-show="show_expanded()" ng-click="show_expanded(false)">Hide</a>
</dd>
</dl>
</div>
</div>
<div class="detail-group" ng-if="show_extended && show_expanded()">
<!--
<div class="detail-header">
<h6 class="detail-label">Table</h6>
</div>
-->
<div class="detail-group" ng-if="hasData(extended)">
<div class="detail-body">
<dl class="detail"
ng-repeat="item in extended"
Expand Down
13 changes: 13 additions & 0 deletions src/app/components/table_details/table_details.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ angular

scope.details = [];
scope.extended = [];
scope.meta = null;
scope._show_expanded = false;

scope.show_expanded = function(v) {
Expand All @@ -27,6 +28,16 @@ angular
return scope._show_expanded;
}

scope.hasData = function(data) {
if (!data || _.isEmpty(data)) {
return false;
} else if (data.length == 1 && data[0].include == false) {
return false;
}

return true;
}

function asBytes(bytes, precision) {
if (bytes == 0) {
return '0 bytes';
Expand Down Expand Up @@ -128,6 +139,8 @@ angular
var get_type = _.property(['metadata', 'type'])
var rel_type = get_type(nv);

scope.meta = nv.meta || null;

scope.details = getBaseStats(nv);
scope.extended = getExtendedStats(nv.stats);

Expand Down
2 changes: 1 addition & 1 deletion src/app/docs/model.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ <h1>
<div class="app-frame app-pad">
<section class="section">
<div class="section-target" id="details"></div>
<table-details model="model" />
<table-details model="model"></table-details>
</section>

<section class="section">
Expand Down

0 comments on commit db38076

Please sign in to comment.