improve on-boarding II
This commit is contained in:
@@ -124,6 +124,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
$effect(() => {
|
||||
if (setting.key === 'license_key') {
|
||||
const key = $values['license_key'] ?? ''
|
||||
const { valid } = parseLicenseKey(key)
|
||||
if (valid) {
|
||||
$enterpriseLicense = key.split('.')[0]
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
let pythonAvailableVersions: ListAvailablePythonVersionsResponse = $state([])
|
||||
|
||||
let isPyFetching = $state(false)
|
||||
|
||||
@@ -234,7 +234,7 @@
|
||||
const jobSettings = settings['Jobs'] ?? []
|
||||
const jobIsolation = jobSettings.find((s) => s.key === 'job_isolation')
|
||||
const retentionPeriod = jobSettings.find((s) => s.key === 'retention_period_secs')
|
||||
const objectStorage = jobSettings.find((s) => s.key === 'object_store_cache_config')
|
||||
const objectStorage = settings['Object Storage']?.find((s) => s.key === 'object_store_cache_config')
|
||||
return [...baseWithout, ...(jobIsolation ? [jobIsolation] : []), ...(licenseKey ? [licenseKey] : []), ...(retentionPeriod ? [retentionPeriod] : []), ...(objectStorage ? [objectStorage] : [])]
|
||||
}
|
||||
return base
|
||||
@@ -287,7 +287,8 @@
|
||||
export function discardCategory(category: string) {
|
||||
if (category === 'Auth/OAuth/SAML') {
|
||||
for (const s of scimSamlSetting) {
|
||||
$values[s.key] = JSON.parse(JSON.stringify(initialValues[s.key]))
|
||||
const v = initialValues[s.key]
|
||||
$values[s.key] = v !== undefined ? JSON.parse(JSON.stringify(v)) : undefined
|
||||
}
|
||||
oauths = JSON.parse(JSON.stringify(initialOauths))
|
||||
requirePreexistingUserForOauth = initialRequirePreexistingUserForOauth
|
||||
@@ -297,7 +298,8 @@
|
||||
} else {
|
||||
const categorySettings = getSettingsForCategory(category)
|
||||
for (const s of categorySettings) {
|
||||
$values[s.key] = JSON.parse(JSON.stringify(initialValues[s.key]))
|
||||
const v = initialValues[s.key]
|
||||
$values[s.key] = v !== undefined ? JSON.parse(JSON.stringify(v)) : undefined
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -360,7 +362,8 @@
|
||||
|
||||
// Update only the saved category's initial values
|
||||
for (const s of categorySettings) {
|
||||
initialValues[s.key] = JSON.parse(JSON.stringify($values[s.key]))
|
||||
const v = $values[s.key]
|
||||
initialValues[s.key] = v !== undefined ? JSON.parse(JSON.stringify(v)) : undefined
|
||||
}
|
||||
|
||||
// Handle Auth/OAuth/SAML-specific saves
|
||||
@@ -561,7 +564,7 @@
|
||||
<div class="flex-col flex gap-6 pb-6">
|
||||
{#each settings[category] as setting}
|
||||
<!-- slack connect is handled with the alert channels settings, smtp_connect is handled in InstanceSetting -->
|
||||
{#if setting.fieldType != 'slack_connect' && !(quickSetup && setting.hideInQuickSetup)}
|
||||
{#if setting.fieldType != 'slack_connect' && !(quickSetup && setting.hideInQuickSetup) && !(quickSetup && category === 'Core' && setting.key === 'license_key')}
|
||||
<InstanceSetting
|
||||
{openSmtpSettings}
|
||||
on:closeDrawer={() => closeDrawer?.()}
|
||||
@@ -574,7 +577,14 @@
|
||||
{/if}
|
||||
{/each}
|
||||
{#if quickSetup && category === 'Core'}
|
||||
{#each settings['Jobs'].filter((s) => s.key === 'job_isolation' || s.key === 'retention_period_secs') as setting}
|
||||
{@const licenseKeySetting = settings['Core'].find((s) => s.key === 'license_key')}
|
||||
{@const extraSettings = [
|
||||
...settings['Jobs'].filter((s) => s.key === 'job_isolation'),
|
||||
...(licenseKeySetting ? [licenseKeySetting] : []),
|
||||
...settings['Jobs'].filter((s) => s.key === 'retention_period_secs'),
|
||||
...(settings['Object Storage']?.filter((s) => s.key === 'object_store_cache_config') ?? [])
|
||||
]}
|
||||
{#each extraSettings as setting}
|
||||
<InstanceSetting
|
||||
{openSmtpSettings}
|
||||
on:closeDrawer={() => closeDrawer?.()}
|
||||
|
||||
@@ -201,6 +201,13 @@
|
||||
|
||||
loadLogins()
|
||||
|
||||
$effect(() => {
|
||||
if (firstTime && !email && !password) {
|
||||
email = 'admin@windmill.dev'
|
||||
password = 'changeme'
|
||||
}
|
||||
})
|
||||
|
||||
async function checkSmtpConfigured() {
|
||||
try {
|
||||
smtpConfigured = await UserService.isSmtpConfigured()
|
||||
@@ -361,9 +368,9 @@
|
||||
{#if showPassword}
|
||||
<div>
|
||||
{#if firstTime}
|
||||
<div class="text-lg text-center w-full pb-6 text-emphasis"
|
||||
>First time login: admin@windmill.dev / changeme</div
|
||||
>
|
||||
<p class="text-xs text-center w-full pb-4 text-secondary">
|
||||
Welcome! Default credentials admin@windmill.dev / changeme have been prefilled.
|
||||
</p>
|
||||
{/if}
|
||||
<div class="space-y-6">
|
||||
{#if isCloudHosted()}
|
||||
|
||||
@@ -97,9 +97,9 @@
|
||||
|
||||
let showMore = $state(false)
|
||||
const MAX_MSG_LEN = 160
|
||||
let isLongMessage = $derived(message.length > MAX_MSG_LEN)
|
||||
let isLongMessage = $derived((message ?? '').length > MAX_MSG_LEN)
|
||||
let displayMessage = $derived(
|
||||
isLongMessage && !showMore ? message.slice(0, MAX_MSG_LEN) + '... ' : message
|
||||
isLongMessage && !showMore ? (message ?? '').slice(0, MAX_MSG_LEN) + '... ' : (message ?? '')
|
||||
)
|
||||
// let hover = $derived(Object.values(toastStates).some((state) => state.hover))
|
||||
</script>
|
||||
|
||||
@@ -163,7 +163,10 @@
|
||||
accountError = ''
|
||||
accountSubmitting = true
|
||||
try {
|
||||
const oldEmail = $superadmin
|
||||
let oldEmail = $superadmin
|
||||
if (!oldEmail) {
|
||||
oldEmail = await UserService.getCurrentEmail()
|
||||
}
|
||||
if (!oldEmail) {
|
||||
throw new Error('Could not determine current admin email')
|
||||
}
|
||||
@@ -211,7 +214,13 @@
|
||||
|
||||
sendUserToast('Account setup complete')
|
||||
goto(
|
||||
'/user/logout?rd=' + encodeURIComponent('/user/login?email=' + encodeURIComponent(newEmail))
|
||||
'/user/logout?rd=' +
|
||||
encodeURIComponent(
|
||||
'/user/login?email=' +
|
||||
encodeURIComponent(newEmail) +
|
||||
'&password=' +
|
||||
encodeURIComponent(newPassword)
|
||||
)
|
||||
)
|
||||
} catch (e: any) {
|
||||
accountError = e?.body?.message || e?.body || e?.message || 'An error occurred'
|
||||
@@ -438,7 +447,10 @@
|
||||
>
|
||||
Quick setup
|
||||
</Button>
|
||||
<Button variant="accent" unifiedSize="md" onClick={finishSetup}>Continue</Button>
|
||||
<Button variant="accent" unifiedSize="md" onClick={() => {
|
||||
wizardStep = wizardStepLabels.length - 1
|
||||
mode = 'wizard'
|
||||
}}>Continue</Button>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,27 +1,35 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$lib/navigation'
|
||||
import { page } from '$app/stores'
|
||||
import CenteredModal from '$lib/components/CenteredModal.svelte'
|
||||
import { clearUser } from '$lib/logout'
|
||||
import { userStore } from '$lib/stores'
|
||||
import { onMount } from 'svelte'
|
||||
|
||||
const rd = $page.url.searchParams.get('rd')
|
||||
|
||||
function sleep(ms: number): Promise<void> {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms))
|
||||
}
|
||||
|
||||
onMount(async () => {
|
||||
try {
|
||||
await clearUser()
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
|
||||
userStore.set(undefined)
|
||||
|
||||
const { OpenAPI } = await import('$lib/gen')
|
||||
OpenAPI.TOKEN = undefined
|
||||
|
||||
await sleep(3000)
|
||||
|
||||
if ($page.url.pathname != '/user/logout' && $page.url.pathname != '/user/login') {
|
||||
return
|
||||
}
|
||||
|
||||
if (rd?.startsWith('https://') || rd?.startsWith('http://')) {
|
||||
window.location.href = rd
|
||||
} else {
|
||||
goto(rd ?? '/user/login')
|
||||
}
|
||||
window.location.href = rd ?? '/user/login'
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user