ChangeAssociationDialog.js revision e26e5073e1266868172d72453c97f413fe2fb603
/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2015 ForgeRock AS. All rights reserved.
*
* 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
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*/
/*global define */
define("org/forgerock/openidm/ui/admin/mapping/association/dataAssociationManagement/ChangeAssociationDialog", [
"jquery",
"underscore",
"bootstrap-dialog",
], function($, _,
conf,
template: "templates/admin/mapping/association/dataAssociationManagement/ChangeAssociationDialogTemplate.html",
el: "#dialogs",
events: {
"click #targetSearchBtn": "searchTarget",
"click #search_results li": "selectSearchResult",
"click #linkObjectBtn": "linkObject"
},
selectSearchResult: function(e) {
e.preventDefault();
},
searchTarget: function (e) {
e.preventDefault();
dialogData = this.data;
dialogData.searching = true;
searchDelegate.searchResults(this.getCurrentMapping().target, this.data.targetProps, searchCriteria).then(_.bind(function(results) {
return {
};
},this))
.value();
this.reloadData(dialogData);
},this), _.bind(function () {
dialogData.results = [];
this.reloadData(dialogData);
}, this));
},
linkObject: function(e) {
mapping = this.getMappingName(),
e.preventDefault();
syncDelegate.performAction(this.data.recon._id, mapping, "LINK", sourceId, linkId, linkType).then(_.bind(function() {
this.data.reloadAnalysisGrid();
this.currentDialog.close();
}, this));
}, this));
},
getAmbiguousMatches: function() {
searchDelegate.searchResults(this.getCurrentMapping().target, ["_id"], id, "eq").then(_.bind(function(result) {
});
}
}, this));
},this));
return prom;
},
reloadData: function(data) {
uiUtils.renderTemplate("templates/admin/mapping/association/dataAssociationManagement/ChangeAssociationDialogTemplate.html", $("#changeAssociationDialog"), data);
if (data.searchCriteria) {
}
},
var _this = this;
this.dialogContent = $('<div id="changeAssociationDialog"></div>');
this.setElement(this.dialogContent);
this.currentDialog = new BootstrapDialog({
title: $.t("templates.mapping.analysis.changeAssociation"),
message: this.dialogContent,
this.template,
this.$el,
_.bind(function() {
if (callback) {
callback();
}
}, this),
"replace");
}, _this)
});
}
this.getAmbiguousMatches();
}
this.currentDialog.realize();
this.currentDialog.open();
}
});
return new ChangeAssociationDialog();
});