Skip to content

Commit

Permalink
Change node param with seedingPolicies
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastinez committed Jul 2, 2024
1 parent 72e1b99 commit 7756597
Show file tree
Hide file tree
Showing 12 changed files with 124 additions and 89 deletions.
20 changes: 11 additions & 9 deletions src/components/ScopePolicyExplainer.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<script lang="ts">
import type { DefaultSeedingPolicy } from "@http-client";
import type { DefaultSeedingPolicy, SeedingPolicy } from "@http-client";
import { capitalize } from "lodash";
export let seedingPolicy: DefaultSeedingPolicy;
export let seedingPolicy: DefaultSeedingPolicy | SeedingPolicy;
$: [policy, scope] = Object.values(seedingPolicy);
</script>

<style>
Expand All @@ -15,28 +17,28 @@
}
</style>

{#if seedingPolicy.default === "allow"}
{#if policy === "allow"}
<div class="section">
Scope:
<span class="txt-bold">{capitalize(seedingPolicy.scope)}</span>
<span class="txt-bold">{capitalize(scope)}</span>
</div>
<div class="txt-missing">
{#if seedingPolicy.scope === "all"}
{#if scope === "all"}
All changes in seeded repositories, made by any peer, will be synced.
{:else if seedingPolicy.scope === "followed"}
{:else if scope === "followed"}
Only changes made by explicitly followed peers will be synced.
{/if}
</div>
{/if}

<div class="section">
Policy:
<span class="txt-bold">{capitalize(seedingPolicy.default)}</span>
<span class="txt-bold">{capitalize(policy)}</span>
</div>
<div class="txt-missing">
{#if seedingPolicy.default === "allow"}
{#if policy === "allow"}
All discovered repositories will get seeded.
{:else if seedingPolicy.default === "block"}
{:else if policy === "block"}
Only repositories marked as such will get seeded.
{/if}
</div>
6 changes: 3 additions & 3 deletions src/views/projects/Commit.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import type { BaseUrl, Commit, Node, Project } from "@http-client";
import type { BaseUrl, Commit, Project, SeedingPolicy } from "@http-client";
import Button from "@app/components/Button.svelte";
import Changeset from "@app/views/projects/Changeset.svelte";
Expand All @@ -12,7 +12,7 @@
import Id from "@app/components/Id.svelte";
export let baseUrl: BaseUrl;
export let node: Node;
export let seedingPolicy: SeedingPolicy;
export let commit: Commit;
export let project: Project;
Expand Down Expand Up @@ -45,7 +45,7 @@
}
</style>

<Layout {node} {baseUrl} {project}>
<Layout {seedingPolicy} {baseUrl} {project}>
<div class="commit">
<div class="header">
<div style="display:flex; flex-direction: column; gap: 0.5rem;">
Expand Down
6 changes: 3 additions & 3 deletions src/views/projects/History.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
CommitHeader,
Project,
Remote,
Node,
Tree,
SeedingPolicy,
} from "@http-client";
import type { ProjectRoute } from "./router";
Expand All @@ -24,7 +24,7 @@
import ProjectNameHeader from "./Source/ProjectNameHeader.svelte";
export let baseUrl: BaseUrl;
export let node: Node;
export let seedingPolicy: SeedingPolicy;
export let commit: string;
export let commitHeaders: CommitHeader[];
export let peer: string | undefined;
Expand Down Expand Up @@ -90,7 +90,7 @@
}
</style>

<Layout {node} {baseUrl} {project} activeTab="source">
<Layout {seedingPolicy} {baseUrl} {project} activeTab="source">
<ProjectNameHeader {project} {baseUrl} {seeding} slot="header" />

<div style:margin="1rem" slot="subheader">
Expand Down
11 changes: 8 additions & 3 deletions src/views/projects/Issue.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Issue,
IssueState,
Project,
Node,
SeedingPolicy,
} from "@http-client";
import type { Session } from "@app/lib/httpd";
Expand Down Expand Up @@ -49,7 +49,7 @@
import ThreadComponent from "@app/components/Thread.svelte";
export let baseUrl: BaseUrl;
export let node: Node;
export let seedingPolicy: SeedingPolicy;
export let issue: Issue;
export let project: Project;
export let rawPath: (commit?: string) => string;
Expand Down Expand Up @@ -484,7 +484,12 @@
}
</style>

<Layout {node} {baseUrl} {project} activeTab="issues" stylePaddingBottom="0">
<Layout
{seedingPolicy}
{baseUrl}
{project}
activeTab="issues"
stylePaddingBottom="0">
<div class="issue">
<div class="main">
<CobHeader>
Expand Down
12 changes: 9 additions & 3 deletions src/views/projects/Issue/New.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<script lang="ts">
import type { BaseUrl, Embed, Node, Project, Reaction } from "@http-client";
import type {
BaseUrl,
Embed,
Project,
Reaction,
SeedingPolicy,
} from "@http-client";
import * as modal from "@app/lib/modal";
import * as router from "@app/lib/router";
Expand All @@ -17,7 +23,7 @@
import TextInput from "@app/components/TextInput.svelte";
export let baseUrl: BaseUrl;
export let node: Node;
export let seedingPolicy: SeedingPolicy;
export let project: Project;
export let rawPath: (commit?: string) => string;
Expand Down Expand Up @@ -100,7 +106,7 @@
}
</style>

<Layout {node} {baseUrl} {project} activeTab="issues">
<Layout {seedingPolicy} {baseUrl} {project} activeTab="issues">
{#if session}
{@const session_ = session}
<div class="form">
Expand Down
12 changes: 9 additions & 3 deletions src/views/projects/Issues.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<script lang="ts">
import type { BaseUrl, Issue, IssueState, Node, Project } from "@http-client";
import type {
BaseUrl,
Issue,
IssueState,
Project,
SeedingPolicy,
} from "@http-client";
import capitalize from "lodash/capitalize";
import { HttpdClient } from "@http-client";
Expand All @@ -24,7 +30,7 @@
import Share from "./Share.svelte";
export let baseUrl: BaseUrl;
export let node: Node;
export let seedingPolicy: SeedingPolicy;
export let issues: Issue[];
export let project: Project;
export let state: IssueState["status"];
Expand Down Expand Up @@ -106,7 +112,7 @@
}
</style>

<Layout {node} {baseUrl} {project} activeTab="issues">
<Layout {seedingPolicy} {baseUrl} {project} activeTab="issues">
<div slot="header" style:display="flex" style:padding="1rem">
<Popover
popoverPadding="0"
Expand Down
8 changes: 4 additions & 4 deletions src/views/projects/Layout.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import type { ActiveTab } from "./Header.svelte";
import type { BaseUrl, Node, Project } from "@http-client";
import type { BaseUrl, Project, SeedingPolicy } from "@http-client";
import AppHeader from "@app/App/Header.svelte";
Expand All @@ -11,7 +11,7 @@
import Sidebar from "@app/views/projects/Sidebar.svelte";
export let activeTab: ActiveTab | undefined = undefined;
export let node: Node;
export let seedingPolicy: SeedingPolicy;
export let baseUrl: BaseUrl;
export let project: Project;
export let stylePaddingBottom: string = "2.5rem";
Expand Down Expand Up @@ -66,11 +66,11 @@
</div>

<div class="sidebar global-hide-on-medium-desktop-down">
<Sidebar {node} {activeTab} {baseUrl} {project} />
<Sidebar {seedingPolicy} {activeTab} {baseUrl} {project} />
</div>

<div class="sidebar global-hide-on-mobile-down global-hide-on-desktop-up">
<Sidebar {node} {activeTab} {baseUrl} {project} collapsedOnly />
<Sidebar {seedingPolicy} {activeTab} {baseUrl} {project} collapsedOnly />
</div>

