Dummy panels for OpenCirrus
authorAndy Bavier <acb@cs.princeton.edu>
Tue, 22 Jun 2010 20:39:05 +0000 (16:39 -0400)
committerAndy Bavier <acb@cs.princeton.edu>
Tue, 22 Jun 2010 20:39:05 +0000 (16:39 -0400)
HelpPanel.py
InstancePanel.py [new file with mode: 0644]
OpenCirrus.py
RequestPanel.py [new file with mode: 0644]
SfaData.py

index e99ee0b..59e183a 100644 (file)
@@ -43,4 +43,17 @@ class VINIHelpPanel(HelpPanel):
         m += "them.</ol></p></div>"
         self.add(HTML(m))
 
+class OCHelpPanel(HelpPanel):        
+    def __init__(self):
+        HelpPanel.__init__(self)
+        m = "<div class='infoProse'>Steps to set up your slice:"
+        m += "<ol><li>Use the <b>Request</b> tab to request that some "
+        m += "VM instances be allocated to your slice." 
+        m += "<li>Use the <b>Instances</b> tab to get information on "
+        m += "running VM instances."
+        m += "<li>Under the <b>Submit</b> tab, click the <i>Apply</i> button "
+        m += "to submit your changes, or the <i>Reset</i> button to discard "
+        m += "them.</ol></p></div>"
+        self.add(HTML(m))
+
         
diff --git a/InstancePanel.py b/InstancePanel.py
new file mode 100644 (file)
index 0000000..5d50801
--- /dev/null
@@ -0,0 +1,23 @@
+from pyjamas.ui.VerticalPanel import VerticalPanel
+from pyjamas.ui.HorizontalPanel import HorizontalPanel
+from pyjamas.ui.Button import Button
+from pyjamas.ui.HTML import HTML
+from pyjamas.ui import HasAlignment
+
+class InstancePanel(VerticalPanel):
+    def __init__(self, sfadata):
+        VerticalPanel.__init__(self)
+        self.sfadata = sfadata
+        self.setStyleName("ks-layouts")
+        
+    def refresh(self):
+        pass
+                    
+    def apply(self, sender):
+        self.sfadata.applyRSpec()
+
+    def reset(self, sender):
+        self.sfadata.refreshRSpec()
+        
+
+        
index 537f20b..2b8ae79 100644 (file)
@@ -1,13 +1,48 @@
 from Sink import Sink, SinkInfo
+from pyjamas.ui.TabPanel import TabPanel
+from pyjamas.ui.VerticalPanel import VerticalPanel
+from pyjamas.ui.TextArea import TextArea
 from pyjamas.ui.HTML import HTML
+from SfaData import OpenCirrusData
+from RequestPanel import RequestPanel
+from InstancePanel import InstancePanel
+from SubmitPanel import SubmitPanel
+from HelpPanel import OCHelpPanel
+
+class OCTabs(TabPanel):
+    def __init__(self, data):
+        TabPanel.__init__(self)
+
+        self.data = data
+        self.data.refreshRSpec()
+
+        requesttab = RequestPanel(self.data)
+        instancetab = InstancePanel(self.data)
+        submittab = SubmitPanel(self.data)
+        helptab = OCHelpPanel()
+
+        self.add(requesttab, "Request")
+        self.add(instancetab, "Instances")
+        self.add(submittab, "Submit")
+        self.add(HTML("force tabs to right"), None)
+        self.add(helptab, "Help")
+        self.selectTab(0)
+
+    def onTabSelected(self, sender, index):
+        tab = self.getWidget(index)
+        tab.refresh()
+        TabPanel.onTabSelected(self, sender, index)
 
 class OpenCirrus(Sink):
     def __init__(self):
 
         Sink.__init__(self)
 
-        text="Not implemented yet"
-        self.initWidget(HTML(text, True))
+        self.tabs = OCTabs(OpenCirrusData())
+
+        self.tabs.setWidth("100%")
+        self.tabs.setHeight("100%")
+        self.initWidget(self.tabs)
 
     def onShow(self):
         pass
diff --git a/RequestPanel.py b/RequestPanel.py
new file mode 100644 (file)
index 0000000..b011899
--- /dev/null
@@ -0,0 +1,23 @@
+from pyjamas.ui.VerticalPanel import VerticalPanel
+from pyjamas.ui.HorizontalPanel import HorizontalPanel
+from pyjamas.ui.Button import Button
+from pyjamas.ui.HTML import HTML
+from pyjamas.ui import HasAlignment
+
+class RequestPanel(VerticalPanel):
+    def __init__(self, sfadata):
+        VerticalPanel.__init__(self)
+        self.sfadata = sfadata
+        self.setStyleName("ks-layouts")
+        
+    def refresh(self):
+        pass
+                    
+    def apply(self, sender):
+        self.sfadata.applyRSpec()
+
+    def reset(self, sender):
+        self.sfadata.refreshRSpec()
+        
+
+        
index 9100b3e..b6d7331 100644 (file)
@@ -116,6 +116,18 @@ class GpENIData(PlanetLabData):
 class OpenCirrusData(SfaData):
     def __init__(self):
         SfaData.__init__(self)
-        self.registry = "http://www.planet-lab.org:12345"
-        self.slicemgr = "http://www.planet-lab.org:12346"
+        self.registry = "http://198.55.37.29:12345"
+        self.slicemgr = "http://198.55.37.29:12346"
+
+    def refreshRSpec(self):
+        xml = SfaData.getRSpec(self)
+        self.rspec = xml
 
+    def getRSpec(self):
+        if self.rspec is None:
+            self.refreshRSpec()
+        return self.rspec
+    
+    def applyRSpec(self):
+        xml = self.rspec
+        SfaData.applyRSpec(self, xml)