r4761 - in trunk/cumin: python/cumin/grid resources
by croberts@fedoraproject.org
Author: croberts
Date: 2011-05-12 14:18:15 +0000 (Thu, 12 May 2011)
New Revision: 4761
Modified:
trunk/cumin/python/cumin/grid/limit.py
trunk/cumin/python/cumin/grid/limit.strings
trunk/cumin/resources/app.css
Log:
In order to address BZ https://bugzilla.redhat.com/show_bug.cgi?id=697016 I have modified the Limit form to include an "Unlimited" button that will change the value in the box to "Unlimited". In addition, the back end will now support "Unlimited" as a valid input which gets translated to a large number to be sent to condor...the user will still see "unlimited" anytime they set a value over 1M.
Modified: trunk/cumin/python/cumin/grid/limit.py
===================================================================
--- trunk/cumin/python/cumin/grid/limit.py 2011-05-09 12:59:44 UTC (rev 4760)
+++ trunk/cumin/python/cumin/grid/limit.py 2011-05-12 14:18:15 UTC (rev 4761)
@@ -1,20 +1,23 @@
-import logging
-
from cumin.formats import fmt_link
from cumin.model import QmfCall
-from cumin.objectselector import ObjectTableColumn, ObjectQmfSelector,\
+from cumin.objectframe import ObjectFrame, ObjectFrameTask, \
+ ObjectFrameTaskFeedbackForm
+from cumin.objectselector import ObjectTableColumn, ObjectQmfSelector, \
ObjectQmfTable
-from cumin.objectframe import ObjectFrame, ObjectFrameTask,\
- ObjectFrameTaskFeedbackForm
from cumin.qmfadapter import ObjectQmfAdapter
from cumin.widgets import CuminView
-
-from wooly.forms import StringField, StringInput, IntegerField, RealField
+from wooly.forms import StringField, StringInput, IntegerField, RealField, \
+ FormButton, FormField, FormError
from wooly.util import StringCatalog
from wooly.widgets import TabbedModeSet
+from wooly.parameters import *
+import logging
+
+
strings = StringCatalog(__file__)
log = logging.getLogger("cumin.limit")
+LIMIT_FLOAT_VALUE_FOR_UNLIMITED = 1000000.0
class LimitAdapter(ObjectQmfAdapter):
def __init__(self, app, cls, collector):
@@ -104,7 +107,7 @@
limit_max = super(LimitTable.MaxColumn, self).render_cell_content(session, data)
try:
limit_max = float(limit_max)
- if limit_max > 1000000.0:
+ if limit_max >= LIMIT_FLOAT_VALUE_FOR_UNLIMITED:
limit_max = "Unlimited"
except:
limit_max = 0
@@ -177,13 +180,25 @@
self.limit_max = self.LimitMax(app, "max")
self.limit_max.required = True
self.add_field(self.limit_max)
+
+ self.reset_button = self.ResetLimitFormButton(app, "resetbutton")
+ self.add_field(self.reset_button)
+
+
def process_submit(self, session):
- self.validate(session)
+ new_max_value = self.limit_max.input.get(session)
+
+ self.limit_max.validate(session)
+ if not self.errors.get(session):
+ if new_max_value.lower() in ("unlimited", "na", "n/a") or float(new_max_value) >= LIMIT_FLOAT_VALUE_FOR_UNLIMITED:
+ self.limit_max.set(session, LIMIT_FLOAT_VALUE_FOR_UNLIMITED)
+ else:
+ self.limit_max.set(session,new_max_value)
if not self.errors.get(session):
limit_name = self.limit_name.get(session)
- limit_max = self.limit_max.get(session)
+ limit_max = self.limit_max.get_float_value(session)
negotiator = self.object.get(session)
self.task.invoke(session, negotiator, limit_name, limit_max)
@@ -192,6 +207,19 @@
def render_form_class(self, session):
return " ".join((super(NegotiatorLimitForm, self).render_form_class(session), "mform"))
+ class ResetLimitFormButton(FormField):
+ def __init__(self, app, name):
+ super(NegotiatorLimitForm.ResetLimitFormButton, self).__init__(app, name)
+ self.button_tmpl = WidgetTemplate(self, "reset_button_html")
+
+ def do_render(self, session):
+ writer = Writer()
+ self.button_tmpl.render(writer, session)
+ return writer.to_string()
+
+ def render_class(self, session):
+ return "midformbutton"
+
class LimitName(StringField):
def __init__(self, app, name):
super(NegotiatorLimitForm.LimitName, self).__init__(app, name)
@@ -206,10 +234,35 @@
# used to override html and css
pass
- class LimitMax(RealField):
+ class LimitMax(StringField):
def render_title(self, session):
return "Max Allowance"
-
+
+ def get(self,session):
+ # this gets the value for display
+ value = self.input.get(session)
+ if value >= LIMIT_FLOAT_VALUE_FOR_UNLIMITED:
+ value = "Unlimited"
+ return value
+
+ def get_float_value(self,session):
+ # this gets the value sent via QMF to reset the limit
+ value = self.input.get(session)
+ if float(value) >= LIMIT_FLOAT_VALUE_FOR_UNLIMITED:
+ value = LIMIT_FLOAT_VALUE_FOR_UNLIMITED
+ return value
+
+ def validate(self, session):
+ value = self.input.get(session)
+ if value:
+ try:
+ if value not in ("unlimited", "na", "n/a"):
+ value = float(value)
+ except:
+ title = self.render_title(session)
+ message = "The '%s' field must be either \"unlimited\", an integer or a float" % title
+ self.form.errors.add(session, FormError(message))
+
class LimitView(CuminView):
def __init__(self, app, name, limit):
super(LimitView, self).__init__(app, name, None)
Modified: trunk/cumin/python/cumin/grid/limit.strings
===================================================================
--- trunk/cumin/python/cumin/grid/limit.strings 2011-05-09 12:59:44 UTC (rev 4760)
+++ trunk/cumin/python/cumin/grid/limit.strings 2011-05-12 14:18:15 UTC (rev 4761)
@@ -30,3 +30,17 @@
);
//]]>
</script>
+
+[ResetLimitFormButton.reset_button_html]
+<tr id="{id}">
+ <th></th>
+ <td><button class="{class}" type="button" name="{id}" onclick="return resetLimitMax();">Unlimited</button></td>
+</tr>
+<script type="text/javascript">
+//<![CDATA[
+function resetLimitMax() {
+ document.forms[0].elements[1].value="Unlimited";
+ return false;
+}
+//]]>
+</script>
Modified: trunk/cumin/resources/app.css
===================================================================
--- trunk/cumin/resources/app.css 2011-05-09 12:59:44 UTC (rev 4760)
+++ trunk/cumin/resources/app.css 2011-05-12 14:18:15 UTC (rev 4761)
@@ -237,6 +237,10 @@
padding: 0.25em 0.25em 0 0.25em;
}
+form.mform button.midformbutton {
+ margin: 0em;
+}
+
form.mform a.help {
float: left;
margin: 0.5em;
12 years, 11 months
r4760 - trunk/cumin/python/cumin
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-05-09 12:59:44 +0000 (Mon, 09 May 2011)
New Revision: 4760
Modified:
trunk/cumin/python/cumin/model.py
Log:
Remove CuminStat class, no longer used.
Modified: trunk/cumin/python/cumin/model.py
===================================================================
--- trunk/cumin/python/cumin/model.py 2011-05-09 12:58:48 UTC (rev 4759)
+++ trunk/cumin/python/cumin/model.py 2011-05-09 12:59:44 UTC (rev 4760)
@@ -412,121 +412,6 @@
return "%s %s" % (pred0, pred1)
-class CuminStat(object):
- def __init__(self, cls, name):
- self.model = cls.model
- self.cumin_class = cls
-
- self.name = name
- self.unit = None
- self.title = None
- self.category = "general"
- self.summary = False
- self.format = None
-
- self.link_cb = None
- self.highlow = False
-
- self.cumin_class.add_stat(self)
-
- def init(self):
- pass
-
- def get_connection(self):
- return self.app.database.get_connection()
-
- def get_db_name(self):
- name = self.name
- nname = list()
- for c in name:
- if c.isupper():
- if len(nname):
- nname.append("_")
- c = c.lower()
- nname.append(c)
- return "".join(nname)
-
- def value_html(self, object):
- text = self.value_text(object)
-
- if text:
- html = text
- else:
- html = fmt_none_brief()
-
- return html
-
- def value_text(self, object):
- value = self.value(object)
-
- if value is None:
- text = ""
- elif self.format:
- text = self.format % value
- elif type(value) in (int, long, Decimal):
- if value == 0:
- text = "0"
- else:
- text = "%i" % value
- else:
- text = "%r" % value
-
- return text
-
- def value(self, object):
- try:
- return getattr(object, self.name)
- except AttributeError:
- pass
-
- def rate_html(self, object):
- text = self.rate_text(object)
-
- if text:
- html = text
- else:
- html = fmt_none_brief()
-
- return html
-
- def rate_text(self, object):
- rate = self.rate(object)
-
- if rate is None:
- text = ""
- elif rate == 0:
- text = "0"
- else:
- text = "%0.2f" % rate
-
- return text
-
- def rate(self, object):
- threshold = datetime.now() - timedelta(minutes=10)
-
- try:
- if object.statsCurr and object.statsCurr.qmfUpdateTime > threshold:
- curr = getattr(object.statsCurr, self.name)
- ctime = object.statsCurr.qmfUpdateTime
- csecs = mktime(ctime.timetuple())
-
- if object.statsPrev:
- prev = getattr(object.statsPrev, self.name)
- ptime = object.statsPrev.qmfUpdateTime
- psecs = mktime(ptime.timetuple())
-
- if curr is not None and prev is not None:
- return calc_rate(curr, prev, csecs, psecs)
- except AttributeError:
- pass
-
- def write_xml(self, writer, object):
- value = self.value_text(object)
- rate = self.rate_text(object)
-
- writer.write("<stat name=\"%s\" value=\"%s\" rate=\"%s\"/>" \
- % (self.name, value, rate))
-
class SamplesSqlAdapter(SqlAdapter):
qmf_update_col = '_qmf_update_time'
12 years, 11 months
r4759 - trunk/wooly/python/wooly
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-05-09 12:58:48 +0000 (Mon, 09 May 2011)
New Revision: 4759
Modified:
trunk/wooly/python/wooly/sql.py
Log:
Allow null where expressions on sql queries.
Modified: trunk/wooly/python/wooly/sql.py
===================================================================
--- trunk/wooly/python/wooly/sql.py 2011-05-09 12:58:08 UTC (rev 4758)
+++ trunk/wooly/python/wooly/sql.py 2011-05-09 12:58:48 UTC (rev 4759)
@@ -118,9 +118,9 @@
def render_sql_where(self, session):
exprs = self.where_exprs.get(session)
+ if exprs:
+ return "where %s" % " and ".join(exprs)
- return "where %s" % " and ".join(exprs)
-
def render_sql_order_by(self, session):
pass
12 years, 11 months
r4758 - trunk/cumin/python/cumin/usergrid
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-05-09 12:58:08 +0000 (Mon, 09 May 2011)
New Revision: 4758
Modified:
trunk/cumin/python/cumin/usergrid/model.py
Log:
Change get_connection to get_read_connection for user grid operations
Modified: trunk/cumin/python/cumin/usergrid/model.py
===================================================================
--- trunk/cumin/python/cumin/usergrid/model.py 2011-05-05 12:53:49 UTC (rev 4757)
+++ trunk/cumin/python/cumin/usergrid/model.py 2011-05-09 12:58:08 UTC (rev 4758)
@@ -15,7 +15,7 @@
return self.user.get(session).name
def get_connection(self, session):
- return self.app.database.get_connection()
+ return self.app.database.get_read_connection()
def get_object(self, session):
cursor = self.execute(session)
12 years, 11 months
r4757 - in branches/stability/cumin: open-flash-chart python/cumin python/cumin/account
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-05-05 12:53:49 +0000 (Thu, 05 May 2011)
New Revision: 4757
Removed:
branches/stability/cumin/open-flash-chart/build.xml
Modified:
branches/stability/cumin/python/cumin/account/widgets.py
branches/stability/cumin/python/cumin/account/widgets.strings
branches/stability/cumin/python/cumin/charts.py
branches/stability/cumin/python/cumin/main.py
branches/stability/cumin/python/cumin/stat.py
branches/stability/cumin/python/cumin/task.py
branches/stability/cumin/python/cumin/task.strings
branches/stability/cumin/python/cumin/widgets.py
branches/stability/cumin/python/cumin/widgets.strings
Log:
Stability set should be based on 4746
Deleted: branches/stability/cumin/open-flash-chart/build.xml
===================================================================
--- branches/stability/cumin/open-flash-chart/build.xml 2011-05-05 12:24:12 UTC (rev 4756)
+++ branches/stability/cumin/open-flash-chart/build.xml 2011-05-05 12:53:49 UTC (rev 4757)
@@ -1,15 +0,0 @@
-<project name='Flex' default='mxml'>
- <target name='mxml'>
- <!-- Be sure to define FLEX_HOME and FLASH_DEPLOY, ex:
- -DFLEX_HOME=/home/croberts/flex -DFLASH_DEPLOY=/home/croberts/workspace/cumin-trunk/cumin/resources
- -->
- <property name='compiler' location='${FLEX_HOME}/bin/mxmlc' />
- <exec executable='${compiler}' failonerror='true'>
- <arg line='-output ${FLASH_DEPLOY}/open-flash-chart.swf' />
- <arg line='-static-link-runtime-shared-libraries=true' />
- <arg line='-debug=true' />
- <arg line='main.as' />
- </exec>
- <echo>swf file generated successfully</echo>
- </target>
-</project>
\ No newline at end of file
Modified: branches/stability/cumin/python/cumin/account/widgets.py
===================================================================
--- branches/stability/cumin/python/cumin/account/widgets.py 2011-05-05 12:24:12 UTC (rev 4756)
+++ branches/stability/cumin/python/cumin/account/widgets.py 2011-05-05 12:53:49 UTC (rev 4757)
@@ -35,6 +35,9 @@
self.settings = SettingsFrame(app, "main")
self.add_tab(self.settings)
+ self.about = AboutFrame(app, "about")
+ self.add_tab(self.about)
+
class SettingsFrame(Frame):
def __init__(self, app, name):
super(SettingsFrame, self).__init__(app, name)
@@ -61,7 +64,42 @@
def render_content(self, sessino):
return "Change password"
+class AboutFrame(Frame):
+ def __init__(self, app, name):
+ super(AboutFrame, self).__init__(app, name)
+ content = AboutContent(app, "about_content")
+ self.add_child(content)
+ def render_title(self, session):
+ return "About the console"
+
+class AboutContent(Widget):
+ def __init__(self, app, name):
+ super(AboutContent, self).__init__(app, name)
+
+ self.version_string = ""
+ self.version_local = False
+
+ # Look for version info in our well-known file.
+ version_path = os.path.join(self.app.home, "version")
+ if os.path.isfile(version_path):
+ # Permission errors or corrupt file always possible
+ try:
+ f = open(version_path)
+ self.version_string = f.readline().strip()
+ self.version_local = f.readline().strip() == "local"
+ except:
+ pass
+
+ if len(self.version_string) == 0:
+ self.version_string = "Version has not been set"
+
+ def render_version(self, session):
+ res = self.version_string
+ if self.version_local:
+ res += ", devel instance"
+ return res
+
class LoginPage(HtmlPage):
def __init__(self, app, name):
super(LoginPage, self).__init__(app, name)
Modified: branches/stability/cumin/python/cumin/account/widgets.strings
===================================================================
--- branches/stability/cumin/python/cumin/account/widgets.strings 2011-05-05 12:24:12 UTC (rev 4756)
+++ branches/stability/cumin/python/cumin/account/widgets.strings 2011-05-05 12:53:49 UTC (rev 4757)
@@ -76,3 +76,9 @@
<p class="login_invalid">The user name and password you entered do not
match any account.</p>
+[AboutContent.html]
+<div>
+<h3>Management console version</h3>
+{version}
+</div>
+
Modified: branches/stability/cumin/python/cumin/charts.py
===================================================================
--- branches/stability/cumin/python/cumin/charts.py 2011-05-05 12:24:12 UTC (rev 4756)
+++ branches/stability/cumin/python/cumin/charts.py 2011-05-05 12:53:49 UTC (rev 4757)
@@ -365,8 +365,8 @@
value = fraction * self.y_max - self.y_min
value = int(round(value + self.y_min))
- if value >= 1000000:
- svalue = "%.2fm" % (round(value / 1000000.0, 2))
+ if value >= 10000000:
+ svalue = "%im" % int(round(value / 1000000.0, -1))
elif value >= 10000:
svalue = "%ik" % int(round(value / 1000.0, -1))
else:
Modified: branches/stability/cumin/python/cumin/main.py
===================================================================
--- branches/stability/cumin/python/cumin/main.py 2011-05-05 12:24:12 UTC (rev 4756)
+++ branches/stability/cumin/python/cumin/main.py 2011-05-05 12:53:49 UTC (rev 4757)
@@ -24,7 +24,6 @@
from wooly import Session
from cumin.stat import PieChartPage
-from cumin.widgets import AboutPage
strings = StringCatalog(__file__)
log = logging.getLogger("cumin")
@@ -74,7 +73,7 @@
# Space separated list of sasl authentication
# mechanisms, according to the sasl documentation
self.sasl_mech_list = None
-
+
def server_alive(self):
return self.server.server_alive()
@@ -172,9 +171,6 @@
self.export_page = CuminExportPage(self, "csv")
self.add_page(self.export_page)
-
- self.about_page = AboutPage(self, "about.html")
- self.add_page(self.about_page)
self.resource_page.protected = False
Modified: branches/stability/cumin/python/cumin/stat.py
===================================================================
--- branches/stability/cumin/python/cumin/stat.py 2011-05-05 12:24:12 UTC (rev 4756)
+++ branches/stability/cumin/python/cumin/stat.py 2011-05-05 12:53:49 UTC (rev 4757)
@@ -939,8 +939,8 @@
if i % step == 0:
value = int(round(i * y_step, 0))
- if value >= 1000000:
- svalue = "%.2fm" % (round(value / 1000000.0, 2))
+ if value >= 10000000:
+ svalue = "%im" % int(round(value / 1000000.0, -1))
elif value >= 10000:
svalue = "%ik" % int(round(value / 1000.0, -1))
else:
@@ -1053,7 +1053,7 @@
if secs(dt) < min_dt:
break
- vals.sort(key=lambda stat: stat["dt"], reverse=False) #here, we sort by dt to be sure that our graphs are valid
+ vals.reverse()
return vals
def make_chart_lines(self, session, chart, line_type, stats, dot_size, halo_size, line_width, samples, duration, end_secs, mode):
Modified: branches/stability/cumin/python/cumin/task.py
===================================================================
--- branches/stability/cumin/python/cumin/task.py 2011-05-05 12:24:12 UTC (rev 4756)
+++ branches/stability/cumin/python/cumin/task.py 2011-05-05 12:53:49 UTC (rev 4757)
@@ -189,9 +189,6 @@
self.dismiss = IntegerParameter(app, "dismiss")
self.add_parameter(self.dismiss)
-
- self.dismiss_all = BooleanParameter(app, "dismiss_all")
- self.add_parameter(self.dismiss_all)
self.item_widget = TaskInvocationItem(app, "item")
self.add_child(self.item_widget)
@@ -204,20 +201,15 @@
super(TaskInvocationSet, self).do_process(session)
dismiss = self.dismiss.get(session)
- dismiss_all = self.dismiss_all.get(session)
-
- if(dismiss_all):
- for invoc in self.get_items(session):
- invoc.dismissed = True
- self.dismiss_all.set(session, self.dismiss_all.default)
-
+
if dismiss:
- for invoc in self.get_items(session):
- if id(invoc) == dismiss:
- invoc.dismissed = True
- break
- self.dismiss.set(session, self.dismiss.default)
+ for invoc in self.get_items(session):
+ if id(invoc) == dismiss:
+ invoc.dismissed = True
+ break
+ self.dismiss.set(session, self.dismiss.default)
+ #self.dismiss.unset(session)
def do_render(self, session):
items = self.get_items(session)
@@ -232,11 +224,6 @@
writer.write(self.item_widget.render(session, item))
return writer.to_string()
-
- def render_dismiss_all_href(self, session):
- branch = session.branch()
- self.dismiss_all.set(branch, True)
- return branch.marshal()
class TaskInvocationItem(Widget):
def render_icon_href(self, session, item):
Modified: branches/stability/cumin/python/cumin/task.strings
===================================================================
--- branches/stability/cumin/python/cumin/task.strings 2011-05-05 12:24:12 UTC (rev 4756)
+++ branches/stability/cumin/python/cumin/task.strings 2011-05-05 12:53:49 UTC (rev 4757)
@@ -24,7 +24,7 @@
[TaskInvocationSet.html]
<div id="{id}" class="{class}">
- <a class="dismissall" href="{dismiss_all_href}">Dismiss all</a>
+ <!-- <a class="dismissall" href="">Dismiss all</a> -->
<ul>{items}</ul>
</div>
Modified: branches/stability/cumin/python/cumin/widgets.py
===================================================================
--- branches/stability/cumin/python/cumin/widgets.py 2011-05-05 12:24:12 UTC (rev 4756)
+++ branches/stability/cumin/python/cumin/widgets.py 2011-05-05 12:53:49 UTC (rev 4757)
@@ -83,11 +83,6 @@
return branch.marshal()
else:
return super(CuminMainView, self).render_tab_href(session, tab)
-
- def render_about_href(self, session):
- page = self.app.about_page
- lsess = Session(page)
- return lsess.marshal()
class CuminPageLinks(ItemSet):
def __init__(self, app, name):
@@ -1627,57 +1622,3 @@
class TopTableFooter(Widget):
def render(self, session):
return ""
-
-class AboutPage(CuminPage, ModeSet):
- def __init__(self, app, name):
- super(AboutPage, self).__init__(app, name)
-
- self.about = AboutMainView(app, "about")
- self.add_mode(self.about)
- self.set_default_frame(self.about)
-
- def render_title(self, session):
- return "About"
-
-class AboutFrame(Frame):
- def __init__(self, app, name):
- super(AboutFrame, self).__init__(app, name)
- content = AboutContent(app, "about_content")
- self.add_child(content)
-
- def render_title(self, session):
- return "About the console"
-
-class AboutMainView(CuminMainView):
- def __init__(self, app, name):
- super(AboutMainView, self).__init__(app, name)
-
- self.about = AboutFrame(app, "about")
- self.add_tab(self.about)
-
-class AboutContent(Widget):
- def __init__(self, app, name):
- super(AboutContent, self).__init__(app, name)
-
- self.version_string = ""
- self.version_local = False
-
- # Look for version info in our well-known file.
- version_path = os.path.join(self.app.home, "version")
- if os.path.isfile(version_path):
- # Permission errors or corrupt file always possible
- try:
- f = open(version_path)
- self.version_string = f.readline().strip()
- self.version_local = f.readline().strip() == "local"
- except:
- pass
-
- if len(self.version_string) == 0:
- self.version_string = "Version has not been set"
-
- def render_version(self, session):
- res = self.version_string
- if self.version_local:
- res += ", devel instance"
- return res
Modified: branches/stability/cumin/python/cumin/widgets.strings
===================================================================
--- branches/stability/cumin/python/cumin/widgets.strings 2011-05-05 12:24:12 UTC (rev 4756)
+++ branches/stability/cumin/python/cumin/widgets.strings 2011-05-05 12:53:49 UTC (rev 4757)
@@ -155,8 +155,6 @@
Hi, {user_name}
<span class="separator">|</span>
<a id="logout" onclick="wooly.clearUpdates()" href="{logout_href}">Log out</a>
- <span class="separator">|</span>
- <a href="{about_href}">About</a>
</div>
<div id="global">
@@ -903,9 +901,3 @@
[StaticColumnHeader.html]
<th class="{class}">{content}</th>
-[AboutContent.html]
-<div>
-<h3>Management console version</h3>
-{version}
-</div>
-
12 years, 12 months
r4756 - branches
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-05-05 12:24:12 +0000 (Thu, 05 May 2011)
New Revision: 4756
Added:
branches/stability/
Log:
Create branch for selective inclusions
12 years, 12 months
r4755 - branches
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-05-05 12:10:43 +0000 (Thu, 05 May 2011)
New Revision: 4755
Removed:
branches/1.3.2/
Log:
Branch no longer necessary
12 years, 12 months
r4754 - branches
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-05-05 12:07:10 +0000 (Thu, 05 May 2011)
New Revision: 4754
Removed:
branches/multiples/
Log:
Brach was for intermediate work.
12 years, 12 months
r4753 - in trunk/cumin/python/cumin: . account
by croberts@fedoraproject.org
Author: croberts
Date: 2011-05-04 20:10:13 +0000 (Wed, 04 May 2011)
New Revision: 4753
Modified:
trunk/cumin/python/cumin/account/widgets.py
trunk/cumin/python/cumin/account/widgets.strings
trunk/cumin/python/cumin/main.py
trunk/cumin/python/cumin/widgets.py
trunk/cumin/python/cumin/widgets.strings
Log:
Moving the "About" link to a better spot per RFE BZ: https://bugzilla.redhat.com/show_bug.cgi?id=694827 .
Modified: trunk/cumin/python/cumin/account/widgets.py
===================================================================
--- trunk/cumin/python/cumin/account/widgets.py 2011-05-04 18:48:54 UTC (rev 4752)
+++ trunk/cumin/python/cumin/account/widgets.py 2011-05-04 20:10:13 UTC (rev 4753)
@@ -35,9 +35,6 @@
self.settings = SettingsFrame(app, "main")
self.add_tab(self.settings)
- self.about = AboutFrame(app, "about")
- self.add_tab(self.about)
-
class SettingsFrame(Frame):
def __init__(self, app, name):
super(SettingsFrame, self).__init__(app, name)
@@ -64,42 +61,7 @@
def render_content(self, sessino):
return "Change password"
-class AboutFrame(Frame):
- def __init__(self, app, name):
- super(AboutFrame, self).__init__(app, name)
- content = AboutContent(app, "about_content")
- self.add_child(content)
- def render_title(self, session):
- return "About the console"
-
-class AboutContent(Widget):
- def __init__(self, app, name):
- super(AboutContent, self).__init__(app, name)
-
- self.version_string = ""
- self.version_local = False
-
- # Look for version info in our well-known file.
- version_path = os.path.join(self.app.home, "version")
- if os.path.isfile(version_path):
- # Permission errors or corrupt file always possible
- try:
- f = open(version_path)
- self.version_string = f.readline().strip()
- self.version_local = f.readline().strip() == "local"
- except:
- pass
-
- if len(self.version_string) == 0:
- self.version_string = "Version has not been set"
-
- def render_version(self, session):
- res = self.version_string
- if self.version_local:
- res += ", devel instance"
- return res
-
class LoginPage(HtmlPage):
def __init__(self, app, name):
super(LoginPage, self).__init__(app, name)
Modified: trunk/cumin/python/cumin/account/widgets.strings
===================================================================
--- trunk/cumin/python/cumin/account/widgets.strings 2011-05-04 18:48:54 UTC (rev 4752)
+++ trunk/cumin/python/cumin/account/widgets.strings 2011-05-04 20:10:13 UTC (rev 4753)
@@ -76,9 +76,3 @@
<p class="login_invalid">The user name and password you entered do not
match any account.</p>
-[AboutContent.html]
-<div>
-<h3>Management console version</h3>
-{version}
-</div>
-
Modified: trunk/cumin/python/cumin/main.py
===================================================================
--- trunk/cumin/python/cumin/main.py 2011-05-04 18:48:54 UTC (rev 4752)
+++ trunk/cumin/python/cumin/main.py 2011-05-04 20:10:13 UTC (rev 4753)
@@ -24,6 +24,7 @@
from wooly import Session
from cumin.stat import PieChartPage
+from cumin.widgets import AboutPage
strings = StringCatalog(__file__)
log = logging.getLogger("cumin")
@@ -73,7 +74,7 @@
# Space separated list of sasl authentication
# mechanisms, according to the sasl documentation
self.sasl_mech_list = None
-
+
def server_alive(self):
return self.server.server_alive()
@@ -171,6 +172,9 @@
self.export_page = CuminExportPage(self, "csv")
self.add_page(self.export_page)
+
+ self.about_page = AboutPage(self, "about.html")
+ self.add_page(self.about_page)
self.resource_page.protected = False
Modified: trunk/cumin/python/cumin/widgets.py
===================================================================
--- trunk/cumin/python/cumin/widgets.py 2011-05-04 18:48:54 UTC (rev 4752)
+++ trunk/cumin/python/cumin/widgets.py 2011-05-04 20:10:13 UTC (rev 4753)
@@ -83,6 +83,11 @@
return branch.marshal()
else:
return super(CuminMainView, self).render_tab_href(session, tab)
+
+ def render_about_href(self, session):
+ page = self.app.about_page
+ lsess = Session(page)
+ return lsess.marshal()
class CuminPageLinks(ItemSet):
def __init__(self, app, name):
@@ -1622,3 +1627,57 @@
class TopTableFooter(Widget):
def render(self, session):
return ""
+
+class AboutPage(CuminPage, ModeSet):
+ def __init__(self, app, name):
+ super(AboutPage, self).__init__(app, name)
+
+ self.about = AboutMainView(app, "about")
+ self.add_mode(self.about)
+ self.set_default_frame(self.about)
+
+ def render_title(self, session):
+ return "About"
+
+class AboutFrame(Frame):
+ def __init__(self, app, name):
+ super(AboutFrame, self).__init__(app, name)
+ content = AboutContent(app, "about_content")
+ self.add_child(content)
+
+ def render_title(self, session):
+ return "About the console"
+
+class AboutMainView(CuminMainView):
+ def __init__(self, app, name):
+ super(AboutMainView, self).__init__(app, name)
+
+ self.about = AboutFrame(app, "about")
+ self.add_tab(self.about)
+
+class AboutContent(Widget):
+ def __init__(self, app, name):
+ super(AboutContent, self).__init__(app, name)
+
+ self.version_string = ""
+ self.version_local = False
+
+ # Look for version info in our well-known file.
+ version_path = os.path.join(self.app.home, "version")
+ if os.path.isfile(version_path):
+ # Permission errors or corrupt file always possible
+ try:
+ f = open(version_path)
+ self.version_string = f.readline().strip()
+ self.version_local = f.readline().strip() == "local"
+ except:
+ pass
+
+ if len(self.version_string) == 0:
+ self.version_string = "Version has not been set"
+
+ def render_version(self, session):
+ res = self.version_string
+ if self.version_local:
+ res += ", devel instance"
+ return res
Modified: trunk/cumin/python/cumin/widgets.strings
===================================================================
--- trunk/cumin/python/cumin/widgets.strings 2011-05-04 18:48:54 UTC (rev 4752)
+++ trunk/cumin/python/cumin/widgets.strings 2011-05-04 20:10:13 UTC (rev 4753)
@@ -155,6 +155,8 @@
Hi, {user_name}
<span class="separator">|</span>
<a id="logout" onclick="wooly.clearUpdates()" href="{logout_href}">Log out</a>
+ <span class="separator">|</span>
+ <a href="{about_href}">About</a>
</div>
<div id="global">
@@ -901,3 +903,9 @@
[StaticColumnHeader.html]
<th class="{class}">{content}</th>
+[AboutContent.html]
+<div>
+<h3>Management console version</h3>
+{version}
+</div>
+
12 years, 12 months
r4752 - trunk/cumin/python/cumin
by croberts@fedoraproject.org
Author: croberts
Date: 2011-05-04 18:48:54 +0000 (Wed, 04 May 2011)
New Revision: 4752
Modified:
trunk/cumin/python/cumin/task.py
trunk/cumin/python/cumin/task.strings
Log:
Adding a link to the yellow "notification box" to dismiss all notifications. This is per BZ https://bugzilla.redhat.com/show_bug.cgi?id=698106
Modified: trunk/cumin/python/cumin/task.py
===================================================================
--- trunk/cumin/python/cumin/task.py 2011-05-04 18:19:55 UTC (rev 4751)
+++ trunk/cumin/python/cumin/task.py 2011-05-04 18:48:54 UTC (rev 4752)
@@ -189,6 +189,9 @@
self.dismiss = IntegerParameter(app, "dismiss")
self.add_parameter(self.dismiss)
+
+ self.dismiss_all = BooleanParameter(app, "dismiss_all")
+ self.add_parameter(self.dismiss_all)
self.item_widget = TaskInvocationItem(app, "item")
self.add_child(self.item_widget)
@@ -201,15 +204,20 @@
super(TaskInvocationSet, self).do_process(session)
dismiss = self.dismiss.get(session)
-
+ dismiss_all = self.dismiss_all.get(session)
+
+ if(dismiss_all):
+ for invoc in self.get_items(session):
+ invoc.dismissed = True
+ self.dismiss_all.set(session, self.dismiss_all.default)
+
if dismiss:
- for invoc in self.get_items(session):
- if id(invoc) == dismiss:
- invoc.dismissed = True
- break
+ for invoc in self.get_items(session):
+ if id(invoc) == dismiss:
+ invoc.dismissed = True
+ break
+ self.dismiss.set(session, self.dismiss.default)
- self.dismiss.set(session, self.dismiss.default)
- #self.dismiss.unset(session)
def do_render(self, session):
items = self.get_items(session)
@@ -224,6 +232,11 @@
writer.write(self.item_widget.render(session, item))
return writer.to_string()
+
+ def render_dismiss_all_href(self, session):
+ branch = session.branch()
+ self.dismiss_all.set(branch, True)
+ return branch.marshal()
class TaskInvocationItem(Widget):
def render_icon_href(self, session, item):
Modified: trunk/cumin/python/cumin/task.strings
===================================================================
--- trunk/cumin/python/cumin/task.strings 2011-05-04 18:19:55 UTC (rev 4751)
+++ trunk/cumin/python/cumin/task.strings 2011-05-04 18:48:54 UTC (rev 4752)
@@ -24,7 +24,7 @@
[TaskInvocationSet.html]
<div id="{id}" class="{class}">
- <!-- <a class="dismissall" href="">Dismiss all</a> -->
+ <a class="dismissall" href="{dismiss_all_href}">Dismiss all</a>
<ul>{items}</ul>
</div>
12 years, 12 months