By default, use new seed format

Signed-off-by: Alexis Sellier <self@cloudhead.io>
This commit is contained in:
Alexis Sellier
2022-02-09 16:22:33 +01:00
parent aec7307af8
commit 66955f92dd
2 changed files with 13 additions and 6 deletions
+2 -3
View File
@@ -13,8 +13,7 @@ describe('SeedAddress', function () {
port: 8776
}
}, styles);
cy.findByText("hydkkk…coygh1@seed.cloudhead.io").should("exist").should("have.attr", "href", "/seeds/seed.cloudhead.io");
cy.findByText(":8776").should("exist");
cy.findByText("seed.cloudhead.io").should("exist").should("have.attr", "href", "/seeds/seed.cloudhead.io");
cy.findByText("Copy").should("exist");
});
@@ -22,7 +21,7 @@ describe('SeedAddress', function () {
cy.findByText("Copy").click().should("exist");
cy.findByText("Copy ✓").should("have.attr", "disabled");
// We invoke the cy.window here since doing the clipboard action in the runner window, would throw an error
cy.window().its("navigator.clipboard").invoke("readText").should("equal", "hydkkkf5ksbe5fuszdhpqhytu3q36gwagj874wxwpo5a8ti8coygh1@seed.cloudhead.io:8776");
cy.window().its("navigator.clipboard").invoke("readText").should("equal", "seed.cloudhead.io");
cy.wait(4000);
cy.findByText("Copy").click().should("exist").should("not.have.attr", "disabled");
});
+11 -3
View File
@@ -4,11 +4,15 @@
export let seed: Seed;
export let port: number;
export let full = false;
let seedCopied = false;
const copySeed = (seedId: string, seedHost: string) => {
return () => toClipboard(formatSeedAddress(seedId, seedHost, port)).then(() => {
const str = full
? formatSeedAddress(seedId, seedHost, port)
: seedHost;
return () => toClipboard(str).then(() => {
seedCopied = true;
setTimeout(() => {
seedCopied = false;
@@ -38,8 +42,12 @@
<div class="desktop">
<div class="seed-address">
<span class="seed-icon">🌱</span>
<span><a href="/seeds/{seed.host}" class="link">{formatSeedId(seed.id)}@{seed.host}</a></span>
<span class="faded">:{port}</span>
{#if full}
<span><a href="/seeds/{seed.host}" class="link">{formatSeedId(seed.id)}@{seed.host}</a></span>
<span class="faded">:{port}</span>
{:else}
<span><a href="/seeds/{seed.host}" class="link">{seed.host}</a></span>
{/if}
</div>
</div>
<div>