<commit_before>/// <reference path="activemqPlugin.ts"/>
module ActiveMQ {
  _module.controller("ActiveMQ.DurableSubscriberController", ["$scope", "workspace", "jolokia", ($scope, workspace:Workspace, jolokia) => {

      $scope.refresh = loadTable;

      $scope.durableSubscribers = [];

      $scope.tempData = [];

      $scope.createSubscriberDialog = new UI.Dialog();
      $scope.deleteSubscriberDialog = new UI.Dialog();
      $scope.showSubscriberDialog = new UI.Dialog();

      $scope.topicName = '';
      $scope.clientId = '';
      $scope.subscriberName = '';
      $scope.subSelector = '';

      $scope.gridOptions = {
        selectedItems: [],
        data: 'durableSubscribers',
        displayFooter: false,
        showFilter: false,
        showColumnMenu: true,
        enableCellSelection: false,
        enableColumnResize: true,
        enableColumnReordering: true,
        selectWithCheckboxOnly: false,
        showSelectionCheckbox: false,
        multiSelect: false,
        displaySelectionCheckbox : false, // old pre 2.0 config!
        filterOptions: {
          filterText: ''
        },
        maintainColumnRatios: false,
        columnDefs: [
          {
              field: 'destinationName',
              displayName: 'Topic',
              width: '30%'
          },
          {
            field: 'clientId',
            displayName: 'Client ID',
            width: '30%'
          },
          {
            field: 'consumerId',
            displayName: 'Consumer ID',
            cellTemplate: '<div class="ngCellText"><span ng-hide="row.entity.status != \'Offline\'">{{row.entity.consumerId}}</span><a ng-show="row.entity.status != \'Offline\'" ng-click="openSubscriberDialog(row)">{{row.entity.consumerId}}</a></div>',
            width: '30%'
          },
          {
            field: 'status',
            displayName: 'Status',
            width: '10%'
          }
        ]
      };

      $scope.doCreateSubscriber = (clientId, subscriberName, topicName, subSelector) => {
          $scope.createSubscriberDialog.close();
          $scope.clientId = clientId;
          $scope.subscriberName = subscriberName;
          $scope.topicName = topicName;
          $scope.subSelector = subSelector;
          if (Core.isBlank($scope.subSelector)) {
            $scope.subSelector = null;
          }
          var mbean = getBrokerMBean(jolokia);
          if (mbean) {
              jolokia.execute(mbean, "createDurableSubscriber(java.lang.String, java.lang.String, java.lang.String, java.lang.String)", $scope.clientId, $scope.subscriberName, $scope.topicName, $scope.subSelector, onSuccess(function() {
                  Core.notification('success', "Created durable subscriber " + clientId);
                  $scope.clientId = '';
                  $scope.subscriberName = '';
                  $scope.topicName = '';
                  $scope.subSelector = '';
                  loadTable();
              }));
          } else {
              Core.notification("error", "Could not find the Broker MBean!");
          }
      }

      $scope.deleteSubscribers = () => {
        var mbean = $scope.gridOptions.selectedItems[0]._id;
        jolokia.execute(mbean, "destroy()",  onSuccess(function() {
            $scope.showSubscriberDialog.close();
            Core.notification('success', "Deleted durable subscriber");
            loadTable();
            $scope.gridOptions.selectedItems = [];
        }));
      };

    $scope.openSubscriberDialog = (subscriber) => {
      jolokia.request({type: "read", mbean: subscriber.entity._id}, onSuccess((response) => {
        $scope.showSubscriberDialog.subscriber = response.value;
        $scope.showSubscriberDialog.subscriber.Status =  subscriber.entity.status;
        console.log("Subscriber is now " + $scope.showSubscriberDialog.subscriber);
        Core.$apply($scope);

        // now lets start opening the dialog
        setTimeout(() => {
          $scope.showSubscriberDialog.open();
          Core.$apply($scope);
        }, 100);
      }));
    };

    $scope.topicNames = (completionText) => {
      var topicsFolder = getSelectionTopicsFolder(workspace);
      return (topicsFolder) ? topicsFolder.children.map(n => n.title) : [];
    };
<commit_msg>[ENTESB-2841] correctly handle list of selected durable subscribers<commit_after>/// <reference path="activemqPlugin.ts"/>
module ActiveMQ {
  _module.controller("ActiveMQ.DurableSubscriberController", ["$scope", "workspace", "jolokia", ($scope, workspace:Workspace, jolokia) => {

      $scope.refresh = loadTable;

      $scope.durableSubscribers = [];

      $scope.tempData = [];

      $scope.createSubscriberDialog = new UI.Dialog();
      $scope.deleteSubscriberDialog = new UI.Dialog();
      $scope.showSubscriberDialog = new UI.Dialog();

      $scope.topicName = '';
      $scope.clientId = '';
      $scope.subscriberName = '';
      $scope.subSelector = '';

      $scope.gridOptions = {
        selectedItems: [],
        data: 'durableSubscribers',
        displayFooter: false,
        showFilter: false,
        showColumnMenu: true,
        enableCellSelection: false,
        enableColumnResize: true,
        enableColumnReordering: true,
        selectWithCheckboxOnly: false,
        showSelectionCheckbox: false,
        multiSelect: false,
        displaySelectionCheckbox : false, // old pre 2.0 config!
        filterOptions: {
          filterText: ''
        },
        maintainColumnRatios: false,
        columnDefs: [
          {
              field: 'destinationName',
              displayName: 'Topic',
              width: '30%'
          },
          {
            field: 'clientId',
            displayName: 'Client ID',
            width: '30%'
          },
          {
            field: 'consumerId',
            displayName: 'Consumer ID',
            cellTemplate: '<div class="ngCellText"><span ng-hide="row.entity.status != \'Offline\'">{{row.entity.consumerId}}</span><a ng-show="row.entity.status != \'Offline\'" ng-click="openSubscriberDialog(row)">{{row.entity.consumerId}}</a></div>',
            width: '30%'
          },
          {
            field: 'status',
            displayName: 'Status',
            width: '10%'
          }
        ]
      };

      $scope.doCreateSubscriber = (clientId, subscriberName, topicName, subSelector) => {
          $scope.createSubscriberDialog.close();
          $scope.clientId = clientId;
          $scope.subscriberName = subscriberName;
          $scope.topicName = topicName;
          $scope.subSelector = subSelector;
          if (Core.isBlank($scope.subSelector)) {
            $scope.subSelector = null;
          }
          var mbean = getBrokerMBean(jolokia);
          if (mbean) {
              jolokia.execute(mbean, "createDurableSubscriber(java.lang.String, java.lang.String, java.lang.String, java.lang.String)", $scope.clientId, $scope.subscriberName, $scope.topicName, $scope.subSelector, onSuccess(function() {
                  Core.notification('success', "Created durable subscriber " + clientId);
                  $scope.clientId = '';
                  $scope.subscriberName = '';
                  $scope.topicName = '';
                  $scope.subSelector = '';
                  loadTable();
              }));
          } else {
              Core.notification("error", "Could not find the Broker MBean!");
          }
      }

      $scope.deleteSubscribers = () => {
        var mbean = $scope.gridOptions.selectedItems[0]._id;
        jolokia.execute(mbean, "destroy()",  onSuccess(function() {
            $scope.showSubscriberDialog.close();
            Core.notification('success', "Deleted durable subscriber");
            loadTable();
            $scope.gridOptions.selectedItems.splice(0, $scope.gridOptions.selectedItems.length);
        }));
      };

    $scope.openSubscriberDialog = (subscriber) => {
      jolokia.request({type: "read", mbean: subscriber.entity._id}, onSuccess((response) => {
        $scope.showSubscriberDialog.subscriber = response.value;
        $scope.showSubscriberDialog.subscriber.Status =  subscriber.entity.status;
        console.log("Subscriber is now " + $scope.showSubscriberDialog.subscriber);
        Core.$apply($scope);

        // now lets start opening the dialog
        setTimeout(() => {
          $scope.showSubscriberDialog.open();
          Core.$apply($scope);
        }, 100);
      }));
    };

    $scope.topicNames = (completionText) => {
      var topicsFolder = getSelectionTopicsFolder(workspace);
      return (topicsFolder) ? topicsFolder.children.map(n => n.title) : [];
    };

{'fraction_non_alphanumeric': 0.13743637204997686, 'fraction_numerical': 0.003817677001388246, 'mean_word_length': 2.1574141709276846, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6271365', 'n_tokens_mistral': 2438, 'n_tokens_neox': 2352, 'n_words': 400}