<div class="content" style:padding-bottom={stylePaddingBottom}>
Expand Down
11 changes: 8 additions & 3 deletions src/views/projects/Patch.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
PatchState,
Revision,
Diff,
Node,
SeedingPolicy,
} from "@http-client";
interface Thread {
Expand Down Expand Up @@ -92,7 +92,7 @@
import TextInput from "@app/components/TextInput.svelte";
export let baseUrl: BaseUrl;
export let node: Node;
export let seedingPolicy: SeedingPolicy;
export let patch: Patch;
export let stats: Diff["stats"];
export let rawPath: (commit?: string) => string;
Expand Down Expand Up @@ -708,7 +708,12 @@
}
</style>

<Layout {node} {baseUrl} {project} activeTab="patches" stylePaddingBottom="0">
<Layout
{seedingPolicy}
{baseUrl}
{project}
activeTab="patches"
stylePaddingBottom="0">
<div class="patch">
<div class="main">
<CobHeader>
Expand Down
12 changes: 9 additions & 3 deletions src/views/projects/Patches.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<script lang="ts">
import type { BaseUrl, Node, Patch, PatchState, Project } from "@http-client";
import type {
BaseUrl,
Patch,
PatchState,
Project,
SeedingPolicy,
} from "@http-client";
import { HttpdClient } from "@http-client";
import capitalize from "lodash/capitalize";
Expand All @@ -25,7 +31,7 @@
import Command from "@app/components/Command.svelte";
export let baseUrl: BaseUrl;
export let node: Node;
export let seedingPolicy: SeedingPolicy;
export let patches: Patch[];
export let project: Project;
export let state: PatchState["status"];
Expand Down Expand Up @@ -121,7 +127,7 @@
}
</style>

<Layout {node} {baseUrl} {project} activeTab="patches">
<Layout {seedingPolicy} {baseUrl} {project} activeTab="patches">
<div slot="header" style:display="flex" style:padding="1rem">
<Popover
popoverPadding="0"
Expand Down
6 changes: 2 additions & 4 deletions src/views/projects/Sidebar.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import type { ActiveTab } from "./Header.svelte";
import type { BaseUrl, Node, Project } from "@http-client";
import type { BaseUrl, Project, SeedingPolicy } from "@http-client";
import Button from "@app/components/Button.svelte";
import ContextRepo from "@app/views/projects/Sidebar/ContextRepo.svelte";
Expand All @@ -13,7 +13,7 @@
const SIDEBAR_STATE_KEY = "sidebarState";
export let activeTab: ActiveTab | undefined = undefined;
export let node: Node;
export let seedingPolicy: SeedingPolicy;
export let baseUrl: BaseUrl;
export let project: Project;
export let collapsedOnly = false;
Expand Down Expand Up @@ -41,8 +41,6 @@
expanded = !expanded;
storeSidebarState(expanded);
}
$: seedingPolicy = formatShortSeedingPolicy(node.config?.seedingPolicy);
</script>

<style>
Expand Down
17 changes: 14 additions & 3 deletions src/views/projects/Source.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<script lang="ts">
import type { BaseUrl, Node, Project, Remote, Tree } from "@http-client";
import type {
BaseUrl,
Project,
Remote,
SeedingPolicy,
Tree,
} from "@http-client";
import type { BlobResult, ProjectRoute } from "./router";
import { HttpdClient } from "@http-client";
Expand All @@ -16,11 +22,11 @@
export let baseUrl: BaseUrl;
export let blobResult: BlobResult;
export let commit: string;
export let node: Node;
export let path: string;
export let peer: string | undefined;
export let peers: Remote[];
export let project: Project;
export let seedingPolicy: SeedingPolicy;
export let rawPath: (commit?: string) => string;
export let revision: string | undefined;
export let seeding: boolean;
Expand Down Expand Up @@ -111,7 +117,12 @@
}
</style>

<Layout {node} {baseUrl} {project} activeTab="source" stylePaddingBottom="0">
<Layout
{seedingPolicy}
{baseUrl}
{project}
activeTab="source"
stylePaddingBottom="0">
<ProjectNameHeader {project} {baseUrl} {seeding} slot="header" />

<div style:margin="1rem" slot="subheader">
Expand Down
Loading

0 comments on commit 7756597

Please sign in to comment.