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

XMLWordPrintableJSON

    • 5
    • Iteration I (Aug 11 - Aug 25), Iteration J (Aug 25 - Sept 8)
    • Not Needed
    • 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. 

      We will need to add a new drawer content type `FieldDrawerContent` and a SelectedItems type of `field` to show the drawer.

      Designs: https://www.figma.com/design/reNpAkCcrtlHEgBoNDiY6P/Ben-s-playground?node-id=1446-19060&t=l7XpedfYuOnF5yWq-4 

      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>,  }

      ),

      As this is likely one of the last tickets in the first milestone we'll complete, let's try out some of the first milestone tickets in DE when we complete it. https://github.com/10gen/mms/blob/5b1546c1c2267a79dabd02d791189982c6b9ecfc/client/packages/project/dataExplorerCompassWeb/router.tsx#L161 

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

              Created:
              Updated:
              Resolved: