-
Notifications
You must be signed in to change notification settings - Fork 439
refactor: rename isSubscribed for better expressiveness and avoid initializing cloud modules on local
#7127
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
Changes from 6 commits
9d88919
afaceb5
cd15c27
5fd6aa6
6fb677f
1ebdab9
8ce0c9e
b8f563d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| import { computed } from 'vue' | ||
|
|
||
| import { useCurrentUser } from '@/composables/auth/useCurrentUser' | ||
| import { useFirebaseAuthActions } from '@/composables/auth/useFirebaseAuthActions' | ||
| import { useSelectedLiteGraphItems } from '@/composables/canvas/useSelectedLiteGraphItems' | ||
|
|
@@ -46,6 +48,7 @@ import { useQueueSettingsStore, useQueueStore } from '@/stores/queueStore' | |
| import { useSubgraphNavigationStore } from '@/stores/subgraphNavigationStore' | ||
| import { useSubgraphStore } from '@/stores/subgraphStore' | ||
| import { useBottomPanelStore } from '@/stores/workspace/bottomPanelStore' | ||
| import { isCloud } from '@/platform/distribution/types' | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Import placement breaks alphabetical grouping. The -import { useBottomPanelStore } from '@/stores/workspace/bottomPanelStore'
-import { isCloud } from '@/platform/distribution/types'
-import { useColorPaletteStore } from '@/stores/workspace/colorPaletteStore'
+import { isCloud } from '@/platform/distribution/types'
+import { useBottomPanelStore } from '@/stores/workspace/bottomPanelStore'
+import { useColorPaletteStore } from '@/stores/workspace/colorPaletteStore'Note: Run
🤖 Prompt for AI Agents |
||
| import { useColorPaletteStore } from '@/stores/workspace/colorPaletteStore' | ||
| import { useRightSidePanelStore } from '@/stores/workspace/rightSidePanelStore' | ||
| import { useSearchBoxStore } from '@/stores/workspace/searchBoxStore' | ||
|
|
@@ -63,7 +66,8 @@ import { ManagerTab } from '@/workbench/extensions/manager/types/comfyManagerTyp | |
|
|
||
| import { useWorkflowTemplateSelectorDialog } from './useWorkflowTemplateSelectorDialog' | ||
|
|
||
| const { isActiveSubscription, showSubscriptionDialog } = useSubscription() | ||
| const defaultSubscriptionState = computed(() => true) | ||
| const noop = () => {} | ||
|
|
||
| const moveSelectedNodesVersionAdded = '1.22.2' | ||
|
|
||
|
|
@@ -85,6 +89,11 @@ export function useCoreCommands(): ComfyCommand[] { | |
| useSelectedLiteGraphItems() | ||
| const getTracker = () => workflowStore.activeWorkflow?.changeTracker | ||
|
|
||
| const subscription = isCloud ? useSubscription() : null | ||
| const subscriptionState = | ||
| subscription?.isSubscriptionRequirementMet ?? defaultSubscriptionState | ||
| const subscriptionDialog = subscription?.showSubscriptionDialog ?? noop | ||
|
|
||
| const moveSelectedNodes = ( | ||
| positionUpdater: (pos: Point, gridSize: number) => Point | ||
| ) => { | ||
|
|
@@ -475,8 +484,8 @@ export function useCoreCommands(): ComfyCommand[] { | |
| trigger_source?: ExecutionTriggerSource | ||
| }) => { | ||
| useTelemetry()?.trackRunButton(metadata) | ||
| if (!isActiveSubscription.value) { | ||
| showSubscriptionDialog() | ||
| if (!subscriptionState.value) { | ||
| subscriptionDialog() | ||
| return | ||
| } | ||
|
|
||
|
|
@@ -498,8 +507,8 @@ export function useCoreCommands(): ComfyCommand[] { | |
| trigger_source?: ExecutionTriggerSource | ||
| }) => { | ||
| useTelemetry()?.trackRunButton(metadata) | ||
| if (!isActiveSubscription.value) { | ||
| showSubscriptionDialog() | ||
| if (!subscriptionState.value) { | ||
| subscriptionDialog() | ||
| return | ||
| } | ||
|
|
||
|
|
@@ -520,8 +529,8 @@ export function useCoreCommands(): ComfyCommand[] { | |
| trigger_source?: ExecutionTriggerSource | ||
| }) => { | ||
| useTelemetry()?.trackRunButton(metadata) | ||
| if (!isActiveSubscription.value) { | ||
| showSubscriptionDialog() | ||
| if (!subscriptionState.value) { | ||
| subscriptionDialog() | ||
| return | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,7 +17,6 @@ import SettingDialogHeader from '@/components/dialog/header/SettingDialogHeader. | |
| import { t } from '@/i18n' | ||
| import { useTelemetry } from '@/platform/telemetry' | ||
| import { isCloud } from '@/platform/distribution/types' | ||
| import { useSubscription } from '@/platform/cloud/subscription/composables/useSubscription' | ||
| import SettingDialogContent from '@/platform/settings/components/SettingDialogContent.vue' | ||
| import type { ExecutionErrorWsMessage } from '@/schemas/apiSchema' | ||
| import { useDialogStore } from '@/stores/dialogStore' | ||
|
|
@@ -377,11 +376,16 @@ export const useDialogService = () => { | |
| }) | ||
| } | ||
|
|
||
| function showTopUpCreditsDialog(options?: { | ||
| async function showTopUpCreditsDialog(options?: { | ||
| isInsufficientCredits?: boolean | ||
| }) { | ||
| const { isActiveSubscription } = useSubscription() | ||
| if (!isActiveSubscription.value) return | ||
| if (isCloud) { | ||
| const { useSubscription } = await import( | ||
| '@/platform/cloud/subscription/composables/useSubscription' | ||
| ) | ||
| const { isSubscriptionRequirementMet } = useSubscription() | ||
| if (!isSubscriptionRequirementMet.value) return | ||
| } | ||
|
Comment on lines
+379
to
+388
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: rg -n "showTopUpCreditsDialog" srcRepository: Comfy-Org/ComfyUI_frontend Length of output: 999 🏁 Script executed: # Check app.ts context around lines 680, 686
sed -n '675,695n' src/scripts/app.ts
# Check CurrentUserPopover.vue context around line 151
sed -n '145,160n' src/components/topbar/CurrentUserPopover.vue
# Check CreditsPanel.vue context around line 176
sed -n '170,185n' src/components/dialog/content/setting/CreditsPanel.vueRepository: Comfy-Org/ComfyUI_frontend Length of output: 52 🏁 Script executed: # Check app.ts around lines 680, 686
cat -n src/scripts/app.ts | sed -n '675,695p'
# Check CurrentUserPopover.vue around line 151
cat -n src/components/topbar/CurrentUserPopover.vue | sed -n '145,160p'
# Check CreditsPanel.vue around line 176
cat -n src/components/dialog/content/setting/CreditsPanel.vue | sed -n '170,185p'Repository: Comfy-Org/ComfyUI_frontend Length of output: 1916 🏁 Script executed: # Read the full showTopUpCreditsDialog function from dialogService.ts
sed -n '379,430p' src/services/dialogService.ts | cat -nRepository: Comfy-Org/ComfyUI_frontend Length of output: 2060 🏁 Script executed: # Find dialogStore and its showDialog method
rg -n "showDialog" src/stores/dialogStore.ts -A 5 | head -40Repository: Comfy-Org/ComfyUI_frontend Length of output: 442 🏁 Script executed: # Check the full showDialog implementation
sed -n '212,245p' src/stores/dialogStore.ts | cat -nRepository: Comfy-Org/ComfyUI_frontend Length of output: 1404 Add The function is now |
||
|
|
||
| return dialogStore.showDialog({ | ||
| key: 'top-up-credits', | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.