From 167e1614922c4fb240459a7a561f57220cfd8e55 Mon Sep 17 00:00:00 2001 From: jhnnsrs Date: Wed, 2 Aug 2023 18:01:12 +0200 Subject: [PATCH 1/4] new new new --- graphql/mikro_next/fragments/antibody.graphql | 4 + graphql/mikro_next/fragments/camera.graphql | 10 + graphql/mikro_next/fragments/channel.graphql | 5 + .../mikro_next/fragments/credentials.graphql | 18 + graphql/mikro_next/fragments/dataset.graphql | 31 + graphql/mikro_next/fragments/era.graphql | 5 + graphql/mikro_next/fragments/file.graphql | 15 + .../mikro_next/fragments/fluorophore.graphql | 5 + graphql/mikro_next/fragments/history.graphql | 6 + graphql/mikro_next/fragments/image.graphql | 55 + .../mikro_next/fragments/instrument.graphql | 6 + graphql/mikro_next/fragments/metric.graphql | 8 + .../mikro_next/fragments/objective.graphql | 6 + graphql/mikro_next/fragments/roi.graphql | 7 + graphql/mikro_next/fragments/snapshot.graphql | 7 + graphql/mikro_next/fragments/stage.graphql | 13 + graphql/mikro_next/fragments/store.graphql | 22 + graphql/mikro_next/fragments/table.graphql | 10 + graphql/mikro_next/fragments/video.graphql | 7 + graphql/mikro_next/fragments/views.graphql | 66 + graphql/mikro_next/mutations/antibody.graphql | 14 + graphql/mikro_next/mutations/camera.graphql | 35 + graphql/mikro_next/mutations/channel.graphql | 16 + graphql/mikro_next/mutations/dataset.graphql | 63 + graphql/mikro_next/mutations/era.graphql | 6 + graphql/mikro_next/mutations/file.graphql | 24 + .../mikro_next/mutations/fluorophore.graphql | 18 + graphql/mikro_next/mutations/image.graphql | 43 + .../mikro_next/mutations/instrument.graphql | 13 + .../mikro_next/mutations/objective.graphql | 13 + graphql/mikro_next/mutations/snapshot.graphql | 5 + graphql/mikro_next/mutations/stage.graphql | 12 + graphql/mikro_next/mutations/table.graphql | 29 + .../mutations/viewcollection.graphql | 6 + graphql/mikro_next/queries/camera.graphql | 5 + graphql/mikro_next/queries/channel.graphql | 0 graphql/mikro_next/queries/dataset.graphql | 11 + graphql/mikro_next/queries/file.graphql | 5 + graphql/mikro_next/queries/hallo.graphql | 6 + graphql/mikro_next/queries/image copy.graphql | 11 + graphql/mikro_next/queries/image.graphql | 11 + graphql/mikro_next/queries/instrument.graphql | 5 + graphql/mikro_next/queries/objective.graphql | 5 + graphql/mikro_next/queries/stage.graphql | 11 + graphql/mikro_next/queries/table.graphql | 5 + graphql/port/fragments/container.graphql | 26 - graphql/port/fragments/deployment.graphql | 24 - graphql/port/fragments/image.graphql | 3 - graphql/port/fragments/network.graphql | 4 - graphql/port/fragments/repo.graphql | 17 - graphql/port/fragments/whale.graphql | 38 - graphql/port/mutations/container.graphql | 23 - graphql/port/mutations/repo.graphql | 19 - graphql/port/mutations/whale.graphql | 29 - graphql/port/queries/container.graphql | 11 - graphql/port/queries/deployments.graphql | 11 - graphql/port/queries/repo.graphql | 11 - graphql/port/queries/search.graphql | 9 - graphql/port/queries/whale.graphql | 11 - graphql/port/subscriptions/whale.graphql | 12 - graphql/rekuest/queries/node.graphql | 1 + mikro_next.yml | 20 + package.json | 2 + src/App.tsx | 9 +- src/ProtectedApp.tsx | 131 +- src/bridges/MikroNextAutoConfigure.tsx | 26 + src/bridges/MikroNextWard.tsx | 56 + src/components/navigation/NavigationBar.tsx | 15 +- src/layout/PaginatedList.tsx | 146 + src/layout/page/Refetcher.tsx | 21 + src/linker.tsx | 85 + src/mikro/api/graphql.ts | 71 +- src/mikro/graphql.schema.json | 248 +- src/mikro_next/MikroNextContext.tsx | 30 + src/mikro_next/MikroNextGuard.tsx | 25 + src/mikro_next/MikroNextModule.tsx | 33 + src/mikro_next/MikroNextProvider.tsx | 33 + src/mikro_next/api/fragments.ts | 30 + src/mikro_next/api/graphql.ts | 4529 +++ src/mikro_next/client.tsx | 129 + .../components/cards/ChannelViewCard.tsx | 33 + .../components/cards/DatasetCard.tsx | 41 + src/mikro_next/components/cards/FileCard.tsx | 33 + .../components/cards/HistoryCard.tsx | 44 + src/mikro_next/components/cards/ImageCard.tsx | 49 + .../components/cards/ImageMetricCard.tsx | 33 + .../components/cards/LabelViewCard.tsx | 33 + .../components/cards/OpticsViewCard.tsx | 33 + src/mikro_next/components/cards/StageCard.tsx | 41 + .../cards/TransformationViewCard.tsx | 41 + .../components/lists/DatasetList.tsx | 34 + src/mikro_next/components/lists/ImageList.tsx | 34 + src/mikro_next/components/lists/StageList.tsx | 34 + .../components/panels/SnapshotPanel.tsx | 19 + .../components/panels/VideoPanel.tsx | 23 + .../components/views/SnapshotPanel.tsx | 19 + .../components/views/VideoPanel.tsx | 23 + src/mikro_next/graphql.schema copy.json | 33283 ++++++++++++++++ src/mikro_next/graphql.schema.json | 17252 ++++++++ src/mikro_next/hooks/useDeleteContext.tsx | 21 + src/mikro_next/hooks/useDeleteModel.tsx | 19 + src/mikro_next/hooks/withDelete.tsx | 18 + src/mikro_next/pages/DatasetPage.tsx | 147 + src/mikro_next/pages/DatasetsPage.tsx | 18 + src/mikro_next/pages/HomePage.tsx | 22 + src/mikro_next/pages/ImagePage.tsx | 201 + src/mikro_next/pages/ImagesPage.tsx | 19 + src/mikro_next/pages/StagePage.tsx | 66 + src/mikro_next/pages/StagesPage.tsx | 19 + src/mikro_next/types.tsx | 23 + src/mikro_next/visu/TwoDOffcanvas.tsx | 799 + src/next_linker.tsx | 278 + src/rekuest/api/graphql.schema.json | 2 +- src/rekuest/api/graphql.ts | 3 +- yarn.lock | 5 + 115 files changed, 59003 insertions(+), 325 deletions(-) create mode 100644 graphql/mikro_next/fragments/antibody.graphql create mode 100644 graphql/mikro_next/fragments/camera.graphql create mode 100644 graphql/mikro_next/fragments/channel.graphql create mode 100644 graphql/mikro_next/fragments/credentials.graphql create mode 100644 graphql/mikro_next/fragments/dataset.graphql create mode 100644 graphql/mikro_next/fragments/era.graphql create mode 100644 graphql/mikro_next/fragments/file.graphql create mode 100644 graphql/mikro_next/fragments/fluorophore.graphql create mode 100644 graphql/mikro_next/fragments/history.graphql create mode 100644 graphql/mikro_next/fragments/image.graphql create mode 100644 graphql/mikro_next/fragments/instrument.graphql create mode 100644 graphql/mikro_next/fragments/metric.graphql create mode 100644 graphql/mikro_next/fragments/objective.graphql create mode 100644 graphql/mikro_next/fragments/roi.graphql create mode 100644 graphql/mikro_next/fragments/snapshot.graphql create mode 100644 graphql/mikro_next/fragments/stage.graphql create mode 100644 graphql/mikro_next/fragments/store.graphql create mode 100644 graphql/mikro_next/fragments/table.graphql create mode 100644 graphql/mikro_next/fragments/video.graphql create mode 100644 graphql/mikro_next/fragments/views.graphql create mode 100644 graphql/mikro_next/mutations/antibody.graphql create mode 100644 graphql/mikro_next/mutations/camera.graphql create mode 100644 graphql/mikro_next/mutations/channel.graphql create mode 100644 graphql/mikro_next/mutations/dataset.graphql create mode 100644 graphql/mikro_next/mutations/era.graphql create mode 100644 graphql/mikro_next/mutations/file.graphql create mode 100644 graphql/mikro_next/mutations/fluorophore.graphql create mode 100644 graphql/mikro_next/mutations/image.graphql create mode 100644 graphql/mikro_next/mutations/instrument.graphql create mode 100644 graphql/mikro_next/mutations/objective.graphql create mode 100644 graphql/mikro_next/mutations/snapshot.graphql create mode 100644 graphql/mikro_next/mutations/stage.graphql create mode 100644 graphql/mikro_next/mutations/table.graphql create mode 100644 graphql/mikro_next/mutations/viewcollection.graphql create mode 100644 graphql/mikro_next/queries/camera.graphql create mode 100644 graphql/mikro_next/queries/channel.graphql create mode 100644 graphql/mikro_next/queries/dataset.graphql create mode 100644 graphql/mikro_next/queries/file.graphql create mode 100644 graphql/mikro_next/queries/hallo.graphql create mode 100644 graphql/mikro_next/queries/image copy.graphql create mode 100644 graphql/mikro_next/queries/image.graphql create mode 100644 graphql/mikro_next/queries/instrument.graphql create mode 100644 graphql/mikro_next/queries/objective.graphql create mode 100644 graphql/mikro_next/queries/stage.graphql create mode 100644 graphql/mikro_next/queries/table.graphql delete mode 100644 graphql/port/fragments/container.graphql delete mode 100644 graphql/port/fragments/deployment.graphql delete mode 100644 graphql/port/fragments/image.graphql delete mode 100644 graphql/port/fragments/network.graphql delete mode 100644 graphql/port/fragments/repo.graphql delete mode 100644 graphql/port/fragments/whale.graphql delete mode 100644 graphql/port/mutations/container.graphql delete mode 100644 graphql/port/mutations/repo.graphql delete mode 100644 graphql/port/mutations/whale.graphql delete mode 100644 graphql/port/queries/container.graphql delete mode 100644 graphql/port/queries/deployments.graphql delete mode 100644 graphql/port/queries/repo.graphql delete mode 100644 graphql/port/queries/search.graphql delete mode 100644 graphql/port/queries/whale.graphql delete mode 100644 graphql/port/subscriptions/whale.graphql create mode 100644 mikro_next.yml create mode 100644 src/bridges/MikroNextAutoConfigure.tsx create mode 100644 src/bridges/MikroNextWard.tsx create mode 100644 src/layout/PaginatedList.tsx create mode 100644 src/layout/page/Refetcher.tsx create mode 100644 src/mikro_next/MikroNextContext.tsx create mode 100644 src/mikro_next/MikroNextGuard.tsx create mode 100644 src/mikro_next/MikroNextModule.tsx create mode 100644 src/mikro_next/MikroNextProvider.tsx create mode 100644 src/mikro_next/api/fragments.ts create mode 100644 src/mikro_next/api/graphql.ts create mode 100644 src/mikro_next/client.tsx create mode 100644 src/mikro_next/components/cards/ChannelViewCard.tsx create mode 100644 src/mikro_next/components/cards/DatasetCard.tsx create mode 100644 src/mikro_next/components/cards/FileCard.tsx create mode 100644 src/mikro_next/components/cards/HistoryCard.tsx create mode 100644 src/mikro_next/components/cards/ImageCard.tsx create mode 100644 src/mikro_next/components/cards/ImageMetricCard.tsx create mode 100644 src/mikro_next/components/cards/LabelViewCard.tsx create mode 100644 src/mikro_next/components/cards/OpticsViewCard.tsx create mode 100644 src/mikro_next/components/cards/StageCard.tsx create mode 100644 src/mikro_next/components/cards/TransformationViewCard.tsx create mode 100644 src/mikro_next/components/lists/DatasetList.tsx create mode 100644 src/mikro_next/components/lists/ImageList.tsx create mode 100644 src/mikro_next/components/lists/StageList.tsx create mode 100644 src/mikro_next/components/panels/SnapshotPanel.tsx create mode 100644 src/mikro_next/components/panels/VideoPanel.tsx create mode 100644 src/mikro_next/components/views/SnapshotPanel.tsx create mode 100644 src/mikro_next/components/views/VideoPanel.tsx create mode 100644 src/mikro_next/graphql.schema copy.json create mode 100644 src/mikro_next/graphql.schema.json create mode 100644 src/mikro_next/hooks/useDeleteContext.tsx create mode 100644 src/mikro_next/hooks/useDeleteModel.tsx create mode 100644 src/mikro_next/hooks/withDelete.tsx create mode 100644 src/mikro_next/pages/DatasetPage.tsx create mode 100644 src/mikro_next/pages/DatasetsPage.tsx create mode 100644 src/mikro_next/pages/HomePage.tsx create mode 100644 src/mikro_next/pages/ImagePage.tsx create mode 100644 src/mikro_next/pages/ImagesPage.tsx create mode 100644 src/mikro_next/pages/StagePage.tsx create mode 100644 src/mikro_next/pages/StagesPage.tsx create mode 100644 src/mikro_next/types.tsx create mode 100644 src/mikro_next/visu/TwoDOffcanvas.tsx create mode 100644 src/next_linker.tsx diff --git a/graphql/mikro_next/fragments/antibody.graphql b/graphql/mikro_next/fragments/antibody.graphql new file mode 100644 index 0000000..9b5a152 --- /dev/null +++ b/graphql/mikro_next/fragments/antibody.graphql @@ -0,0 +1,4 @@ +fragment Antibody on Antibody { + name + epitope +} \ No newline at end of file diff --git a/graphql/mikro_next/fragments/camera.graphql b/graphql/mikro_next/fragments/camera.graphql new file mode 100644 index 0000000..8311c73 --- /dev/null +++ b/graphql/mikro_next/fragments/camera.graphql @@ -0,0 +1,10 @@ +fragment Camera on Camera { + sensorSizeX + sensorSizeY + pixelSizeX + pixelSizeY + + name + serialNumber + +} \ No newline at end of file diff --git a/graphql/mikro_next/fragments/channel.graphql b/graphql/mikro_next/fragments/channel.graphql new file mode 100644 index 0000000..5820799 --- /dev/null +++ b/graphql/mikro_next/fragments/channel.graphql @@ -0,0 +1,5 @@ +fragment Channel on Channel { + id + name + excitationWavelength +} \ No newline at end of file diff --git a/graphql/mikro_next/fragments/credentials.graphql b/graphql/mikro_next/fragments/credentials.graphql new file mode 100644 index 0000000..b2e5357 --- /dev/null +++ b/graphql/mikro_next/fragments/credentials.graphql @@ -0,0 +1,18 @@ +fragment Credentials on Credentials { + accessKey + status + secretKey + bucket + key + sessionToken + store +} + +fragment AccessCredentials on AccessCredentials { + accessKey + secretKey + bucket + key + sessionToken + path +} diff --git a/graphql/mikro_next/fragments/dataset.graphql b/graphql/mikro_next/fragments/dataset.graphql new file mode 100644 index 0000000..a058e0f --- /dev/null +++ b/graphql/mikro_next/fragments/dataset.graphql @@ -0,0 +1,31 @@ +fragment Dataset on Dataset { + id + name + description + history { + ...History + } + images { + ...ListImage + } + files { + ...ListFile + } + children { + ...ListDataset + } + isDefault + pinned + createdAt + creator { + sub + } + tags +} + +fragment ListDataset on Dataset { + id + name + description + isDefault +} diff --git a/graphql/mikro_next/fragments/era.graphql b/graphql/mikro_next/fragments/era.graphql new file mode 100644 index 0000000..c77785d --- /dev/null +++ b/graphql/mikro_next/fragments/era.graphql @@ -0,0 +1,5 @@ +fragment Era on Era { + id + begin + name +} \ No newline at end of file diff --git a/graphql/mikro_next/fragments/file.graphql b/graphql/mikro_next/fragments/file.graphql new file mode 100644 index 0000000..085ed2a --- /dev/null +++ b/graphql/mikro_next/fragments/file.graphql @@ -0,0 +1,15 @@ +fragment File on File { + origins { + id + } + id + name + store { + ...BigFileStore + } +} + +fragment ListFile on File { + id + name +} diff --git a/graphql/mikro_next/fragments/fluorophore.graphql b/graphql/mikro_next/fragments/fluorophore.graphql new file mode 100644 index 0000000..6b1608d --- /dev/null +++ b/graphql/mikro_next/fragments/fluorophore.graphql @@ -0,0 +1,5 @@ +fragment Fluorophore on Fluorophore { + name + emissionWavelength + excitationWavelength +} \ No newline at end of file diff --git a/graphql/mikro_next/fragments/history.graphql b/graphql/mikro_next/fragments/history.graphql new file mode 100644 index 0000000..afcaacd --- /dev/null +++ b/graphql/mikro_next/fragments/history.graphql @@ -0,0 +1,6 @@ +fragment History on History { + id + during + kind + date +} diff --git a/graphql/mikro_next/fragments/image.graphql b/graphql/mikro_next/fragments/image.graphql new file mode 100644 index 0000000..c4cc10f --- /dev/null +++ b/graphql/mikro_next/fragments/image.graphql @@ -0,0 +1,55 @@ +fragment Image on Image { + origins { + id + } + id + name + store { + ...ZarrStore + } + views { + ...ChannelView + ...TransformationView + ...LabelView + ...TimepointView + ...OpticsView + } + pinned + renders { + ...Snapshot + ...Video + } + dataset { + name + id + } + createdAt + history(pagination: { limit: 3 }) { + ...History + } + creator { + sub + } + tags + metrics { + ...ImageMetric + } + roiOrigins { + ...ListROI + } + fileOrigins { + ...ListFile + } +} + +fragment ListImage on Image { + latestSnapshot { + id + store { + key + presignedUrl + } + } + id + name +} diff --git a/graphql/mikro_next/fragments/instrument.graphql b/graphql/mikro_next/fragments/instrument.graphql new file mode 100644 index 0000000..b3bde57 --- /dev/null +++ b/graphql/mikro_next/fragments/instrument.graphql @@ -0,0 +1,6 @@ +fragment Instrument on Instrument { + model + name + serialNumber + +} \ No newline at end of file diff --git a/graphql/mikro_next/fragments/metric.graphql b/graphql/mikro_next/fragments/metric.graphql new file mode 100644 index 0000000..347d4e2 --- /dev/null +++ b/graphql/mikro_next/fragments/metric.graphql @@ -0,0 +1,8 @@ +fragment ImageIntMetric on ImageIntMetric { + id + value +} + +fragment ImageMetric on ImageMetric { + ...ImageIntMetric +} diff --git a/graphql/mikro_next/fragments/objective.graphql b/graphql/mikro_next/fragments/objective.graphql new file mode 100644 index 0000000..01978ad --- /dev/null +++ b/graphql/mikro_next/fragments/objective.graphql @@ -0,0 +1,6 @@ +fragment Objective on Objective { + na + name + serialNumber + +} \ No newline at end of file diff --git a/graphql/mikro_next/fragments/roi.graphql b/graphql/mikro_next/fragments/roi.graphql new file mode 100644 index 0000000..23dcb0d --- /dev/null +++ b/graphql/mikro_next/fragments/roi.graphql @@ -0,0 +1,7 @@ +fragment ListROI on ROI { + id + image { + id + name + } +} diff --git a/graphql/mikro_next/fragments/snapshot.graphql b/graphql/mikro_next/fragments/snapshot.graphql new file mode 100644 index 0000000..73b1dc5 --- /dev/null +++ b/graphql/mikro_next/fragments/snapshot.graphql @@ -0,0 +1,7 @@ +fragment Snapshot on Snapshot { + id + store { + key + presignedUrl + } +} \ No newline at end of file diff --git a/graphql/mikro_next/fragments/stage.graphql b/graphql/mikro_next/fragments/stage.graphql new file mode 100644 index 0000000..6dcb2e7 --- /dev/null +++ b/graphql/mikro_next/fragments/stage.graphql @@ -0,0 +1,13 @@ +fragment Stage on Stage { + id + views { + ...TransformationView + } + pinned + name +} + +fragment ListStage on Stage { + id + name +} diff --git a/graphql/mikro_next/fragments/store.graphql b/graphql/mikro_next/fragments/store.graphql new file mode 100644 index 0000000..cd9b840 --- /dev/null +++ b/graphql/mikro_next/fragments/store.graphql @@ -0,0 +1,22 @@ +fragment ZarrStore on ZarrStore { + id + key + bucket + path + shape + dtype +} + +fragment ParquetStore on ParquetStore { + id + key + bucket + path +} + +fragment BigFileStore on BigFileStore { + id + key + bucket + path +} diff --git a/graphql/mikro_next/fragments/table.graphql b/graphql/mikro_next/fragments/table.graphql new file mode 100644 index 0000000..1a0584c --- /dev/null +++ b/graphql/mikro_next/fragments/table.graphql @@ -0,0 +1,10 @@ +fragment Table on Table { + origins { + id + } + id + name + store { + ...ParquetStore + } +} diff --git a/graphql/mikro_next/fragments/video.graphql b/graphql/mikro_next/fragments/video.graphql new file mode 100644 index 0000000..2e0bcdc --- /dev/null +++ b/graphql/mikro_next/fragments/video.graphql @@ -0,0 +1,7 @@ +fragment Video on Video { + id + store { + key + presignedUrl + } +} diff --git a/graphql/mikro_next/fragments/views.graphql b/graphql/mikro_next/fragments/views.graphql new file mode 100644 index 0000000..c43e8c5 --- /dev/null +++ b/graphql/mikro_next/fragments/views.graphql @@ -0,0 +1,66 @@ +fragment View on View { + zMin + zMax +} + +fragment ChannelView on ChannelView { + ...View + id + channel { + ...Channel + } +} + +fragment TransformationView on TransformationView { + ...View + id + kind + matrix + stage { + id + } +} + +fragment TimepointView on TimepointView { + ...View + id + msSinceStart + indexSinceStart + era { + ...Era + } +} + +fragment OpticsView on OpticsView { + ...View + id + objective { + id + name + serialNumber + } + camera { + id + name + serialNumber + } + instrument { + id + name + serialNumber + } +} + +fragment LabelView on LabelView { + ...View + id + fluorophore { + ...Fluorophore + } + primaryAntibody { + ...Antibody + } + secondaryAntibody { + ...Antibody + } +} diff --git a/graphql/mikro_next/mutations/antibody.graphql b/graphql/mikro_next/mutations/antibody.graphql new file mode 100644 index 0000000..686137a --- /dev/null +++ b/graphql/mikro_next/mutations/antibody.graphql @@ -0,0 +1,14 @@ +mutation CreateAntibody($name: String!, $epitope: String ) { + createAntibody(input: {name: $name, epitope: $epitope}) { + id + name + } +} + +mutation EnsureAntibody($name: String!, $epitope: String ) { + ensureAntibody(input: {name: $name, epitope: $epitope}) { + id + name + } +} + diff --git a/graphql/mikro_next/mutations/camera.graphql b/graphql/mikro_next/mutations/camera.graphql new file mode 100644 index 0000000..8bb4f41 --- /dev/null +++ b/graphql/mikro_next/mutations/camera.graphql @@ -0,0 +1,35 @@ +mutation CreateCamera($serialNumber: String!, $name: String, $pixelSizeX: Micrometers, $pixelSizeY: Micrometers, $sensorSizeX: Int, $sensorSizeY: Int,) { + createCamera(input: { + name: $name, + pixelSizeX: $pixelSizeX, + serialNumber: $serialNumber, + pixelSizeY: $pixelSizeY, + sensorSizeX: $sensorSizeX, + sensorSizeY: $sensorSizeY, + + + + + }) { + id + name + } +} + +mutation EnsureCamera($serialNumber: String!, $name: String, $pixelSizeX: Micrometers, $pixelSizeY: Micrometers, $sensorSizeX: Int, $sensorSizeY: Int,) { + ensureCamera(input: { + name: $name, + pixelSizeX: $pixelSizeX, + serialNumber: $serialNumber, + pixelSizeY: $pixelSizeY, + sensorSizeX: $sensorSizeX, + sensorSizeY: $sensorSizeY, + + + + + }) { + id + name + } +} \ No newline at end of file diff --git a/graphql/mikro_next/mutations/channel.graphql b/graphql/mikro_next/mutations/channel.graphql new file mode 100644 index 0000000..38a15dd --- /dev/null +++ b/graphql/mikro_next/mutations/channel.graphql @@ -0,0 +1,16 @@ +mutation CreateChannel($name: String!) { + createChannel(input: {name: $name}) { + id + name + } +} + +mutation EnsureChannel($name: String!){ + ensureChannel(input: { + name: $name + }) { + id + name + + } +} \ No newline at end of file diff --git a/graphql/mikro_next/mutations/dataset.graphql b/graphql/mikro_next/mutations/dataset.graphql new file mode 100644 index 0000000..c71b250 --- /dev/null +++ b/graphql/mikro_next/mutations/dataset.graphql @@ -0,0 +1,63 @@ +mutation CreateDataset($name: String!) { + createDataset(input: { name: $name }) { + id + name + } +} + +mutation UpdateDataset($id: ID!, $name: String!) { + updateDataset(input: { id: $id, name: $name }) { + id + name + } +} + +mutation PinDataset($id: ID!, $pin: Boolean!) { + pinDataset(input: { id: $id, pin: $pin }) { + ...Dataset + } +} + +mutation PutDatasetsInDataset($selfs: [ID!]!, $other: ID!) { + putDatasetsInDataset(input: { selfs: $selfs, other: $other }) { + ...Dataset + } +} + +mutation ReleaseDatasetsFromDataset($selfs: [ID!]!, $other: ID!) { + releaseDatasetsFromDataset(input: { selfs: $selfs, other: $other }) { + ...Dataset + } +} + +mutation PutImagesInDataset($selfs: [ID!]!, $other: ID!) { + putImagesInDataset(input: { selfs: $selfs, other: $other }) { + ...Dataset + } +} + +mutation ReleaseImagesFromDataset($selfs: [ID!]!, $other: ID!) { + releaseImagesFromDataset(input: { selfs: $selfs, other: $other }) { + ...Dataset + } +} + +mutation PutFilesInDataset($selfs: [ID!]!, $other: ID!) { + putFilesInDataset(input: { selfs: $selfs, other: $other }) { + ...Dataset + } +} + +mutation ReleaseFilesFromDataset($selfs: [ID!]!, $other: ID!) { + releaseFilesFromDataset(input: { selfs: $selfs, other: $other }) { + ...Dataset + } +} + +mutation RevertDataset($dataset: ID!, $history: ID!) { + revertDataset(input: { id: $dataset, historyId: $history }) { + id + name + description + } +} diff --git a/graphql/mikro_next/mutations/era.graphql b/graphql/mikro_next/mutations/era.graphql new file mode 100644 index 0000000..0c116ad --- /dev/null +++ b/graphql/mikro_next/mutations/era.graphql @@ -0,0 +1,6 @@ +mutation CreateEra($name: String!, $begin: DateTime) { + createEra(input: {name: $name, begin: $begin}) { + id + begin + } +} \ No newline at end of file diff --git a/graphql/mikro_next/mutations/file.graphql b/graphql/mikro_next/mutations/file.graphql new file mode 100644 index 0000000..ed4ec66 --- /dev/null +++ b/graphql/mikro_next/mutations/file.graphql @@ -0,0 +1,24 @@ +mutation from_file_like( + $file: FileLike! + $name: String! + $origins: [ID!] + $dataset: ID +) { + fromFileLike( + input: { file: $file, name: $name, origins: $origins, dataset: $dataset } + ) { + ...File + } +} + +mutation RequestFileUpload($key: String!, $datalayer: String!) { + requestFileUpload(input: { key: $key, datalayer: $datalayer }) { + ...Credentials + } +} + +mutation RequestFileAccess($store: ID!, $duration: Int) { + requestFileAccess(input: { store: $store, duration: $duration }) { + ...AccessCredentials + } +} diff --git a/graphql/mikro_next/mutations/fluorophore.graphql b/graphql/mikro_next/mutations/fluorophore.graphql new file mode 100644 index 0000000..e3b6a96 --- /dev/null +++ b/graphql/mikro_next/mutations/fluorophore.graphql @@ -0,0 +1,18 @@ +mutation CreateFluorophore($name: String!, $excitationWavelength: Micrometers, $emissionWavelength: Micrometers) { + createFluorophore(input: {name: $name, excitationWavelength: $excitationWavelength, emissionWavelength: $emissionWavelength}) { + id + name + } +} + +mutation EnsureFluorophore($name: String!, $excitationWavelength: Micrometers, $emissionWavelength: Micrometers){ + ensureFluorophore(input: { + name: $name + excitationWavelength: $excitationWavelength + emissionWavelength: $emissionWavelength + }) { + id + name + + } +} \ No newline at end of file diff --git a/graphql/mikro_next/mutations/image.graphql b/graphql/mikro_next/mutations/image.graphql new file mode 100644 index 0000000..96206d7 --- /dev/null +++ b/graphql/mikro_next/mutations/image.graphql @@ -0,0 +1,43 @@ +mutation from_array_like( + $array: ArrayLike! + $name: String! + $origins: [ID!] + $channelViews: [PartialChannelViewInput!] + $transformationViews: [PartialTransformationViewInput!] + $labelViews: [PartialLabelViewInput!] + $timepointViews: [PartialTimepointViewInput!] + $opticsViews: [PartialOpticsViewInput!] +) { + fromArrayLike( + input: { + array: $array + name: $name + origins: $origins + channelViews: $channelViews + transformationViews: $transformationViews + labelViews: $labelViews + timepointViews: $timepointViews + opticsViews: $opticsViews + } + ) { + ...Image + } +} + +mutation RequestUpload($key: String!, $datalayer: String!) { + requestUpload(input: { key: $key, datalayer: $datalayer }) { + ...Credentials + } +} + +mutation RequestAccess($store: ID!, $duration: Int) { + requestAccess(input: { store: $store, duration: $duration }) { + ...AccessCredentials + } +} + +mutation PinImage($id: ID!, $pin: Boolean!) { + pinImage(input: { id: $id, pin: $pin }) { + ...Image + } +} diff --git a/graphql/mikro_next/mutations/instrument.graphql b/graphql/mikro_next/mutations/instrument.graphql new file mode 100644 index 0000000..c1cd43f --- /dev/null +++ b/graphql/mikro_next/mutations/instrument.graphql @@ -0,0 +1,13 @@ +mutation CreateInstrument($serialNumber: String!, $name: String, $model: String) { + createInstrument(input: {name: $name, model: $model, serialNumber: $serialNumber}) { + id + name + } +} + +mutation EnsureInstrument($serialNumber: String!, $name: String, $model: String) { + ensureInstrument(input: {name: $name, model: $model, serialNumber: $serialNumber}) { + id + name + } +} diff --git a/graphql/mikro_next/mutations/objective.graphql b/graphql/mikro_next/mutations/objective.graphql new file mode 100644 index 0000000..b9a0679 --- /dev/null +++ b/graphql/mikro_next/mutations/objective.graphql @@ -0,0 +1,13 @@ +mutation CreateObjective($serialNumber: String!, $name: String, $na: Float, $magnification: Float) { + createObjective(input: {name: $name, na: $na, serialNumber: $serialNumber, magnification: $magnification}) { + id + name + } +} + +mutation EnsureObjective($serialNumber: String!, $name: String, $na: Float, $magnification: Float) { + ensureObjective(input: {name: $name, na: $na, serialNumber: $serialNumber, magnification: $magnification}) { + id + name + } +} diff --git a/graphql/mikro_next/mutations/snapshot.graphql b/graphql/mikro_next/mutations/snapshot.graphql new file mode 100644 index 0000000..31fc878 --- /dev/null +++ b/graphql/mikro_next/mutations/snapshot.graphql @@ -0,0 +1,5 @@ +mutation CreateSnapshot($image: ID!, $file: Upload!) { + createSnapshot(input: { file: $file , image: $image}) { + ...Snapshot + } +} diff --git a/graphql/mikro_next/mutations/stage.graphql b/graphql/mikro_next/mutations/stage.graphql new file mode 100644 index 0000000..83006dd --- /dev/null +++ b/graphql/mikro_next/mutations/stage.graphql @@ -0,0 +1,12 @@ +mutation CreateStage($name: String!) { + createStage(input: { name: $name }) { + id + name + } +} + +mutation PinStage($id: ID!, $pin: Boolean!) { + pinStage(input: { id: $id, pin: $pin }) { + ...Stage + } +} diff --git a/graphql/mikro_next/mutations/table.graphql b/graphql/mikro_next/mutations/table.graphql new file mode 100644 index 0000000..a7bc178 --- /dev/null +++ b/graphql/mikro_next/mutations/table.graphql @@ -0,0 +1,29 @@ +mutation from_parquet_like( + $dataframe: ParquetLike! + $name: String! + $origins: [ID!] + $dataset: ID +) { + fromParquetLike( + input: { + dataframe: $dataframe + name: $name + origins: $origins + dataset: $dataset + } + ) { + ...Table + } +} + +mutation RequestTableUpload($key: String!, $datalayer: String!) { + requestTableUpload(input: { key: $key, datalayer: $datalayer }) { + ...Credentials + } +} + +mutation RequestTableAccess($store: ID!, $duration: Int) { + requestTableAccess(input: { store: $store, duration: $duration }) { + ...AccessCredentials + } +} diff --git a/graphql/mikro_next/mutations/viewcollection.graphql b/graphql/mikro_next/mutations/viewcollection.graphql new file mode 100644 index 0000000..d171cb6 --- /dev/null +++ b/graphql/mikro_next/mutations/viewcollection.graphql @@ -0,0 +1,6 @@ +mutation CreateViewCollection($name: String!) { + createViewCollection(input: {name: $name}) { + id + name + } +} \ No newline at end of file diff --git a/graphql/mikro_next/queries/camera.graphql b/graphql/mikro_next/queries/camera.graphql new file mode 100644 index 0000000..d962166 --- /dev/null +++ b/graphql/mikro_next/queries/camera.graphql @@ -0,0 +1,5 @@ +query GetCamera($id: ID!) { + camera(id: $id) { + ...Camera + } +} \ No newline at end of file diff --git a/graphql/mikro_next/queries/channel.graphql b/graphql/mikro_next/queries/channel.graphql new file mode 100644 index 0000000..e69de29 diff --git a/graphql/mikro_next/queries/dataset.graphql b/graphql/mikro_next/queries/dataset.graphql new file mode 100644 index 0000000..95cb4e9 --- /dev/null +++ b/graphql/mikro_next/queries/dataset.graphql @@ -0,0 +1,11 @@ +query GetDataset($id: ID!) { + dataset(id: $id) { + ...Dataset + } +} + +query GetDatasets($filters: DatasetFilter, $pagination: OffsetPaginationInput) { + datasets(filters: $filters, pagination: $pagination) { + ...ListDataset + } +} diff --git a/graphql/mikro_next/queries/file.graphql b/graphql/mikro_next/queries/file.graphql new file mode 100644 index 0000000..f34fb64 --- /dev/null +++ b/graphql/mikro_next/queries/file.graphql @@ -0,0 +1,5 @@ +query GetFile($id: ID!) { + file(id: $id) { + ...File + } +} diff --git a/graphql/mikro_next/queries/hallo.graphql b/graphql/mikro_next/queries/hallo.graphql new file mode 100644 index 0000000..cb1c61c --- /dev/null +++ b/graphql/mikro_next/queries/hallo.graphql @@ -0,0 +1,6 @@ + +query Images{ + images { + id + } +} \ No newline at end of file diff --git a/graphql/mikro_next/queries/image copy.graphql b/graphql/mikro_next/queries/image copy.graphql new file mode 100644 index 0000000..62b7080 --- /dev/null +++ b/graphql/mikro_next/queries/image copy.graphql @@ -0,0 +1,11 @@ +query GetImage($id: ID!) { + image(id: $id) { + ...Image + } +} + +query GetImages($filters: ImageFilter, $pagination: OffsetPaginationInput) { + images(filters: $filters, pagination: $pagination) { + ...ListImage + } +} diff --git a/graphql/mikro_next/queries/image.graphql b/graphql/mikro_next/queries/image.graphql new file mode 100644 index 0000000..62b7080 --- /dev/null +++ b/graphql/mikro_next/queries/image.graphql @@ -0,0 +1,11 @@ +query GetImage($id: ID!) { + image(id: $id) { + ...Image + } +} + +query GetImages($filters: ImageFilter, $pagination: OffsetPaginationInput) { + images(filters: $filters, pagination: $pagination) { + ...ListImage + } +} diff --git a/graphql/mikro_next/queries/instrument.graphql b/graphql/mikro_next/queries/instrument.graphql new file mode 100644 index 0000000..44d43e4 --- /dev/null +++ b/graphql/mikro_next/queries/instrument.graphql @@ -0,0 +1,5 @@ +query GetInstrument($id: ID!) { + instrument(id: $id) { + ...Instrument + } +} diff --git a/graphql/mikro_next/queries/objective.graphql b/graphql/mikro_next/queries/objective.graphql new file mode 100644 index 0000000..168f6fa --- /dev/null +++ b/graphql/mikro_next/queries/objective.graphql @@ -0,0 +1,5 @@ +query GetObjective($id: ID!) { + objective(id: $id) { + ...Objective + } +} \ No newline at end of file diff --git a/graphql/mikro_next/queries/stage.graphql b/graphql/mikro_next/queries/stage.graphql new file mode 100644 index 0000000..00fb832 --- /dev/null +++ b/graphql/mikro_next/queries/stage.graphql @@ -0,0 +1,11 @@ +query GetStage($id: ID!) { + stage(id: $id) { + ...Stage + } +} + +query GetStages($filters: StageFilter, $pagination: OffsetPaginationInput) { + stages(filters: $filters, pagination: $pagination) { + ...ListStage + } +} diff --git a/graphql/mikro_next/queries/table.graphql b/graphql/mikro_next/queries/table.graphql new file mode 100644 index 0000000..06d96e1 --- /dev/null +++ b/graphql/mikro_next/queries/table.graphql @@ -0,0 +1,5 @@ +query GetTable($id: ID!) { + table(id: $id) { + ...Table + } +} diff --git a/graphql/port/fragments/container.graphql b/graphql/port/fragments/container.graphql deleted file mode 100644 index 9858aa7..0000000 --- a/graphql/port/fragments/container.graphql +++ /dev/null @@ -1,26 +0,0 @@ -fragment DetailContainer on Container { - id - name - image { - ...DetailImage - } - logs - labels - status - whale { - ...DetailWhale - } -} - -fragment ListContainer on Container { - id - name - image { - ...DetailImage - } - labels - status - whale { - ...DetailWhale - } -} diff --git a/graphql/port/fragments/deployment.graphql b/graphql/port/fragments/deployment.graphql deleted file mode 100644 index 52dd42c..0000000 --- a/graphql/port/fragments/deployment.graphql +++ /dev/null @@ -1,24 +0,0 @@ -fragment DetailDeployment on Deployment { - id - identifier - version - scopes - image - requirements - command - logo - originalLogo -} - -fragment ListDeployment on Deployment { - id - identifier - version - scopes - image - whales { - id - } - command - logo -} diff --git a/graphql/port/fragments/image.graphql b/graphql/port/fragments/image.graphql deleted file mode 100644 index a484876..0000000 --- a/graphql/port/fragments/image.graphql +++ /dev/null @@ -1,3 +0,0 @@ -fragment DetailImage on Image { - tags -} diff --git a/graphql/port/fragments/network.graphql b/graphql/port/fragments/network.graphql deleted file mode 100644 index d5614ff..0000000 --- a/graphql/port/fragments/network.graphql +++ /dev/null @@ -1,4 +0,0 @@ -fragment DetailNetwork on Network { - name - id -} diff --git a/graphql/port/fragments/repo.graphql b/graphql/port/fragments/repo.graphql deleted file mode 100644 index c9a6192..0000000 --- a/graphql/port/fragments/repo.graphql +++ /dev/null @@ -1,17 +0,0 @@ -fragment DetailGithubRepo on GithubRepo { - id - user - repo - branch - deployments { - ...ListDeployment - } - readme -} - -fragment ListGithubRepo on GithubRepo { - id - user - repo - branch -} diff --git a/graphql/port/fragments/whale.graphql b/graphql/port/fragments/whale.graphql deleted file mode 100644 index 78e1f73..0000000 --- a/graphql/port/fragments/whale.graphql +++ /dev/null @@ -1,38 +0,0 @@ -fragment DetailWhale on Whale { - id - deployment { - ...DetailDeployment - } - pulled - latestPull - token - containers { - id - name - image { - ...DetailImage - } - logs - labels - status - } -} - -fragment ListWhale on Whale { - id - createdAt - deployment { - ...ListDeployment - } - clientId - pulled - token - latestPull - latestEvent { - whale - pull { - status - progress - } - } -} diff --git a/graphql/port/mutations/container.graphql b/graphql/port/mutations/container.graphql deleted file mode 100644 index ca59cee..0000000 --- a/graphql/port/mutations/container.graphql +++ /dev/null @@ -1,23 +0,0 @@ -mutation StopContainer($id: ID!) { - stopContainer(id: $id) { - id - name - status - } -} - -mutation RemoveContainer($id: ID!) { - removeContainer(id: $id) { - id - name - status - } -} - -mutation RestartContainer($id: ID!) { - restartContainer(id: $id) { - id - name - status - } -} diff --git a/graphql/port/mutations/repo.graphql b/graphql/port/mutations/repo.graphql deleted file mode 100644 index 0345e6b..0000000 --- a/graphql/port/mutations/repo.graphql +++ /dev/null @@ -1,19 +0,0 @@ -mutation DeleteGithubRepo($id: ID!) { - deleteGithubRepo(id: $id) { - id - } -} - -mutation CreateGithubRepo($repo: String!, $user: String!, $branch: String!) { - createGithubRepo(repo: $repo, user: $user, branch: $branch) { - ...ListGithubRepo - } -} - -mutation ScanRepo($id: ID!) { - scanRepo(id: $id) { - id - identifier - version - } -} diff --git a/graphql/port/mutations/whale.graphql b/graphql/port/mutations/whale.graphql deleted file mode 100644 index 5562c41..0000000 --- a/graphql/port/mutations/whale.graphql +++ /dev/null @@ -1,29 +0,0 @@ -mutation RunWhale($id: ID!, $instance: String) { - runWhale(id: $id, instance: $instance) { - ...DetailWhale - } -} - -mutation DeleteWhale($id: ID!) { - deleteWhale(id: $id) { - id - } -} - -mutation PullWhale($id: ID!) { - pullWhale(id: $id) { - id - } -} - -mutation PurgeWhale($id: ID!) { - purgeWhale(id: $id) { - ...DetailWhale - } -} - -mutation CreateWhale($deployment: ID!, $clientId: String!, $token: String!) { - createWhale(deployment: $deployment, clientId: $clientId, token: $token) { - ...DetailWhale - } -} diff --git a/graphql/port/queries/container.graphql b/graphql/port/queries/container.graphql deleted file mode 100644 index 7a267ac..0000000 --- a/graphql/port/queries/container.graphql +++ /dev/null @@ -1,11 +0,0 @@ -query Containers($status: [ContainerStatus]) { - containers(status: $status) { - ...ListContainer - } -} - -query DetailContainer($id: ID!) { - container(id: $id) { - ...DetailContainer - } -} diff --git a/graphql/port/queries/deployments.graphql b/graphql/port/queries/deployments.graphql deleted file mode 100644 index abc3612..0000000 --- a/graphql/port/queries/deployments.graphql +++ /dev/null @@ -1,11 +0,0 @@ -query Deployments($limit: Int, $offset: Int) { - deployments(limit: $limit, offset: $offset) { - ...ListDeployment - } -} - -query DetailDeployment($id: ID!) { - deployment(id: $id) { - ...DetailDeployment - } -} diff --git a/graphql/port/queries/repo.graphql b/graphql/port/queries/repo.graphql deleted file mode 100644 index 86708fa..0000000 --- a/graphql/port/queries/repo.graphql +++ /dev/null @@ -1,11 +0,0 @@ -query GithubRepos($limit: Int, $offset: Int) { - githubRepos(limit: $limit, offset: $offset) { - ...ListGithubRepo - } -} - -query DetailGithubRepo($id: ID!) { - githubRepo(id: $id) { - ...DetailGithubRepo - } -} diff --git a/graphql/port/queries/search.graphql b/graphql/port/queries/search.graphql deleted file mode 100644 index f51f901..0000000 --- a/graphql/port/queries/search.graphql +++ /dev/null @@ -1,9 +0,0 @@ -query PortGlobalSearch($search: String) { - containers(search: $search) { - ...ListContainer - } - - whales(search: $search) { - ...ListWhale - } -} diff --git a/graphql/port/queries/whale.graphql b/graphql/port/queries/whale.graphql deleted file mode 100644 index f118933..0000000 --- a/graphql/port/queries/whale.graphql +++ /dev/null @@ -1,11 +0,0 @@ -query DetailWhale($id: ID!) { - whale(id: $id) { - ...DetailWhale - } -} - -query Whales($limit: Int, $offset: Int) { - whales(limit: $limit, offset: $offset) { - ...ListWhale - } -} diff --git a/graphql/port/subscriptions/whale.graphql b/graphql/port/subscriptions/whale.graphql deleted file mode 100644 index ad90f27..0000000 --- a/graphql/port/subscriptions/whale.graphql +++ /dev/null @@ -1,12 +0,0 @@ -subscription MyWhalesUpdate { - whalesEvent { - whale - pull { - status - progress - } - up { - container - } - } -} diff --git a/graphql/rekuest/queries/node.graphql b/graphql/rekuest/queries/node.graphql index 40a625a..81fc349 100644 --- a/graphql/rekuest/queries/node.graphql +++ b/graphql/rekuest/queries/node.graphql @@ -25,6 +25,7 @@ query Nodes( templated: $templated collections: $collections scopes: $scopes + limit: 20 ) { ...NodeListItem } diff --git a/mikro_next.yml b/mikro_next.yml new file mode 100644 index 0000000..c16b9e3 --- /dev/null +++ b/mikro_next.yml @@ -0,0 +1,20 @@ +overwrite: true +schema: "http://localhost:8030/graphql" +documents: "graphql/mikro_next/**/*.graphql" +generates: + src/mikro_next/api/fragments.ts: + plugins: + - "fragment-matcher" + src/mikro_next/api/graphql.ts: + plugins: + - "typescript" + - "typescript-operations" + - "typescript-react-apollo" + config: + withHooks: true + reactApolloVersion: 3 + arrayInputCoercion: false + + src/mikro_next/graphql.schema.json: + plugins: + - "introspection" diff --git a/package.json b/package.json index 3deacff..7b083fb 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "port": "graphql-codegen --config port.yml", "rekuest": "graphql-codegen --config rekuest.yml", "mikro": "graphql-codegen --config mikro.yml", + "mikro_next": "graphql-codegen --config mikro_next.yml", "herre": "graphql-codegen --config herre.yml", "lok": "graphql-codegen --config lok.yml", "dockbuild": "vite build && docker build -t jhnnsrs/orkestrator:prod .", @@ -63,6 +64,7 @@ "formik": "^2.2.9", "fuse.js": "^6.6.2", "graphiql": "^2.0.4", + "graphql-ws": "^5.14.0", "headless-stepper": "^1.6.0", "idb": "^7.1.1", "js-colormaps": "^1.0.0", diff --git a/src/App.tsx b/src/App.tsx index 35c0796..fede01d 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -58,6 +58,7 @@ import { AlerterProvider } from "./components/alerter/alerter-provider"; import { ConfirmerProvider } from "./components/confirmer/confirmer-provider"; import { Live } from "./dashboard/Dashboard"; import { HealthzProvider } from "./healthz/provider"; +import MikroNextModule from "./mikro_next/MikroNextModule"; import { Fluss } from "./pages/Fluss"; import { Local } from "./pages/Local"; import { Settings } from "./pages/Settings"; @@ -227,7 +228,13 @@ export const MainApp: React.FC = (props) => { }> } /> - {/* Mikro */} + {/* Mikro Next*/} + } + /> + + {/* Mikro*/} }> = () => { - - + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - {" "} - - - - - - - - - - - - - - -
-
- Loading} - > - - {" "} + + + {" "} + + + + + + + + + + + + + + +
+
+ Loading + } + > + + {" "} +
+
+ +
-
- -
-
- - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/src/bridges/MikroNextAutoConfigure.tsx b/src/bridges/MikroNextAutoConfigure.tsx new file mode 100644 index 0000000..4485f99 --- /dev/null +++ b/src/bridges/MikroNextAutoConfigure.tsx @@ -0,0 +1,26 @@ +import { useFakts } from "@jhnnsrs/fakts"; +import { useHerre } from "@jhnnsrs/herre"; +import React, { useEffect } from "react"; +import { useMikroNext } from "../mikro_next/MikroNextContext"; +import result from "../mikro_next/api/fragments"; + +export const MikroNextAutoConfigure: React.FC<{}> = (props) => { + const { configure } = useMikroNext(); + const { token } = useHerre(); + const { fakts } = useFakts(); + + useEffect(() => { + if (token && fakts.mikro_new) { + configure({ + secure: fakts.mikro_new.secure, + datalayer: fakts.mikro_new.datalayer, + wsEndpointUrl: fakts.mikro_new.ws_endpoint_url, + endpointUrl: fakts.mikro_new.endpoint_url, + possibleTypes: result.possibleTypes, + retrieveToken: () => token, + }); + } + }, [token, fakts]); + + return <> ; +}; diff --git a/src/bridges/MikroNextWard.tsx b/src/bridges/MikroNextWard.tsx new file mode 100644 index 0000000..887d2d2 --- /dev/null +++ b/src/bridges/MikroNextWard.tsx @@ -0,0 +1,56 @@ +import { gql } from "@apollo/client"; +import React, { useEffect } from "react"; +import { withMikro } from "../mikro/MikroContext"; +import { useDetailMetricQuery } from "../mikro/api/graphql"; +import { useMikroNext } from "../mikro_next/MikroNextContext"; +import { useWidgetRegistry } from "../rekuest/widgets/widget-context"; + +export const MetricWidget = (props: any) => { + const { data } = withMikro(useDetailMetricQuery)({ + variables: { + id: props.value, + }, + }); + + return ( +
+
{data?.metric?.key}
+
{JSON.stringify(data?.metric?.value)}
+
+ ); +}; + +export const MikroNextWard: React.FC<{ + key?: string; + fallback?: React.ReactNode; +}> = ({ key, fallback }) => { + const { client } = useMikroNext(); + const { registry } = useWidgetRegistry(); + + useEffect(() => { + if (client) { + const runFunc = (options: { query: string; variables: any }) => { + let document = gql(options.query); + return client + .query({ + query: document, + variables: options.variables, + }) + .then((result: any) => result.data); + }; + + const resolveHook = (hook: string | undefined | null) => { + if (hook == "metric") { + return (value: any) => ; + } + }; + + registry?.registerWard("mikro_new", { + search: runFunc, + hook: resolveHook, + }); + } + }, [client, registry]); + + return <>; +}; diff --git a/src/components/navigation/NavigationBar.tsx b/src/components/navigation/NavigationBar.tsx index ba54555..3a419e1 100644 --- a/src/components/navigation/NavigationBar.tsx +++ b/src/components/navigation/NavigationBar.tsx @@ -5,11 +5,12 @@ import { FiSettings } from "react-icons/fi"; import { GrDocker } from "react-icons/gr"; import { IconContext } from "react-icons/lib"; import { TbHistory, TbLayoutDashboard } from "react-icons/tb"; -import { TiFlowSwitch } from "react-icons/ti"; +import { TiArrowUp, TiFlowSwitch } from "react-icons/ti"; import { NavLink, useLocation, useNavigate } from "react-router-dom"; import { FlussGuard } from "../../fluss/guard"; import { ManGuard } from "../../lok/guard"; import { MikroGuard } from "../../mikro/MikroGuard"; +import { MikroNextGuard } from "../../mikro_next/MikroNextGuard"; import { PortGuard } from "../../port/PortGuard"; import { ExperimentalFeature } from "../../providers/experimental/Experimental"; import { RekuestGuard } from "../../rekuest/RekuestGuard"; @@ -108,6 +109,18 @@ const NavigationBar: React.FC = ({ children }) => { + + + ` dark:hover:text-back-400 px-2 py-2 hidden md:block + } ${isActive ? "dark:text-back-400" : "text-back-500"}` + } + > + + + void; +}) => { + return ( +
+
{props.children}
+ {props.right &&
{props.right}
} +
+ ); +}; + +export const Refetcher = (props: { onClick: () => Promise }) => { + const [refetching, setRefetching] = useState(false); + + const onClick = async () => { + setRefetching(true); + await props.onClick(); + setRefetching(false); + }; + + return ( + + ); +}; + +export const Offsetter = ({ + offset, + setOffset, + step, + array, +}: { + offset: number; + setOffset: React.Dispatch>; + step: number; + array?: any[] | undefined | null; +}) => ( + <> + {offset != 0 && ( + + )} + {array && array.length == step && ( + + )} + +); + +export const ConditionalRender = ({ + array, + loading, + children, +}: { + array?: any[] | undefined | null; + loading?: boolean; + children: ReactNode; +}) => { + return <>{array && array.length > 0 && children}; +}; + +export const PaginatedList = ({ + title, + loading, + array, + actions, + children, + refetch, + limit = 20, +}: { + title: React.ReactNode; + loading?: boolean; + children: (item: T, index: number) => ReactNode; + array: (T | null | undefined)[] | null | undefined; + limit?: number; + actions?: React.ReactNode; + refetch?: (values: { + pagination: { limit: number; offset: number }; + }) => Promise; +}) => { + const [offset, setOffset] = useState(0); + + useEffect(() => { + if (refetch) { + refetch({ pagination: { limit: limit, offset: offset } }); + } + }, [offset, limit]); + + return ( + <> + {array && (array.length > 0 || offset > 0) && ( + <> + + + {refetch && ( + + refetch({ pagination: { limit: limit, offset: offset } }) + } + /> + )} + {actions} +
+ } + > + {title} + + + {array?.filter(notEmpty).map(children)} + + + )} + + ); +}; diff --git a/src/layout/page/Refetcher.tsx b/src/layout/page/Refetcher.tsx new file mode 100644 index 0000000..0e92a05 --- /dev/null +++ b/src/layout/page/Refetcher.tsx @@ -0,0 +1,21 @@ +import { useState } from "react"; +import { BiRefresh } from "react-icons/bi"; + +export const Refetcher = (props: { refetch: () => Promise }) => { + const [refetching, setRefetching] = useState(false); + + const onClick = async () => { + setRefetching(true); + await props.refetch(); + setRefetching(false); + }; + + return ( + + ); +}; diff --git a/src/linker.tsx b/src/linker.tsx index 43a5c43..8c8fd24 100644 --- a/src/linker.tsx +++ b/src/linker.tsx @@ -159,6 +159,91 @@ export const Representation = buildSmart( ] ); +export const Image = buildSmart("@mikronext/image", "images", [ + "list:@mikro/sample", + "item:@mikro/sample", + "list:@mikro/model", + "item:@mikro/model", + "list:@mikro/experiment", + "item:@mikro/experiment", + "list:@mikro/representation", + "item:@mikro/representation", +]); + +export const History = buildSmart("@mikronext/history", "history", [ + "list:@mikro/sample", + "item:@mikro/sample", + "list:@mikro/model", + "item:@mikro/model", + "list:@mikro/experiment", + "item:@mikro/experiment", + "list:@mikro/representation", + "item:@mikro/representation", +]); + +export const TransformationView = buildSmart( + "@mikronext/transformationview", + "transformationviews", + [ + "list:@mikro/sample", + "item:@mikro/sample", + "list:@mikro/model", + "item:@mikro/model", + "list:@mikro/experiment", + "item:@mikro/experiment", + "list:@mikro/representation", + "item:@mikro/representation", + ] +); + +export const LabelView = buildSmart("@mikronext/labelview", "labelviews", [ + "list:@mikro/sample", + "item:@mikro/sample", + "list:@mikro/model", + "item:@mikro/model", + "list:@mikro/experiment", + "item:@mikro/experiment", + "list:@mikro/representation", + "item:@mikro/representation", +]); + +export const File = buildSmart("@mikronext/file", "files", [ + "list:@mikro/sample", + "item:@mikro/sample", + "list:@mikro/model", + "item:@mikro/model", + "list:@mikro/experiment", + "item:@mikro/experiment", + "list:@mikro/representation", + "item:@mikro/representation", +]); + +export const ChannelView = buildSmart( + "@mikronext/channelview", + "channelviews", + [ + "list:@mikro/sample", + "item:@mikro/sample", + "list:@mikro/model", + "item:@mikro/model", + "list:@mikro/experiment", + "item:@mikro/experiment", + "list:@mikro/representation", + "item:@mikro/representation", + ] +); + +export const OpticsView = buildSmart("@mikronext/opticsview", "opticsviews", [ + "list:@mikro/sample", + "item:@mikro/sample", + "list:@mikro/model", + "item:@mikro/model", + "list:@mikro/experiment", + "item:@mikro/experiment", + "list:@mikro/representation", + "item:@mikro/representation", +]); + export const Graph = buildSmart("@mikro/graph", "graphs", [ "list:@mikro/graph", "item:@mikro/graph", diff --git a/src/mikro/api/graphql.ts b/src/mikro/api/graphql.ts index e43c961..30d2051 100644 --- a/src/mikro/api/graphql.ts +++ b/src/mikro/api/graphql.ts @@ -175,7 +175,8 @@ export type Comment = { parent?: Maybe; resolved?: Maybe; resolvedBy?: Maybe; - text: Scalars['String']; + /** The text of the comment (without any formatting) */ + text?: Maybe; user: User; }; @@ -2519,6 +2520,7 @@ export type OmeroViewsArgs = { activeForY?: InputMaybe; activeForZ?: InputMaybe; ids?: InputMaybe>>; + isGlobal?: InputMaybe; limit?: InputMaybe; name?: InputMaybe; offset?: InputMaybe; @@ -3074,6 +3076,14 @@ export type Query = { /** My samples return all of the users samples attached to the current user */ graphs?: Maybe>>; hello?: Maybe; + /** + * Get a single Image by ID + * + * Returns a single Representation by ID. If the user does not have access + * to the Representation, an error will be raised. + * + */ + image?: Maybe; /** * Get a single instrumes by ID * @@ -3783,6 +3793,12 @@ export type QueryGraphsArgs = { }; +/** The root Query */ +export type QueryImageArgs = { + id: Scalars['ID']; +}; + + /** The root Query */ export type QueryInstrumentArgs = { id?: InputMaybe; @@ -4535,6 +4551,7 @@ export type QueryViewsArgs = { activeForY?: InputMaybe; activeForZ?: InputMaybe; ids?: InputMaybe>>; + isGlobal?: InputMaybe; limit?: InputMaybe; name?: InputMaybe; offset?: InputMaybe; @@ -4723,6 +4740,8 @@ export type Representation = { variety: RepresentationVariety; /** The rendered bioimages */ videos: Array