mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-25 10:33:21 +03:00
Use getContextByClass
for AuthService
This commit is contained in:
parent
87dd2c7327
commit
a282a41c39
@ -3,14 +3,16 @@
|
|||||||
import Icon from './Icon.svelte';
|
import Icon from './Icon.svelte';
|
||||||
import InfoMessage from './InfoMessage.svelte';
|
import InfoMessage from './InfoMessage.svelte';
|
||||||
import Link from './Link.svelte';
|
import Link from './Link.svelte';
|
||||||
|
import { AuthService } from '$lib/backend/auth';
|
||||||
|
import { getContextByClass } from '$lib/utils/context';
|
||||||
import { slide } from 'svelte/transition';
|
import { slide } from 'svelte/transition';
|
||||||
import type { AuthService } from '$lib/backend/auth';
|
|
||||||
|
|
||||||
export let authService: AuthService;
|
|
||||||
export let projectId: string;
|
export let projectId: string;
|
||||||
export let remoteName: string | null | undefined;
|
export let remoteName: string | null | undefined;
|
||||||
export let branchName: string | null | undefined;
|
export let branchName: string | null | undefined;
|
||||||
|
|
||||||
|
const authService = getContextByClass(AuthService);
|
||||||
|
|
||||||
type Check = { name: string; promise: Promise<any> };
|
type Check = { name: string; promise: Promise<any> };
|
||||||
$: checks = [] as Check[];
|
$: checks = [] as Check[];
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
import RadioButton from './RadioButton.svelte';
|
import RadioButton from './RadioButton.svelte';
|
||||||
import SectionCard from './SectionCard.svelte';
|
import SectionCard from './SectionCard.svelte';
|
||||||
import TextBox from './TextBox.svelte';
|
import TextBox from './TextBox.svelte';
|
||||||
|
import { AuthService } from '$lib/backend/auth';
|
||||||
import { ProjectService, type Key, type KeyType, type Project } from '$lib/backend/projects';
|
import { ProjectService, type Key, type KeyType, type Project } from '$lib/backend/projects';
|
||||||
import Button from '$lib/components/Button.svelte';
|
import Button from '$lib/components/Button.svelte';
|
||||||
import Link from '$lib/components/Link.svelte';
|
import Link from '$lib/components/Link.svelte';
|
||||||
@ -13,11 +14,10 @@
|
|||||||
import { openExternalUrl } from '$lib/utils/url';
|
import { openExternalUrl } from '$lib/utils/url';
|
||||||
import { BaseBranch } from '$lib/vbranches/types';
|
import { BaseBranch } from '$lib/vbranches/types';
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import type { AuthService } from '$lib/backend/auth';
|
|
||||||
|
|
||||||
export let authService: AuthService;
|
|
||||||
export let project: Project;
|
export let project: Project;
|
||||||
|
|
||||||
|
const authService = getContextByClass(AuthService);
|
||||||
const baseBranch = getContextStoreByClass(BaseBranch);
|
const baseBranch = getContextStoreByClass(BaseBranch);
|
||||||
const projectService = getContextByClass(ProjectService);
|
const projectService = getContextByClass(ProjectService);
|
||||||
|
|
||||||
@ -207,7 +207,6 @@
|
|||||||
<CredentialCheck
|
<CredentialCheck
|
||||||
bind:this={credentialCheck}
|
bind:this={credentialCheck}
|
||||||
projectId={project.id}
|
projectId={project.id}
|
||||||
{authService}
|
|
||||||
remoteName={remoteName || $baseBranch?.remoteName}
|
remoteName={remoteName || $baseBranch?.remoteName}
|
||||||
branchName={branchName || $baseBranch?.shortName}
|
branchName={branchName || $baseBranch?.shortName}
|
||||||
/>
|
/>
|
||||||
|
@ -7,15 +7,13 @@
|
|||||||
import { UserService } from '$lib/stores/user';
|
import { UserService } from '$lib/stores/user';
|
||||||
import { getContextByClass } from '$lib/utils/context';
|
import { getContextByClass } from '$lib/utils/context';
|
||||||
import { BranchController } from '$lib/vbranches/branchController';
|
import { BranchController } from '$lib/vbranches/branchController';
|
||||||
import type { AuthService } from '$lib/backend/auth';
|
|
||||||
import type { Project } from '$lib/backend/projects';
|
import type { Project } from '$lib/backend/projects';
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
|
|
||||||
export let authService: AuthService;
|
|
||||||
const branchController = getContextByClass(BranchController);
|
|
||||||
export let project: Project;
|
export let project: Project;
|
||||||
export let remoteBranches: { name: string }[];
|
export let remoteBranches: { name: string }[];
|
||||||
|
|
||||||
|
const branchController = getContextByClass(BranchController);
|
||||||
const userService = getContextByClass(UserService);
|
const userService = getContextByClass(UserService);
|
||||||
const user = userService.user;
|
const user = userService.user;
|
||||||
|
|
||||||
@ -37,7 +35,7 @@
|
|||||||
<DecorativeSplitView user={$user} img={newProjectSvg}>
|
<DecorativeSplitView user={$user} img={newProjectSvg}>
|
||||||
{#if selectedBranch}
|
{#if selectedBranch}
|
||||||
{@const [remoteName, branchName] = selectedBranch.split(/\/(.*)/s)}
|
{@const [remoteName, branchName] = selectedBranch.split(/\/(.*)/s)}
|
||||||
<KeysForm {project} {authService} {remoteName} {branchName} />
|
<KeysForm {project} {remoteName} {branchName} />
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<Button kind="outlined" color="neutral" on:mousedown={() => (selectedBranch = '')}
|
<Button kind="outlined" color="neutral" on:mousedown={() => (selectedBranch = '')}
|
||||||
>Back</Button
|
>Back</Button
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
import '../styles/main.postcss';
|
import '../styles/main.postcss';
|
||||||
|
|
||||||
import { AIService } from '$lib/backend/aiService';
|
import { AIService } from '$lib/backend/aiService';
|
||||||
|
import { AuthService } from '$lib/backend/auth';
|
||||||
import { GitConfigService } from '$lib/backend/gitConfigService';
|
import { GitConfigService } from '$lib/backend/gitConfigService';
|
||||||
import { ProjectService } from '$lib/backend/projects';
|
import { ProjectService } from '$lib/backend/projects';
|
||||||
import { PromptService } from '$lib/backend/prompt';
|
import { PromptService } from '$lib/backend/prompt';
|
||||||
@ -23,7 +24,7 @@
|
|||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
|
|
||||||
export let data: LayoutData;
|
export let data: LayoutData;
|
||||||
$: ({ cloud, promptService } = data);
|
$: ({ cloud } = data);
|
||||||
|
|
||||||
const userSettings = loadUserSettings();
|
const userSettings = loadUserSettings();
|
||||||
initTheme(userSettings);
|
initTheme(userSettings);
|
||||||
@ -35,7 +36,8 @@
|
|||||||
$: setContext(GitHubService, data.githubService);
|
$: setContext(GitHubService, data.githubService);
|
||||||
$: setContext(GitConfigService, data.gitConfig);
|
$: setContext(GitConfigService, data.gitConfig);
|
||||||
$: setContext(AIService, data.aiService);
|
$: setContext(AIService, data.aiService);
|
||||||
$: setContext(PromptService, promptService);
|
$: setContext(PromptService, data.promptService);
|
||||||
|
$: setContext(AuthService, data.authService);
|
||||||
|
|
||||||
let shareIssueModal: ShareIssueModal;
|
let shareIssueModal: ShareIssueModal;
|
||||||
|
|
||||||
|
@ -15,12 +15,13 @@
|
|||||||
import type { PageData } from './$types';
|
import type { PageData } from './$types';
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
|
|
||||||
|
// TODO: Too much functionality here for a +page.svelte file
|
||||||
|
|
||||||
export let data: PageData;
|
export let data: PageData;
|
||||||
|
|
||||||
$: projectService = data.projectService;
|
$: projectService = data.projectService;
|
||||||
$: project$ = data.project$;
|
$: project$ = data.project$;
|
||||||
$: cloud = data.cloud;
|
$: cloud = data.cloud;
|
||||||
$: authService = data.authService;
|
|
||||||
|
|
||||||
const userService = getContextByClass(UserService);
|
const userService = getContextByClass(UserService);
|
||||||
const user = userService.user;
|
const user = userService.user;
|
||||||
@ -74,7 +75,7 @@
|
|||||||
<ContentWrapper title="Project settings">
|
<ContentWrapper title="Project settings">
|
||||||
<CloudForm project={$project$} on:updated={onCloudUpdated} />
|
<CloudForm project={$project$} on:updated={onCloudUpdated} />
|
||||||
<DetailsForm project={$project$} on:updated={onDetailsUpdated} />
|
<DetailsForm project={$project$} on:updated={onDetailsUpdated} />
|
||||||
<KeysForm project={$project$} {authService} />
|
<KeysForm project={$project$} />
|
||||||
<Spacer />
|
<Spacer />
|
||||||
<PreferencesForm project={$project$} on:updated={onPreferencesUpdated} />
|
<PreferencesForm project={$project$} on:updated={onPreferencesUpdated} />
|
||||||
<SectionCard>
|
<SectionCard>
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
export let data: PageData;
|
export let data: PageData;
|
||||||
|
|
||||||
$: ({ authService, projectId, project$ } = data);
|
$: ({ projectId, project$ } = data);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#await getRemoteBranches(projectId)}
|
{#await getRemoteBranches(projectId)}
|
||||||
@ -21,7 +21,7 @@
|
|||||||
use virtual branches, please push your code to a remote branch to use as a base"
|
use virtual branches, please push your code to a remote branch to use as a base"
|
||||||
/>
|
/>
|
||||||
{:else}
|
{:else}
|
||||||
<ProjectSetup project={$project$} {authService} {remoteBranches} />
|
<ProjectSetup project={$project$} {remoteBranches} />
|
||||||
{/if}
|
{/if}
|
||||||
{:catch}
|
{:catch}
|
||||||
<ProblemLoadingRepo
|
<ProblemLoadingRepo
|
||||||
|
Loading…
Reference in New Issue
Block a user