Fix peer selector for new http-api

Signed-off-by: Alexis Sellier <self@cloudhead.io>
This commit is contained in:
Alexis Sellier
2022-04-04 20:52:29 +02:00
parent 7a3958ab4a
commit 2bed0e4fd0
5 changed files with 13 additions and 13 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
[
{
"id": "hyndc7nx9keq76p1bkw9831arcndeeu3trwsc7kxt3osmpi6j9oeke",
"name": "dabit3",
"person": { "name": "dabit3" },
"delegate": true
}
]
+3 -3
View File
@@ -7,7 +7,7 @@ const defaultProps = {
peers: [
{
"id": "hyyg555wwkkutaysg6yr67qnu5d5ji54iur3n5uzzszndh8dp7ofue",
"name": "sebastinez",
"person": { "name": "sebastinez" },
"delegate": true
}
],
@@ -73,12 +73,12 @@ describe('Events', () => {
peers: [
{
"id": "hyy841u4phudmr8s5rg1jjwd1ct7x7438wmjwtsm464y8uyxyhyi6c",
"name": "cloudhead",
"person": { "name": "cloudhead" },
"delegate": true
},
{
"id": "hyyg555wwkkutaysg6yr67qnu5d5ji54iur3n5uzzszndh8dp7ofue",
"name": "sebastinez",
"person": { "name": "sebastinez" },
"delegate": true
}
]
+3 -3
View File
@@ -17,8 +17,8 @@
onMount(() => {
meta = peers.find(p => p.id === peer);
items = peers.map(p => {
if (! p.name) console.debug("Not able to resolve peer identity for: ", p.id);
let key = p.name ? `<strong>${p.name}</strong> ${p.id}` : p.id;
if (! p.person?.name) console.debug("Not able to resolve peer identity for: ", p.id);
let key = p.person?.name ? `<strong>${p.person.name}</strong> ${p.id}` : p.id;
return { key, value: p.id, badge: p.delegate ? "delegate" : null };
});
@@ -72,7 +72,7 @@
<Icon name="fork" width={15} height={15} />
{#if meta}
<span class="peer-id">
{meta.name ?? formatSeedId(meta.id)}
{meta.person?.name ?? formatSeedId(meta.id)}
</span>
{#if meta.delegate}
<span class="badge primary">delegate</span>
+1 -5
View File
@@ -1,4 +1,4 @@
import type { Stats } from "@app/project";
import type { Stats, Person } from "@app/project";
import type { Diff } from "@app/diff";
import { ApiError } from "@app/api";
@@ -33,10 +33,6 @@ export interface GroupedCommitsHistory {
stats: Stats;
}
export interface Person {
name: string;
}
export interface CommitContext {
committer?: {
peer: {
+5 -1
View File
@@ -86,9 +86,13 @@ export interface Remote {
heads: Branches;
}
export interface Person {
name: string;
}
export interface Peer {
id: PeerId;
name: string;
person?: Person;
delegate: boolean;
}