Skip to content

Commit

Permalink
feat: add Elektro GraphQL fragments, queries, and components for trac…
Browse files Browse the repository at this point in the history
…e management; refactor to replace Room with Trace components
  • Loading branch information
jhnnsrs committed Feb 27, 2025
1 parent 77f330d commit 435a807
Show file tree
Hide file tree
Showing 27 changed files with 6,506 additions and 1,002 deletions.
2 changes: 1 addition & 1 deletion alpaka.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ overwrite: true
schema: "http://jhnnsrs-lab/alpaka/graphql"
documents: "graphql/alpaka/**/*.graphql"
generates:
src/kraph/api/fragments.ts:
src/alpaka/api/fragments.ts:
plugins:
- "fragment-matcher"
src/alpaka/api/graphql.ts:
Expand Down
20 changes: 20 additions & 0 deletions elektro.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
overwrite: true
schema: "http://jhnnsrs-lab/elektro/graphql"
documents: "graphql/elektro/**/*.graphql"
generates:
src/elektro/api/fragments.ts:
plugins:
- "fragment-matcher"
src/elektro/api/graphql.ts:
plugins:
- "typescript"
- "typescript-operations"
- "typescript-react-apollo"
config:
withHooks: true
reactApolloVersion: 3
apolloReactHooksImportFrom: "@/lib/elektro/funcs"

src/elektro/graphql.schema.json:
plugins:
- "introspection"
31 changes: 31 additions & 0 deletions graphql/elektro/fragments/credentials.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
fragment Credentials on Credentials {
accessKey
status
secretKey
bucket
key
sessionToken
store
}

fragment AccessCredentials on AccessCredentials {
accessKey
secretKey
bucket
key
sessionToken
path
}


fragment PresignedPostCredentials on PresignedPostCredentials {
xAmzAlgorithm
xAmzCredential
xAmzDate
xAmzSignature
key
bucket
datalayer
policy
store
}
8 changes: 8 additions & 0 deletions graphql/elektro/fragments/store.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
fragment ZarrStore on ZarrStore {
id
key
bucket
path
shape
dtype
}
12 changes: 12 additions & 0 deletions graphql/elektro/fragments/trace.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
fragment DetailTrace on Trace {
id
name
store {
...ZarrStore
}
}

fragment ListTrace on Trace {
id
name
}
13 changes: 13 additions & 0 deletions graphql/elektro/mutations/trace.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@


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
}
}
11 changes: 11 additions & 0 deletions graphql/elektro/queries/room.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
query DetailTrace($id: ID!){
trace(id: $id){
...DetailTrace
}
}

query Traces {
traces(pagination: {limit: 10}) {
...ListTrace
}
}
9 changes: 9 additions & 0 deletions graphql/elektro/queries/search.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
query GlobalSearch(
$search: String
$pagination: OffsetPaginationInput
) {
traces: traces(filters: { search: $search }, pagination: $pagination)
{
...ListTrace
}
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"fluss": "graphql-codegen --config fluss.yml",
"kabinet": "graphql-codegen --config kabinet.yml",
"port": "graphql-codegen --config port-next.yml",
"lok": "graphql-codegen --config lok.yml"
"lok": "graphql-codegen --config lok.yml",
"elektro": "graphql-codegen --config elektro.yml"
},
"dependencies": {
"@air/react-drag-to-select": "^5.0.8",
Expand Down
38 changes: 18 additions & 20 deletions src/arkitekt/Arkitekt.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
import { LivekitClient } from "@/lib/livekit/client";
import { ApolloClient, NormalizedCache } from "@apollo/client";
import { buildArkitekt, buildGuard } from ".";
import { ServiceBuilderMap, useArkitekt } from "./provider";
import alpakaResult from "@/alpaka/api/fragments";
import { manifest } from "@/constants";
import { createMikroClient } from "@/lib/mikro/client";
import { createRekuestClient } from "@/lib/rekuest/client";
import elektroResult from "@/elektro/api/fragments";
import kabinetResult from "@/kabinet/api/fragments";
import kraphResult from "@/kraph/api/fragments";
import { createAlpakaClient } from "@/lib/alpaka/client";
import { createElektroClient } from "@/lib/elektro/client";
import { createFlussClient } from "@/lib/fluss/client";
import { createKabinetClient } from "@/lib/kabinet/client";
import { createKraphClient } from "@/lib/kraph/client";
import { createLivekitClient, LivekitClient } from "@/lib/livekit/client";
import { createMikroClient } from "@/lib/mikro/client";
import { createOmeroArkClient } from "@/lib/omero-ark/client";
import { createRekuestClient } from "@/lib/rekuest/client";
import lokResult from "@/lok-next/api/fragments";
import { createLokClient } from "@/lok-next/lib/LokClient";
import mikroResult from "@/mikro-next/api/fragments";
import omeroArkResult from "@/omero-ark/api/fragments";
import flussResult from "@/reaktion/api/fragments";
import rekuestResult from "@/rekuest/api/fragments";
import kabinetResult from "@/kabinet/api/fragments";
import alpakaResult from "@/alpaka/api/fragments";
import kraphResult from "@/kraph/api/fragments";
import { WidgetRegistry } from "@/rekuest/widgets/Registry";
import { createOmeroArkClient } from "@/lib/omero-ark/client";
import { createLokClient } from "@/lok-next/lib/LokClient";
import { App, ServiceMap } from "./types";
import { createLivekitClient } from "@/lib/livekit/client";
import { createKraphClient } from "@/lib/kraph/client";
import { createAlpakaClient } from "@/lib/alpaka/client";
import { createElektroClient } from "@/lib/elektro/client";
import { ApolloClient, NormalizedCache } from "@apollo/client";
import { buildArkitekt, buildGuard } from ".";
import { ServiceBuilderMap, useArkitekt } from "./provider";

export const electronRedirect = async (
url: string,
Expand Down Expand Up @@ -159,9 +157,9 @@ export const serviceMap: ServiceBuilderMap = {
builder: (manifest, fakts: any, token) => {
return {
client: createElektroClient({
wsEndpointUrl: fakts.alpaka.ws_endpoint_url,
endpointUrl: fakts.alpaka.endpoint_url,
possibleTypes: alpakaResult.possibleTypes,
wsEndpointUrl: fakts.elektro.ws_endpoint_url,
endpointUrl: fakts.elektro.endpoint_url,
possibleTypes: elektroResult.possibleTypes,
retrieveToken: () => token,
}),
};
Expand Down
4 changes: 2 additions & 2 deletions src/elektro/ElektroModule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ModuleLayout } from "@/components/layout/ModuleLayout";
import React from "react";
import { Route, Routes } from "react-router";
import HomePage from "./pages/HomePage";
import RoomPage from "./pages/RoomPage";
import TracePage from "./pages/TracePage";
import StandardPane from "./panes/StandardPane";
interface Props {}

Expand All @@ -12,7 +12,7 @@ export const ElektroModule: React.FC<Props> = (props) => {
<Guard.Elektro fallback={<>Loading</>}>
<ModuleLayout pane={<StandardPane />}>
<Routes>
<Route path="rooms/:id" element={<RoomPage />} />
<Route path="traces/:id" element={<TracePage />} />
<Route path="*" element={<HomePage />} />
</Routes>
</ModuleLayout>
Expand Down
12 changes: 1 addition & 11 deletions src/elektro/api/fragments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,7 @@
}
}
const result: PossibleTypesResultData = {
"possibleTypes": {
"Descendant": [
"LeafDescendant",
"MentionDescendant",
"ParagraphDescendant"
],
"SocialAccount": [
"GenericAccount",
"OrcidAccount"
]
}
"possibleTypes": {}
};
export default result;

Loading

0 comments on commit 435a807

Please sign in to comment.