Skip to content

Commit

Permalink
Add pagination support; tweak UI for speed/ease
Browse files Browse the repository at this point in the history
  • Loading branch information
BigBlueHat committed Apr 3, 2017
1 parent cd69b86 commit 8504c51
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 39 deletions.
49 changes: 29 additions & 20 deletions dist/index.js
Expand Up @@ -5847,7 +5847,9 @@ window.app = new Vue({
predicate: '',
object: ''
},
current_tab: 'json-ld'
current_tab: 'json-ld',
limit: 100,
offset: 0
},
watch: {
current_tab: function(v) {
Expand Down Expand Up @@ -5887,6 +5889,9 @@ window.app = new Vue({
} else {
throw Error('Hrm...current_tab got messed up somehow...');
}
},
actual_table: function() {
return this.table.slice(this.offset, this.limit+this.offset);
}
},
created: function() {
Expand Down Expand Up @@ -6506,7 +6511,7 @@ function applyEach$1(eachfn) {
var go = initialParams(function (args, callback) {
var that = this;
return eachfn(fns, function (fn, cb) {
fn.apply(that, args.concat([cb]));
fn.apply(that, args.concat(cb));
}, callback);
});
if (args.length) {
Expand Down Expand Up @@ -6611,8 +6616,7 @@ function baseGetTag(value) {
if (value == null) {
return value === undefined ? undefinedTag : nullTag;
}
value = Object(value);
return (symToStringTag && symToStringTag in value)
return (symToStringTag && symToStringTag in Object(value))
? getRawTag(value)
: objectToString(value);
}
Expand Down Expand Up @@ -6743,6 +6747,10 @@ function isArrayLike(value) {
return value != null && isLength(value.length) && !isFunction(value);
}

// A temporary value used to identify if the loop should be broken.
// See #1064, #1293
var breakLoop = {};

/**
* This method returns `undefined`.
*
Expand Down Expand Up @@ -7047,7 +7055,7 @@ var freeProcess = moduleExports$1 && freeGlobal.process;
/** Used to access faster Node.js helpers. */
var nodeUtil = (function() {
try {
return freeProcess && freeProcess.binding('util');
return freeProcess && freeProcess.binding && freeProcess.binding('util');
} catch (e) {}
}());

Expand Down Expand Up @@ -7252,10 +7260,6 @@ function onlyOnce(fn) {
};
}

// A temporary value used to identify if the loop should be broken.
// See #1064, #1293
var breakLoop = {};

function _eachOfLimit(limit) {
return function (obj, iteratee, callback) {
callback = once(callback || noop);
Expand Down Expand Up @@ -7340,10 +7344,10 @@ function eachOfArrayLike(coll, iteratee, callback) {
callback(null);
}

function iteratorCallback(err) {
function iteratorCallback(err, value) {
if (err) {
callback(err);
} else if (++completed === length) {
} else if (++completed === length || value === breakLoop) {
callback(null);
}
}
Expand Down Expand Up @@ -7932,7 +7936,7 @@ var auto = function (tasks, concurrency, callback) {
var runningTasks = 0;
var hasError = false;

var listeners = {};
var listeners = Object.create(null);

var readyTasks = [];

Expand Down Expand Up @@ -7960,7 +7964,7 @@ var auto = function (tasks, concurrency, callback) {

arrayEach(dependencies, function (dependencyName) {
if (!tasks[dependencyName]) {
throw new Error('async.auto task `' + key + '` has a non-existent dependency in ' + dependencies.join(', '));
throw new Error('async.auto task `' + key + '` has a non-existent dependency `' + dependencyName + '` in ' + dependencies.join(', '));
}
addListener(dependencyName, function () {
remainingDependencies--;
Expand Down Expand Up @@ -8022,7 +8026,7 @@ var auto = function (tasks, concurrency, callback) {
});
safeResults[key] = args;
hasError = true;
listeners = [];
listeners = Object.create(null);

callback(err, safeResults);
} else {
Expand Down Expand Up @@ -8239,15 +8243,17 @@ function asciiToArray(string) {

/** Used to compose unicode character classes. */
var rsAstralRange = '\\ud800-\\udfff';
var rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23';
var rsComboSymbolsRange = '\\u20d0-\\u20f0';
var rsComboMarksRange = '\\u0300-\\u036f';
var reComboHalfMarksRange = '\\ufe20-\\ufe2f';
var rsComboSymbolsRange = '\\u20d0-\\u20ff';
var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
var rsVarRange = '\\ufe0e\\ufe0f';

/** Used to compose unicode capture groups. */
var rsZWJ = '\\u200d';

/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');
var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');

/**
* Checks if `string` contains Unicode symbols.
Expand All @@ -8262,13 +8268,15 @@ function hasUnicode(string) {

/** Used to compose unicode character classes. */
var rsAstralRange$1 = '\\ud800-\\udfff';
var rsComboMarksRange$1 = '\\u0300-\\u036f\\ufe20-\\ufe23';
var rsComboSymbolsRange$1 = '\\u20d0-\\u20f0';
var rsComboMarksRange$1 = '\\u0300-\\u036f';
var reComboHalfMarksRange$1 = '\\ufe20-\\ufe2f';
var rsComboSymbolsRange$1 = '\\u20d0-\\u20ff';
var rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1;
var rsVarRange$1 = '\\ufe0e\\ufe0f';

/** Used to compose unicode capture groups. */
var rsAstral = '[' + rsAstralRange$1 + ']';
var rsCombo = '[' + rsComboMarksRange$1 + rsComboSymbolsRange$1 + ']';
var rsCombo = '[' + rsComboRange$1 + ']';
var rsFitz = '\\ud83c[\\udffb-\\udfff]';
var rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')';
var rsNonAstral = '[^' + rsAstralRange$1 + ']';
Expand Down Expand Up @@ -8662,6 +8670,7 @@ function queue(worker, concurrency, payload) {

var workers = 0;
var workersList = [];
var isProcessing = false;
var q = {
_tasks: new DLL(),
concurrency: concurrency,
Expand Down
56 changes: 38 additions & 18 deletions index.html
Expand Up @@ -16,9 +16,9 @@
#app {margin: 1%}
.ui.buttons.hover-hidden {display: none}
tr:hover .ui.buttons.hover-hidden {display: inherit}
.compact.table td.tight {padding: 0}
tr td .ui.input {display: none}
.ui.bottom.attached.segment {padding:0}
.compact.table tbody td:last-child {padding: 0}
.ui.bottom.attached.segment {padding:0 auto}
/* codemirror */
.CodeMirror.cm-s-default {border-top: 1px solid #ccc;}
</style>
Expand Down Expand Up @@ -85,49 +85,69 @@ <h1 class="ui dividing page header">
</div>
</div>

<table class="ui compact table">
<table class="ui compact fixed table">
<thead>
<tr>
<th>subject</th>
<th>predicate</th>
<th>object</th>
<th colspan="2">
<th class="four wide">
<div class="ui ribbon label">
Triples
<div class="detail">{{table.length}}</div>
</div>
subject
</th>
<th class="four wide">predicate</th>
<th class="four wide">object</th>
<th class="three wide">
graph
<button @click="empty()" class="ui right floated negative button">empty</button>
</th>
<th class="one wide">
<button @click="empty()" class="ui right floated tiny negative button">empty</button>
</th>
</tr>
<tr>
<th class="four wide">
<th>
<div class="ui fluid input">
<input v-model="filter.subject" @keyup.enter="applyFilter()">
</div>
</th>
<th class="four wide">
<th>
<div class="ui fluid input">
<input v-model="filter.predicate" @keyup.enter="applyFilter()">
</div>
</th>
<th class="four wide">
<th>
<div class="ui fluid input">
<input v-model="filter.object" @keyup.enter="applyFilter()">
</div>
</th>
<th class="four wide" colspan="2">
<th>
<div class="ui tiny buttons">
<button @click="applyFilter()" class="ui button">Filter</button>
<div class="or">
<button @click="addSPO()" class="ui positive button">Add</button>
</div>
</th>
<th>
<div class="ui right floated mini pagination menu"
v-if="table.length > limit">
<a class="icon item" @click="offset -= limit"
:class="{disabled: offset <= 0}">
<i class="left chevron icon"></i>
</a>
<a class="icon item" @click="offset += limit">
<i class="right chevron icon"></i>
</a>
</div>
</th>
</tr>
</thead>
<tbody v-cloak>
<tr v-for="(spo, idx) in table">
<td>{{spo.subject}}</td>
<td>{{spo.predicate}}</td>
<td>{{spo.object}}</td>
<td>{{spo.graph}}</td>
<td class="tight">
<tr v-for="(spo, idx) in actual_table">
<td :title="spo.subject">{{spo.subject}}</td>
<td :title="spo.predicate">{{spo.predicate}}</td>
<td :title="spo.object">{{spo.object}}</td>
<td :title="spo.graph">{{spo.graph}}</td>
<td>
<div class="ui mini hover-hidden right floated buttons">
<div class="ui icon button" @click="setFilter(spo)">
<i class="pencil icon"></i>
Expand Down
7 changes: 6 additions & 1 deletion index.js
Expand Up @@ -66,7 +66,9 @@ window.app = new Vue({
predicate: '',
object: ''
},
current_tab: 'json-ld'
current_tab: 'json-ld',
limit: 100,
offset: 0
},
watch: {
current_tab: function(v) {
Expand Down Expand Up @@ -106,6 +108,9 @@ window.app = new Vue({
} else {
throw Error('Hrm...current_tab got messed up somehow...');
}
},
actual_table: function() {
return this.table.slice(this.offset, this.limit+this.offset);
}
},
created: function() {
Expand Down

0 comments on commit 8504c51

Please sign in to comment.