Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoGen Studio] Fix the new workflow process #1181

Merged
merged 4 commits into from
Jan 17, 2024

Conversation

shhdgit
Copy link
Contributor

@shhdgit shhdgit commented Jan 9, 2024

Why are these changes needed?

Because the new workflow state is set to null, we are unable to add a new workflow again after editing or closing the workflow modal.

Before:

Screen.Recording.2024-01-09.at.16.16.08.mov

After:

Screen.Recording.2024-01-09.at.16.17.47.mov

Checks

@shhdgit
Copy link
Contributor Author

shhdgit commented Jan 9, 2024

@microsoft-github-policy-service agree

Copy link
Collaborator

@victordibia victordibia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for finding this bug and suggesting a fix.
This PR makes changes to the convention used across multiple files (e.g., setWorkflow being renamed to saveWorflow).

Please consider limiting the change to removing setWorkflow(null). We can create a separate PR towards a general style refactor.

@shhdgit
Copy link
Contributor Author

shhdgit commented Jan 12, 2024

Thanks for finding this bug and suggesting a fix. This PR makes changes to the convention used across multiple files (e.g., setWorkflow being renamed to saveWorflow).

Please consider limiting the change to removing setWorkflow(null). We can create a separate PR towards a general style refactor.

Thank you for your advice! The WorkflowModal seems like an internal implementation.
Do you mean something like the code snippet below to remove the setWorkflow(null) for "new workflow" only?

  const defaultConfig = sampleWorkflowConfig();
  const [newWorkflow] = React.useState<IFlowConfig | null>(defaultConfig);
  
  ...
  
  const WorkflowModal = ({
    workflow,
    setWorkflow,
    showWorkflowModal,
    setShowWorkflowModal,
    handler,
  }: {
    workflow: IFlowConfig | null;
    setWorkflow?: (workflow: IFlowConfig | null) => void;
    showWorkflowModal: boolean;
    setShowWorkflowModal: (show: boolean) => void;
    handler?: (workflow: IFlowConfig) => void;
  }) => {
  
  ...
  
      <Modal
        title={
          <>
            Workflow Specification{" "}
            <span className="text-accent font-normal">
              {localWorkflow?.name}
            </span>{" "}
          </>
        }
        width={800}
        open={showWorkflowModal}
        onOk={() => {
          setShowWorkflowModal(false);
          if (handler) {
            handler(localWorkflow as IFlowConfig);
          }
        }}
        onCancel={() => {
          setShowWorkflowModal(false);
          setWorkflow?.(null);
        }}
      >
      
  ...
  
  return (
    <div className="  ">
      <WorkflowModal
        workflow={selectedWorkflow}
        setWorkflow={setSelectedWorkflow}
        showWorkflowModal={showWorkflowModal}
        setShowWorkflowModal={setShowWorkflowModal}
        handler={(workflow: IFlowConfig) => {
          saveWorkFlow(workflow);
          setShowWorkflowModal(false);
        }}
      />

      <WorkflowModal
        workflow={newWorkflow}
        showWorkflowModal={showNewWorkflowModal}
        setShowWorkflowModal={setShowNewWorkflowModal}
        handler={(workflow: IFlowConfig) => {
          saveWorkFlow(workflow);
          setShowNewWorkflowModal(false);
        }}
      />
  ...

@shhdgit
Copy link
Contributor Author

shhdgit commented Jan 15, 2024

@victordibia PTAL, thanks!

Copy link
Collaborator

@victordibia victordibia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@codecov-commenter
Copy link

codecov-commenter commented Jan 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (563b1bb) 32.08% compared to head (8f4bb9d) 32.08%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1181   +/-   ##
=======================================
  Coverage   32.08%   32.08%           
=======================================
  Files          32       32           
  Lines        4394     4394           
  Branches     1025     1025           
=======================================
  Hits         1410     1410           
  Misses       2867     2867           
  Partials      117      117           
Flag Coverage Δ
unittests 32.04% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sonichi sonichi added this pull request to the merge queue Jan 17, 2024
Merged via the queue into microsoft:main with commit 39182cc Jan 17, 2024
16 checks passed
@shhdgit shhdgit deleted the fix-studio-new-workflow branch January 17, 2024 02:52
joshkyh pushed a commit that referenced this pull request Jan 17, 2024
Co-authored-by: Victor Dibia <victordibia@microsoft.com>
whiskyboy pushed a commit to whiskyboy/autogen that referenced this pull request Apr 17, 2024
Co-authored-by: Victor Dibia <victordibia@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants