diff --git a/web/libs/datamanager/src/sdk/lsf-sdk.js b/web/libs/datamanager/src/sdk/lsf-sdk.js index 8e4a5ebbe51c..f9a12aca665d 100644 --- a/web/libs/datamanager/src/sdk/lsf-sdk.js +++ b/web/libs/datamanager/src/sdk/lsf-sdk.js @@ -8,7 +8,10 @@ import { FF_FIT_1304_STRICT_OVERLAP, isFF, } from "../utils/feature-flags"; -import { isActive, FF_FIT_720_LAZY_LOAD_ANNOTATIONS } from "@humansignal/core/lib/utils/feature-flags"; +import { + isActive, + FF_FIT_720_LAZY_LOAD_ANNOTATIONS, +} from "@humansignal/core/lib/utils/feature-flags"; import { isDefined } from "../utils/utils"; import { Modal } from "../components/Common/Modal/Modal"; import { CommentsSdk } from "./comments-sdk"; @@ -17,7 +20,10 @@ import { annotationToServer, taskToLSFormat } from "./lsf-utils"; import { when, runInAction } from "mobx"; import { isAlive } from "mobx-state-tree"; import { imageCache } from "@humansignal/core"; -import { invalidateAnnotationCache, invalidateDistributionCache } from "@humansignal/core/lib/utils/annotation-cache"; +import { + invalidateAnnotationCache, + invalidateDistributionCache, +} from "@humansignal/core/lib/utils/annotation-cache"; const waitForPaint = () => new Promise((resolve) => { @@ -73,7 +79,8 @@ const errorHandlerAllowSpecialErrors = (result) => { // Support portal URL constants used to construct error reporting links // These are used in showOperationToast() to create support links with request IDs // for better error tracking and customer support -export const SUPPORT_URL = "https://support.humansignal.com/hc/en-us/requests/new"; +export const SUPPORT_URL = + "https://support.humansignal.com/hc/en-us/requests/new"; export const SUPPORT_URL_REQUEST_ID_PARAM = "tf_37934448633869"; // request_id field ID in ZD // Toast ID for overlap reached message - used to dismiss this specific toast @@ -144,9 +151,18 @@ export class LSFWrapper { this.handleOverlapNextTask = () => this.loadTask(); this.handleOverlapCloseTask = () => this.closeTask(); this.handleOverlapExitStream = () => this.exitStream(); - window.addEventListener("overlap-error-next-task", this.handleOverlapNextTask); - window.addEventListener("overlap-error-close-task", this.handleOverlapCloseTask); - window.addEventListener("overlap-error-exit-stream", this.handleOverlapExitStream); + window.addEventListener( + "overlap-error-next-task", + this.handleOverlapNextTask, + ); + window.addEventListener( + "overlap-error-close-task", + this.handleOverlapCloseTask, + ); + window.addEventListener( + "overlap-error-exit-stream", + this.handleOverlapExitStream, + ); } let interfaces = [...DEFAULT_INTERFACES]; @@ -155,14 +171,21 @@ export class LSFWrapper { interfaces.push("annotations:deny-empty"); } - if (window.APP_SETTINGS.annotator_reviewer_firewall_enabled && this.labelStream) { + if ( + window.APP_SETTINGS.annotator_reviewer_firewall_enabled && + this.labelStream + ) { interfaces.push("annotations:hide-info"); } if (this.labelStream) { - interfaces.push("infobar"); - if (!window.APP_SETTINGS.label_stream_navigation_disabled) interfaces.push("topbar:prevnext"); - if (FF_DEV_2186 && this.project.review_settings?.require_comment_on_reject) { + interfaces.push("infobar", "predictions:tabs"); + if (!window.APP_SETTINGS.label_stream_navigation_disabled) + interfaces.push("topbar:prevnext"); + if ( + FF_DEV_2186 && + this.project.review_settings?.require_comment_on_reject + ) { interfaces.push("comments:update"); } if (this.project.show_skip_button) { @@ -174,11 +197,10 @@ export class LSFWrapper { "annotations:add-new", "annotations:view-all", "annotations:delete", - "annotations:tabs", - "predictions:tabs", "annotations:copy-link", ); } + interfaces.push("annotations:tabs", "predictions:tabs"); if (this.datamanager.hasInterface("instruction")) { interfaces.push("instruction"); @@ -211,11 +233,17 @@ export class LSFWrapper { }); } - const queueTotal = dm.store.project.reviewer_queue_total || dm.store.project.queue_total; + const queueTotal = + dm.store.project.reviewer_queue_total || dm.store.project.queue_total; const queueDone = dm.store.project.queue_done; const queueLeft = dm.store.project.queue_left; - const queuePosition = queueDone ? queueDone + 1 : queueLeft ? queueTotal - queueLeft + 1 : 1; - const commentClassificationConfig = dm.store.project.comment_classification_config; + const queuePosition = queueDone + ? queueDone + 1 + : queueLeft + ? queueTotal - queueLeft + 1 + : 1; + const commentClassificationConfig = + dm.store.project.comment_classification_config; const lsfProperties = { user: options.user, @@ -265,7 +293,9 @@ export class LSFWrapper { this.lsfInstance.on("presignUrlForProject", this.onPresignUrlForProject); - const names = Array.from(this.datamanager.callbacks.keys()).filter((k) => k.startsWith("lsf:")); + const names = Array.from(this.datamanager.callbacks.keys()).filter((k) => + k.startsWith("lsf:"), + ); names.forEach((name) => { this.datamanager.getEventCallbacks(name).forEach((clb) => { @@ -296,7 +326,8 @@ export class LSFWrapper { if (params) { const task = await api.call("task", { params }); - const noData = !task || (!task.annotations?.length && !task.drafts?.length); + const noData = + !task || (!task.annotations?.length && !task.drafts?.length); const body = `Task #${taskID}${commentId ? ` with comment #${commentId}` : ""} was not found!`; if (noData) { @@ -458,7 +489,11 @@ export class LSFWrapper { this.lsf.initializeStore(lsfTask); - await this.setAnnotation(annotationID, fromHistory || isRejectedQueue, selectPrediction); + await this.setAnnotation( + annotationID, + fromHistory || isRejectedQueue, + selectPrediction, + ); this.setLoading(false); if (isFF(FF_FIT_1304_STRICT_OVERLAP) && this.overlapReached) { @@ -481,7 +516,9 @@ export class LSFWrapper { {this.overlapReachedMessage}