aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/LoadingBox.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2024-05-14 23:15:24 -0400
committerbobzel <zzzman@gmail.com>2024-05-14 23:15:24 -0400
commit3534aaf88a3c30a474b3b5a5b7f04adfe6f15fac (patch)
tree47fb7a8671b209bd4d76e0f755a5b035c6936607 /src/client/views/nodes/LoadingBox.tsx
parent87bca251d87b5a95da06b2212400ce9427152193 (diff)
parent5cb7ad90e120123ca572e8ef5b1aa6ca41581134 (diff)
Merge branch 'restoringEslint' into sarah-ai-visualization
Diffstat (limited to 'src/client/views/nodes/LoadingBox.tsx')
-rw-r--r--src/client/views/nodes/LoadingBox.tsx27
1 files changed, 10 insertions, 17 deletions
diff --git a/src/client/views/nodes/LoadingBox.tsx b/src/client/views/nodes/LoadingBox.tsx
index adccc9db6..5f343bdfe 100644
--- a/src/client/views/nodes/LoadingBox.tsx
+++ b/src/client/views/nodes/LoadingBox.tsx
@@ -6,7 +6,8 @@ import { Doc } from '../../../fields/Doc';
import { Id } from '../../../fields/FieldSymbols';
import { StrCast } from '../../../fields/Types';
import { Networking } from '../../Network';
-import { DocumentManager } from '../../util/DocumentManager';
+import { DocumentType } from '../../documents/DocumentTypes';
+import { Docs } from '../../documents/Documents';
import { ViewBoxAnnotatableComponent } from '../DocComponent';
import { FieldView, FieldViewProps } from './FieldView';
import './LoadingBox.scss';
@@ -37,30 +38,18 @@ export class LoadingBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
public static LayoutString(fieldKey: string) {
return FieldView.LayoutString(LoadingBox, fieldKey);
}
- // removes from currently loading display
- public static removeCurrentlyLoading(doc: Doc) {
- if (DocumentManager.Instance.CurrentlyLoading) {
- const index = DocumentManager.Instance.CurrentlyLoading.indexOf(doc);
- runInAction(() => index !== -1 && DocumentManager.Instance.CurrentlyLoading.splice(index, 1));
- }
- }
-
- // adds doc to currently loading display
- public static addCurrentlyLoading(doc: Doc) {
- if (DocumentManager.Instance.CurrentlyLoading.indexOf(doc) === -1) {
- runInAction(() => DocumentManager.Instance.CurrentlyLoading.push(doc));
- }
- }
_timer: any;
@observable progress = '';
componentDidMount() {
- if (!DocumentManager.Instance.CurrentlyLoading?.includes(this.Document)) {
+ if (!Doc.CurrentlyLoading?.includes(this.Document)) {
this.Document.loadingError = 'Upload interrupted, please try again';
} else {
const updateFunc = async () => {
const result = await Networking.QueryYoutubeProgress(StrCast(this.Document[Id])); // We use the guid of the overwriteDoc to track file uploads.
- runInAction(() => (this.progress = result.progress));
+ runInAction(() => {
+ this.progress = result.progress;
+ });
!this.Document.loadingError && this._timer && (this._timer = setTimeout(updateFunc, 1000));
};
this._timer = setTimeout(updateFunc, 1000);
@@ -87,3 +76,7 @@ export class LoadingBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
);
}
}
+Docs.Prototypes.TemplateMap.set(DocumentType.LOADING, {
+ layout: { view: LoadingBox, dataField: '' },
+ options: { acl: '', _layout_fitWidth: true, _layout_nativeDimEditable: true },
+});