$scope.number = 0;
$scope.clname = "";
$scope.guard_ids = [];
+ $scope.duplicated = false;
+
function getAllFormId() {
return Array.from(document.getElementsByClassName("formId"));
}
}
var resourceVFModule = getResourceDetailsVfModuleProperty();
- if (targetType == "VFModule" && (null !== resourceVFModule || undefined !== resourceVFModule)) {
+ if (targetType == "VFMODULE" && (null !== resourceVFModule || undefined !== resourceVFModule)) {
if (recipe == 'VF Module Create' || recipe == 'VF Module Delete') {
for ( var prop in resourceVFModule) {
if (resourceVFModule[prop]["isBase"] == false) {
var resourceVFModule = getResourceDetailsVfModuleProperty();
var type = $("#formId" + formNum +" #type").val();
var recipe = $("#formId" + formNum +" #recipe").val();
- if (type == "VFModule" && (null !== resourceVFModule || undefined !== resourceVFModule)
+ if (type == "VFMODULE" && (null !== resourceVFModule || undefined !== resourceVFModule)
&& (recipe == 'VF Module Create' || recipe == 'VF Module Delete')) {
for ( var prop in resourceVFModule) {
if (prop == $(event.target).val()) {
$($("#formId" + formNum + " #actor")[1]).val($(event.target).val());
}
// When we change the name of a policy
- $scope.updateTabLabel = function(event) {
-
- // update policy id structure
- var formNum = $(event.target).closest('.formId').attr('id').substring(6);
- $scope.policy_ids.splice($scope.policy_ids.indexOf($("#formId" + formNum + " #id").val()), 1);
- $scope.policy_ids.push($(event.target).val());
- // Update the tab now
- $("#go_properties_tab" + formNum).text($(event.target).val());
- }
+ $scope.updateTabLabel = function (event) {
+
+ // update policy id structure
+ var formNum = $(event.target).closest('.formId').attr('id').substring(6);
+ var policyId = $(event.target).val();
+ if ($scope.policy_ids.includes(policyId)) {
+ console.log("Duplicated ID, cannot proceed");
+ $scope.duplicated = true;
+ } else {
+ $scope.duplicated = false;
+ $scope.policy_ids.splice($scope.policy_ids.indexOf($("#formId" + formNum + " #id").val()), 1);
+ $scope.policy_ids.push($(event.target).val());
+ // Update the tab now
+ $("#go_properties_tab" + formNum).text($(event.target).val());
+ }
+ };
$scope.close = function() {
console.log("close");