Skip to content

Commit

Permalink
Merge branch 'main' into 740-improve-roles
Browse files Browse the repository at this point in the history
  • Loading branch information
srvEq authored Feb 14, 2025
2 parents a2ac30a + 494d14c commit 41f4b52
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 29 deletions.
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
# Changelog

## [2.9.0](https://github.com/equinor/flyt/compare/v2.8.0...v2.9.0) (2025-02-07)


### Features

* Added seconds as option in duration unit ([#858](https://github.com/equinor/flyt/issues/858)) ([64213af](https://github.com/equinor/flyt/commit/64213af341c0de85e4ffbc746f482ceabbc2c184))
* All roles combined into Contributor role ([#877](https://github.com/equinor/flyt/issues/877)) ([88e6578](https://github.com/equinor/flyt/commit/88e6578582afa578d43b9b368b4ae6e94af40ed9))
* delete card button ([#856](https://github.com/equinor/flyt/issues/856)) ([dbe0354](https://github.com/equinor/flyt/commit/dbe0354d77c389c363176b28691efe82e4f226bb))
* display edit box and tooltip below the card when cropped ([#842](https://github.com/equinor/flyt/issues/842)) ([759d01c](https://github.com/equinor/flyt/commit/759d01c963ccc037d897961467f81b23ea7a61f0))
* enable writing directly on cards ([#823](https://github.com/equinor/flyt/issues/823)) ([34aad3f](https://github.com/equinor/flyt/commit/34aad3f350cea798d17d6a7072386a4fef4a0186))
* Redesign sidebar ([#839](https://github.com/equinor/flyt/issues/839)) ([9a39225](https://github.com/equinor/flyt/commit/9a3922508c4829387afb7044654a02908c025d38))
* updated the linked process delete confirmation message. ([#872](https://github.com/equinor/flyt/issues/872)) ([a5c15d2](https://github.com/equinor/flyt/commit/a5c15d2c0894db8e3e5e07a9616ba2b962f9b5e4))


### Bug Fixes

* Dragging cards sometimes cause crashes ([#852](https://github.com/equinor/flyt/issues/852)) ([5efa058](https://github.com/equinor/flyt/commit/5efa05835d62f85f75cfc3de375c41dbe1f58a3f))
* Hidden nodes causes Flyt to crash ([#850](https://github.com/equinor/flyt/issues/850)) ([b237bc2](https://github.com/equinor/flyt/commit/b237bc24b63e42289180d29e9644d34e98070217))
* Main activity can now be moved ([#838](https://github.com/equinor/flyt/issues/838)) ([591a405](https://github.com/equinor/flyt/commit/591a405b9859a906693de710bd5d992f5e3c9fee))
* make seconds as choice in duration unit ([#866](https://github.com/equinor/flyt/issues/866)) ([0ba70d9](https://github.com/equinor/flyt/commit/0ba70d99e53b0602f4eae72419c865ca81e3f22f))
* Redesign sidebar description ([#846](https://github.com/equinor/flyt/issues/846)) ([c499138](https://github.com/equinor/flyt/commit/c499138b7955d316604e3fef193f47a23496d50f))
* Unable to delete edge bug ([#848](https://github.com/equinor/flyt/issues/848)) ([5f4d668](https://github.com/equinor/flyt/commit/5f4d668a506eea871d33d97ea4211e054164ecf2))


### Reverts

* "feat: Added seconds as option in duration unit" ([#865](https://github.com/equinor/flyt/issues/865)) ([3692194](https://github.com/equinor/flyt/commit/3692194f25a0341c4f33cdc547117f9963993b2e))

## [2.8.0](https://github.com/equinor/flyt/compare/v2.7.0...v2.8.0) (2024-11-20)

### Features
Expand Down
17 changes: 17 additions & 0 deletions components/LiveIndicator.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.liveIndicatorContainer {
position: absolute;
right: 0;
top: 64px;
z-index: 20;
}

.textContainer {
padding-right: 12px;
margin: 12px;
display: flex;
align-items: center;
}

.iconStyle {
padding: 5px;
}
15 changes: 4 additions & 11 deletions components/LiveIndicator.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
import { ColorDot } from "./ColorDot";
import colors from "../theme/colors";
import styles from "./LiveIndicator.module.scss";

export function LiveIndicator(props: {
live: boolean;
title: string;
}): JSX.Element {
const { live } = props;
return (
<div style={{ position: "absolute", right: 0, top: 124, zIndex: 20 }}>
<div
style={{
paddingRight: 12,
margin: 12,
display: "flex",
alignItems: "center",
}}
title={props.title}
>
<div style={{ padding: 5 }}>
<div className={styles.liveIndicatorContainer}>
<div className={styles.textContainer} title={props.title}>
<div className={styles.iconStyle}>
<ColorDot color={live ? colors.SUCCESS : colors.ERROR} />
</div>
{live ? <p>Live</p> : <p>Disconnected</p>}
Expand Down
7 changes: 3 additions & 4 deletions components/canvas/Canvas.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import { Graph } from "@/types/Graph";
import { CanvasButtons } from "components/CanvasButtons";
import { ManageLabelBox } from "components/Labels/ManageLabelBox";
import { ResetProcessButton } from "components/ResetProcessButton";
import { useState } from "react";
import "reactflow/dist/style.css";
import { Project } from "types/Project";
import { LiveIndicator } from "../LiveIndicator";
import { FlowWrapper } from "./Flow";
import { useAccess } from "./hooks/useAccess";
import { useWebSocket } from "./hooks/useWebSocket";
import { ToBeToggle } from "./ToBeToggle";

type CanvasProps = {
graph: Graph;
Expand Down Expand Up @@ -45,8 +43,9 @@ const Canvas = ({
}.`
}
/>
<ToBeToggle />
<ResetProcessButton />
{/* Note: Current and To Be Toggle button is hidden as To Be function is not fully developed. */}
{/* <ToBeToggle />
<ResetProcessButton /> */}
<FlowWrapper
apiNodes={apiNodes}
apiEdges={apiEdges}
Expand Down
53 changes: 40 additions & 13 deletions components/canvas/hooks/useNodeDrag.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { moveVertice, moveVerticeRightOfTarget } from "@/services/graphApi";
import {
moveVertice,
moveVerticeLeftOfTarget,
moveVerticeRightOfTarget,
} from "@/services/graphApi";
import { notifyOthers } from "@/services/notifyOthers";
import { NodeDataCommon } from "@/types/NodeData";
import { NodeTypes } from "@/types/NodeTypes";
Expand Down Expand Up @@ -77,11 +81,7 @@ export const useNodeDrag = () => {
moveNode.mutate({
nodeId: node.id,
targetId: target?.id ?? "",
position:
node.type === NodeTypes.mainActivity &&
target?.type === NodeTypes.mainActivity
? Position.Right
: Position.Bottom,
position: target ? getPosition(node, target) : Position.Bottom,
includeChildren: target ? includeChildren(node, target) : false,
});
setTarget(undefined);
Expand Down Expand Up @@ -111,13 +111,25 @@ export const useNodeDrag = () => {
includeChildren: boolean;
}) => {
dispatch.setSnackMessage("⏳ Moving card...");
return position === Position.Bottom
? moveVertice(
{ vertexToMoveId: nodeId, vertexDestinationParentId: targetId },
projectId,
includeChildren
)
: moveVerticeRightOfTarget({ vertexId: nodeId }, targetId, projectId);
if (position === Position.Right) {
return moveVerticeRightOfTarget(
{ vertexId: nodeId },
targetId,
projectId
);
}
if (position === Position.Left) {
return moveVerticeLeftOfTarget(
{ vertexId: nodeId },
targetId,
projectId
);
}
return moveVertice(
{ vertexToMoveId: nodeId, vertexDestinationParentId: targetId },
projectId,
includeChildren
);
},
{
onSuccess: () => {
Expand Down Expand Up @@ -145,6 +157,21 @@ export const useNodeDrag = () => {
return false;
};

const getPosition = (
source: Node<NodeDataCommon>,
target: Node<NodeDataCommon>
) => {
if (
source.type === NodeTypes.mainActivity &&
target?.type === NodeTypes.mainActivity
) {
return (source.data?.order ?? 0) > (target.data?.order ?? 0)
? Position.Left
: Position.Right;
}
return Position.Bottom;
};

return {
onNodeDragStart,
onNodeDrag,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "flyt",
"radix-name": "flyt",
"version": "2.8.0",
"version": "2.9.0",
"private": true,
"scripts": {
"dev": "NODE_OPTIONS='--inspect' next dev",
Expand Down
10 changes: 10 additions & 0 deletions services/graphApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@ export const moveVerticeRightOfTarget = (
data
).then((r) => r.data);

export const moveVerticeLeftOfTarget = (
data: { vertexId: string },
targetId: string,
projectId: string
): Promise<unknown> =>
BaseAPIServices.put(
`${baseUrl}/graph/${projectId}/vertices/${targetId}/left`,
data
).then((r) => r.data);

export const mergeVertices = (
data: { fromVertexId: string; toVertexId: string },
projectId: string
Expand Down

0 comments on commit 41f4b52

Please sign in to comment.