Skip to content

Commit

Permalink
patch svelte
Browse files Browse the repository at this point in the history
  • Loading branch information
0o-de-lally committed May 18, 2021
1 parent 29f8327 commit 6f0206c
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 40 deletions.
92 changes: 55 additions & 37 deletions ol/cli/web-monitor/public/build/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@ var app = (function () {
block.o(local);
}
}

const globals = (typeof window !== 'undefined'
? window
: typeof globalThis !== 'undefined'
? globalThis
: global);
function create_component(block) {
block && block.c();
}
Expand Down Expand Up @@ -19499,40 +19505,42 @@ var app = (function () {
}

/* src/components/upgrade/InProgress.svelte generated by Svelte v3.37.0 */

const { console: console_1 } = globals;
const file$3 = "src/components/upgrade/InProgress.svelte";

function get_each_context(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[5] = list[i];
child_ctx[7] = i;
child_ctx[6] = list[i];
child_ctx[8] = i;
return child_ctx;
}

function get_each_context_1(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[8] = list[i];
child_ctx[7] = i;
child_ctx[9] = list[i];
child_ctx[8] = i;
return child_ctx;
}

// (48:10) {#each prop.validators as val, i}
// (55:10) {#each prop.validators as val, i}
function create_each_block_1(ctx) {
let p;
let t_value = /*val*/ ctx[8] + "";
let t_value = /*val*/ ctx[9] + "";
let t;

const block = {
c: function create() {
p = element("p");
t = text(t_value);
add_location(p, file$3, 48, 12, 1467);
add_location(p, file$3, 55, 12, 1649);
},
m: function mount(target, anchor) {
insert_dev(target, p, anchor);
append_dev(p, t);
},
p: function update(ctx, dirty) {
if (dirty & /*vote_counts*/ 1 && t_value !== (t_value = /*val*/ ctx[8] + "")) set_data_dev(t, t_value);
if (dirty & /*vote_counts*/ 1 && t_value !== (t_value = /*val*/ ctx[9] + "")) set_data_dev(t, t_value);
},
d: function destroy(detaching) {
if (detaching) detach_dev(p);
Expand All @@ -19543,29 +19551,29 @@ var app = (function () {
block,
id: create_each_block_1.name,
type: "each",
source: "(48:10) {#each prop.validators as val, i}",
source: "(55:10) {#each prop.validators as val, i}",
ctx
});

return block;
}

// (39:8) {#each vote_counts as prop, i}
// (46:8) {#each vote_counts as prop, i}
function create_each_block(ctx) {
let h5;
let t0;
let t1_value = /*i*/ ctx[7] + 1 + "";
let t1_value = /*i*/ ctx[8] + 1 + "";
let t1;
let t2;
let p;
let t3_value = /*vote_counts*/ ctx[0].length + "";
let t3_value = /*prop*/ ctx[6].validators.length + "";
let t3;
let t4;
let t5;
let t6;
let t7;
let each_1_anchor;
let each_value_1 = /*prop*/ ctx[5].validators;
let each_value_1 = /*prop*/ ctx[6].validators;
validate_each_argument(each_value_1);
let each_blocks = [];

Expand All @@ -19592,9 +19600,9 @@ var app = (function () {

each_1_anchor = empty();
attr_dev(h5, "class", "uk-text-muted uk-text-center uk-text-uppercase uk-text-small");
add_location(h5, file$3, 39, 10, 1130);
add_location(h5, file$3, 46, 10, 1308);
attr_dev(p, "class", "uk-text-uppercase uk-text-small");
add_location(p, file$3, 44, 10, 1282);
add_location(p, file$3, 51, 10, 1460);
},
m: function mount(target, anchor) {
insert_dev(target, h5, anchor);
Expand All @@ -19615,11 +19623,11 @@ var app = (function () {
insert_dev(target, each_1_anchor, anchor);
},
p: function update(ctx, dirty) {
if (dirty & /*vote_counts*/ 1 && t3_value !== (t3_value = /*vote_counts*/ ctx[0].length + "")) set_data_dev(t3, t3_value);
if (dirty & /*vote_counts*/ 1 && t3_value !== (t3_value = /*prop*/ ctx[6].validators.length + "")) set_data_dev(t3, t3_value);
if (dirty & /*validator_count*/ 2) set_data_dev(t5, /*validator_count*/ ctx[1]);

if (dirty & /*vote_counts*/ 1) {
each_value_1 = /*prop*/ ctx[5].validators;
each_value_1 = /*prop*/ ctx[6].validators;
validate_each_argument(each_value_1);
let i;

Expand Down Expand Up @@ -19656,7 +19664,7 @@ var app = (function () {
block,
id: create_each_block.name,
type: "each",
source: "(39:8) {#each vote_counts as prop, i}",
source: "(46:8) {#each vote_counts as prop, i}",
ctx
});

Expand All @@ -19674,7 +19682,6 @@ var app = (function () {
let td0;
let t3;
let td1;
let t4_value = /*vote_counts*/ ctx[0].length + "";
let t4;
let t5;
let t6;
Expand Down Expand Up @@ -19711,7 +19718,7 @@ var app = (function () {
td0.textContent = "VOTERS:";
t3 = space();
td1 = element("td");
t4 = text(t4_value);
t4 = text(/*voters*/ ctx[3]);
t5 = text("/");
t6 = text(/*validator_count*/ ctx[1]);
t7 = space();
Expand All @@ -19732,24 +19739,24 @@ var app = (function () {
}

attr_dev(h3, "class", "uk-text-muted uk-text-center uk-text-uppercase");
add_location(h3, file$3, 18, 4, 592);
add_location(h3, file$3, 25, 4, 782);
attr_dev(td0, "class", "uk-text-uppercase");
add_location(td0, file$3, 24, 10, 753);
add_location(td1, file$3, 25, 10, 806);
add_location(tr0, file$3, 23, 8, 738);
add_location(td0, file$3, 31, 10, 943);
add_location(td1, file$3, 32, 10, 996);
add_location(tr0, file$3, 30, 8, 928);
attr_dev(td2, "class", "uk-text-uppercase");
add_location(td2, file$3, 28, 10, 893);
add_location(td3, file$3, 29, 10, 950);
add_location(tr1, file$3, 27, 8, 878);
add_location(tbody, file$3, 22, 6, 722);
add_location(td2, file$3, 35, 10, 1071);
add_location(td3, file$3, 36, 10, 1128);
add_location(tr1, file$3, 34, 8, 1056);
add_location(tbody, file$3, 29, 6, 912);
attr_dev(table, "class", "uk-table");
add_location(table, file$3, 21, 4, 691);
add_location(hr, file$3, 34, 4, 1028);
add_location(table, file$3, 28, 4, 881);
add_location(hr, file$3, 41, 4, 1206);
attr_dev(div0, "class", "uk-text-center");
add_location(div0, file$3, 37, 6, 1052);
add_location(div1, file$3, 36, 4, 1040);
add_location(div2, file$3, 17, 2, 582);
add_location(main, file$3, 16, 0, 573);
add_location(div0, file$3, 44, 6, 1230);
add_location(div1, file$3, 43, 4, 1218);
add_location(div2, file$3, 24, 2, 772);
add_location(main, file$3, 23, 0, 763);
},
l: function claim(nodes) {
throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
Expand Down Expand Up @@ -19785,7 +19792,7 @@ var app = (function () {
}
},
p: function update(ctx, [dirty]) {
if (dirty & /*vote_counts*/ 1 && t4_value !== (t4_value = /*vote_counts*/ ctx[0].length + "")) set_data_dev(t4, t4_value);
if (dirty & /*voters*/ 8) set_data_dev(t4, /*voters*/ ctx[3]);
if (dirty & /*validator_count*/ 2) set_data_dev(t6, /*validator_count*/ ctx[1]);
if (dirty & /*expiration_height*/ 4) set_data_dev(t10, /*expiration_height*/ ctx[2]);

Expand Down Expand Up @@ -19838,12 +19845,21 @@ var app = (function () {
let vote_counts = [];
let validator_count = 0;
let expiration_height = 0;
let voters = 0;
let vote_window_expired;
let current_height = 0;

chainInfo.subscribe(info_str => {
let data = JSON.parse(info_str);
$$invalidate(0, vote_counts = data.chain_view.upgrade.upgrade.vote_counts);
$$invalidate(3, voters = 0);
console.log(vote_counts);

vote_counts.forEach(e => {
console.log(e.validators.length);
$$invalidate(3, voters = voters + e.validators.length);
});

$$invalidate(2, expiration_height = data.chain_view.upgrade.upgrade.vote_window);
vote_window_expired = expiration_height < current_height;
current_height = data.chain_view.height;
Expand All @@ -19853,14 +19869,15 @@ var app = (function () {
const writable_props = [];

Object.keys($$props).forEach(key => {
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console.warn(`<InProgress> was created with unknown prop '${key}'`);
if (!~writable_props.indexOf(key) && key.slice(0, 2) !== "$$") console_1.warn(`<InProgress> was created with unknown prop '${key}'`);
});

$$self.$capture_state = () => ({
chainInfo,
vote_counts,
validator_count,
expiration_height,
voters,
vote_window_expired,
current_height
});
Expand All @@ -19869,6 +19886,7 @@ var app = (function () {
if ("vote_counts" in $$props) $$invalidate(0, vote_counts = $$props.vote_counts);
if ("validator_count" in $$props) $$invalidate(1, validator_count = $$props.validator_count);
if ("expiration_height" in $$props) $$invalidate(2, expiration_height = $$props.expiration_height);
if ("voters" in $$props) $$invalidate(3, voters = $$props.voters);
if ("vote_window_expired" in $$props) vote_window_expired = $$props.vote_window_expired;
if ("current_height" in $$props) current_height = $$props.current_height;
};
Expand All @@ -19877,7 +19895,7 @@ var app = (function () {
$$self.$inject_state($$props.$$inject);
}

return [vote_counts, validator_count, expiration_height];
return [vote_counts, validator_count, expiration_height, voters];
}

class InProgress extends SvelteComponentDev {
Expand Down
2 changes: 1 addition & 1 deletion ol/cli/web-monitor/public/build/bundle.js.map

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions ol/cli/web-monitor/src/components/upgrade/InProgress.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,20 @@
let vote_counts = [];
let validator_count = 0;
let expiration_height = 0;
let voters = 0;
let vote_window_expired: Boolean;
let current_height = 0;
chainInfo.subscribe((info_str) => {
let data = JSON.parse(info_str);
vote_counts = data.chain_view.upgrade.upgrade.vote_counts;
voters = 0;
console.log(vote_counts);
vote_counts.forEach(e => {
console.log(e.validators.length);
voters = voters + e.validators.length;
});
expiration_height = data.chain_view.upgrade.upgrade.vote_window;
vote_window_expired = expiration_height < current_height;
current_height = data.chain_view.height;
Expand All @@ -27,7 +35,7 @@
<tbody>
<tr>
<td class="uk-text-uppercase">VOTERS:</td>
<td> {vote_counts.length}/{validator_count} </td>
<td> {voters}/{validator_count} </td>
</tr>
<tr>
<td class="uk-text-uppercase">EXPIRATION:</td>
Expand All @@ -47,7 +55,7 @@
proposal {i + 1}
</h5>
<p class="uk-text-uppercase uk-text-small">
{vote_counts.length} votes / {validator_count} validators
{prop.validators.length} votes / {validator_count} validators
</p>
{#each prop.validators as val, i}
<p>{val}</p>
Expand Down

0 comments on commit 6f0206c

Please sign in to comment.