Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

refactor(web): convert file-local Step enum to as-const in website crawlers 🤖🤖🤖 (#34565)

Jean Ibarz26e50bb084c3
diff --git a/eslint-suppressions.json b/eslint-suppressions.json
index 29fcf2634e3..32de602651b 100644
--- a/eslint-suppressions.json
+++ b/eslint-suppressions.json
@@ -2449,9 +2449,6 @@
}
},
"web/app/components/datasets/create/website/firecrawl/index.tsx": {
- "erasable-syntax-only/enums": {
- "count": 1
- },
"no-console": {
"count": 1
},
@@ -2468,9 +2465,6 @@
}
},
"web/app/components/datasets/create/website/jina-reader/index.tsx": {
- "erasable-syntax-only/enums": {
- "count": 1
- },
"no-console": {
"count": 1
},
@@ -2487,9 +2481,6 @@
}
},
"web/app/components/datasets/create/website/watercrawl/index.tsx": {
- "erasable-syntax-only/enums": {
- "count": 1
- },
"no-console": {
"count": 1
},
diff --git a/web/app/components/datasets/create/website/firecrawl/index.tsx b/web/app/components/datasets/create/website/firecrawl/index.tsx
index 33aa43b4028..4f6077d6cc1 100644
--- a/web/app/components/datasets/create/website/firecrawl/index.tsx
+++ b/web/app/components/datasets/create/website/firecrawl/index.tsx
@@ -27,11 +27,12 @@ type Props = {
crawlOptions: CrawlOptions
onCrawlOptionsChange: (payload: CrawlOptions) => void
}
-enum Step {
- init = 'init',
- running = 'running',
- finished = 'finished',
-}
+const Step = {
+ init: 'init',
+ running: 'running',
+ finished: 'finished',
+} as const
+type Step = typeof Step[keyof typeof Step]
type CrawlState = {
current: number
total: number
diff --git a/web/app/components/datasets/create/website/jina-reader/index.tsx b/web/app/components/datasets/create/website/jina-reader/index.tsx
index 0beee86103a..3dc3505bb44 100644
--- a/web/app/components/datasets/create/website/jina-reader/index.tsx
+++ b/web/app/components/datasets/create/website/jina-reader/index.tsx
@@ -27,11 +27,12 @@ type Props = {
crawlOptions: CrawlOptions
onCrawlOptionsChange: (payload: CrawlOptions) => void
}
-enum Step {
- init = 'init',
- running = 'running',
- finished = 'finished',
-}
+const Step = {
+ init: 'init',
+ running: 'running',
+ finished: 'finished',
+} as const
+type Step = typeof Step[keyof typeof Step]
const JinaReader: FC<Props> = ({ onPreview, checkedCrawlResult, onCheckedCrawlResultChange, onJobIdChange, crawlOptions, onCrawlOptionsChange }) => {
const { t } = useTranslation()
const [step, setStep] = useState<Step>(Step.init)
diff --git a/web/app/components/datasets/create/website/watercrawl/index.tsx b/web/app/components/datasets/create/website/watercrawl/index.tsx
index d8e3c6c0679..62285479660 100644
--- a/web/app/components/datasets/create/website/watercrawl/index.tsx
+++ b/web/app/components/datasets/create/website/watercrawl/index.tsx
@@ -27,11 +27,12 @@ type Props = {
crawlOptions: CrawlOptions
onCrawlOptionsChange: (payload: CrawlOptions) => void
}
-enum Step {
- init = 'init',
- running = 'running',
- finished = 'finished',
-}
+const Step = {
+ init: 'init',
+ running: 'running',
+ finished: 'finished',
+} as const
+type Step = typeof Step[keyof typeof Step]
const WaterCrawl: FC<Props> = ({ onPreview, checkedCrawlResult, onCheckedCrawlResultChange, onJobIdChange, crawlOptions, onCrawlOptionsChange }) => {
const { t } = useTranslation()
const [step, setStep] = useState<Step>(Step.init)