Skip to content
Snippets Groups Projects

Refactor TopAppBarLabel into Breadcrumbs

Merged Loic Huder requested to merge style-crumbs into main
8 unresolved threads
  • Merged TopAppBarLabel into Breadcrumbs component (previously SubgraphBreadcrumbs). Reworked a bit the styling.
  • Reworked displayedWorkflowHierarchy to only store parents (or ancestors), following the recommendation in !390 (comment 280913)
  • Fixed the Cypress tests to match the new Breadcrumbs component structure
Edited by Loic Huder

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Loic Huder
  • 9 10 ) {
    10 const workflowIndexInHierarchy: number = oldHierarchy.indexOf(
    11 newWorkflowInfo.id
    12 );
    13
    14 if (workflowIndexInHierarchy === -1) {
    15 return [...oldHierarchy, newWorkflowInfo.id];
    11 if (prevWorkflowId === '') {
    12 return prevParents;
    16 13 }
    14 const nextWorkflowIsAParent = new Set(prevParents).has(nextWorkflowId);
    17 15
    18 if (workflowIndexInHierarchy === oldHierarchy.length - 1) {
    19 // TODO: if user insert the same 'graph' and is the first then stack is not updated
    20 // Not applicable so left as is and it just wont be able to doubleClick
    21 return oldHierarchy;
  • 3 3 import type { SetState } from 'zustand';
    4 4 import { merge } from 'lodash';
    5 5
    6 function getNewHierarchy(
    7 newWorkflowInfo: GraphDetails,
    8 oldHierarchy: string[]
    6 function getParentsOfNextWorkflow(
    7 nextWorkflowId: string,
    8 prevWorkflowId: string,
  • 5 5
    6 function getNewHierarchy(
    7 newWorkflowInfo: GraphDetails,
    8 oldHierarchy: string[]
    6 function getParentsOfNextWorkflow(
    7 nextWorkflowId: string,
    8 prevWorkflowId: string,
    9 prevParents: string[]
    9 10 ) {
    10 const workflowIndexInHierarchy: number = oldHierarchy.indexOf(
    11 newWorkflowInfo.id
    12 );
    13
    14 if (workflowIndexInHierarchy === -1) {
    15 return [...oldHierarchy, newWorkflowInfo.id];
    11 if (prevWorkflowId === '') {
  • Loic Huder added 3 commits

    added 3 commits

    Compare with previous version

  • 94 cy.findByRole('button', { name: 'Open edit actions menu' }).click();
    95 cy.findByRole('menuitem', { name: 'Clone Workflow' }).click();
    104 96 cy.waitForStableDOM();
    105 97
    106 cy.contains('Give the new workflow identifier')
    107 .parent()
    108 .should('have.class', 'MuiDialogTitle-root')
    109 .siblings()
    110 .first()
    111 .as('dialogContent')
    112 .should('have.class', 'MuiDialogContent-root');
    98 cy.findByRole('dialog').within(() => {
    99 cy.findAllByRole('heading', {
    100 name: 'Give the new workflow identifier',
    101 }).should('be.visible');
    102 });
  • assigned to @bocciare

  • Loic Huder requested review from @bocciare

    requested review from @bocciare

  • unassigned @bocciare

  • 19 19 it('opens the tutorial_Graph on the canvas', () => {
    20 20 cy.loadGraph('tutorial_Graph');
    21 21
    22 cy.get('h1').should('include.text', 'tutorial_Graph');
    22 cy.hasBreadcrumbs(['tutorial_Graph']);
  • 49 53 fitView({ duration: 500 });
    50 54 }, 300);
    51 55 }
    52 };
    53 56
    54 57 return (
    55 <Breadcrumbs aria-label="breadcrumb" color="inherit">
    56 {subgraphsStack.map((graphId, index) => {
    57 const graphLabel = loadedGraphs.get(graphId)?.graph.label || graphId;
    58 <MuiBreadcrumbs
    59 className={styles.title}
    60 aria-label="breadcrumb"
  • 24 30 const setDataFromEdges = useEdgeDataStore((state) => state.setDataFromEdges);
    25 31
    26 if (subgraphsStack.length === 1) {
    27 const { id, label = id } = displayedWorkflowInfo;
    28 return <span data-cy={label}>{label}</span>;
    29 }
    30
    31 const goToGraph = (e: React.MouseEvent) => {
    32 e.preventDefault();
    32 const rootWorkflowId = useStore((state) => state.rootWorkflowId);
    33 33
    34 const { target } = e;
    34 if (!rootWorkflowId) {
    35 return (
    36 <>
    37 Untitled_workflow <span className={styles.labelHint}>(unsaved)</span>
  • 8 oldHierarchy: string[]
    6 function getParentsOfNextWorkflow(
    7 nextWorkflowId: string,
    8 prevWorkflowId: string,
    9 prevParents: string[]
    9 10 ) {
    10 const workflowIndexInHierarchy: number = oldHierarchy.indexOf(
    11 newWorkflowInfo.id
    12 );
    13
    14 if (workflowIndexInHierarchy === -1) {
    15 return [...oldHierarchy, newWorkflowInfo.id];
    11 if (prevWorkflowId === '') {
    12 return prevParents;
    16 13 }
    14 const nextWorkflowIsAParent = new Set(prevParents).has(nextWorkflowId);
  • Axel Bocciarelli approved this merge request

    approved this merge request

  • Loic Huder added 2 commits

    added 2 commits

    • c3560256 - Refactor TopAppBarLabel into Breadcrumbs
    • d9082565 - Fix Cypress tests

    Compare with previous version

  • merged

  • Loic Huder mentioned in commit c46be140

    mentioned in commit c46be140

  • Please register or sign in to reply
    Loading