add a 'stopped_org_readonly' state for crawls that are running while org is made read-only (#1977)
an org is made read-only while crawls are running: - treat similar to other stopped_* states, do a graceful stop - update UI to display "Stopped: Crawling Disabled" for this status - don't add corresponding skipped status - just skip running crawls if org is read-only
This commit is contained in:
		
							parent
							
								
									96691a33fa
								
							
						
					
					
						commit
						e9aeff1836
					
				| @ -224,6 +224,7 @@ TYPE_SUCCESSFUL_STATES = Literal[ | |||||||
|     "stopped_by_user", |     "stopped_by_user", | ||||||
|     "stopped_storage_quota_reached", |     "stopped_storage_quota_reached", | ||||||
|     "stopped_time_quota_reached", |     "stopped_time_quota_reached", | ||||||
|  |     "stopped_org_readonly", | ||||||
| ] | ] | ||||||
| SUCCESSFUL_STATES = get_args(TYPE_SUCCESSFUL_STATES) | SUCCESSFUL_STATES = get_args(TYPE_SUCCESSFUL_STATES) | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1242,6 +1242,9 @@ class CrawlOperator(BaseOperator): | |||||||
|         # gracefully stop crawl if current running crawl sizes reach storage quota |         # gracefully stop crawl if current running crawl sizes reach storage quota | ||||||
|         org = await self.org_ops.get_org_by_id(crawl.oid) |         org = await self.org_ops.get_org_by_id(crawl.oid) | ||||||
| 
 | 
 | ||||||
|  |         if org.readOnly: | ||||||
|  |             return "stopped_org_readonly" | ||||||
|  | 
 | ||||||
|         if org.quotas.storageQuota: |         if org.quotas.storageQuota: | ||||||
|             running_crawls_total_size = status.size |             running_crawls_total_size = status.size | ||||||
|             for crawl_job in data.related[CJS].values(): |             for crawl_job in data.related[CJS].values(): | ||||||
| @ -1366,6 +1369,8 @@ class CrawlOperator(BaseOperator): | |||||||
|                 state = "stopped_storage_quota_reached" |                 state = "stopped_storage_quota_reached" | ||||||
|             elif status.stopReason == "stopped_time_quota_reached": |             elif status.stopReason == "stopped_time_quota_reached": | ||||||
|                 state = "stopped_time_quota_reached" |                 state = "stopped_time_quota_reached" | ||||||
|  |             elif status.stopReason == "stopped_org_readonly": | ||||||
|  |                 state = "stopped_org_readonly" | ||||||
|             else: |             else: | ||||||
|                 state = "complete" |                 state = "complete" | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -21,6 +21,7 @@ StopReason = Literal[ | |||||||
|     "size-limit", |     "size-limit", | ||||||
|     "stopped_storage_quota_reached", |     "stopped_storage_quota_reached", | ||||||
|     "stopped_time_quota_reached", |     "stopped_time_quota_reached", | ||||||
|  |     "stopped_org_readonly", | ||||||
| ] | ] | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -228,6 +228,16 @@ export class CrawlStatus extends TailwindElement { | |||||||
|         label = msg("Stopped: Time Quota Reached"); |         label = msg("Stopped: Time Quota Reached"); | ||||||
|         break; |         break; | ||||||
| 
 | 
 | ||||||
|  |       case "stopped_org_readonly": | ||||||
|  |         color = "var(--warning)"; | ||||||
|  |         icon = html`<sl-icon
 | ||||||
|  |           name="exclamation-square-fill" | ||||||
|  |           slot="prefix" | ||||||
|  |           style="color: ${color}" | ||||||
|  |         ></sl-icon>`; | ||||||
|  |         label = msg("Stopped: Crawling Disabled"); | ||||||
|  |         break; | ||||||
|  | 
 | ||||||
|       case "canceled": |       case "canceled": | ||||||
|         color = "var(--sl-color-orange-600)"; |         color = "var(--sl-color-orange-600)"; | ||||||
|         icon = html`<sl-icon
 |         icon = html`<sl-icon
 | ||||||
|  | |||||||
| @ -139,7 +139,8 @@ export type CrawlState = | |||||||
|   | "canceled" |   | "canceled" | ||||||
|   | "stopped_by_user" |   | "stopped_by_user" | ||||||
|   | "stopped_storage_quota_reached" |   | "stopped_storage_quota_reached" | ||||||
|   | "stopped_time_quota_reached"; |   | "stopped_time_quota_reached" | ||||||
|  |   | "stopped_org_readonly"; | ||||||
| 
 | 
 | ||||||
| // TODO maybe convert this to an enum?
 | // TODO maybe convert this to an enum?
 | ||||||
| export enum ReviewStatus { | export enum ReviewStatus { | ||||||
|  | |||||||
| @ -21,6 +21,7 @@ export const finishedCrawlStates: CrawlState[] = [ | |||||||
|   "stopped_by_user", |   "stopped_by_user", | ||||||
|   "stopped_storage_quota_reached", |   "stopped_storage_quota_reached", | ||||||
|   "stopped_time_quota_reached", |   "stopped_time_quota_reached", | ||||||
|  |   "stopped_org_readonly", | ||||||
| ]; | ]; | ||||||
| 
 | 
 | ||||||
| export const inactiveCrawlStates: CrawlState[] = [ | export const inactiveCrawlStates: CrawlState[] = [ | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user