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 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( constructor(
private eventService: EventService, private eventService: EventService,
private deployService: DeployService, private deployService: DeployService,
@ -246,7 +257,7 @@ export class AutomaticComponent implements OnInit {
} }
public async runAutoDeploy(executeJson: boolean = false) { public async runAutoDeploy(executeJson: boolean = false) {
this.autodeploying = true if (!this.deployInNewWindow) this.autodeploying = true
if (executeJson) { if (executeJson) {
this.executeJson() this.executeJson()
@ -255,7 +266,7 @@ export class AutomaticComponent implements OnInit {
if (this.recreateDatabase) { if (this.recreateDatabase) {
this.createDatabase() this.createDatabase()
} else { } else {
this.autodeployDone = true if (!this.deployInNewWindow) this.autodeployDone = true
} }
} }
@ -296,6 +307,9 @@ export class AutomaticComponent implements OnInit {
debug: true debug: true
} }
if (this.deployInNewWindow) {
this.runMakedataInNewWindow(selectedComputeContextName)
} else {
this.sasJs this.sasJs
.request(`services/admin/makedata`, data, overrideConfig, () => { .request(`services/admin/makedata`, data, overrideConfig, () => {
this.sasService.shouldLogin.next(true) this.sasService.shouldLogin.next(true)
@ -342,6 +356,26 @@ export class AutomaticComponent implements OnInit {
} }
}) })
} }
}
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`
let programUrl =
serverUrl +
execPath +
'/?_program=' +
appLoc +
'/services/admin/makedata' +
contextname +
debug
window.open(programUrl)
}
/** /**
* Only when on Viya streamed app, this method will update the `contextname` in the `index.html` on the SAS drive * Only when on Viya streamed app, this method will update the `contextname` in the `index.html` on the SAS drive