-
-
Notifications
You must be signed in to change notification settings - Fork 129
feat(builder): dedicated native builder request, worker UI, and pool routing #2740
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
riderx
wants to merge
7
commits into
main
Choose a base branch
from
cursor/dedicated-native-builder-72be
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,974
−43
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9cda4ee
feat(builder): add dedicated native builder request and worker UI
cursoragent 0d58455
fix(builder): address Sonar findings on dedicated builder
cursoragent 963dc70
fix(builder): harden dedicated builder auth and migration constraints
cursoragent 64b9267
fix(builder): address Cubic review on dedicated builder UI
cursoragent 1f1f054
fix(builder): add aria-label to build error details button
cursoragent 5ab7582
fix(builder): harden dedicated builder permission reload and SQL style
cursoragent 96693f0
fix(builder): satisfy quote-props lint on build error button
cursoragent File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| <script setup lang="ts"> | ||
| import type { DedicatedBuilder } from '~/services/dedicatedBuilder' | ||
| import { computed, ref, watch } from 'vue' | ||
| import { useI18n } from 'vue-i18n' | ||
| import { useRouter } from 'vue-router' | ||
| import IconServer from '~icons/heroicons/server-stack' | ||
| import { DedicatedBuilderApiError, fetchDedicatedBuilder } from '~/services/dedicatedBuilder' | ||
| import { useOrganizationStore } from '~/stores/organization' | ||
|
|
||
| const props = defineProps<{ | ||
| appId: string | ||
| /** When true, show even if the org already has a pending/active dedicated builder. */ | ||
| force?: boolean | ||
| }>() | ||
|
|
||
| const { t } = useI18n() | ||
| const router = useRouter() | ||
| const organizationStore = useOrganizationStore() | ||
|
|
||
| const dedicatedBuilder = ref<DedicatedBuilder | null>(null) | ||
| const loaded = ref(false) | ||
| const loadFailed = ref(false) | ||
| let reqToken = 0 | ||
|
|
||
| const visible = computed(() => { | ||
| if (!loaded.value || loadFailed.value) | ||
| return false | ||
| if (props.force) | ||
| return true | ||
| // Teaser when they don't have a dedicated builder yet, or it's cancelled. | ||
| return !dedicatedBuilder.value || dedicatedBuilder.value.status === 'cancelled' | ||
| }) | ||
|
|
||
| const ctaLabel = computed(() => { | ||
| if (dedicatedBuilder.value?.status === 'active') | ||
| return t('dedicated-builder-banner-view') | ||
| if (dedicatedBuilder.value?.status === 'requested' || dedicatedBuilder.value?.status === 'provisioning') | ||
| return t('dedicated-builder-banner-view-status') | ||
| return t('dedicated-builder-banner-cta') | ||
| }) | ||
|
|
||
| async function load() { | ||
| const token = ++reqToken | ||
| loaded.value = false | ||
| loadFailed.value = false | ||
| await organizationStore.awaitInitialLoad() | ||
| // App URLs can belong to an org other than the currently selected one. | ||
| const orgId = organizationStore.getOrgByAppId(props.appId)?.gid | ||
| if (!orgId) { | ||
| if (token !== reqToken) | ||
| return | ||
| dedicatedBuilder.value = null | ||
| loadFailed.value = true | ||
| loaded.value = true | ||
| return | ||
| } | ||
| try { | ||
| const row = await fetchDedicatedBuilder(orgId) | ||
| if (token !== reqToken) | ||
| return | ||
| dedicatedBuilder.value = row | ||
| } | ||
| catch (error) { | ||
| if (token !== reqToken) | ||
| return | ||
| // Auth/billing failures and transient API errors must not look like "no builder". | ||
| dedicatedBuilder.value = null | ||
| loadFailed.value = true | ||
| if (!(error instanceof DedicatedBuilderApiError && error.status === 403)) | ||
| console.error('[DedicatedBuilderBanner] failed to load dedicated builder', error) | ||
| } | ||
| finally { | ||
| if (token === reqToken) | ||
| loaded.value = true | ||
| } | ||
| } | ||
|
|
||
| watch( | ||
| () => [props.appId, organizationStore.currentOrganization?.gid] as const, | ||
| () => { | ||
| load() | ||
| }, | ||
| { immediate: true }, | ||
| ) | ||
|
|
||
| function goToDedicatedBuilder() { | ||
| router.push('/settings/organization/dedicated-builder') | ||
| } | ||
| </script> | ||
|
|
||
| <template> | ||
| <div | ||
| v-if="visible" | ||
| class="flex flex-col gap-3 p-4 mb-6 border rounded-xl sm:flex-row sm:items-center sm:justify-between border-azure-200 dark:border-azure-900/50 bg-gradient-to-r from-sky-50 to-slate-50 dark:from-slate-900 dark:to-slate-800" | ||
| > | ||
| <div class="flex items-start gap-3"> | ||
| <div class="flex items-center justify-center w-9 h-9 rounded-lg bg-azure-500/10 text-azure-600 dark:text-azure-400 shrink-0"> | ||
| <IconServer class="w-5 h-5" /> | ||
| </div> | ||
| <div> | ||
| <p class="text-sm font-semibold text-slate-900 dark:text-white"> | ||
| {{ t('dedicated-builder-banner-title') }} | ||
| </p> | ||
| <p class="mt-0.5 text-sm text-slate-600 dark:text-slate-300"> | ||
| {{ t('dedicated-builder-banner-desc') }} | ||
| </p> | ||
| </div> | ||
| </div> | ||
| <button | ||
| type="button" | ||
| class="d-btn d-btn-sm d-btn-primary shrink-0" | ||
| @click="goToDedicatedBuilder" | ||
| > | ||
| {{ ctaLabel }} | ||
| </button> | ||
| </div> | ||
| </template> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.