fix(viya deploy): run makedata in new window to ensure logs are available for the user
All checks were successful
Build / Build-and-ng-test (pull_request) Successful in 4m12s
Build / Build-and-test-development (pull_request) Successful in 8m42s

This commit is contained in:
Mihajlo Medjedovic
2025-06-17 15:33:11 +02:00
parent 519d8953b5
commit 0b4042af60

View File

@ -78,6 +78,17 @@ export class AutomaticComponent implements OnInit {
runMakeData: null
}
public sasjsConfig = this.sasService.getSasjsConfig()
/**
* makedata service will be run in a new window
* This is needed to ensure that the user can see the logs
* and the progress of the service execution.
* If this is set to `false`, the service will be run in the same window
* using the adapter request method.
*/
public deployInNewWindow: boolean = true
constructor(
private eventService: EventService,
private deployService: DeployService,
@ -246,7 +257,7 @@ export class AutomaticComponent implements OnInit {
}
public async runAutoDeploy(executeJson: boolean = false) {
this.autodeploying = true
if (!this.deployInNewWindow) this.autodeploying = true
if (executeJson) {
this.executeJson()
@ -255,7 +266,7 @@ export class AutomaticComponent implements OnInit {
if (this.recreateDatabase) {
this.createDatabase()
} else {
this.autodeployDone = true
if (!this.deployInNewWindow) this.autodeployDone = true
}
}
@ -296,51 +307,74 @@ export class AutomaticComponent implements OnInit {
debug: true
}
this.sasJs
.request(`services/admin/makedata`, data, overrideConfig, () => {
this.sasService.shouldLogin.next(true)
})
.then((res: any) => {
this.autodeployDone = true
if (this.deployInNewWindow) {
this.runMakedataInNewWindow(selectedComputeContextName)
} else {
this.sasJs
.request(`services/admin/makedata`, data, overrideConfig, () => {
this.sasService.shouldLogin.next(true)
})
.then((res: any) => {
this.autodeployDone = true
try {
this.makeDataResponse = JSON.stringify(res)
} catch {
this.makeDataResponse = res
}
try {
this.makeDataResponse = JSON.stringify(res)
} catch {
this.makeDataResponse = res
}
if (res.result && res.result.length > 0) {
this.autoDeployStatus.runMakeData = true
} else {
if (res.result && res.result.length > 0) {
this.autoDeployStatus.runMakeData = true
} else {
this.autoDeployStatus.runMakeData = false
}
if (typeof res.sasjsAbort !== 'undefined') {
const abortRes = res
const abortMsg = abortRes.sasjsAbort[0].MSG
const macMsg = abortRes.sasjsAbort[0].MAC
this.eventService.showAbortModal('makedata', abortMsg, {
SYSWARNINGTEXT: abortRes.SYSWARNINGTEXT,
SYSERRORTEXT: abortRes.SYSERRORTEXT,
MAC: macMsg
})
}
if (this.helperService.isStreamingViya())
this.updateIndexHtmlComputeContext()
})
.catch((err: any) => {
this.eventService.showAbortModal('makedata', JSON.stringify(err))
this.autoDeployStatus.runMakeData = false
}
this.autodeployDone = true
if (typeof res.sasjsAbort !== 'undefined') {
const abortRes = res
const abortMsg = abortRes.sasjsAbort[0].MSG
const macMsg = abortRes.sasjsAbort[0].MAC
try {
this.makeDataResponse = JSON.stringify(err)
} catch {
this.makeDataResponse = err
}
})
}
}
this.eventService.showAbortModal('makedata', abortMsg, {
SYSWARNINGTEXT: abortRes.SYSWARNINGTEXT,
SYSERRORTEXT: abortRes.SYSERRORTEXT,
MAC: macMsg
})
}
public runMakedataInNewWindow(contextName: string) {
let serverUrl = this.sasjsConfig.serverUrl
let appLoc = this.sasjsConfig.appLoc
const execPath = this.sasService.getExecutionPath()
let contextname = `&_contextname=${contextName}`
let debug = `&_debug=131`
if (this.helperService.isStreamingViya())
this.updateIndexHtmlComputeContext()
})
.catch((err: any) => {
this.eventService.showAbortModal('makedata', JSON.stringify(err))
this.autoDeployStatus.runMakeData = false
this.autodeployDone = true
let programUrl =
serverUrl +
execPath +
'/?_program=' +
appLoc +
'/services/admin/makedata' +
contextname +
debug
try {
this.makeDataResponse = JSON.stringify(err)
} catch {
this.makeDataResponse = err
}
})
window.open(programUrl)
}
/**