this exists already. You should be able to call https://github.com/juju/juju-gui/blob/develop/app/widgets/machine-view-panel-header.js#L77