AddConnectorView.js revision 90929d4c6b284dd318f4a78c2aa407afb7423747
/**
* The contents of this file are subject to the terms of the Common Development and
* Distribution License (the License). You may not use this file except in compliance with the
* License.
*
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2014-2015 ForgeRock AS.
*/
/*global define */
"jquery",
"underscore",
"form2js",
], function($, _,
events: {
"change #connectorType" : "loadConnectorTemplate",
"onValidate": "onValidate"
},
data: {
},
connectorTypeRef: null,
connectorList: null,
oAuthConnector: false,
this.data = {};
this.data.versionDisplay = {};
this.data.currentMainVersion = null;
this.oAuthConnector = false;
this.connectorTypeRef = null;
this.connectorList = null;
this.name = null;
//Build Connector type selection
.groupBy( function(connectorRef) {
return connectorRef.displayName;
})
.pairs()
.sortBy(function(connectorRef) {
return connectorRef[0];
})
.map(function(connectorRef){
return {
};
})
.value();
}, this);
this.parentRender(_.bind(function () {
this.loadConnectorTemplate(callback);
}, this));
}, this));
},
getProvisioner: function() {
var connectorData,
mergedResult = {},
arrayComponents = $(".connector-array-component");
if(this.connectorTypeRef.getGenericState()) {
delete connectorData.root;
}
connectorData.enabled = true;
} else {
connectorData.enabled = false;
}
delete connectorData.connectorType;
//Added logic to ensure array parts correctly add and delete what is set
mergedResult.configurationProperties[tempKeys[0]] = tempArrayObject.configurationProperties[tempKeys[0]];
}
}, this);
return mergedResult;
},
connectorFormSubmit: function(event) {
var mergedResult = this.getProvisioner(),
//Checks for connector specific save function to do any additional changes to data
if(this.connectorTypeRef.connectorSaved) {
}
if(!mergedResult.objectTypes) {
}
ConfigDelegate.createEntity(this.data.systemType + "/" + urlName, mergedResult).then(_.bind(function () {
eventManager.sendEvent(constants.EVENT_CHANGE_VIEW, {route: router.configuration.routes.editConnectorView, args: [this.data.systemType +"_" +urlName,""]});
}, this));
}, this),
}, this)
);
}
});
return new AddEditConnectorView();
});