When the startupservice fails, the modal is a dead end: the adapter returned no log, so there is nothing to act on. The modal now offers a button that runs the same service through the JES / STP web app in a new browser window, where the SAS log is returned as the page body. `_debug=131` is always added (the log is the point), and `_executionTasks` is never included, so on Viya the run is not submitted as a Compute task and cannot hit the execution-task timeout. The URL is built by `buildServiceUrl`, which works for SAS 9, Viya and SASjs Server, and is the same shape the deploy configurator already uses to open makedata. The startup failure modals now carry the service name, which is what shows the button: all three failure branches (malformed response, missing properties, request rejected) pass `public/startupservice`.
72 lines
2.0 KiB
TypeScript
72 lines
2.0 KiB
TypeScript
import { InfoModalComponent } from './info-modal.component'
|
|
|
|
describe('InfoModalComponent', () => {
|
|
let component: InfoModalComponent
|
|
let sasService: any
|
|
|
|
const buildComponent = (sasServiceConfig: any = {}) => {
|
|
sasService = {
|
|
getSasjsConfig: () => sasServiceConfig,
|
|
openServiceInNewWindow: jasmine.createSpy('openServiceInNewWindow')
|
|
}
|
|
|
|
component = new InfoModalComponent(
|
|
{} as any,
|
|
{} as any,
|
|
sasService,
|
|
{} as any
|
|
)
|
|
component.data = {
|
|
modalTitle: 'Error',
|
|
message: 'startupservice failed',
|
|
sasService: 'public/startupservice',
|
|
details: null
|
|
}
|
|
component.ngOnInit()
|
|
}
|
|
|
|
describe('showServiceLauncher', () => {
|
|
beforeEach(() => buildComponent())
|
|
|
|
it('is shown for the startupservice, on every server type', () => {
|
|
expect(component.showServiceLauncher('public/startupservice')).toBeTrue()
|
|
expect(
|
|
component.showServiceLauncher('services/public/startupservice')
|
|
).toBeTrue()
|
|
})
|
|
|
|
it('is not shown for other services or a missing service', () => {
|
|
expect(component.showServiceLauncher('public/getdata')).toBeFalse()
|
|
expect(component.showServiceLauncher('')).toBeFalse()
|
|
expect(component.showServiceLauncher(null)).toBeFalse()
|
|
})
|
|
})
|
|
|
|
describe('openServiceInNewWindow', () => {
|
|
it('runs the startupservice in a new window', () => {
|
|
buildComponent({ serverType: 'SASVIYA' })
|
|
|
|
component.openServiceInNewWindow()
|
|
|
|
expect(sasService.openServiceInNewWindow).toHaveBeenCalledWith(
|
|
'public/startupservice',
|
|
{}
|
|
)
|
|
})
|
|
|
|
it('passes the configured Viya context so the log comes from it', () => {
|
|
buildComponent({
|
|
serverType: 'SASVIYA',
|
|
contextName: 'SAS Job Execution compute context'
|
|
})
|
|
|
|
component.openServiceInNewWindow()
|
|
|
|
expect(sasService.openServiceInNewWindow).toHaveBeenCalledWith(
|
|
'public/startupservice',
|
|
{ _contextname: 'SAS Job Execution compute context' }
|
|
)
|
|
})
|
|
})
|
|
})
|