Skip to content

Commit

Permalink
Merge pull request #8 from jhnnsrs/with_next
Browse files Browse the repository at this point in the history
build stuff
  • Loading branch information
jhnnsrs authored Oct 18, 2023
2 parents 98d40a5 + 1ebcf85 commit f687192
Show file tree
Hide file tree
Showing 28 changed files with 563 additions and 119 deletions.
3 changes: 0 additions & 3 deletions graphql/mikro/fragments/stage.graphql
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
fragment Stage on Stage {
id
positions {
...ListPosition
}
kind
name
createdAt
Expand Down
5 changes: 4 additions & 1 deletion graphql/mikro/queries/stage.graphql
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
query DetailStage($id: ID!) {
query DetailStage($id: ID!, $limit: Int, $offset: Int) {
stage(id: $id) {
...Stage
positions(limit: $limit, offset: $offset) {
...ListPosition
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion graphql/rekuest/queries/assignation.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ query MyRequests {
}

query RequestsHistory($limit: Int = 20, $filter: [AssignationStatusInput]) {
myrequests(limit: $limit, filter: $filter) {
myrequests(limit: $limit, filter: $filter, latest: true, onlyMine: true) {
...ListAssignation
}
}
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
"herre": "graphql-codegen --config herre.yml",
"lok": "graphql-codegen --config lok.yml",
"dockbuild": "vite build && docker build -t jhnnsrs/orkestrator:release .",
"paperbuild": "vite build && docker build -t jhnnsrs/orkestrator:paper .",
"dockbuildx": "vite build && docker buildx build -t jhnnsrs/orkestrator:releasex --platform linux/arm64/v8,linux/amd64 --push .",
"p": "docker push jhnnsrs/orkestrator:release",
"paperp": "docker push jhnnsrs/orkestrator:paper",
"serve": "vite preview --port 6789"
},
"dependencies": {
Expand Down
27 changes: 24 additions & 3 deletions src/app/AutoConfiguration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { ConfirmModal } from "../components/confirmer/ConfirmModal";
import { DialogDisplay } from "../components/dialog/Dialog";
import { notEmpty } from "../floating/utils";
import { FlussWard } from "../fluss/ward";
import { RekuestAssignation } from "../linker";
import { LokGuard } from "../lok/LokGuard";
import { MentionListener } from "../lok/komment/listeners/MentionListener";
import { MikroGuard } from "../mikro/MikroGuard";
Expand Down Expand Up @@ -74,21 +75,41 @@ const CriticalMessageContainer =
);
};

const AssignMessageContainer =
(ass: PostmanAssignationFragment) =>
({}: ToastContentProps) => {
return (
<RekuestAssignation.DetailLink object={ass.id} className="text-white">
Open Assignation
</RekuestAssignation.DetailLink>
);
};




const DoneMessageContainer =
(ass: PostmanAssignationFragment) =>
({}: ToastContentProps) => {
return <div className="text-white">{"Done :)"}</div>;
return <RekuestAssignation.DetailLink object={ass.id} className="text-white">{"Done :)"}</RekuestAssignation.DetailLink>;
};

const onAssignUpdate = (ass: PostmanAssignationFragment) => {
console.log(ass);
switch (ass.status) {
case AssignationStatus.Acknowledged:
case AssignationStatus.Bound:
case AssignationStatus.Assigned: {
case AssignationStatus.Bound:{
console.log(ass);
break;
}
case AssignationStatus.Bound: {
toast(AssignMessageContainer(ass));
break;
}




case AssignationStatus.Critical: {
toast(CriticalMessageContainer(ass));
break;
Expand Down
26 changes: 5 additions & 21 deletions src/components/MyBigFiles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ import { notEmpty } from "../floating/utils";
import { useDeleteFileMate } from "../mates/file/useDeleteFileMate";
import { useDownloadFileMate } from "../mates/file/useDownloadFileMate";
import { useMikroLinkMate } from "../mates/generics/useLinkMate";
import { usePostmanMate } from "../mates/postman/usePostmanMates";
import { FileCard } from "../mikro/components/cards/FileCard";
import { DataHomeFilterParams } from "../pages/data/Home";
import { DataHomeFilterParams } from "../mikro/pages/Home";
import { ResponsiveContainerGrid } from "./layout/ResponsiveContainerGrid";
export type IMyRepresentationsProps = {};

Expand Down Expand Up @@ -55,7 +54,6 @@ const MyBigFiles: React.FC<IMyRepresentationsProps & DataHomeFilterParams> = ({
const deleteFileMate = useDeleteFileMate();
const downloadFileMate = useDownloadFileMate();
const mikroLinkMate = useMikroLinkMate();
const postmanMate = usePostmanMate();

const variables = { limit: limit, offset: 0, createdDay: createdDay };

Expand All @@ -69,24 +67,10 @@ const MyBigFiles: React.FC<IMyRepresentationsProps & DataHomeFilterParams> = ({
});

const [uploadFile] = withMikro(useUploadBigFileMutation)({
update(cache, result) {
const existing: any = cache.readQuery({
query: MyOmeroFilesDocument,
variables,
});
cache.writeQuery({
query: MyOmeroFilesDocument,
variables,
data: {
myomerofiles: existing.myomerofiles.concat(
result.data?.uploadBigFile
),
},
});
},

});

const [{ isOver, canDrop }, drop] = useDrop(() => {
const [{ isOver, canDrop, item }, drop] = useDrop(() => {
return {
accept: [NativeTypes.FILE],
drop: (item, monitor) => {
Expand Down Expand Up @@ -115,7 +99,7 @@ const MyBigFiles: React.FC<IMyRepresentationsProps & DataHomeFilterParams> = ({
})
.then((x) => {
console.log(x);
return uploadFile({ variables: { file: x } });
return uploadFile({ variables: { file: x } }).then((x) => {refetch(variables); return x})
})
.then((x) =>
setUploadFutures((futures) =>
Expand All @@ -137,6 +121,7 @@ const MyBigFiles: React.FC<IMyRepresentationsProps & DataHomeFilterParams> = ({
collect: (monitor) => ({
isOver: !!monitor.isOver(),
canDrop: !!monitor.canDrop(),
item: monitor.getItem(),
}),
};
}, []);
Expand Down Expand Up @@ -187,7 +172,6 @@ const MyBigFiles: React.FC<IMyRepresentationsProps & DataHomeFilterParams> = ({
deleteFileMate(file),
downloadFileMate(file.file),
mikroLinkMate,
postmanMate,
]}
/>
))}
Expand Down
4 changes: 1 addition & 3 deletions src/components/MyFiles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { SectionTitle } from "../layout/SectionTitle";
import { MikroFile } from "../linker";
import { useDeleteFileMate } from "../mates/file/useDeleteFileMate";
import { useDownloadFileMate } from "../mates/file/useDownloadFileMate";
import { usePostmanMate } from "../mates/postman/usePostmanMates";
import { withMikro } from "../mikro/MikroContext";
import {
MyOmeroFilesDocument,
Expand Down Expand Up @@ -54,7 +53,6 @@ const MyFiles: React.FC<IMyRepresentationsProps & DataHomeFilterParams> = ({

const downloadFile = useDownloadFileMate();
const deleteFile = useDeleteFileMate();
const mates = usePostmanMate();

const [uploadFile] = withMikro(useUploadOmeroFileMutation)({
update(cache, result) {
Expand Down Expand Up @@ -168,7 +166,7 @@ const MyFiles: React.FC<IMyRepresentationsProps & DataHomeFilterParams> = ({
{data?.myomerofiles?.filter(notEmpty).map((file) => (
<FileCard
file={file}
mates={[deleteFile(file), downloadFile(file.file), mates]}
mates={[deleteFile(file), downloadFile(file.file)]}
/>
))}

Expand Down
22 changes: 12 additions & 10 deletions src/components/MyRepresentations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useEffect, useState } from "react";
import { ListRender } from "../layout/SectionTitle";
import { MikroRepresentation } from "../linker";
import { useMikroLinkMate } from "../mates/generics/useLinkMate";
import { usePostmanMate } from "../mates/postman/usePostmanMates";
import { useDeleteRepresentationMate } from "../mates/representation/useDeleteRepresentationMate";
import { withMikro } from "../mikro/MikroContext";
import {
MyRepresentationsEventDocument,
Expand All @@ -23,25 +23,27 @@ const MyRepresentations: React.FC<
const [offset, setOffset] = useState(0);

const mikroLinkMate = useMikroLinkMate();
const postmanMate = usePostmanMate();
const deleteImageMate = useDeleteRepresentationMate();

const variables = {
limit: limit,
offset: 0,
order: ["-created_at"],
createdDay: createdDay,
};

const { data, loading, subscribeToMore, refetch } = withMikro(
useMyRepresentationsQuery
)({
variables: {
limit: limit,
offset: 0,
order: ["-created_at"],
createdDay: createdDay,
},
variables: variables,
//pollInterval: 1000,
});

useEffect(() => {
console.log("Subscribing to My Representations");
const unsubscribe = subscribeToMore({
document: MyRepresentationsEventDocument,
variables: {},
variables: variables,
updateQuery: (prev, { subscriptionData }) => {
console.log("Received Representation", subscriptionData);
var data = subscriptionData as MyRepresentationsEventSubscriptionResult;
Expand Down Expand Up @@ -103,7 +105,7 @@ const MyRepresentations: React.FC<
<RepresentationCard
rep={rep}
key={rep?.id}
mates={[mikroLinkMate, postmanMate]}
mates={[mikroLinkMate, deleteImageMate(rep)]}
/>
)}
</ListRender>
Expand Down
2 changes: 1 addition & 1 deletion src/components/MyTables.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const MyTables: React.FC<IMyRepresentationsProps & DataHomeFilterParams> = ({
array={data?.mytables}
loading={loading}
title={
<MikroTable.ListLink className="flex-0">Stages</MikroTable.ListLink>
<MikroTable.ListLink className="flex-0">Tables</MikroTable.ListLink>
}
refetch={refetch}
>
Expand Down
Loading

0 comments on commit f687192

Please sign in to comment.