1 /*jshint indent:2, curly:true, eqeqeq:true, immed:true, latedef:true,
2 newcap:true, noarg:true, regexp:true, undef:true, trailing:true,
4 /*global XT:true, XV:true, Backbone:true, enyo:true, console:true */
8 XT.extensions.oauth2.initWorkspace = function () {
10 name: "XV.Oauth2clientWorkspace",
12 title: "_oauth2Client".loc(),
13 model: "XM.Oauth2client",
15 {kind: "Panels", arrangerKind: "CarouselArranger",
16 fit: true, components: [
17 {kind: "XV.Groupbox", name: "mainPanel", components: [
18 {kind: "onyx.GroupboxHeader", content: "_overview".loc()},
19 {kind: "XV.ScrollableGroupbox", name: "mainGroup", fit: true,
20 classes: "in-panel", components: [
21 {kind: "onyx.GroupboxHeader", content: "_id".loc()},
22 {kind: "XV.TextArea", attr: "clientID", classes: "xv-short-textarea" },
23 {kind: "onyx.GroupboxHeader", content: "_secret".loc()},
24 {kind: "XV.TextArea", attr: "clientSecret", classes: "xv-short-textarea" },
25 {kind: "onyx.GroupboxHeader", content: "_details".loc()},
26 {kind: "XV.InputWidget", attr: "clientName", label: "_name".loc()},
27 {kind: "XV.InputWidget", attr: "clientEmail", label: "_email".loc()},
28 {kind: "XV.InputWidget", attr: "clientWebSite", label: "_website".loc()},
29 {kind: "XV.InputWidget", attr: "clientLogo", label: "_logoURL".loc()},
30 {kind: "XV.Oauth2clientTypePicker", attr: "clientType"},
31 {kind: "XV.CheckboxWidget", attr: "isActive"},
32 {kind: "XV.DateWidget", attr: "issued"},
33 {kind: "XV.InputWidget", attr: "organization"},
34 {kind: "XV.CheckboxWidget", name: "delegatedAccess", attr: "delegatedAccess"},
35 {kind: "onyx.GroupboxHeader", content: "_x509PubCert".loc()},
36 {kind: "XV.TextArea", name: "clientX509PubCert", attr: "clientX509PubCert"},
37 {kind: "onyx.GroupboxHeader", content: "_fullListUrl".loc()},
38 {kind: "XV.TextArea", name: "fullListUrl", classes: "xv-short-textarea", disabled: true},
39 {kind: "onyx.GroupboxHeader", content: "_singleResourceUrl".loc()},
40 {kind: "XV.TextArea", name: "singleResourceUrl", classes: "xv-short-textarea", disabled: true},
41 {kind: "onyx.GroupboxHeader", content: "_authURI".loc()},
42 {kind: "XV.TextArea", name: "authURI", classes: "xv-short-textarea", disabled: true},
43 {kind: "onyx.GroupboxHeader", content: "_tokenURI".loc()},
44 {kind: "XV.TextArea", name: "tokenURI", classes: "xv-short-textarea", disabled: true},
45 {kind: "onyx.GroupboxHeader", content: "_tokenRevocationURI".loc()},
46 {kind: "XV.TextArea", name: "tokenRevocationURI", classes: "xv-short-textarea", disabled: true}
49 {kind: "XV.Oauth2clientRedirectBox", name: "redirectBox", attr: "redirectURIs", showing: false}
53 var base = XT.getBaseUrl() + XT.getOrganizationPath();
54 this.inherited(arguments);
56 this.$.fullListUrl.setValue(base + "/discovery/v1alpha1/apis/v1alpha1/rest");
57 this.$.singleResourceUrl.setValue(base + "/discovery/v1alpha1/apis/:model/v1alpha1/rest");
58 this.$.authURI.setValue(base + "/dialog/authorize");
59 this.$.tokenURI.setValue(base + "/oauth/token");
60 this.$.tokenRevocationURI.setValue(base + "/oauth/revoke-token");
62 attributesChanged: function (model, options) {
63 this.inherited(arguments);
65 var serviceAccount = model.get("clientType") === 'jwt bearer',
66 webServer = model.get("clientType") === 'web server';
68 // Delegated Access is only meaningful for Service Accounts
69 this.$.delegatedAccess.setShowing(serviceAccount);
70 this.$.clientX509PubCert.setShowing(serviceAccount);
71 this.$.redirectBox.setShowing(webServer);
72 // There is some rendering issue with this box that this fixes w/o css
73 this.$.redirectBox.render();
77 XV.registerModelWorkspace("XM.Oauth2client", "XV.Oauth2clientWorkspace");