Skip to content

Commit

Permalink
Merge branch 'main' of github.com:specklesystems/speckle-server into …
Browse files Browse the repository at this point in the history
…gergo/web-2158-previews-module-multi-region
  • Loading branch information
gjedlicska committed Nov 19, 2024
2 parents d55296a + 4e7a002 commit 0e78c27
Show file tree
Hide file tree
Showing 57 changed files with 2,642 additions and 837 deletions.
8 changes: 5 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -595,13 +595,13 @@ jobs:
POSTGRES_DB: speckle2_test
POSTGRES_PASSWORD: speckle
POSTGRES_USER: speckle
command: -c 'max_connections=1000'
command: -c 'max_connections=1000' -c 'wal_level=logical'
- image: 'speckle/speckle-postgres'
environment:
POSTGRES_DB: speckle2_test
POSTGRES_PASSWORD: speckle
POSTGRES_USER: speckle
command: -c 'max_connections=1000' -c 'port=5433'
command: -c 'max_connections=1000' -c 'port=5433' -c 'wal_level=logical'
- image: 'minio/minio'
command: server /data --console-address ":9001"
environment:
Expand All @@ -623,8 +623,10 @@ jobs:
S3_REGION: '' # optional, defaults to 'us-east-1'
AUTOMATE_ENCRYPTION_KEYS_PATH: 'test/assets/automate/encryptionKeys.json'
FF_BILLING_INTEGRATION_ENABLED: 'true'
# These are the only 2 different env keys:
# These are the only different env keys:
MULTI_REGION_CONFIG_PATH: '../../.circleci/multiregion.test-ci.json'
FF_WORKSPACES_MODULE_ENABLED: 'true'
FF_WORKSPACES_MULTI_REGION_ENABLED: 'true'
RUN_TESTS_IN_MULTIREGION_MODE: true

test-frontend-2:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
class="pt-4 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between"
>
<Portal to="navigation">
<HeaderNavLink :to="automationFunctionsRoute" :name="'Automate functions'" />
<HeaderNavLink
:separator="false"
:to="automationFunctionsRoute"
:name="'Automate functions'"
/>
</Portal>

<h1 class="text-heading-xl">Automate functions</h1>
Expand Down
106 changes: 106 additions & 0 deletions packages/frontend-2/components/billing/Alert.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<template>
<div>
<CommonCard v-if="!hasValidPlan" class="bg-foundation py-3 px-4">
<div class="flex gap-x-2">
<ExclamationCircleIcon v-if="showIcon" class="h-4 w-4 text-danger mt-1" />
<div class="flex-1 flex gap-x-4 items-center">
<div class="flex-1">
<h5 class="text-body-xs font-medium text-foreground">{{ title }}</h5>
<p class="text-body-xs text-foreground-2">{{ description }}</p>
</div>
<slot name="actions" />
<FormButton
v-if="isPaymentFailed"
:icon-right="ArrowTopRightOnSquareIcon"
@click="billingPortalRedirect(workspace.id)"
>
Update payment information
</FormButton>
</div>
</div>
</CommonCard>
</div>
</template>

<script setup lang="ts">
import {
ExclamationCircleIcon,
ArrowTopRightOnSquareIcon
} from '@heroicons/vue/24/outline'
import { graphql } from '~/lib/common/generated/gql'
import {
type BillingAlert_WorkspaceFragment,
WorkspacePlanStatuses,
WorkspacePlans
} from '~/lib/common/generated/gql/graphql'
import { useBillingActions } from '~/lib/billing/composables/actions'
graphql(`
fragment BillingAlert_Workspace on Workspace {
id
plan {
name
status
}
subscription {
billingInterval
currentBillingCycleEnd
}
}
`)
const props = defineProps<{
workspace: BillingAlert_WorkspaceFragment
}>()
const { billingPortalRedirect } = useBillingActions()
const planStatus = computed(() => props.workspace.plan?.status)
// If there is no plan status, we assume it's a trial
const isTrial = computed(
() => !planStatus.value || planStatus.value === WorkspacePlanStatuses.Trial
)
const isPaymentFailed = computed(
() => planStatus.value === WorkspacePlanStatuses.PaymentFailed
)
const title = computed(() => {
if (isTrial.value) {
return `You are currently on a free ${
props.workspace.plan?.name ?? WorkspacePlans.Team
} plan trial`
}
switch (planStatus.value) {
case WorkspacePlanStatuses.CancelationScheduled:
return `Your ${props.workspace.plan?.name} plan subscription is scheduled for cancelation`
case WorkspacePlanStatuses.Canceled:
return `Your ${props.workspace.plan?.name} plan subscription has been canceled`
case WorkspacePlanStatuses.Expired:
return `Your free ${props.workspace.plan?.name} plan trial has ended`
case WorkspacePlanStatuses.PaymentFailed:
return "Your last payment didn't go through"
default:
return ''
}
})
const description = computed(() => {
if (isTrial.value) {
return 'Upgrade to a paid plan to start your subscription.'
}
switch (planStatus.value) {
case WorkspacePlanStatuses.CancelationScheduled:
return 'Your workspace subscription is scheduled for cancelation. After the cancelation, your workspace will be in read-only mode.'
case WorkspacePlanStatuses.Canceled:
return 'Your workspace has been canceled and is in read-only mode. Upgrade your plan to continue.'
case WorkspacePlanStatuses.Expired:
return "The workspace is in a read-only locked state until there's an active subscription. Upgrade your plan to continue."
case WorkspacePlanStatuses.PaymentFailed:
return "Update your payment information now to ensure your workspace doesn't go into maintenance mode."
default:
return ''
}
})
const showIcon = computed(() => {
return !!planStatus.value && planStatus.value !== WorkspacePlanStatuses.Trial
})
const hasValidPlan = computed(() => planStatus.value === WorkspacePlanStatuses.Valid)
</script>
59 changes: 0 additions & 59 deletions packages/frontend-2/components/billing/Summary.vue

This file was deleted.

12 changes: 11 additions & 1 deletion packages/frontend-2/components/dashboard/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@
<LayoutSidebarMenuGroupItem
:label="item.label"
:active="isActive(item.to)"
:tag="
item.plan?.status === WorkspacePlanStatuses.Trial ||
!item.plan?.status
? 'Trial'
: undefined
"
class="!pl-1"
>
<template #icon>
Expand Down Expand Up @@ -187,6 +193,7 @@ import { useActiveUser } from '~~/lib/auth/composables/activeUser'
import { HomeIcon } from '@heroicons/vue/24/outline'
import { useMixpanel } from '~~/lib/core/composables/mp'
import { Roles } from '@speckle/shared'
import { WorkspacePlanStatuses } from '~/lib/common/generated/gql/graphql'
const { isLoggedIn } = useActiveUser()
const isWorkspacesEnabled = useIsWorkspacesEnabled()
Expand Down Expand Up @@ -222,7 +229,10 @@ const workspacesItems = computed(() =>
id: workspace.id,
to: workspaceRoute(workspace.slug),
logo: workspace.logo,
defaultLogoIndex: workspace.defaultLogoIndex
defaultLogoIndex: workspace.defaultLogoIndex,
plan: {
status: workspace.plan?.status
}
}))
: []
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<template>
<ProjectEmptyState
:small="small"
title="No discussions, yet."
:text="small ? undefined : 'Open a model and start the collaboration today!'"
>
<ProjectEmptyState :small="small" title="No discussions, yet." :text="text">
<template #cta>
<div v-if="showButton" class="mt-3">
<FormButton :icon-left="PlusIcon" @click="() => $emit('new-discussion')">
Expand All @@ -23,5 +19,6 @@ defineEmits<{
defineProps<{
small?: boolean
showButton?: boolean
text?: string
}>()
</script>
10 changes: 10 additions & 0 deletions packages/frontend-2/components/settings/Dialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@
:title="workspaceItem.name"
collapsible
class="workspace-item"
:tag="
workspaceItem.plan?.status === WorkspacePlanStatuses.Trial ||
!workspaceItem.plan?.status
? 'Trial'
: undefined
"
:collapsed="targetWorkspaceId !== workspaceItem.id"
>
<template #title-icon>
Expand Down Expand Up @@ -139,6 +145,7 @@ import { graphql } from '~~/lib/common/generated/gql'
import type { WorkspaceRoles } from '@speckle/shared'
import { useMixpanel } from '~~/lib/core/composables/mp'
import { workspacesRoute } from '~/lib/common/helpers/route'
import { WorkspacePlanStatuses } from '~/lib/common/generated/gql/graphql'
graphql(`
fragment SettingsDialog_Workspace on Workspace {
Expand All @@ -147,6 +154,9 @@ graphql(`
slug
role
name
plan {
status
}
}
`)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
{ id: 'actions', header: '', classes: 'col-span-1 flex justify-end' }
]"
:items="tokens"
:loading="loading"
>
<template #name="{ item }">
{{ item.name }}
Expand Down Expand Up @@ -107,9 +108,11 @@ const emit = defineEmits<{
(e: 'delete', item: TokenItem): void
}>()
const { result: tokensResult, refetch: refetchTokens } = useQuery(
developerSettingsAccessTokensQuery
)
const {
result: tokensResult,
refetch: refetchTokens,
loading
} = useQuery(developerSettingsAccessTokensQuery)
const tokenSuccess = ref('')
const showCreateTokenDialog = ref(false)
Expand Down
Loading

0 comments on commit 0e78c27

Please sign in to comment.