Skip to content

Commit

Permalink
Merge pull request #900 from AllenBW/enhancement/ensure-unique-url-fo…
Browse files Browse the repository at this point in the history
…r-resource-details-state

Ensure unique url for service.resource-details, update all instances
  • Loading branch information
chriskacerguis authored Sep 5, 2017
2 parents e5275b4 + bb43ead commit 1855682
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
20 changes: 15 additions & 5 deletions client/app/services/service-details/service-details.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ export const ServiceDetailsComponent = {

/** @ngInject */
function ComponentController ($stateParams, $state, $window, CollectionsApi, EventNotifications, Chargeback, Consoles,
TagEditorModal, ModalService, PowerOperations, ServicesState, TaggingService, lodash,
Polling, LONG_POLLING_INTERVAL, UsageGraphsService) {
TagEditorModal, ModalService, PowerOperations, ServicesState, TaggingService, lodash,
Polling, LONG_POLLING_INTERVAL, UsageGraphsService) {
const vm = this
vm.$onInit = activate
vm.$onDestroy = onDestroy
Expand Down Expand Up @@ -286,14 +286,24 @@ function ComponentController ($stateParams, $state, $window, CollectionsApi, Eve

/** @ngInject */
function resolveUsers (CollectionsApi) {
const options = {expand: 'resources', attributes: ['userid', 'name'], sort_by: 'name', sort_options: 'ignore_case'}
const options = {
expand: 'resources',
attributes: ['userid', 'name'],
sort_by: 'name',
sort_options: 'ignore_case'
}

return CollectionsApi.query('users', options)
}

/** @ngInject */
function resolveGroups (CollectionsApi) {
const options = {expand: 'resources', attributes: ['description'], sort_by: 'description', sort_options: 'ignore_case'}
const options = {
expand: 'resources',
attributes: ['description'],
sort_by: 'description',
sort_options: 'ignore_case'
}

return CollectionsApi.query('groups', options)
}
Expand Down Expand Up @@ -356,7 +366,7 @@ function ComponentController ($stateParams, $state, $window, CollectionsApi, Eve
}

function gotoComputeResource (resource) {
$state.go('services.resource-details', {vmId: resource.id})
$state.go('services.resource-details', {serviceId: vm.serviceId, vmId: resource.id})
}

function startVM (item, isDisabled) {
Expand Down
7 changes: 5 additions & 2 deletions client/app/services/service-details/service-details.html
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,11 @@ <h2 translate>Resources</h2>
Details</a>
</li>
<li role="menuitem">
<a ui-sref="services.resource-details({vmId: item.id, viewType: 'graphsView'})" translate>View
Graphs</a>
<a
ui-sref="services.resource-details({serviceId: vm.service.id, vmId: item.id, viewType: 'graphsView'})"
translate>
View Graphs
</a>
</li>
</ul>
</div>
Expand Down
2 changes: 1 addition & 1 deletion client/app/services/vms/snapshots.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<a ng-if="!vm.vm.service.name" ui-sref="dashboard" translate>No Service</a>
</li>
<li>
<a ui-sref="services.resource-details({vmId: vm.vm.id})"> {{vm.vm.name}} </a>
<a ui-sref="services.resource-details({serviceId: vm.vm.service.id, vmId: vm.vm.id})"> {{vm.vm.name}} </a>
</li>
<li class="active" translate>
Snapshots
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function VmsDetailsState (routerHelper) {
function getStates () {
return {
'services.resource-details': {
url: '/:vmId',
url: '/:serviceId/resource=:vmId',
params: { viewType: null },
template: '<vm-details>',
title: N_('Resource Details')
Expand Down

0 comments on commit 1855682

Please sign in to comment.