diff --git a/cypress/fixtures/projectInfo.json b/cypress/fixtures/projectInfo.json index 8f3ff303b..9a373f747 100644 --- a/cypress/fixtures/projectInfo.json +++ b/cypress/fixtures/projectInfo.json @@ -12,5 +12,7 @@ ] } ], - "head": "56e4e029c294b08546386e1fb706b772c7433c49" + "head": "56e4e029c294b08546386e1fb706b772c7433c49", + "patches": 2, + "issues": 3 } diff --git a/src/base/projects/Header.svelte b/src/base/projects/Header.svelte index a32431711..f838eb8b1 100644 --- a/src/base/projects/Header.svelte +++ b/src/base/projects/Header.svelte @@ -8,8 +8,6 @@ import PeerSelector from "@app/base/projects/PeerSelector.svelte"; import type { Tree } from "@app/project"; import Input from "@app/Input.svelte"; - import { groupIssues, Issue } from "@app/issue"; - import { groupPatches, Patch } from "@app/patch"; export let project: Project; export let tree: Tree; @@ -210,30 +208,30 @@ on:click={() => toggleContent(ProjectContent.History, true)}> {tree.stats.commits} commit(s) - {#await Issue.getIssues(project.urn, seed.api) then issues} + {#if project.issues > 0}
- {:catch} + {:else} - {/await} - {#await Patch.getPatches(project.urn, seed.api) then patches} + {/if} + {#if project.patches > 0} - {:catch} + {:else} - {/await} + {/if} diff --git a/src/project.ts b/src/project.ts index c4cc3fdce..b4f7bd6d1 100644 --- a/src/project.ts +++ b/src/project.ts @@ -6,12 +6,20 @@ import { isOid, isRadicleId } from '@app/utils'; import { Profile, ProfileType } from '@app/profile'; import { Seed } from '@app/base/seeds/Seed'; import type { Config } from '@app/config'; -import type { Issue } from '@app/issue'; export type Urn = string; export type PeerId = string; export type Branches = { [key: string]: string }; +export type Delegate = { + type: "indirect"; + urn: Urn; + ids: PeerId[]; +} | { + type: "direct"; + id: PeerId; +}; + export interface Anchor { confirmed: true; id: string; @@ -47,8 +55,10 @@ export interface ProjectInfo { name: string; description: string; defaultBranch: string; - maintainers: Urn[]; - delegates: PeerId[]; + delegates: Delegate[]; + remotes: PeerId[]; + patches: number; + issues: number; } export interface Tree { @@ -247,13 +257,15 @@ export class Project implements ProjectInfo { name: string; description: string; defaultBranch: string; - maintainers: Urn[]; - delegates: PeerId[]; + delegates: Delegate[]; + remotes: PeerId[]; seed: Seed; peers: Peer[]; branches: Branches; profile: Profile | null; anchors: string[]; + patches: number; + issues: number; constructor(urn: string, info: ProjectInfo, seed: Seed, peers: Peer[], branches: Branches, profile: Profile | null, anchors: string[]) { this.urn = urn; @@ -261,11 +273,13 @@ export class Project implements ProjectInfo { this.name = info.name; this.description = info.description; this.defaultBranch = info.defaultBranch; - this.maintainers = info.maintainers; this.delegates = info.delegates; + this.remotes = info.remotes; this.seed = seed; this.peers = peers; this.branches = branches; + this.patches = info.patches; + this.issues = info.issues; this.profile = profile; this.anchors = anchors; } @@ -336,14 +350,6 @@ export class Project implements ProjectInfo { return new Request(`projects/${this.urn}/commits/${commit}`, this.seed.api).get(); } - static async getIssues(urn: string, host: Host): Promise