Skip to content

Commit 2dbaef3

Browse files
authored
Merge branch 'develop' into exclude-for-sched
2 parents 566a89d + 805e7c2 commit 2dbaef3

49 files changed

Lines changed: 1381 additions & 491 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CODEOWNERS

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
# will be the default reviewers for everything in the repository unless a later
33
# match overrides them.
44

5-
# Catch all.
6-
* @ssiyad
7-
85
# Wildcards.
96
nginx.conf @adityahase
107
*server @adityahase

dashboard/src/App.vue

Lines changed: 69 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,99 +1,113 @@
11
<template>
2-
<div class="flex flex-col md:flex-row h-full">
3-
<AppSidebar v-if="!isSignupFlow && !isHideSidebar && $session.user && $team?.doc && route.name !== 'Login'" />
2+
<div class="flex flex-col md:flex-row h-full">
3+
<AppSidebar
4+
v-if="!isSignupFlow && !isHideSidebar && $session.user && $team?.doc && route.name !== 'Login'"
5+
/>
46

5-
<div class="w-full overflow-auto z-0" id="scrollContainer">
6-
<div class="border bg-surface-red-2 px-5 py-3 text-base text-ink-red-4" v-if="
7+
<div class="w-full overflow-auto z-0" id="scrollContainer">
8+
<div
9+
class="border bg-surface-red-2 px-5 py-3 text-base text-ink-red-4"
10+
v-if="
711
!isSignupFlow &&
812
!isSiteLogin &&
913
!$session.user &&
1014
!$route.meta.isLoginPage
11-
">
12-
You are not logged in.
13-
<router-link to="/login" class="underline">Login</router-link> to
14-
access dashboard.
15-
</div>
15+
"
16+
>
17+
You are not logged in.
18+
<router-link to="/login" class="underline">Login</router-link>
19+
to access dashboard.
20+
</div>
1621

17-
<router-view />
18-
</div>
19-
</div>
22+
<router-view />
23+
</div>
24+
</div>
2025

21-
<Toaster position="top-right"
22-
:toastOptions="{ class: 'text-sm prose-sm dark:bg-surface-cards dark:border-outline-gray-2 text-ink-gray-9' }" />
23-
<component v-for="dialog in dialogs" :is="dialog" :key="dialog.id" />
24-
<SearchModal v-if="searchModalOpen" />
26+
<Toaster
27+
position="top-right"
28+
:toastOptions="{ class: 'text-sm prose-sm dark:bg-surface-cards dark:border-outline-gray-2 text-ink-gray-9' }"
29+
/>
30+
<component v-for="dialog in dialogs" :is="dialog" :key="dialog.id" />
31+
<SearchModal v-if="searchModalOpen" />
32+
<PartnerRegistrationModal
33+
v-if="partnerRegistrationModalOpen"
34+
v-model="partnerRegistrationModalOpen"
35+
/>
2536
</template>
2637

