Skip to content

Commit b7b84f7

Browse files
committed
Move BlobUrl type into util/types
This not only reduces the number of places where defintions code is depending on stores code, but it also makes it easier to migrate this code to TypeScript as the defintions will need to be migrated before the stores.
1 parent 31129e1 commit b7b84f7

File tree

10 files changed

+14
-11
lines changed

10 files changed

+14
-11
lines changed

src/main/webapp/ui/src/Inventory/components/DetailedListing/Card.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import UserDetails from "../UserDetails";
3737
import ContainerModel from "../../../stores/models/ContainerModel";
3838
import SampleModel from "../../../stores/models/SampleModel";
3939
import SubSampleModel from "../../../stores/models/SubSampleModel";
40-
import { type BlobUrl } from "../../../stores/stores/ImageStore";
40+
import { type BlobUrl } from "../../../util/types";
4141

4242
const CustomCardStructure = withStyles<
4343
{|

src/main/webapp/ui/src/Inventory/components/Fields/Attachments/AttachmentTableRow.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import InsertPhotoIcon from "@mui/icons-material/InsertPhoto";
2121
import useStores from "../../../../stores/use-stores";
2222
import { mkAlert } from "../../../../stores/contexts/Alert";
2323
import { type HasEditableFields } from "../../../../stores/definitions/Editable";
24-
import { type BlobUrl } from "../../../../stores/stores/ImageStore";
24+
import { type BlobUrl } from "../../../../util/types";
2525
import { doNotAwait } from "../../../../util/Util";
2626

2727
const ChemicalPreview = observer(

src/main/webapp/ui/src/Inventory/components/Fields/Attachments/Attachments.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import { withStyles } from "Styles";
3737
import AttachFileIcon from "@mui/icons-material/AttachFile";
3838
import { type Attachment } from "../../../../stores/definitions/Attachment";
3939
import { type HasEditableFields } from "../../../../stores/definitions/Editable";
40-
import { type BlobUrl } from "../../../../stores/stores/ImageStore";
40+
import { type BlobUrl } from "../../../../util/types";
4141
import BigIconButton from "../../../../components/BigIconButton";
4242
import CardContent from "@mui/material/CardContent";
4343
import Grid from "@mui/material/Grid";

src/main/webapp/ui/src/Inventory/components/Fields/Image.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import React, { type Node, useContext } from "react";
55
import { observer } from "mobx-react-lite";
66
import { doNotAwait } from "../../../util/Util";
77
import { type HasEditableFields } from "../../../stores/definitions/Editable";
8-
import { type BlobUrl } from "../../../stores/stores/ImageStore";
8+
import { type BlobUrl } from "../../../util/types";
99
import { capImageAt1MB } from "../../../util/images";
1010
import SearchContext from "../../../stores/contexts/Search";
1111
import { Alert } from "@mui/material";

src/main/webapp/ui/src/components/Inputs/AttachmentField.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import Grid from "@mui/material/Grid";
1818
import Alert from "@mui/material/Alert";
1919
import AlertTitle from "@mui/material/AlertTitle";
2020
import type { HasEditableFields } from "../../stores/definitions/Editable";
21-
import { type BlobUrl } from "../../stores/stores/ImageStore";
21+
import { type BlobUrl } from "../../util/types";
2222
import type { Attachment } from "../../stores/definitions/Attachment";
2323
import { type GalleryFile } from "../../eln/gallery/useGalleryListing";
2424
import UploadIcon from "@mui/icons-material/Publish";

src/main/webapp/ui/src/stores/definitions/InventoryRecord.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import { match } from "../../util/Util";
1010
import { globalIdPatterns, type Id, type GlobalId } from "./BaseRecord";
1111
import { type Record, type ReadAccessLevel } from "./Record";
12-
import { type BlobUrl } from "../stores/ImageStore";
12+
import { type BlobUrl } from "../../util/types";
1313
import { type Editable } from "./Editable";
1414
import { type HasChildren } from "./HasChildren";
1515
import { type Factory } from "./Factory";

src/main/webapp/ui/src/stores/models/ContainerModel.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import {
4040
type Permissioned,
4141
mapPermissioned,
4242
} from "../definitions/PermissionedData";
43-
import { type BlobUrl } from "../stores/ImageStore";
43+
import { type BlobUrl } from "../../util/types";
4444
import getRootStore from "../stores/RootStore";
4545
import { type AttachmentJson } from "./AttachmentModel";
4646
import { type ExtraFieldAttrs } from "../definitions/ExtraField";

src/main/webapp/ui/src/stores/models/Result.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import {
2929
type AdjustableTableRow,
3030
type AdjustableTableRowOptions,
3131
} from "../definitions/Tables";
32-
import { type BlobUrl } from "../stores/ImageStore";
32+
import { type BlobUrl } from "../../util/types";
3333
import getRootStore from "../stores/RootStore";
3434
import { mkAlert, type Alert } from "../contexts/Alert";
3535
import { newExistingAttachment } from "./AttachmentModel";

src/main/webapp/ui/src/stores/stores/ImageStore.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
import axios from "@/common/axios";
44
import type { RootStore } from "./RootStore";
55
import JwtService from "../../common/JwtService";
6-
import { type URL as URLType } from "../../util/types";
7-
8-
export type BlobUrl = string;
6+
import { type URL as URLType, type BlobUrl } from "../../util/types";
97

108
/*
119
* A single, centralised image store for fetching and processing images,

src/main/webapp/ui/src/util/types.js

+5
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,8 @@ export type IsoTimestamp = string;
6464
* This is a string in the format of a URL.
6565
*/
6666
export type URL = string;
67+
68+
/*
69+
* This is a URL whose protocol is "blob".
70+
*/
71+
export type BlobUrl = URL;

0 commit comments

Comments
 (0)