Build set default quota forms using client form builder

This commit is contained in:
guerler
2017-08-08 16:26:17 -04:00
parent ae181d776f
commit bd542000fa
10 changed files with 62902 additions and 63 deletions
+4
View File
@@ -94,6 +94,10 @@ window.app = function app( options, bootstrapped ){
url : 'admin/edit_quota?id=' + QueryStringParsing.get( 'id' ),
redirect : 'admin/quotas'
},
set_quota_default: {
url : 'admin/set_quota_default?id=' + QueryStringParsing.get( 'id' ),
redirect : 'admin/quotas'
},
};
this.page.display( new FormWrapper.View ( form_defs[ form_id ] ) );
}
+28 -19
View File
@@ -404,11 +404,11 @@ class QuotaListGrid( grids.Grid ):
grids.GridOperation( "Set as different type of default",
condition=( lambda item: item.default ),
allow_multiple=False,
url_args=dict( webapp="galaxy", action="set_quota_default" ) ),
url_args=dict( action="forms/set_quota_default" ) ),
grids.GridOperation( "Set as default",
condition=( lambda item: not item.default and not item.deleted ),
allow_multiple=False,
url_args=dict( webapp="galaxy", action="set_quota_default" ) ),
url_args=dict( action="forms/set_quota_default" ) ),
grids.GridOperation( "Unset as default",
condition=( lambda item: item.default and not item.deleted ),
allow_multiple=False ),
@@ -565,7 +565,7 @@ class AdminGalaxy( controller.JSAppLauncher, AdminActions, UsesQuotaMixin, Quota
message = self._undelete_quota( quotas )
elif operation == 'purge':
message = self._purge_quota( quotas )
elif operation == 'unset quota default':
elif operation == 'unset as default':
message = self._unset_quota_default( quotas[ 0 ] )
except ActionInputError as e:
message, status = ( e.err_msg, 'error' )
@@ -711,24 +711,33 @@ class AdminGalaxy( controller.JSAppLauncher, AdminActions, UsesQuotaMixin, Quota
except ActionInputError as e:
return message_exception( trans, e.err_msg )
@web.expose
@web.expose_api
@web.require_admin
def set_quota_default( self, trans, **kwd ):
quota, params = self._quota_op( trans, 'set_default_quota_button', self._set_quota_default, kwd )
if not quota:
return
if params.default:
default = params.default
elif quota.default:
default = quota.default[0].type
def set_quota_default( self, trans, payload=None, **kwd ):
id = kwd.get( 'id' )
if not id:
return message_exception( trans, 'No quota id received for renaming.' )
quota = get_quota( trans, id )
if trans.request.method == 'GET':
default_value = quota.default[ 0 ].type if quota.default else 'no'
default_options = [ ( 'No', 'no' ) ]
for typ in trans.app.model.DefaultQuotaAssociation.types.__dict__.values():
default_options.append( ( 'Yes, ' + typ, typ ) )
return {
'title' : 'Set quota default for \'%s\'' % util.sanitize_text( quota.name ),
'inputs' : [{
'name' : 'default',
'label' : 'Assign, increase by amount, or decrease by amount?',
'options' : default_options,
'value' : default_value,
'help' : 'Warning: Any users or groups associated with this quota will be disassociated.'
}]
}
else:
default = "no"
return trans.fill_template( '/admin/quota/quota_set_default.mako',
id=params.id,
default=default,
webapp=params.webapp,
message=params.message,
status=params.status )
try:
return { 'message': self._set_quota_default( quota, util.Params( payload ) ) }
except ActionInputError as e:
return message_exception( trans, e.err_msg )
@web.expose
@web.require_admin
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+48 -1
View File
@@ -1,2 +1,49 @@
webpackJsonp([5],[function(e,i,n){(function(e,i){var a=n(1),t=a,r=n(49).GalaxyApp,o=n(6),l=n(50);window.app=function(n,c){window.Galaxy=new r(n,c),Galaxy.debug("login app");var p=encodeURI(n.redirect);if(!n.show_welcome_with_login){var d=a.param({use_panels:"True",redirect:p});return void(window.location.href=Galaxy.root+"user/login?"+d)}var w=e.View.extend({initialize:function(i){this.page=i,this.model=new e.Model({title:o("Login required")}),this.setElement(this._template())},render:function(){this.page.$("#galaxy_main").prop("src",n.welcome_url)},_template:function(){var e=n.root+"user/login?"+t.param({redirect:p});return'<iframe src="'+e+'" frameborder="0" style="width: 100%; height: 100%;"/>'}});t(function(){Galaxy.page=new l.View(i.extend(n,{Right:w}))})}}).call(i,n(2),n(3))}]);
webpackJsonp([6],[
/* 0 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(Backbone, _) {var jQuery = __webpack_require__(2),
$ = jQuery,
GalaxyApp = __webpack_require__(3).GalaxyApp,
_l = __webpack_require__(7),
Page = __webpack_require__(40);
window.app = function app(options, bootstrapped) {
window.Galaxy = new GalaxyApp(options, bootstrapped);
Galaxy.debug('login app');
var redirect = encodeURI(options.redirect);
// TODO: remove iframe for user login (at least) and render login page from here
// then remove this redirect
if (!options.show_welcome_with_login) {
var params = jQuery.param({ use_panels: 'True', redirect: redirect });
window.location.href = Galaxy.root + 'user/login?' + params;
return;
}
var LoginPage = Backbone.View.extend({
initialize: function (page) {
this.page = page;
this.model = new Backbone.Model({ title: _l('Login required') });
this.setElement(this._template());
},
render: function () {
this.page.$('#galaxy_main').prop('src', options.welcome_url);
},
_template: function () {
var login_url = options.root + 'user/login?' + $.param({ redirect: redirect });
return '<iframe src="' + login_url + '" frameborder="0" style="width: 100%; height: 100%;"/>';
}
});
$(function () {
Galaxy.page = new Page.View(_.extend(options, {
Right: LoginPage
}));
});
};
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4), __webpack_require__(1)))
/***/ }
]);
//# sourceMappingURL=login.bundled.js.map
+1 -1
View File
@@ -1 +1 @@
{"version":3,"sources":["webpack:///login.bundled.js","webpack:///./galaxy/scripts/apps/login.js"],"names":["webpackJsonp","module","exports","__webpack_require__","Backbone","_","jQuery","$","GalaxyApp","_l","Page","window","app","options","bootstrapped","Galaxy","debug","redirect","encodeURI","show_welcome_with_login","params","param","use_panels","location","href","root","LoginPage","View","extend","initialize","page","this","model","Model","title","setElement","_template","render","prop","welcome_url","login_url","Right","call"],"mappings":"AAAAA,cAAc,IAER,SAASC,EAAQC,EAASC,ICFhC,SAAAC,EAAAC,GAAA,GAAIC,GAASH,EAAS,GAClBI,EAAID,EACJE,EAAYL,EAAS,IAAWK,UAChCC,EAAKN,EAAS,GACdO,EAAOP,EAAS,GAEpBQ,QAAOC,IAAM,SAAcC,EAASC,GAChCH,OAAOI,OAAS,GAAIP,GAAWK,EAASC,GACxCC,OAAOC,MAAO,YACd,IAAIC,GAAWC,UAAWL,EAAQI,SAIlC,KAAKJ,EAAQM,wBAAyB,CAClC,GAAIC,GAASd,EAAOe,OAAQC,WAAa,OAAQL,SAAWA,GAE5D,aADAN,OAAOY,SAASC,KAAOT,OAAOU,KAAO,cAAgBL,GAIzD,GAAIM,GAAYtB,EAASuB,KAAKC,QAC1BC,WAAY,SAAUC,GAClBC,KAAKD,KAAOA,EACZC,KAAKC,MAAQ,GAAI5B,GAAS6B,OAAQC,MAAQzB,EAAI,oBAC9CsB,KAAKI,WAAYJ,KAAKK,cAE1BC,OAAQ,WACJN,KAAKD,KAAKvB,EAAG,gBAAiB+B,KAAM,MAAOzB,EAAQ0B,cAEvDH,UAAY,WACR,GAAII,GAAY3B,EAAQY,KAAO,cAAgBlB,EAAEc,OAASJ,SAAWA,GACrE,OAAO,gBAAkBuB,EAAY,2DAI7CjC,GAAE,WACEQ,OAAOe,KAAO,GAAIpB,GAAKiB,KAAMtB,EAAEuB,OAAQf,GACnC4B,MAAQf,UDQUgB,KAAKxC,EAASC,EAAoB,GAAIA,EAAoB","file":"login.bundled.js","sourcesContent":["webpackJsonp([5],[\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(Backbone, _) {var jQuery = __webpack_require__(1),\n\t $ = jQuery,\n\t GalaxyApp = __webpack_require__(49).GalaxyApp,\n\t _l = __webpack_require__(6),\n\t Page = __webpack_require__(50);\n\t\n\twindow.app = function app(options, bootstrapped) {\n\t window.Galaxy = new GalaxyApp(options, bootstrapped);\n\t Galaxy.debug('login app');\n\t var redirect = encodeURI(options.redirect);\n\t\n\t // TODO: remove iframe for user login (at least) and render login page from here\n\t // then remove this redirect\n\t if (!options.show_welcome_with_login) {\n\t var params = jQuery.param({ use_panels: 'True', redirect: redirect });\n\t window.location.href = Galaxy.root + 'user/login?' + params;\n\t return;\n\t }\n\t\n\t var LoginPage = Backbone.View.extend({\n\t initialize: function (page) {\n\t this.page = page;\n\t this.model = new Backbone.Model({ title: _l('Login required') });\n\t this.setElement(this._template());\n\t },\n\t render: function () {\n\t this.page.$('#galaxy_main').prop('src', options.welcome_url);\n\t },\n\t _template: function () {\n\t var login_url = options.root + 'user/login?' + $.param({ redirect: redirect });\n\t return '<iframe src=\"' + login_url + '\" frameborder=\"0\" style=\"width: 100%; height: 100%;\"/>';\n\t }\n\t });\n\t\n\t $(function () {\n\t Galaxy.page = new Page.View(_.extend(options, {\n\t Right: LoginPage\n\t }));\n\t });\n\t};\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(3)))\n\n/***/ }\n]);\n\n\n// WEBPACK FOOTER //\n// login.bundled.js","var jQuery = require( 'jquery' ),\n $ = jQuery,\n GalaxyApp = require( 'galaxy' ).GalaxyApp,\n _l = require( 'utils/localization' ),\n Page = require( 'layout/page' );\n\nwindow.app = function app( options, bootstrapped ){\n window.Galaxy = new GalaxyApp( options, bootstrapped );\n Galaxy.debug( 'login app' );\n var redirect = encodeURI( options.redirect );\n\n // TODO: remove iframe for user login (at least) and render login page from here\n // then remove this redirect\n if( !options.show_welcome_with_login ){\n var params = jQuery.param({ use_panels : 'True', redirect : redirect });\n window.location.href = Galaxy.root + 'user/login?' + params;\n return;\n }\n\n var LoginPage = Backbone.View.extend({\n initialize: function( page ) {\n this.page = page;\n this.model = new Backbone.Model({ title : _l( 'Login required' ) } );\n this.setElement( this._template() );\n },\n render: function() {\n this.page.$( '#galaxy_main' ).prop( 'src', options.welcome_url );\n },\n _template : function() {\n var login_url = options.root + 'user/login?' + $.param( { redirect : redirect } );\n return '<iframe src=\"' + login_url + '\" frameborder=\"0\" style=\"width: 100%; height: 100%;\"/>';\n }\n });\n\n $(function(){\n Galaxy.page = new Page.View( _.extend( options, {\n Right : LoginPage\n } ) );\n });\n};\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/apps/login.js"],"sourceRoot":""}
{"version":3,"sources":["webpack:///./galaxy/scripts/apps/login.js"],"names":["jQuery","require","$","GalaxyApp","_l","Page","window","app","options","bootstrapped","Galaxy","debug","redirect","encodeURI","show_welcome_with_login","params","param","use_panels","location","href","root","LoginPage","Backbone","View","extend","initialize","page","model","Model","title","setElement","_template","render","prop","welcome_url","login_url","_","Right"],"mappings":";;;;AAAA,wDAAIA,SAAS,mBAAAC,CAAS,CAAT,CAAb;AAAA,KACIC,IAAIF,MADR;AAAA,KAEIG,YAAY,mBAAAF,CAAS,CAAT,EAAoBE,SAFpC;AAAA,KAGIC,KAAK,mBAAAH,CAAS,CAAT,CAHT;AAAA,KAIII,OAAO,mBAAAJ,CAAS,EAAT,CAJX;;AAMAK,QAAOC,GAAP,GAAa,SAASA,GAAT,CAAcC,OAAd,EAAuBC,YAAvB,EAAqC;AAC9CH,YAAOI,MAAP,GAAgB,IAAIP,SAAJ,CAAeK,OAAf,EAAwBC,YAAxB,CAAhB;AACAC,YAAOC,KAAP,CAAc,WAAd;AACA,SAAIC,WAAWC,UAAWL,QAAQI,QAAnB,CAAf;;AAEA;AACA;AACA,SAAI,CAACJ,QAAQM,uBAAb,EAAsC;AAClC,aAAIC,SAASf,OAAOgB,KAAP,CAAa,EAAEC,YAAa,MAAf,EAAuBL,UAAWA,QAAlC,EAAb,CAAb;AACAN,gBAAOY,QAAP,CAAgBC,IAAhB,GAAuBT,OAAOU,IAAP,GAAc,aAAd,GAA8BL,MAArD;AACA;AACH;;AAED,SAAIM,YAAYC,SAASC,IAAT,CAAcC,MAAd,CAAqB;AACjCC,qBAAY,UAAUC,IAAV,EAAiB;AACzB,kBAAKA,IAAL,GAAYA,IAAZ;AACA,kBAAKC,KAAL,GAAa,IAAIL,SAASM,KAAb,CAAmB,EAAEC,OAAQzB,GAAI,gBAAJ,CAAV,EAAnB,CAAb;AACA,kBAAK0B,UAAL,CAAiB,KAAKC,SAAL,EAAjB;AACH,UALgC;AAMjCC,iBAAQ,YAAW;AACf,kBAAKN,IAAL,CAAUxB,CAAV,CAAa,cAAb,EAA8B+B,IAA9B,CAAoC,KAApC,EAA2CzB,QAAQ0B,WAAnD;AACH,UARgC;AASjCH,oBAAY,YAAW;AACnB,iBAAII,YAAY3B,QAAQY,IAAR,GAAe,aAAf,GAA+BlB,EAAEc,KAAF,CAAS,EAAEJ,UAAWA,QAAb,EAAT,CAA/C;AACA,oBAAO,kBAAkBuB,SAAlB,GAA8B,wDAArC;AACH;AAZgC,MAArB,CAAhB;;AAeAjC,OAAE,YAAU;AACRQ,gBAAOgB,IAAP,GAAc,IAAIrB,KAAKkB,IAAT,CAAea,EAAEZ,MAAF,CAAUhB,OAAV,EAAmB;AAC5C6B,oBAAQhB;AADoC,UAAnB,CAAf,CAAd;AAGH,MAJD;AAKH,EAjCD,C","file":"login.bundled.js","sourcesContent":["var jQuery = require( 'jquery' ),\n $ = jQuery,\n GalaxyApp = require( 'galaxy' ).GalaxyApp,\n _l = require( 'utils/localization' ),\n Page = require( 'layout/page' );\n\nwindow.app = function app( options, bootstrapped ){\n window.Galaxy = new GalaxyApp( options, bootstrapped );\n Galaxy.debug( 'login app' );\n var redirect = encodeURI( options.redirect );\n\n // TODO: remove iframe for user login (at least) and render login page from here\n // then remove this redirect\n if( !options.show_welcome_with_login ){\n var params = jQuery.param({ use_panels : 'True', redirect : redirect });\n window.location.href = Galaxy.root + 'user/login?' + params;\n return;\n }\n\n var LoginPage = Backbone.View.extend({\n initialize: function( page ) {\n this.page = page;\n this.model = new Backbone.Model({ title : _l( 'Login required' ) } );\n this.setElement( this._template() );\n },\n render: function() {\n this.page.$( '#galaxy_main' ).prop( 'src', options.welcome_url );\n },\n _template : function() {\n var login_url = options.root + 'user/login?' + $.param( { redirect : redirect } );\n return '<iframe src=\"' + login_url + '\" frameborder=\"0\" style=\"width: 100%; height: 100%;\"/>';\n }\n });\n\n $(function(){\n Galaxy.page = new Page.View( _.extend( options, {\n Right : LoginPage\n } ) );\n });\n};\n\n\n\n// WEBPACK FOOTER //\n// ./galaxy/scripts/apps/login.js"],"sourceRoot":""}