From 12c2796124ed76584ab5bf2c27726668b757d6b3 Mon Sep 17 00:00:00 2001 From: Allen Wight Date: Fri, 10 Mar 2017 14:16:18 -0500 Subject: [PATCH] Adds ansible details to service-details component Increases polling duration for this view --- .../service-details-ansible.component.js | 18 ++- .../service-details-ansible.html | 127 +++++++++--------- .../service-details.component.js | 19 ++- .../service-details/service-details.html | 2 +- client/app/services/services-state.service.js | 23 ++-- 5 files changed, 101 insertions(+), 88 deletions(-) diff --git a/client/app/services/service-details/service-details-ansible.component.js b/client/app/services/service-details/service-details-ansible.component.js index 28eb3521d..7e7b8bb60 100644 --- a/client/app/services/service-details/service-details-ansible.component.js +++ b/client/app/services/service-details/service-details-ansible.component.js @@ -5,7 +5,7 @@ export const ServiceDetailsAnsibleComponent = { controller: ComponentController, controllerAs: 'vm', bindings: { - results: '<', + service: '<', }, templateUrl, }; @@ -17,24 +17,18 @@ function ComponentController(ModalService) { function activate() { angular.extend(vm, { - // Data + oStacks: vm.service.orchestration_stacks[0], + output: "", plays: { open: true, resources: [], }, - creds: { - open: true, - resources: [], - }, - results: { - resources: [], - }, - output: "", // Functions sampleAction: angular.noop(), viewPlay: angular.noop(), watchLive: watchLive, + elapsed: elapsed, // Config credListConfig: credListConfig(), @@ -67,6 +61,10 @@ function ComponentController(ModalService) { }; ModalService.open(modalOptions); } + + function elapsed(finish, start) { + return Math.abs(new Date(finish) - new Date(start))/100; + } } diff --git a/client/app/services/service-details/service-details-ansible.html b/client/app/services/service-details/service-details-ansible.html index dbdf9ae77..3e3a030d8 100644 --- a/client/app/services/service-details/service-details-ansible.html +++ b/client/app/services/service-details/service-details-ansible.html @@ -2,90 +2,93 @@

Results

-
-
-
-
- -
- -
+
+
+
+
+ +
+
-
- -
- -
+
+
+ +
+
-
- -
- -
+
+
+ +
+
-
- -
- -
+
+
+ +
+
-
- -
- -
+
+
+ +
+
-
-
-
- -
- -
+
+
+
+
+ +
+
-
- -
- -
+
+
+ +
+
-
- -
- -
+
+
+ +
+
-
- -
- -
+
+
+ +
+
+
  • - - {{ 'Credentials' | translate}} ({{vm.creds.resources.length}}) + + {{ 'Credentials' | translate}} ({{vm.service.credential.length}}) -
    -
    +
    +
    No credentials available.
    -
    +
    -
    +
    - {{ item.provider }} + {{ item.name }}
    @@ -104,11 +107,11 @@

    Results

    • - {{ 'Plays' | translate}} ({{vm.plays.resources.length}}) -
      +
      No plays available. @@ -190,7 +193,7 @@

      Standard Out

      -
      +
      diff --git a/client/app/services/service-details/service-details.component.js b/client/app/services/service-details/service-details.component.js index ae7c4d335..81b040023 100644 --- a/client/app/services/service-details/service-details.component.js +++ b/client/app/services/service-details/service-details.component.js @@ -27,6 +27,7 @@ function ComponentController($stateParams, $state, $window, CollectionsApi, Even title: N_('Service Details'), service: {}, availableTags: [], + credential: {}, listActions: [], // Functions @@ -53,7 +54,7 @@ function ComponentController($stateParams, $state, $window, CollectionsApi, Even resourceListConfig: getResourceListConfig(), }); fetchResources(vm.serviceId); - Polling.start('servicesPolling', startPollingService, 10000); + Polling.start('servicesPolling', startPollingService, 50000); } function startPollingService() { @@ -64,16 +65,22 @@ function ComponentController($stateParams, $state, $window, CollectionsApi, Even ServicesState.getService(id).then(handleSuccess, handleFailure); function handleSuccess(response) { - TaggingService.queryAvailableTags('services/' + id + '/tags/').then(assignAvailableTags); - function assignAvailableTags(response) { - vm.availableTags = response; - } - vm.service = response; vm.title = vm.service.name; getListActions(); Chargeback.processReports(vm.service); vm.computeGroup = vm.createResourceGroups(vm.service); + + TaggingService.queryAvailableTags('services/' + id + '/tags/').then(assignAvailableTags); + function assignAvailableTags(response) { + vm.availableTags = response; + } + + ServicesState.getServiceCredential(vm.service.options.config_info.provision.credential_id).then(assignCredential); + function assignCredential(response) { + vm.service.credential = [response]; + } + vm.loading = false; } diff --git a/client/app/services/service-details/service-details.html b/client/app/services/service-details/service-details.html index ed2230188..32c990bac 100644 --- a/client/app/services/service-details/service-details.html +++ b/client/app/services/service-details/service-details.html @@ -305,7 +305,7 @@

      Resources

      + service="vm.service">
      diff --git a/client/app/services/services-state.service.js b/client/app/services/services-state.service.js index 24ade3959..74dc4e5b3 100644 --- a/client/app/services/services-state.service.js +++ b/client/app/services/services-state.service.js @@ -10,6 +10,7 @@ export function ServicesStateFactory(ListConfiguration, CollectionsApi, RBAC) { return { services: services, getService: getService, + getServiceCredential: getServiceCredential, getServices: getServices, getServicesMinimal: getServicesMinimal, getLifeCycleCustomDropdown: getLifeCycleCustomDropdown, @@ -17,15 +18,6 @@ export function ServicesStateFactory(ListConfiguration, CollectionsApi, RBAC) { getConfigurationCustomDropdown: getConfigurationCustomDropdown, }; - // Returns minimal data for the services matching the current filters, useful for getting a filter count - function getServicesMinimal(filters) { - const options = { - filter: getQueryFilters(filters), - }; - - return CollectionsApi.query('services', options); - } - function getService(id) { const options = { attributes: [ @@ -50,6 +42,19 @@ export function ServicesStateFactory(ListConfiguration, CollectionsApi, RBAC) { return CollectionsApi.get('services', id, options); } + function getServiceCredential(credentialId) { + return CollectionsApi.get('authentications', credentialId, {}); + } + + // Returns minimal data for the services matching the current filters, useful for getting a filter count + function getServicesMinimal(filters) { + const options = { + filter: getQueryFilters(filters), + }; + + return CollectionsApi.query('services', options); + } + function getServices(limit, offset, filters, sortField, sortAscending) { const options = { expand: 'resources',