Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change service dialog api call to match CUI #1438

Merged
merged 1 commit into from
May 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions client/app/states/catalogs/details/details.state.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@ function Controller ($stateParams, CollectionsApi, EventNotifications, ShoppingC
vm.parsedDialogs = dialogs.resources[0].content
}
}
setDialogUrl(vm.serviceTemplate.service_template_catalog_id)
setDialogUrl()
vm.loading = false
})
})
}

init()
function setDialogUrl (serviceTemplateCatalogId) {
vm.dialogUrl = `service_catalogs/${serviceTemplateCatalogId}/service_templates`
function setDialogUrl () {
vm.dialogUrl = `service_dialogs`

return vm.dialogUrl
}
Expand All @@ -131,12 +131,12 @@ function Controller ($stateParams, CollectionsApi, EventNotifications, ShoppingC
}

let idList = {
dialogId: vm.parsedDialogs.id,
dialogId: vm.parsedDialogs[0].id,
resourceActionId: resourceActionId,
targetId: vm.serviceTemplate.id,
targetType: 'service_template'
}
const url = `${vm.dialogUrl}/${vm.serviceTemplate.id}`
const url = `${vm.dialogUrl}`
return DialogFieldRefresh.refreshDialogField(vm.dialogData, [field.name], url, idList)
}
/**
Expand Down
13 changes: 8 additions & 5 deletions client/app/states/catalogs/details/details.state.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,17 @@ describe('State: catalogs.details', () => {
it('it allows a field to be refreshed', (done) => {
controller = $controller($state.get('catalogs.details').controller)
controller.serviceTemplate = serviceTemplate
controller.setDialogUrl(serviceTemplate.service_template_catalog_id)
controller.setDialogUrl()
const refreshSpy = sinon.stub(DialogFieldRefresh, 'refreshDialogField').returns(Promise.resolve({'status': 'success'}))
const dialogData = {
'dialogField1': '1',
'dialogField2': '2'
}
const parsedDialogs = [
{
id: 1234
}
]
const field = {'name': 'dialogField1'}
const idList = {
dialogId: 1234,
Expand All @@ -75,14 +80,12 @@ describe('State: catalogs.details', () => {
targetType: 'service_template'
}
controller.dialogData = dialogData
controller.parsedDialogs = {
id: 1234
}
controller.parsedDialogs = parsedDialogs

controller.refreshField(field).then((data) => {
done()
})
const url = `service_catalogs/${serviceTemplate.service_template_catalog_id}/service_templates/${serviceTemplate.id}`
const url = `service_dialogs`
expect(refreshSpy).to.have.been.calledWith(dialogData, ['dialogField1'], url, idList)
})
it('allows dialog data to be updated', () => {
Expand Down