2738
<script setup>
28-
import { computed, defineAsyncComponent, provide, ref, watch } from "vue";
29-
import { useRoute } from "vue-router";
30-
import { Toaster } from "vue-sonner";
31-
import SearchModal from "@/components/navigation/search/Popup.vue";
32-
import { useSearch } from "@/components/navigation/search/utils";
33-
import { searchModalOpen } from "@/data/ui";
34-
import { initTheme } from "@/utils/useTheme";
35-
import { session } from "./data/session.js";
36-
import { getTeam } from "./data/team";
37-
import { dialogs } from "./utils/components";
39+
import { computed, defineAsyncComponent, provide, ref, watch } from 'vue'
40+
import { useRoute } from 'vue-router'
41+
import { Toaster } from 'vue-sonner'
42+
import SearchModal from '@/components/navigation/search/Popup.vue'
43+
import { useSearch } from '@/components/navigation/search/utils'
44+
import { partnerRegistrationModalOpen, searchModalOpen } from '@/data/ui'
45+
import { initTheme } from '@/utils/useTheme'
46+
import { session } from './data/session.js'
47+
import { getTeam } from './data/team'
48+
import { dialogs } from './utils/components'
3849
3950
const AppSidebar = defineAsyncComponent(
40-
() => import("./components/navigation/sidebar/Sidebar.vue"),
41-
);
51+
() => import('./components/navigation/sidebar/Sidebar.vue'),
52+
)
53+
const PartnerRegistrationModal = defineAsyncComponent(
54+
() => import('./onboarding/modal/PartnerOnboardingModal.vue'),
55+
)
4256
43-
const route = useRoute();
44-
const team = getTeam();
57+
const route = useRoute()
58+
const team = getTeam()
4559
4660
const isHideSidebar = computed(() => {
4761
const alwaysHideSidebarRoutes = [
48-
"Site Login",
49-
"SignupLoginToSite",
50-
"SignupSetup",
51-
];
52-
const alwaysHideSidebarPaths = ["/dashboard/site-login"];
62+
'Site Login',
63+
'SignupLoginToSite',
64+
'SignupSetup',
65+
]
66+
const alwaysHideSidebarPaths = ['/dashboard/site-login']
5367
54-
if (!session.user) return false;
68+
if (!session.user) return false
5569
if (
5670
alwaysHideSidebarRoutes.includes(route.name) ||
5771
alwaysHideSidebarPaths.includes(window.location.pathname)
5872
)
59-
return true;
73+
return true
6074
6175
return (
6276
route.meta.hideSidebar && session.user && team?.doc?.hide_sidebar === true
63-
);
64-
});
77+
)
78+
})
6579
6680
const isSignupFlow = ref(
67-
window.location.pathname.startsWith("/dashboard/create-site") ||
68-
window.location.pathname.startsWith("/dashboard/setup-account") ||
69-
window.location.pathname.startsWith("/dashboard/site-login") ||
70-
window.location.pathname.startsWith("/dashboard/signup"),
71-
);
72-
const isSiteLogin = ref(window.location.pathname.endsWith("/site-login"));
81+
window.location.pathname.startsWith('/dashboard/create-site') ||
82+
window.location.pathname.startsWith('/dashboard/setup-account') ||
83+
window.location.pathname.startsWith('/dashboard/site-login') ||
84+
window.location.pathname.startsWith('/dashboard/signup'),
85+
)
86+
const isSiteLogin = ref(window.location.pathname.endsWith('/site-login'))
7387
7488
watch(
7589
() => route.name,
7690
() => {
7791
isSignupFlow.value =
78-
window.location.pathname.startsWith("/dashboard/create-site") ||
79-
window.location.pathname.startsWith("/dashboard/setup-account") ||
80-
window.location.pathname.startsWith("/dashboard/site-login") ||
81-
window.location.pathname.startsWith("/dashboard/signup");
92+
window.location.pathname.startsWith('/dashboard/create-site') ||
93+
window.location.pathname.startsWith('/dashboard/setup-account') ||
94+
window.location.pathname.startsWith('/dashboard/site-login') ||
95+
window.location.pathname.startsWith('/dashboard/signup')
8296
},
83-
);
97+
)
8498
85-
provide("team", team);
86-
provide("session", session);
99+
provide('team', team)
100+
provide('session', session)
87101
88102
watch(
89103
() => team?.doc?.onboarding?.complete,
90104
(x) => {
91-
if (x) useSearch();
105+
if (x) useSearch()
92106
},
93107
{ once: true },
94-
);
108+
)
95109
96-
initTheme();
110+
initTheme()
97111
</script>
98112
99113
<style src="./assets/style.css"></style>

dashboard/src/components/GitHubAppSelector.vue

Lines changed: 59 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,30 @@
22
<div v-if="$resources.options.loading" class="mt-2 flex justify-center">
33
<LoadingText />
44
</div>
5-
<div class="flex justify-center pt-2" v-else-if="!options?.authorized">
6-
<Button
7-
v-if="requiresReAuth"
8-
variant="solid"
9-
icon-left="github"
10-
label="Re-authorize GitHub"
11-
@click="$resources.clearAccessToken.submit()"
12-
:loading="$resources.clearAccessToken.loading"
13-
/>
14-
<Button
15-
v-if="needsAuthorization"
16-
variant="solid"
17-
icon-left="github"
18-
label="Connect To GitHub"
19-
:link="installationLink"
20-
/>
5+
<div class="pt-2" v-else-if="!options?.authorized">
6+
<div v-if="!!needsAuthorization" class="flex justify-center">
7+
<Button
8+
variant="solid"
9+
icon-left="github"
10+
label="Connect To GitHub"
11+
:link="installationLink"
12+
/>
13+
</div>
14+
<div v-else-if="!!requiresReAuth" class="flex justify-center">
15+
<Button
16+
variant="solid"
17+
icon-left="github"
18+
label="Re-authorize GitHub"
19+
@click="$resources.clearAccessToken.submit()"
20+
:loading="$resources.clearAccessToken.loading"
21+
/>
22+
</div>
23+
<div
24+
v-else-if="$resources.options.error?.messages?.[0]"
25+
class="flex flex-row justify-center"
26+
>
27+
<ErrorMessage :message="$resources.options.error?.messages?.[0]" />
28+
</div>
2129
</div>
2230
<div v-else class="space-y-4">
2331
<FormControl
@@ -117,7 +125,7 @@
117125
</template>
118126

119127
<script>
120-
import { Combobox, debounce } from 'frappe-ui';
128+
import { Combobox, debounce } from 'frappe-ui'
121129
122130
export default {
123131
components: {
@@ -130,31 +138,31 @@ export default {
130138
selectedBranch: null,
131139
selectedGithubUser: null,
132140
selectedGithubRepository: null,
133-
};
141+
}
134142
},
135143
watch: {
136144
selectedGithubUser() {
137-
this.selectedBranch = '';
138-
this.$emit('fieldChange');
145+
this.selectedBranch = ''
146+
this.$emit('fieldChange')
139147
},
140148
selectedGithubRepository(repo) {
141149
if (!repo) {
142-
this.selectedBranch = '';
143-
return;
150+
this.selectedBranch = ''
151+
return
144152
}
145-
this.$emit('fieldChange');
153+
this.$emit('fieldChange')
146154
this.$resources.branches.submit({
147155
owner: this.selectedGithubUser?.login,
148156
name: repo?.name,
149157
installation: this.selectedGithubUser?.id,
150-
});
158+
})
151159
152160
if (this.selectedGithubUserData) {
153161
let defaultBranch = this.selectedGithubUserData.repos.find(
154162
(r) => r.name === repo.name,
155-
).default_branch;
156-
this.selectedBranch = { label: defaultBranch, value: defaultBranch };
157-
} else this.selectedBranch = '';
163+
).default_branch
164+
this.selectedBranch = { label: defaultBranch, value: defaultBranch }
165+
} else this.selectedBranch = ''
158166
},
159167
selectedBranch(newSelectedBranch) {
160168
if (this.appOwner && this.appName && newSelectedBranch)
@@ -163,7 +171,7 @@ export default {
163171
repository: this.appName,
164172
branch: newSelectedBranch.value,
165173
selectedGithubUser: this.selectedGithubUserData,
166-
});
174+
})
167175
},
168176
},
169177
resources: {
@@ -173,82 +181,82 @@ export default {
173181
makeParams() {
174182
return {
175183
redirect_url: window.location.href,
176-
};
184+
}
177185
},
178186
auto: true,
179-
};
187+
}
180188
},
181189
branches() {
182190
return {
183191
url: 'press.api.github.branches',
184-
};
192+
}
185193
},
186194
clearAccessToken() {
187195
return {
188196
url: 'press.api.github.clear_token_and_get_installation_url',
189197
makeParams() {
190198
return {
191199
redirect_url: window.location.href,
192-
};
200+
}
193201
},
194202
onSuccess(installationData) {
195-
window.location.href = this.getInstallationLink(installationData);
203+
window.location.href = this.getInstallationLink(installationData)
196204
},
197-
};
205+
}
198206
},
199207
},
200208
methods: {
201209
getInstallationLink(installationData) {
202210
if (!installationData?.installation_url || !installationData?.state) {
203-
return null;
211+
return null
204212
}
205213
206-
return `${installationData.installation_url}?state=${installationData.state}`;
214+
return `${installationData.installation_url}?state=${installationData.state}`
207215
},
208216
},
209217
computed: {
210218
options() {
211-
return this.$resources.options.data;
219+
return this.$resources.options.data
212220
},
213221
installationLink() {
214-
return this.getInstallationLink(this.options);
222+
return this.getInstallationLink(this.options)
215223
},
216224
appOwner() {
217-
return this.selectedGithubUser?.login;
225+
return this.selectedGithubUser?.login
218226
},
219227
appName() {
220-
return this.selectedGithubRepository?.name;
228+
return this.selectedGithubRepository?.name
221229
},
222230
branchOptions() {
223231
return (this.$resources.branches.data || []).map((branch) => ({
224232
label: branch.name,
225233
value: branch.name,
226-
}));
234+
}))
227235
},
228236
selectedGithubUserData() {
229-
if (!this.selectedGithubUser) return null;
237+
if (!this.selectedGithubUser) return null
230238
return this.options.installations.find(
231239
(i) => i.id === Number(this.selectedGithubUser.id),
232-
);
240+
)
233241
},
234242
needsAuthorization() {
235-
if (this.$resources.options.loading) return false;
243+
if (this.$resources.options.loading) return false
236244
return (
237245
this.$resources.options.data &&
238246
(!this.$resources.options.data.authorized ||
239247
this.$resources.options.data.installations.length === 0)
240-
);
248+
)
241249
},
242250
requiresReAuth() {
243-
return this.$resources.options?.error?.messages.some((msg) =>
244-
msg.includes('Bad credentials'),
245-
);
251+
return this.$resources.options?.error?.messages?.some(
252+
(msg) => msg.includes && msg.includes('Bad credentials'),
253+
)
246254
},
247255
},
248256
created() {
249257
this.onChangeBranchDebounce = debounce((val) => {
250-
this.selectedBranch = { label: val, value: val };
251-
}, 500);
258+
this.selectedBranch = { label: val, value: val }
259+
}, 500)
252260
},
253-
};
261+
}
254262
</script>

0 commit comments

Comments
 (0)