@must_be_valid_project
@must_have_permission(ADMIN)
@must_not_be_registration
def component_remove(auth, node, **kwargs):
    try:
        node.remove_node(auth)
    except NodeStateError as e:
        raise HTTPError(
            http.BAD_REQUEST,
            data={
                'message_short': 'Error',
                'message_long': 'Could not delete component: ' + e.message
            },
        )
    node.save()

    message = '{} has been successfully deleted.'.format(
        node.project_or_component.capitalize()
    )
    status.push_status_message(message, kind='success', trust=False)
    parent = node.parent_node
    if parent and parent.can_view(auth):
        redirect_url = node.node__parent[0].url
    else:
        redirect_url = '/dashboard/'

    return {
        'url': redirect_url,
    }
Remove component, and recursively remove its children. If node has a
dataset/ETHPy150Open CenterForOpenScience/osf.io/website/project/views/node.py/component_remove