Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
157 changes: 116 additions & 41 deletions src/components/Configuration/SettingsEdit.vue
Original file line number Diff line number Diff line change
@@ -1,59 +1,111 @@
<template>
<wwEditorFormRow class="w-100">
<wwEditorInputRadio v-if="isConnected" v-model="selectMode" :disabled="isComingUp" :choices="[
{ label: 'Select a project', value: 'select' },
{ label: 'Create a project', value: 'create' },
]" />
<wwEditorInputRadio
v-if="isConnected"
v-model="selectMode"
:disabled="isComingUp"
:choices="[
{ label: 'Select a project', value: 'select' },
{ label: 'Create a project', value: 'create' },
]"
/>
</wwEditorFormRow>
<template v-if="selectMode === 'select' || !isConnected">
<div class="flex items-center" v-if="isConnected">
<wwEditorFormRow required label="Project URL" class="w-100">
<wwEditorInput type="select" placeholder="https://your-project.supabase.co"
:model-value="settings.publicData.projectUrl" :options="projectsOptions"
@update:modelValue="changeProjectUrl" class="-full" />
<wwEditorInput
type="select"
placeholder="https://your-project.supabase.co"
:model-value="settings.publicData.projectUrl"
:options="projectsOptions"
@update:modelValue="changeProjectUrl"
class="-full"
/>
</wwEditorFormRow>
<button type="button" class="ww-editor-button -primary -small -icon ml-2 mt-1" @click="refreshProjects">
<wwEditorIcon name="refresh" medium />
</button>
</div>
<button v-if="isConnected" @click="showSettings = !showSettings" class="ww-editor-button -secondary -small mb-2"
type="button">
<button
v-if="isConnected"
@click="showSettings = !showSettings"
class="ww-editor-button -secondary -small mb-2"
type="button"
>
{{ showSettings ? 'Close' : 'Open' }} settings
</button>
<template v-if="showSettings || !isConnected">
<wwEditorInputRow label="Project URL" type="query" placeholder="https://your-project.supabase.co"
:model-value="settings.publicData.projectUrl" @update:modelValue="changeProjectUrl" />
<wwEditorInputRow label="Custom Domain (optional)" type="query" placeholder="https://your-custom-domain.com"
:model-value="settings.publicData.customDomain" @update:modelValue="changeCustomDomain" />
<wwEditorInputRow label="Public API key" required type="query" placeholder="ey********"
:model-value="settings.publicData.apiKey" @update:modelValue="changeApiKey" />
<wwEditorFormRow label="Service role key">
<wwEditorInputRow
label="Project URL"
type="query"
placeholder="https://your-project.supabase.co"
:model-value="settings.publicData.projectUrl"
@update:modelValue="changeProjectUrl"
/>
<wwEditorInputRow
label="Custom Domain (optional)"
type="query"
placeholder="https://your-custom-domain.com"
:model-value="settings.publicData.customDomain"
@update:modelValue="changeCustomDomain"
/>
<wwEditorInputRow
label="Public API key"
required
type="query"
placeholder="ey********"
:model-value="settings.publicData.apiKey"
@update:modelValue="changeApiKey"
/>
<wwEditorFormRow label="Service role key" required>
<div class="flex items-center">
<wwEditorInputText type="password" placeholder="ey********" large class="w-full"
:style="{ '-webkit-text-security': 'disc' }" :model-value="settings.privateData.apiKey"
@update:modelValue="changePrivateApiKey" />
<wwEditorQuestionMark tooltip-position="top-left"
<wwEditorInputText
required
type="password"
placeholder="ey********"
large
class="w-full"
:style="{ '-webkit-text-security': 'disc' }"
:model-value="settings.privateData.apiKey"
@update:modelValue="changePrivateApiKey"
/>
<wwEditorQuestionMark
tooltip-position="top-left"
forced-content="Required if you want to manage your users and roles from the Editor or restrict access to a page for a specific role."
class="ml-2" :class="{ 'text-yellow-500': !settings.privateData.apiKey }" />
class="ml-2"
:class="{ 'text-yellow-500': !settings.privateData.apiKey }"
/>
</div>
</wwEditorFormRow>
<wwEditorInputRow v-show="false" label="Connection string" type="query"
<wwEditorInputRow
v-show="false"
label="Connection string"
type="query"
placeholder="postgres://postgres.[YOUR-PROJECT-REF]:[YOUR-PASSWORD]@aws-0-eu-west-3.pooler.supabase.com:6543/postgres"
:model-value="settings.privateData.connectionString" @update:modelValue="changeConnectionString" />
:model-value="settings.privateData.connectionString"
@update:modelValue="changeConnectionString"
/>
<wwEditorFormRow label="Database password" v-show="false">
<template #append-label>
<a class="ww-editor-link ml-2"
<a
class="ww-editor-link ml-2"
:href="`https://supabase.com/dashboard/project/${projectRef}/settings/database`"
target="_blank">
target="_blank"
>
Find it here
</a>
</template>
<div class="flex items-center">
<wwEditorInputText type="password" placeholder="Enter your database password"
:style="{ '-webkit-text-security': 'disc' }" large
<wwEditorInputText
type="password"
placeholder="Enter your database password"
:style="{ '-webkit-text-security': 'disc' }"
large
:tooltip="`Required if you want Copilot to be able to update your database.`"
:model-value="settings.privateData.databasePassword" @update:modelValue="changeDatabasePassword"
class="w-full" />
:model-value="settings.privateData.databasePassword"
@update:modelValue="changeDatabasePassword"
class="w-full"
/>
</div>
</wwEditorFormRow>
</template>
Expand All @@ -64,13 +116,28 @@
<div>We're now preparing your database. Please wait a few moments, it may take up to 1 minute.</div>
</div>
<template v-else>
<wwEditorInputRow label="Project name" type="query" placeholder="My new project" required
v-model="newProject.name" />
<wwEditorInputRow label="Organization" type="select" placeholder="Select an organization" required
<wwEditorInputRow
label="Project name"
type="query"
placeholder="My new project"
required
v-model="newProject.name"
/>
<wwEditorInputRow
label="Organization"
type="select"
placeholder="Select an organization"
required
v-model="newProject.organizationId"
:options="organizations.map(org => ({ label: org.name, value: org.id }))" />
<wwEditorInputRow label="Hosting region" type="select" placeholder="us-east-1" required
v-model="newProject.region" :options="[
:options="organizations.map(org => ({ label: org.name, value: org.id }))"
/>
<wwEditorInputRow
label="Hosting region"
type="select"
placeholder="us-east-1"
required
v-model="newProject.region"
:options="[
{ label: 'us-east-1', value: 'us-east-1' },
{ label: 'us-east-2', value: 'us-east-2' },
{ label: 'us-west-1', value: 'us-west-1' },
Expand All @@ -89,15 +156,23 @@
{ label: 'ca-central-1', value: 'ca-central-1' },
{ label: 'ap-south-1', value: 'ap-south-1' },
{ label: 'sa-east-1', value: 'sa-east-1' },
]" />
]"
/>
<wwEditorFormRow label="Database password" required>
<div class="flex items-center">
<wwEditorInputText :type="showDbPass ? 'text' : 'password'"
<wwEditorInputText
:type="showDbPass ? 'text' : 'password'"
placeholder="Enter your database password"
:style="{ '-webkit-text-security': showDbPass ? 'none' : 'disc' }" large
v-model="newProject.dbPass" class="w-full" />
<button type="button" class="ww-editor-button -secondary -small -icon ml-2"
@click="showDbPass = !showDbPass">
:style="{ '-webkit-text-security': showDbPass ? 'none' : 'disc' }"
large
v-model="newProject.dbPass"
class="w-full"
/>
<button
type="button"
class="ww-editor-button -secondary -small -icon ml-2"
@click="showDbPass = !showDbPass"
>
<wwEditorIcon :name="showDbPass ? '16/eye' : '16/eye-off'" medium />
</button>
</div>
Expand Down
6 changes: 4 additions & 2 deletions src/components/Configuration/SettingsEditMultiEnv.vue
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,10 @@
@update:modelValue="val => changeApiKey(val, env)"
/>

<wwEditorFormRow label="Service role key">
<wwEditorFormRow label="Service role key" :required="env === 'production'">
<div class="flex items-center">
<wwEditorInputText
:required="env === 'production'"
type="password"
placeholder="Enter your service role key"
large
Expand Down Expand Up @@ -280,9 +281,10 @@
@update:modelValue="val => changeApiKey(val, env)"
/>

<wwEditorFormRow label="Service role key">
<wwEditorFormRow label="Service role key" :required="env === 'production'">
<div class="flex items-center">
<wwEditorInputText
:required="env === 'production'"
type="password"
placeholder="Enter your service role key"
large
Expand Down
10 changes: 5 additions & 5 deletions src/wwPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,19 +370,19 @@ export default {
baseProjectRef: config.baseProjectRef,
branch: config.branch,
branchSlug: config.branchSlug,
hasApiKey: !!config.publicApiKey,
apiKeyPreview: maskForLog(config.publicApiKey),
hasPrivateApiKey: !!config.privateApiKey,
apiKeyPreview: maskForLog(config.privateApiKey),
};
if (!runtimeProjectUrl || !config.publicApiKey) {
if (!runtimeProjectUrl || !config.privateApiKey) {
console.warn('[Supabase plugin] fetchDoc skipped', {
reason: 'Missing projectUrl or publicApiKey',
reason: 'Missing projectUrl or privateApiKey',
...logContext,
});
return;
}

try {
const doc = await getDoc(runtimeProjectUrl, config.publicApiKey, {
const doc = await getDoc(runtimeProjectUrl, config.privateApiKey, {
branchSlug: config.branchSlug,
});
this.doc = doc;
Expand Down