Files
windmill/frontend/src/lib/components/NextcloudSetting.svelte
T
6f04292ea7 feat: let integration triggers use any connection of their type (#11968)
* feat: let integration triggers act through any connection of their type

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: keep a connected resource intact when an integration trigger reconnects it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore: pin the ee companion branch

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore: refresh the sqlx cache after merging main

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: leave a resource connected from Resources to Resources

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: name integration triggers in the breadcrumb and the remaining copy

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore: update ee-repo-ref to effb55d778943537b96a9b0af26c2e24ca8b4686

This commit updates the EE repository reference after PR #916 was merged in windmill-ee-private.

Previous ee-repo-ref: 1dfdc11380b866b976f83efe4d0c5203d5e83ccf

New ee-repo-ref: effb55d778943537b96a9b0af26c2e24ca8b4686

Automated by sync-ee-ref workflow.

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: windmill-internal-app[bot] <windmill-internal-app[bot]@users.noreply.github.com>
Co-authored-by: Ruben Fiszel <ruben@windmill.dev>
2026-11-09 18:08:21 +01:00

135 lines
4.4 KiB
Svelte

<script lang="ts">
import CollapseLink from './CollapseLink.svelte'
import IconedResourceType from './IconedResourceType.svelte'
import TextInput from './text_input/TextInput.svelte'
import Password from './Password.svelte'
import Toggle from './Toggle.svelte'
import SettingCard from './instanceSettings/SettingCard.svelte'
import PkceToggle from './PkceToggle.svelte'
interface Props {
value: any
baseUrl?: string
}
let { value = $bindable(), baseUrl }: Props = $props()
function changeDomain(domain) {
if (value && domain) {
// Remove http:// or https:// if user included it
const cleanDomain = domain.replace(/^https?:\/\//, '')
let baseUrl = `https://${cleanDomain}`
value = {
...value,
login_config: {
auth_url: `${baseUrl}/apps/oauth2/authorize`,
token_url: `${baseUrl}/apps/oauth2/api/v1/token`,
userinfo_url: `${baseUrl}/ocs/v2.php/cloud/user?format=json`,
scopes: []
},
connect_config: {
auth_url: `${baseUrl}/apps/oauth2/authorize`,
token_url: `${baseUrl}/apps/oauth2/api/v1/token`,
scopes: []
}
}
}
}
let enabled = $derived(value != undefined)
let lastDomain = $state(value?.['domain'])
$effect(() => {
const currentDomain = value?.['domain']
if (currentDomain && currentDomain !== lastDomain) {
lastDomain = currentDomain
changeDomain(currentDomain)
}
})
</script>
<div class="flex flex-col gap-1">
<!-- svelte-ignore a11y_label_has_associated_control -->
<label class="text-xs font-semibold text-emphasis flex gap-4 items-center"
><div class="w-[120px]"><IconedResourceType name="nextcloud" after={true} /></div><Toggle
checked={enabled}
on:change={(e) => {
if (e.detail) {
value = { id: '', secret: '', pkce: true, domain: '' }
} else {
value = undefined
}
}}
/></label
>
{#if enabled}
<SettingCard class="flex flex-col gap-6">
<label class="flex flex-col gap-1">
<span class="text-emphasis font-semibold text-xs">Nextcloud Instance Domain</span>
<TextInput
inputProps={{ type: 'text', placeholder: 'example.nextcloud.com' }}
bind:value={value['domain']}
/>
</label>
<label class="flex flex-col gap-1">
<span class="text-emphasis font-semibold text-xs">Custom Name</span>
<TextInput
inputProps={{ type: 'text', placeholder: 'Custom Name' }}
bind:value={value['display_name']}
/>
</label>
<label class="flex flex-col gap-1">
<span class="text-emphasis font-semibold text-xs">Client Id </span>
<span class="text-secondary font-normal text-xs"
>Client ID from your Nextcloud OAuth2 app configuration</span
>
<TextInput
inputProps={{ type: 'text', placeholder: 'Client Id' }}
bind:value={value['id']}
/>
</label>
<label for="nextcloud_client_secret" class="flex flex-col gap-1">
<span class="text-emphasis font-semibold text-xs">Client Secret </span>
<span class="text-secondary font-normal text-xs"
>Client Secret from your Nextcloud OAuth2 app configuration</span
>
<Password
id="nextcloud_client_secret"
placeholder="Client Secret"
bind:password={value['secret']}
/>
</label>
<div>
<Toggle
options={{
right:
'Allow workspace admins to set up Nextcloud integration triggers using these credentials'
}}
checked={value['share_with_workspaces'] ?? false}
on:change={(e) => {
value = { ...value, share_with_workspaces: e.detail }
}}
/>
{#if value['share_with_workspaces']}
<p class="text-xs text-tertiary mt-1">
Workspace admins will be able to connect Nextcloud integration triggers without
configuring their own OAuth client. The credentials are not exposed to them. Connections
use whichever redirect URI the client is registered with.
</p>
{/if}
</div>
<CollapseLink text="Instructions">
<div class="text-xs text-primary border rounded-md p-4">
1. Go to your Nextcloud instance as an administrator<br />
2. Navigate to <strong>Administration settings → Security → OAuth 2.0 clients</strong><br
/>
3. Click "Add client" to create a new OAuth2 application<br />
4. Set the redirect URI to your Windmill instance's
<code>{baseUrl || 'BASE_URL'}/user/login_callback/nextcloud</code><br />
5. Copy the Client ID and Client Secret to the fields above<br />
</div>
</CollapseLink>
<PkceToggle bind:pkce={value['pkce']} />
</SettingCard>
{/if}
</div>