Add field editing to the diagram side panel with rename, remove, change type functionality

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Data Modeling
    • 5
    • Iteration I (Aug 11 - Aug 25)
    • None
    • Developer Tools

      We can use the `onFieldClick` we added in the linked ticket to handle when a field is clicked and then open it in the drawer. 

      When editing to an invalid or duplicate field name let's show an error state with an `errorMessage` in the text-input: https://www.mongodb.design/component/text-input/live-example See the error handling section in the tech design for more details: https://docs.google.com/document/d/15Dn5FB3POEj9sYQrYIUajZySqFzlPfpcgjkPhzFqSFg/edit?tab=t.0#bookmark=id.gtbx54ysqe4o 

      Keep in mind this involves changes to the model's relationships. See the tech design for more on the downstream relationship impacts we need to account for: https://docs.google.com/document/d/15Dn5FB3POEj9sYQrYIUajZySqFzlPfpcgjkPhzFqSFg/edit?tab=t.0#bookmark=id.pg61nkxplqwt 

      The edit action related to a change should happen when the input is unfocused. If it's invalid we don't allow the change and keep the initial value.

      z.object(

      {    type: z.literal('RenameField'),    ns: z.string(),    from: FieldPath,    to: FieldPath,  }

      ),
       z.object(

      {    type: z.literal('RemoveField'),    ns: z.string(),    field: FieldPath,  }

      ),
       z.object(

      {    type: z.literal('ChangeFieldType'),    ns: z.string(),    field: FieldPath,    from: z.custom<MongoDBJSONSchema>,    to: z.custom<MongoDBJSONSchema>,  }

      ),

              Assignee:
              Unassigned
              Reporter:
              Rhys Howell
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: