Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
d38c99f
feat: add access token
AlexisJC Jan 6, 2025
92c62cd
feat: add edge function list
AlexisJC Jan 7, 2025
401af11
feat: add data log
AlexisJC Jan 7, 2025
e6c641e
fix: data
AlexisJC Jan 7, 2025
37e63d0
feat: add database password
AlexisJC Jan 9, 2025
4d04566
feat: add project list
AlexisJC Jan 10, 2025
75c6d54
fix: label for projects
AlexisJC Jan 10, 2025
8976a2e
feat: load api key
AlexisJC Jan 10, 2025
d9a3a36
fix: endpoint url
AlexisJC Jan 10, 2025
d0ccd4d
fix: name instead of role
AlexisJC Jan 10, 2025
025113f
feat: forward database pass
AlexisJC Jan 10, 2025
990dc0a
feat: add loader
AlexisJC Jan 10, 2025
f3ef695
feat: improve db link
AlexisJC Jan 10, 2025
dc62669
fix: add defensive code
AlexisJC Jan 10, 2025
d518b55
feat: fetch projects after entering the key
AlexisJC Jan 10, 2025
f668e6b
feat: split connection step
AlexisJC Jan 10, 2025
bb90876
feat: split settings and fix
AlexisJC Jan 10, 2025
f8010da
feat: add oauth
AlexisJC Jan 13, 2025
3ef210a
feat: improve oauth ui
AlexisJC Jan 13, 2025
11692bd
feat: add disabled state
AlexisJC Jan 13, 2025
aeaa5ab
feat: improve ui for connection
AlexisJC Jan 13, 2025
a1ceed4
fix: type button
AlexisJC Jan 13, 2025
459eb90
feat: implement new settings and sync
AlexisJC Jan 15, 2025
d3da4f9
feat: add error in edge function
AlexisJC Jan 15, 2025
03c06b1
feat: add required
AlexisJC Jan 15, 2025
34dfc6b
fix: service role key in supabase plugin
AlexisJC Jan 15, 2025
1d6409e
fix: private key missing
AlexisJC Jan 15, 2025
11d99d7
feat: improve summary
AlexisJC Jan 15, 2025
7599b11
feat: add install script
AlexisJC Jan 15, 2025
90db10e
feat: add fetch project info onLoad
AlexisJC Jan 15, 2025
fc2c4b0
fix: projectInfo load
AlexisJC Jan 15, 2025
f3bc38a
fix: fetch should return data
AlexisJC Jan 15, 2025
d763792
feat: add refresh event
AlexisJC Jan 15, 2025
4137a4b
fix: issue with auto update
AlexisJC Jan 15, 2025
c31ec2d
feat: use new redirect uri
AlexisJC Jan 15, 2025
094f7d9
fix: wrong redirect uri
AlexisJC Jan 15, 2025
1890785
feat: new endpoint for redirect uri
AlexisJC Jan 15, 2025
84f0b82
fix: async
AlexisJC Jan 15, 2025
cf4d7e1
feat: add edge functions in project info
AlexisJC Jan 16, 2025
90f7e45
fix: wrong return
AlexisJC Jan 16, 2025
6ce2f23
feat: add connection string
AlexisJC Jan 16, 2025
220ee0d
feat: add project creation
AlexisJC Jan 16, 2025
2f07701
fix: auto select first orga
AlexisJC Jan 16, 2025
30a1984
fix: better handle project creation
AlexisJC Jan 16, 2025
b15cab2
fix: store project url in state
AlexisJC Jan 16, 2025
a160ef1
fix: wait for healthty status
AlexisJC Jan 16, 2025
d836102
chore: test new flow
AlexisJC Jan 16, 2025
739bdd4
fix: something
AlexisJC Jan 16, 2025
36514fc
chore: update design
AlexisJC Jan 16, 2025
22c3b61
feat: add advanced settings
AlexisJC Jan 17, 2025
d124aca
feat: improve db pass
AlexisJC Jan 17, 2025
f95e86e
chore: improve errors
AlexisJC Jan 20, 2025
78a159a
fix: only send body for non get invokation
AlexisJC Jan 29, 2025
b47e601
feat: hide body for get method
AlexisJC Jan 29, 2025
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
80 changes: 80 additions & 0 deletions src/components/Configuration/ConnectionEdit.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<template>
<button v-if="!isOauth" class="ww-editor-button -secondary" @click="connect" type="button">
<wwEditorIcon name="logos/supabase" class="ww-editor-button-icon -left" />
Connect Supabase
</button>
<span v-if="!isOauth" class="my-4 border-top-primary"></span>
<div class="flex items-center">
<wwEditorFormRow :label="isOauth ? 'Access token' : 'Personal Access Token'" class="w-100">
<template #append-label>
<a class="ww-editor-link ml-2" href="https://supabase.com/dashboard/account/tokens" target="_blank">
Find it here
</a>
</template>
<wwEditorInput
type="query"
placeholder="sbp_bdd0********4f23"
:model-value="settings.privateData.accessToken"
:disabled="isOauth"
@update:modelValue="changeAccessToken"
></wwEditorInput>
</wwEditorFormRow>
<button v-if="isOauth" type="button" class="ww-editor-button -secondary -small -icon ml-2 mt-2" @click="unlink">
<wwEditorIcon name="unbind" medium />
</button>
</div>
</template>

<script>
export default {
props: {
plugin: { type: Object, required: true },
settings: { type: Object, required: true },
},
emits: ['update:settings'],
data() {
return {
isKeyVisible: false,
projects: [],
isLoading: false,
};
},
computed: {
isOauth() {
return this.settings.privateData.accessToken?.startsWith('sbp_oauth');
},
},
mounted() {
if (
!this.settings.privateData.accessToken &&
wwLib.wwPlugins?.supabaseAuth?.settings?.privateData?.accessToken
) {
this.changeAccessToken(wwLib.wwPlugins.supabaseAuth.settings.privateData.accessToken);
}
},
methods: {
changeAccessToken(accessToken) {
this.$emit('update:settings', {
...this.settings,
privateData: { ...this.settings.privateData, accessToken },
});
},
async connect() {
this.isLoading = true;
const redirectUri = window.location.origin + window.location.pathname;
window.localStorage.setItem('supabase_oauth', true);
const { data } = await wwAxios.post(
`${wwLib.wwApiRequests._getPluginsUrl()}/designs/${
wwLib.$store.getters['websiteData/getDesignInfo'].id
}/supabase/authorize`,
{ redirectUri, oauthRedirectUri: wwLib.wwApiRequests._getPluginsUrl() + '/supabase/redirect' }
);
if (!data?.data) throw new Error('No authorization URL returned');
window.location.href = data?.data;
},
unlink() {
this.changeAccessToken('');
},
},
};
</script>
24 changes: 24 additions & 0 deletions src/components/Configuration/ConnectionSummary.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<template>
<div class="flex items-center body-2 mb-2" :class="{ 'content-success': settings.privateData.accessToken }">
<wwEditorIcon :name="settings.privateData.accessToken ? 'bind' : 'unbind'" class="mr-2" />
<div class="text-ellipsis">
{{ settings.privateData.accessToken ? 'Account connected' : 'No account connected' }}
</div>
</div>
</template>

<script>
export default {
props: {
settings: { type: Object, required: true },
},
};
</script>

<style lang="scss" scoped>
.text-ellipsis {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
</style>
Loading