 
         destroy: =>
             super
-            datacenters.off 'all', @update_button_create_namespace
             databases.off 'all', @update_button_create_namespace
             @add_database_dialog.destroy()
             @add_namespace_dialog.destroy()

        initialize: ->
            log_initial '(initializing) namespace list view'

            @add_database_dialog = new NamespaceView.AddDatabaseModal
            @add_namespace_dialog = new NamespaceView.AddNamespaceModal
            @remove_namespace_dialog = new NamespaceView.RemoveNamespaceModal

            super databases, NamespaceView.DatabaseListElement, '.collapsible-list', {}, 'database', 'cluster'

            @datacenters_length = -1
            @databases_length = -1
            datacenters.on 'all', @update_button_create_namespace
            databases.on 'all', @update_button_create_namespace
            @can_create_namespace = true

        update_button_create_namespace: =>
            if databases.length is 0 and @can_create_namespace is true
                @.$('.add-namespace').prop 'disabled', 'disabled'

# This file extends the namespace module with functionality to present
# the index of namespaces.
module 'NamespaceView', ->
    # Show a list of databases, this view extends AbstractList
    class @DatabaseList extends UIComponents.AbstractList
        # Use a namespace-specific template for the namespace list
        template: Handlebars.compile $('#database_list-template').html()
