Fix additional URLs (#752)
This commit is contained in:
		
							parent
							
								
									91c2c1ad62
								
							
						
					
					
						commit
						80bc4a3eb9
					
				| @ -267,9 +267,10 @@ export class ConfigDetails extends LiteElement { | ||||
|     const crawlConfig = this.crawlConfig!; | ||||
|     const seedsConfig = crawlConfig.config; | ||||
|     const additionalUrlList = seedsConfig.seeds.slice(1); | ||||
|     const primarySeedConfig: SeedConfig | Seed = seedsConfig; | ||||
|     const primarySeedUrl = seedsConfig.seeds[0].url; | ||||
|     const includeUrlList = primarySeedConfig.include || seedsConfig.include; | ||||
|     const primarySeedConfig: SeedConfig | Seed = seedsConfig.seeds[0]; | ||||
|     const primarySeedUrl = primarySeedConfig.url; | ||||
|     const includeUrlList = | ||||
|       primarySeedConfig.include || seedsConfig.include || []; | ||||
|     return html` | ||||
|       ${this.renderSetting(msg("Primary Seed URL"), primarySeedUrl, true)} | ||||
|       ${this.renderSetting( | ||||
| @ -303,7 +304,10 @@ export class ConfigDetails extends LiteElement { | ||||
|         additionalUrlList?.length | ||||
|           ? html` | ||||
|               <ul> | ||||
|                 ${additionalUrlList.map((url) => html`<li>${url}</li>`)} | ||||
|                 ${additionalUrlList.map( | ||||
|                   (seed) => | ||||
|                     html`<li>${typeof seed === "string" ? seed : seed.url}</li>` | ||||
|                 )} | ||||
|               </ul> | ||||
|             ` | ||||
|           : msg("None"), | ||||
|  | ||||
| @ -195,6 +195,8 @@ const urlListToArray = flow( | ||||
|   (str: string) => (str.length ? str.trim().split(/\s+/g) : []), | ||||
|   trimArray | ||||
| ); | ||||
| const mapSeedToUrl = (arr: Seed[]) => | ||||
|   arr.map((seed) => (typeof seed === "string" ? seed : seed.url)); | ||||
| const DEFAULT_BEHAVIORS = [ | ||||
|   "autoscroll", | ||||
|   "autoplay", | ||||
| @ -428,13 +430,11 @@ export class CrawlConfigEditor extends LiteElement { | ||||
|       } | ||||
|       const additionalSeeds = seeds.slice(1); | ||||
|       if (additionalSeeds.length) { | ||||
|         formState.urlList = additionalSeeds.join("\n"); | ||||
|         formState.urlList = mapSeedToUrl(additionalSeeds).join("\n"); | ||||
|       } | ||||
|     } else { | ||||
|       // Treat "custom" like URL list
 | ||||
|       formState.urlList = seeds | ||||
|         .map((seed) => (typeof seed === "string" ? seed : seed.url)) | ||||
|         .join("\n"); | ||||
|       formState.urlList = mapSeedToUrl(seeds).join("\n"); | ||||
| 
 | ||||
|       if (this.initialWorkflow.jobType === "custom") { | ||||
|         formState.scopeType = seedsConfig.scopeType || "page"; | ||||
|  | ||||
| @ -10,8 +10,8 @@ type ScopeType = | ||||
| export type Seed = { | ||||
|   url: string; | ||||
|   scopeType: ScopeType; | ||||
|   include?: string[]; | ||||
|   exclude?: string[]; | ||||
|   include?: string[] | null; | ||||
|   exclude?: string[] | null; | ||||
|   limit?: number | null; | ||||
|   extraHops?: number | null; | ||||
| }; | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user