diff --git a/app/components/table/actionbar/actionbar.html b/app/components/table/actionbar/actionbar.html index 81f75e8..62e85ab 100644 --- a/app/components/table/actionbar/actionbar.html +++ b/app/components/table/actionbar/actionbar.html @@ -27,13 +27,13 @@
  • -
  • - @@ -87,53 +87,7 @@
  • - -
    -
    -

    Acknowlege

    -
    -
    -
    -
    - - -
    -
    - - -
    -
    - - -
    -
    - - -
    -
    - - -
    -
    -
    -
    - - -
    + -
    - - + diff --git a/app/components/table/actionbar/actionbar.js b/app/components/table/actionbar/actionbar.js index e9ba3af..40a7266 100644 --- a/app/components/table/actionbar/actionbar.js +++ b/app/components/table/actionbar/actionbar.js @@ -29,43 +29,27 @@ angular.module('bansho.table.actionbar', ['bansho.table', 'bansho.live']) .controller('TableActionbarCtrl', ['$scope', '$filter', 'backendClient', 'actionbarFilters', 'tablesConfig', function ($scope, $filter, backendClient, actionbarFilters, tablesConfig, actionbarSelectFilter) { + $scope.isDowntimeShown = false; + $scope.isAcknowledgeShown = false; + + $scope.switchDowntimeForm = function () { + $scope.isAcknowledgeShown = false; + + $scope.isDowntimeShown = !$scope.isDowntimeShown; + } + + $scope.switchAcknowledgeForm = function () { + $scope.isDowntimeShown = false; + + $scope.isAcknowledgeShown = !$scope.isAcknowledgeShown; + } + $scope.actionbarFilters = actionbarFilters; $scope.actionbarFilters.activeFilter = $scope.actionbarFilters.possibleFilters[0]; - $scope.ackFormIsOpen = false; - - $scope.acknowledgeData = {}; - $scope.acknowledgeData.author = 'anonymous'; - $scope.acknowledgeData.comment = 'No comment'; - $scope.acknowledgeData.sticky = '1'; - $scope.acknowledgeData.notify = '0'; - $scope.acknowledgeData.persistent = '1'; - - $scope.acknowledgeProblems = function () { - angular.forEach(tablesConfig, function (tableConfig) { - var entries = $filter('filter')(tableConfig.entries, - $scope.actionbarFilters.searchFilter); - - angular.forEach(entries, function (entry) { - var service_description = undefined; - - if (entry.is_checked) { - if ('description' in entry) { - service_description = entry.description; - } - - backendClient.acknowledge(entry.host_name, service_description, $scope.acknowledgeData).error(function (data) { - throw new Error('Acknowledge request failed'); - }); - } - }); - }); - }; $scope.activateFilter = function (item) { $scope.actionbarFilters.activeFilter = $scope.actionbarFilters.possibleFilters[item]; }; - - $scope.isDowntimeShown = true; }]) .filter('actionbarSelectFilter', function () { diff --git a/app/components/table/actionbar/actions/acknowledge_form.html b/app/components/table/actionbar/actions/acknowledge_form.html new file mode 100644 index 0000000..e3717d0 --- /dev/null +++ b/app/components/table/actionbar/actions/acknowledge_form.html @@ -0,0 +1,39 @@ +

    Acknowlege

    +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    diff --git a/app/components/table/actionbar/actions/actions.js b/app/components/table/actionbar/actions/actions.js index d2bc2f4..a677dbe 100644 --- a/app/components/table/actionbar/actions/actions.js +++ b/app/components/table/actionbar/actions/actions.js @@ -2,6 +2,41 @@ angular.module('bansho.table.actionbar') + .directive('banshoAcknowledgeForm', + ['$filter', 'tablesConfig', 'actionbarFilters', 'backendClient', + function($filter, tablesConfig, actionbarFilters, backendClient) { + + return { + restrict: 'E', + templateUrl: 'components/table/actionbar/actions/acknowledge_form.html', + scope: { + isShown: '=' + }, + controller: function ($scope) { + $scope.acknowledgeProblems = function () { + angular.forEach(tablesConfig, function (tableConfig) { + var entries = $filter('filter')(tableConfig.entries, + actionbarFilters.searchFilter); + + angular.forEach(entries, function (entry) { + var service_description = undefined; + + if (entry.is_checked) { + if ('description' in entry) { + service_description = entry.description; + } + + backendClient.acknowledge(entry.host_name, service_description, $scope.acknowledgeData).error(function (data) { + throw new Error('Acknowledge request failed'); + }); + } + }); + }); + }; + } + } + }]) + .directive('banshoDowntimeForm', ['$filter', 'tablesConfig', 'actionbarFilters', 'backendClient', function ($filter, tablesConfig, actionbarFilters, backendClient) { diff --git a/app/components/table/actionbar/actions/downtime_form.html b/app/components/table/actionbar/actions/downtime_form.html index cb7d7e6..183f93d 100644 --- a/app/components/table/actionbar/actions/downtime_form.html +++ b/app/components/table/actionbar/actions/downtime_form.html @@ -1,30 +1,28 @@ -
    -
    {{message.text}} + {{message.type}}
    -

    Downtime

    -
    -
    - - -
    -
    - - -
    -
    - - -
    -
    - - -
    -
    - - -
    -
    - - -
    -
    -
    +
    {{message.text}} + {{message.type}}
    +

    Downtime

    +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +