While sorting should we show the name of the sorted entry?

I am designing a web app where a list of devices (I will use devices as a generic term) will be shown to a user. Devices can belong to a master group or a user created group (only one strictly). There is a page where we show all the devices and indicate that these devices are part of a master group. Users can create custom groups which is according to their criteria, these custom groups will also be shown to the user in the same page.

What would be a better way to show the sort results?

  • 1) the devices are shown without group sorting
  • 2) show each group with their corresponding group name

I've attached an image that would be a lot easier to understand than the lengthy explanation I've given. How should I go about solving this?

enter image description here

enter image description here