Skip to content

Commit 659646b

Browse files
committed
sync overridden files from UMA server
1 parent 183a599 commit 659646b

File tree

3 files changed

+44
-144
lines changed
  • openid-connect-server-webapp/src/main/webapp/resources/js
  • uma-server-webapp/src/main/webapp

3 files changed

+44
-144
lines changed

openid-connect-server-webapp/src/main/webapp/resources/js/admin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -962,8 +962,8 @@ var AppRouter = Backbone.Router.extend({
962962

963963
this.updateSidebar('user/profile');
964964

965-
this.userProfileView = new UserProfileView({model: getUserInfo()});
966-
$('#content').html(this.userProfileView.render().el);
965+
var view = new UserProfileView({model: getUserInfo()});
966+
$('#content').html(view.render().el);
967967

968968
setPageTitle($.t('admin.user-profile.show'));
969969

uma-server-webapp/src/main/webapp/WEB-INF/tags/footer.tag

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
<script type="text/javascript" src="resources/js/dynreg.js"></script>
3131
<script type="text/javascript" src="resources/js/rsreg.js"></script>
3232
<script type="text/javascript" src="resources/js/token.js"></script>
33+
<script type="text/javascript" src="resources/js/blacklist.js"></script>
3334
<script type="text/javascript" src="resources/js/policy.js"></script>
3435
<script type="text/javascript" src="resources/js/admin.js"></script>
3536
</c:if>

uma-server-webapp/src/main/webapp/resources/js/admin.js

Lines changed: 41 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,6 @@ var ListWidgetView = Backbone.View.extend({
165165

166166
tagName: "div",
167167

168-
childView:ListWidgetChildView,
169-
170168
events:{
171169
"click .btn-add-list-item":"addItem",
172170
"keypress":function (e) {
@@ -226,7 +224,7 @@ var ListWidgetView = Backbone.View.extend({
226224
this.$el.html(this.template({placeholder:this.options.placeholder,
227225
helpBlockText:this.options.helpBlockText}));
228226

229-
_self = this;
227+
var _self = this;
230228

231229
if (_.size(this.collection.models) == 0 && _.size(this.options.autocomplete) == 0) {
232230
$("tbody", _self.el).html($('#tmpl-list-widget-child-empty').html());
@@ -256,7 +254,7 @@ var ListWidgetView = Backbone.View.extend({
256254
checked = false;
257255
}
258256

259-
var el = new this.childView({model:model, toggle: true, checked: checked, collection: _self.collection}).render().el;
257+
var el = new ListWidgetChildView({model:model, toggle: true, checked: checked, collection: _self.collection}).render().el;
260258
$("tbody", _self.el).append(el);
261259

262260
}, this);
@@ -265,8 +263,7 @@ var ListWidgetView = Backbone.View.extend({
265263

266264
// now render everything not in the autocomplete list
267265
_.each(values.models, function (model) {
268-
269-
var el = new this.childView({model:model, collection: _self.collection}).render().el;
266+
var el = new ListWidgetChildView({model:model, collection: _self.collection}).render().el;
270267
$("tbody", _self.el).append(el);
271268
}, this);
272269
}
@@ -277,18 +274,6 @@ var ListWidgetView = Backbone.View.extend({
277274

278275
});
279276

280-
var BlackListModel = Backbone.Model.extend({
281-
idAttribute: 'id',
282-
283-
urlRoot: 'api/blacklist'
284-
});
285-
286-
var BlackListCollection = Backbone.Collection.extend({
287-
initialize: function() { },
288-
289-
url: "api/blacklist"
290-
});
291-
292277
var BreadCrumbView = Backbone.View.extend({
293278

294279
tagName: 'ul',
@@ -329,125 +314,6 @@ var BreadCrumbView = Backbone.View.extend({
329314
});
330315

331316

332-
var BlackListListView = Backbone.View.extend({
333-
tagName: 'span',
334-
335-
initialize:function(options) {
336-
this.options = options;
337-
if (!this.template) {
338-
this.template = _.template($('#tmpl-blacklist-form').html());
339-
}
340-
},
341-
342-
load:function(callback) {
343-
if (this.model.isFetched) {
344-
callback();
345-
return;
346-
}
347-
348-
$('#loadingbox').sheet('show');
349-
$('#loading').html(
350-
'<span class="label" id="loading-blacklist">' + $.t('admin.blacklist') + '</span> '
351-
);
352-
353-
$.when(this.model.fetchIfNeeded()).done(function() {
354-
$('#loading-blacklist').addClass('label-success');
355-
$('#loadingbox').sheet('hide');
356-
callback();
357-
});
358-
},
359-
360-
events: {
361-
"click .refresh-table":"refreshTable"
362-
},
363-
364-
refreshTable:function(e) {
365-
e.preventDefault();
366-
var _self = this;
367-
$('#loadingbox').sheet('show');
368-
$('#loading').html(
369-
'<span class="label" id="loading-blacklist">' + $.t('admin.blacklist') + '</span> '
370-
);
371-
372-
$.when(this.model.fetch()).done(function() {
373-
$('#loadingbox').sheet('hide');
374-
_self.render();
375-
});
376-
},
377-
378-
render:function (eventName) {
379-
380-
$(this.el).html(this.template(this.model.toJSON()));
381-
382-
$('#blacklist .controls', this.el).html(new BlackListWidgetView({
383-
type: 'uri',
384-
placeholder: 'http://',
385-
collection: this.model
386-
}).render().el);
387-
388-
$(this.el).i18n();
389-
return this;
390-
}
391-
});
392-
393-
var BlackListWidgetView = ListWidgetView.extend({
394-
395-
childView: ListWidgetChildView.extend({
396-
render:function(options) {
397-
this.options = options;
398-
var uri = this.model.get('uri');
399-
400-
this.$el.html(this.template({item: uri}));
401-
402-
if (uri.length > 30) {
403-
this.$el.tooltip({title:uri});
404-
}
405-
return this;
406-
407-
}
408-
}),
409-
410-
addItem:function(e) {
411-
e.preventDefault();
412-
413-
var input_value = $("input", this.el).val().trim();
414-
415-
if (input_value === "") {
416-
return;
417-
}
418-
419-
// TODO: URI/pattern validation, check against existing clients
420-
421-
var item = new BlackListModel({
422-
uri: input_value
423-
});
424-
425-
var _self = this; // closures...
426-
427-
item.save({}, {
428-
success:function() {
429-
_self.collection.add(item);
430-
},
431-
error:function(error, response) {
432-
//Pull out the response text.
433-
var responseJson = JSON.parse(response.responseText);
434-
435-
//Display an alert with an error message
436-
$('#modalAlert div.modal-header').html(responseJson.error);
437-
$('#modalAlert div.modal-body').html(responseJson.error_description);
438-
439-
$("#modalAlert").modal({ // wire up the actual modal functionality and show the dialog
440-
"backdrop" : "static",
441-
"keyboard" : true,
442-
"show" : true // ensure the modal is shown immediately
443-
});
444-
}
445-
});
446-
447-
}
448-
449-
});
450-
451317
// Stats table
452318

453319
var StatsModel = Backbone.Model.extend({
@@ -469,12 +335,29 @@ var UserProfileView = Backbone.View.extend({
469335
render:function() {
470336

471337
$(this.el).html($('#tmpl-user-profile').html());
338+
339+
var t = this.template;
472340

473341
_.each(this.model, function (value, key) {
474342
if (key && value) {
475-
$('dl', this.el).append(
476-
this.template({key: key, value: value})
477-
);
343+
344+
if (typeof(value) === 'object') {
345+
346+
var el = this.el;
347+
var k = key;
348+
349+
_.each(value, function (value, key) {
350+
$('dl', el).append(
351+
t({key: key, value: value, category: k})
352+
);
353+
});
354+
} else if (typeof(value) === 'array') {
355+
// TODO: handle array types
356+
} else {
357+
$('dl', this.el).append(
358+
t({key: key, value: value})
359+
);
360+
}
478361
}
479362
}, this);
480363

@@ -621,6 +504,7 @@ var AppRouter = Backbone.Router.extend({
621504
grantTypes: ["authorization_code"],
622505
responseTypes: ["code"],
623506
subjectType: "PUBLIC",
507+
jwksType: "URI",
624508
contacts: contacts
625509
}, { silent: true });
626510

@@ -659,6 +543,16 @@ var AppRouter = Backbone.Router.extend({
659543
}, { silent: true });
660544
}
661545

546+
if (client.get("jwks")) {
547+
client.set({
548+
jwksType: "VAL"
549+
}, { silent: true });
550+
} else {
551+
client.set({
552+
jwksType: "URI"
553+
}, { silent: true });
554+
}
555+
662556
client.set({
663557
generateClientSecret:false,
664558
displayClientSecret:false
@@ -780,7 +674,6 @@ var AppRouter = Backbone.Router.extend({
780674
this.updateSidebar('user/approved');
781675

782676
var view = new ApprovedSiteListView({model:this.approvedSiteList, clientList: this.clientList, systemScopeList: this.systemScopeList});
783-
784677
view.load(
785678
function(collection, response, options) {
786679
$('#content').html(view.render().el);
@@ -836,7 +729,7 @@ var AppRouter = Backbone.Router.extend({
836729

837730
this.updateSidebar('admin/blacklist');
838731

839-
var view = new BlackListListView({model:this.blackListList});
732+
var view = new BlackListListView({collection: this.blackListList});
840733

841734
view.load(
842735
function(collection, response, options) {
@@ -1230,11 +1123,17 @@ $(function () {
12301123
$.get('resources/template/dynreg.html', _load),
12311124
$.get('resources/template/rsreg.html', _load),
12321125
$.get('resources/template/token.html', _load),
1126+
$.get('resources/template/blacklist.html', _load),
12331127
$.get('resources/template/policy.html', _load)
12341128
).done(function() {
12351129
$.ajaxSetup({cache:false});
12361130
app = new AppRouter();
12371131

1132+
app.on('route', function(name, args) {
1133+
// scroll to top of page on new route selection
1134+
$("html, body").animate({ scrollTop: 0 }, "slow");
1135+
});
1136+
12381137
// grab all hashed URLs and send them through the app router instead
12391138
$(document).on('click', 'a[href^="manage/#"]', function(event) {
12401139
event.preventDefault();

0 commit comments

Comments
 (0)