Author: justi9
Date: 2007-11-29 16:46:43 -0500 (Thu, 29 Nov 2007)
New Revision: 1401
Modified:
mgmt/cumin/python/cumin/broker.py
mgmt/cumin/python/cumin/brokercluster.py
mgmt/cumin/python/cumin/brokerprofile.py
mgmt/cumin/python/cumin/page.py
mgmt/mint/python/mint/__init__.py
mgmt/mint/python/mint/schema.sql
Log:
Adds missing associations to management-side model objects.
Makes the UI more properly use them.
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2007-11-29 21:27:40 UTC (rev 1400)
+++ mgmt/cumin/python/cumin/broker.py 2007-11-29 21:46:43 UTC (rev 1401)
@@ -376,6 +376,9 @@
self.brokers = self.BrowserBrokers(app, "brokers")
self.add_child(self.brokers)
+ def get_title(self, session, model):
+ return "Brokers %s" % fmt_count(Broker.select().count())
+
class BrowserBrokers(BrokerSetForm):
def get_items(self, session, model):
return super(BrokerBrowser.BrowserBrokers, self).get_items \
Modified: mgmt/cumin/python/cumin/brokercluster.py
===================================================================
--- mgmt/cumin/python/cumin/brokercluster.py 2007-11-29 21:27:40 UTC (rev 1400)
+++ mgmt/cumin/python/cumin/brokercluster.py 2007-11-29 21:46:43 UTC (rev 1401)
@@ -19,7 +19,7 @@
return branch.marshal()
def get_title(self, session, model):
- return "Broker Clusters %s" % fmt_count(len(BrokerCluster.select()))
+ return "Broker Clusters %s" %
fmt_count(BrokerCluster.select().count())
def get_items(self, session, model):
return list(BrokerCluster.select())
Modified: mgmt/cumin/python/cumin/brokerprofile.py
===================================================================
--- mgmt/cumin/python/cumin/brokerprofile.py 2007-11-29 21:27:40 UTC (rev 1400)
+++ mgmt/cumin/python/cumin/brokerprofile.py 2007-11-29 21:46:43 UTC (rev 1401)
@@ -1,3 +1,4 @@
+from mint import *
from wooly import *
from wooly.widgets import *
@@ -5,6 +6,7 @@
from broker import *
from widgets import *
from parameters import *
+from formats import *
from util import *
strings = StringCatalog(__file__)
@@ -15,6 +17,9 @@
self.page().show_broker_profile_add(branch)
return branch.marshal()
+ def get_title(self, session, model):
+ return "Broker Profiles %s" %
fmt_count(BrokerProfile.select().count())
+
def get_items(self, session, model):
return list(BrokerProfile.select())
Modified: mgmt/cumin/python/cumin/page.py
===================================================================
--- mgmt/cumin/python/cumin/page.py 2007-11-29 21:27:40 UTC (rev 1400)
+++ mgmt/cumin/python/cumin/page.py 2007-11-29 21:46:43 UTC (rev 1401)
@@ -164,10 +164,10 @@
def __init__(self, app, name):
super(MainView, self).__init__(app, name)
- self.add_tab(self.BrokerTab(app, "brokers"))
+ self.add_tab(BrokerBrowser(app, "brokers"))
self.add_tab(BrokerGroupSet(app, "groups"))
- self.add_tab(self.BrokerProfileTab(app, "profiles"))
- self.add_tab(self.BrokerClusterTab(app, "clusters"))
+ self.add_tab(BrokerProfileSet(app, "profiles"))
+ self.add_tab(BrokerClusterSet(app, "clusters"))
self.add_tab(self.TagTab(app, "tags"))
def show_broker_group(self, session, group):
@@ -178,20 +178,6 @@
def get_title(self, session, model):
return "Messaging"
- class BrokerTab(BrokerBrowser):
- def get_title(self, session, model):
- return "Brokers %s" % fmt_count(len(model.brokers()))
-
- class BrokerProfileTab(BrokerProfileSet):
- def get_title(self, session, model):
- return "Broker Profiles %s" % \
- fmt_count(len(model.get_broker_profiles()))
-
- class BrokerClusterTab(BrokerClusterSet):
- def get_title(self, session, model):
- return "Broker Clusters %s" % \
- fmt_count(len(model.get_broker_clusters()))
-
class TagTab(Widget):
def get_title(self, session, model):
return "Tags"
Modified: mgmt/mint/python/mint/__init__.py
===================================================================
--- mgmt/mint/python/mint/__init__.py 2007-11-29 21:27:40 UTC (rev 1400)
+++ mgmt/mint/python/mint/__init__.py 2007-11-29 21:46:43 UTC (rev 1401)
@@ -15,21 +15,18 @@
except TypeError:
pass
-
class BrokerRegistration(SQLObject):
name = StringCol(length=1000, default=None)
host = StringCol(length=1000, default=None)
port = SmallIntCol(default=None)
broker = ForeignKey("Broker", cascade="null", default=None)
-
class BrokerGroup(SQLObject):
name = StringCol(length=1000, default=None)
- brokers = MultipleJoin("Broker")
+ brokers = RelatedJoin("Broker")
Broker.sqlmeta.addJoin(RelatedJoin("BrokerGroup",
joinMethodName="groups"))
-
class BrokerCluster(SQLObject):
name = StringCol(length=1000, default=None)
brokers = MultipleJoin("Broker")
@@ -39,27 +36,26 @@
Broker.sqlmeta.addColumn(fk)
setattr(Broker, "cluster", fk)
-
class BrokerProfile(SQLObject):
name = StringCol(length=1000, default=None)
brokers = MultipleJoin("Broker")
-
-fk = ForeignKey("BrokerProfile", cascade="null",
- default=None, name="brokerProfile")
+ properties = MultipleJoin("ConfigProperty")
+
+fk = ForeignKey("BrokerProfile", cascade="null", default=None,
+ name="brokerProfile")
Broker.sqlmeta.addColumn(fk)
setattr(Broker, "profile", fk)
-
class ConfigProperty(SQLObject):
name = StringCol(length=1000, default=None)
value = StringCol(length=1000, default=None)
type = StringCol(length=1, default="s")
- profile = ForeignKey("BrokerProfile", cascade="null",
default=None)
-BrokerProfile.sqlmeta.addJoin(MultipleJoin("ConfigProperty",
- joinMethodName="properties"))
+fk = ForeignKey("BrokerProfile", cascade="null", default=None,
+ name="brokerProfile")
+ConfigProperty.sqlmeta.addColumn(fk)
+setattr(ConfigProperty, "profile", fk)
-
class OriginalIdDict:
def __init__(self):
self.idMap = dict()
Modified: mgmt/mint/python/mint/schema.sql
===================================================================
--- mgmt/mint/python/mint/schema.sql 2007-11-29 21:27:40 UTC (rev 1400)
+++ mgmt/mint/python/mint/schema.sql 2007-11-29 21:46:43 UTC (rev 1401)
@@ -26,7 +26,7 @@
name VARCHAR(1000),
value VARCHAR(1000),
type VARCHAR(1),
- profile_id INT
+ broker_profile_id INT
);
CREATE TABLE binding (
@@ -376,7 +376,7 @@
ALTER TABLE broker_registration ADD CONSTRAINT broker_id_exists FOREIGN KEY (broker_id)
REFERENCES broker (id) ON DELETE SET NULL;
-ALTER TABLE config_property ADD CONSTRAINT profile_id_exists FOREIGN KEY (profile_id)
REFERENCES broker_profile (id) ON DELETE SET NULL;
+ALTER TABLE config_property ADD CONSTRAINT broker_profile_id_exists FOREIGN KEY
(broker_profile_id) REFERENCES broker_profile (id) ON DELETE SET NULL;
ALTER TABLE binding ADD CONSTRAINT stats_curr_id_exists FOREIGN KEY (stats_curr_id)
REFERENCES binding_stats (id) ON DELETE SET NULL;