On Tue, May 16, 2017 at 03:26:20PM -0400, Shawn Doherty wrote:
Hello.
I'm trying to get my feet wet in adding some features to Beaker and running
into some hurdles. I was hoping to get some pointers please.
It would be helpful to have the ability to exclude all distros for a
system. I have placed 2 buttons on the SystemExclude form but it is VERY
crudely done. Part of the issue is that I'm not sure that I'm linking the
util.js file correctly, When I debug in a browser I can see the util file
is available but none of my appends to it are available(setup
build/install/restart httpd did not correct). I placed my functions inline
in the template but am very limited and have not been able to get arch
variables going correctly.
Any helpful information on how I can do better with widgets in Beaker?
Thanks, Shawn
Grr. I stumbled upon a similar problem where my csv_export.js file was
not being found. Turns out we have been installing things wrong and the
/usr/share/bkr/server/assets|static directory are not being updated
correctly.
Try this (which is a giant wrapper around 'python setup.py ...'):
make clean
DESTDIR=/ make install
and then check /usr/share/bkr/server/static/utils.js to see if your updates
passed through.
index 9246918..3a9b65f 100644
--- a/Server/bkr/server/widgets.py
+++ b/Server/bkr/server/widgets.py
@@ -41,7 +41,7 @@ class
AutoCompleteTextField(widgets.AutoCompleteTextField):
template="""
<span
xmlns:py="http://purl.org/kid/ns#"
class="${field_class}">
- <script type="text/javascript">
+ <script type="text/javascript"
src='/static/javascript/util.js'>
AutoCompleteManager${field_id} = new
AutoCompleteManager('${field_id}', '${field_id}', null,
'${search_controller}', '${search_param}',
'${result_name}',
${str(only_suggest).lower()},
'${show_spinner and
tg.url('/tg_widgets/turbogears.widgets/spinner.gif') or None}',
@@ -951,9 +951,31 @@ class SystemExclude(Form):
method="${method}" width="100%">
${display_field_for("id")}
${display_field_for("excluded_families")}
- <a py:if="not readonly" class="btn btn-primary"
href="javascript:document.${name}.submit();">Save Exclude Changes</a>
+
+ <!-- separate checkall from source-->
+ <span class="checkAll">
+ <a py:if="not readonly" class="btn btn-secondary btn-sm"
role="button"
onclick='javascript:checkMajor()'>Exclude All</a>
+ <!-- Todo toggle capability & proper variable for arch -->
+ <script type="text/javascript">
+ function checkMajor(){
+
$('[name="excluded_families.x86_64"]').prop("checked", true);
+ $('[name="excluded_families.i386"]').prop("checked",
true);
+ }
+ </script>
+ <a py:if="not readonly" class="btn btn-secondary btn-sm"
role="button"
onclick='javascript:uncheckMajor()'>Exclude None</a>
+ <script type="text/javascript">
+ function uncheckMajor(){
+
$('[name="excluded_families.x86_64"]').prop("checked",
false);
+ $('[name="excluded_families.i386"]').prop("checked",
false);
+ }
+ </script>
+ </span>
+
+ <a py:if="not readonly" class="btn btn-primary"
href="javascript:document.${name}.submit();">Save Exclude Changes</a>
</form>
"""
+ #not seeing js link in debug
+ javascript = [LocalJSLink('bkr', '/static/javascript/util.js')]
member_widgets = ["id", "excluded_families"]
params = ['options', 'readonly']
params_doc = {}
--- a/Server/bkr/server/static/javascript/util.js
+++ b/Server/bkr/server/static/javascript/util.js
@@ -109,3 +109,19 @@ function system_action_remote_form_request(form,
options, action) {
remoteRequest(form, action, null, query, options);
return true;
}
+
+
+function checkMajorCheckboxes(){
+ var majorDistro =
document.getElementsByName("excluded_families.x86_64");
+ for (var i = 0; i < majorDistro.length; i++){
+ majorDistro[i].checked = true;
+ }
+}
+
+function toggleMajorCheckboxes(){
+ var majorDistro =
document.getElementsByName("excluded_families.x86_64");
+ for (var i = 0; i < majorDistro.length; i++){
+ majorDistro[i].checked = !majorDistro[i].checked;
+ }
+}
+
--
Shawn Doherty
Software Engineer, Kernel-HW
Red Hat
<
https://www.redhat.com>
314 Littleton Rd
Westford, MA 01886
sdoherty(a)redhat.com T: 19785891080 INTERNAL:-8131080 IM: sdoherty
<
https://red.ht/sig>
_______________________________________________
Beaker-devel mailing list -- beaker-devel(a)lists.fedorahosted.org
To unsubscribe send an email to beaker-devel-leave(a)lists.fedorahosted.org