Skip to content

Commit

Permalink
Add issue report dialog service (#2284)
Browse files Browse the repository at this point in the history
Co-authored-by: huchenlei <[email protected]>
  • Loading branch information
christian-byrne and huchenlei authored Jan 20, 2025
1 parent a1ed67f commit 654d72b
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 44 deletions.
27 changes: 0 additions & 27 deletions src/components/dialog/content/FeedbackDialogContent.vue

This file was deleted.

32 changes: 32 additions & 0 deletions src/components/dialog/content/IssueReportDialogContent.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<template>
<div class="p-2 h-full" aria-labelledby="issue-report-title">
<Panel
:pt="{
root: 'border-none',
content: 'p-0'
}"
>
<template #header>
<header class="flex flex-col items-center">
<h2 id="issue-report-title" class="text-4xl">{{ title }}</h2>
<span v-if="subtitle" class="text-muted mt-2">{{ subtitle }}</span>
</header>
</template>
<ReportIssuePanel v-bind="panelProps" :pt="{ root: 'border-none' }" />
</Panel>
</div>
</template>

<script setup lang="ts">
import Panel from 'primevue/panel'
import type { IssueReportPanelProps } from '@/types/issueReportTypes'
import ReportIssuePanel from './error/ReportIssuePanel.vue'
defineProps<{
title: string
subtitle?: string
panelProps: IssueReportPanelProps
}>()
</script>
14 changes: 6 additions & 8 deletions src/components/dialog/content/error/ReportIssuePanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,17 @@ import { useI18n } from 'vue-i18n'
import CheckboxGroup from '@/components/common/CheckboxGroup.vue'
import { api } from '@/scripts/api'
import { app } from '@/scripts/app'
import type { DefaultField, ReportField } from '@/types/issueReportTypes'
import type {
DefaultField,
IssueReportPanelProps
} from '@/types/issueReportTypes'
const ISSUE_NAME = 'User reported issue'
const DETAILS_MAX_LEN = 5_000
const CONTACT_MAX_LEN = 320
const props = defineProps<{
errorType: string
defaultFields?: DefaultField[]
extraFields?: ReportField[]
tags?: Record<string, string>
title?: string
}>()
const props = defineProps<IssueReportPanelProps>()
const {
defaultFields = ['Workflow', 'Logs', 'SystemStats', 'Settings'],
tags = {}
Expand Down
14 changes: 11 additions & 3 deletions src/hooks/coreCommandHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
DEFAULT_DARK_COLOR_PALETTE,
DEFAULT_LIGHT_COLOR_PALETTE
} from '@/constants/coreColorPalettes'
import { t } from '@/i18n'
import { api } from '@/scripts/api'
import { app } from '@/scripts/app'
import { useDialogService } from '@/services/dialogService'
Expand Down Expand Up @@ -543,9 +544,16 @@ export function useCoreCommands(): ComfyCommand[] {
id: 'Comfy.Feedback',
icon: 'pi pi-megaphone',
label: 'Give Feedback',
versionAdded: '1.7.15',
function: () => {
dialogService.showFeedbackDialog()
versionAdded: '1.8.2',
function: () => {
dialogService.showIssueReportDialog({
title: t('g.feedback'),
panelProps: {
errorType: 'Feedback',
title: t('issueReport.feedbackTitle'),
defaultFields: ['SystemStats', 'Settings']
}
})
}
}
]
Expand Down
12 changes: 6 additions & 6 deletions src/services/dialogService.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import ConfirmationDialogContent from '@/components/dialog/content/ConfirmationDialogContent.vue'
import ExecutionErrorDialogContent from '@/components/dialog/content/ExecutionErrorDialogContent.vue'
import FeedbackDialogContent from '@/components/dialog/content/FeedbackDialogContent.vue'
import IssueReportDialogContent from '@/components/dialog/content/IssueReportDialogContent.vue'
import LoadWorkflowWarning from '@/components/dialog/content/LoadWorkflowWarning.vue'
import MissingModelsWarning from '@/components/dialog/content/MissingModelsWarning.vue'
import PromptDialogContent from '@/components/dialog/content/PromptDialogContent.vue'
Expand Down Expand Up @@ -84,12 +84,12 @@ export const useDialogService = () => {
})
}

function showFeedbackDialog(
props: InstanceType<typeof FeedbackDialogContent>['$props'] = {}
function showIssueReportDialog(
props: InstanceType<typeof IssueReportDialogContent>['$props']
) {
dialogStore.showDialog({
key: 'global-provide-feedback',
component: FeedbackDialogContent,
key: 'global-issue-report',
component: IssueReportDialogContent,
props
})
}
Expand Down Expand Up @@ -171,7 +171,7 @@ export const useDialogService = () => {
showAboutDialog,
showExecutionErrorDialog,
showTemplateWorkflowsDialog,
showFeedbackDialog,
showIssueReportDialog,
prompt,
confirm
}
Expand Down
27 changes: 27 additions & 0 deletions src/types/issueReportTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,30 @@ export interface ReportField {
*/
optIn: boolean
}

export interface IssueReportPanelProps {
/**
* The type of error being reported. This is used to categorize the error.
*/
errorType: string

/**
* Which of the default fields to include in the report.
*/
defaultFields?: DefaultField[]

/**
* Additional fields to include in the report.
*/
extraFields?: ReportField[]

/**
* Tags that will be added to the report. Tags are used to further categorize the error.
*/
tags?: Record<string, string>

/**
* The title displayed in the dialog.
*/
title?: string
}

0 comments on commit 654d72b

Please sign in to comment.