|
data
|
Type : InfoModal
|
Default value : new InfoModal()
|
|
|
|
forceReload
|
Type : boolean
|
Default value : false
|
|
|
Outputs
|
onConfirmModalClick
|
Type : EventEmitter<any>
|
|
|
Methods
|
closeAbortModal
|
closeAbortModal()
|
|
|
|
|
|
downloadLog
|
downloadLog()
|
|
|
|
|
|
openConfigurator
|
openConfigurator()
|
|
|
Only on SAS9, opening a backend configurator/deploy page
|
|
openRequestsModal
|
openRequestsModal()
|
|
|
|
|
|
openServiceInNewWindow
|
openServiceInNewWindow()
|
|
|
Runs the startupservice in a new browser window so the SAS log is
available even when the adapter response carried none (e.g. a Viya
execution task that timed out).
|
|
showConfiguratorButton
|
showConfiguratorButton(sasService: string | null)
|
|
|
Wheter or not to show the Open configurator button
Button used for navigating to the configuration page
Only for SAS9
Decision is made based on that service path
Parameters :
| Name |
Type |
Optional |
Description |
| sasService |
string | null
|
No
|
backend service that caused this info modal to be shown
Decision is made based on that service path
|
|
|
showServiceLauncher
|
showServiceLauncher(sasService: string | null)
|
|
|
Whether to show the Show log button.
The startupservice failure modal is a dead end otherwise: the adapter
returned no log, so the only way to see the backend reason is to run the
service through the JES / STP web app in a browser tab. Offered on every
server type - SAS 9, Viya and SASjs Server all accept the _program URL.
Parameters :
| Name |
Type |
Optional |
| sasService |
string | null
|
No
|
|
|
Public
defaultData
|
Type : InfoModal
|
Default value : {
modalTitle: 'Abort Message',
sasService: null,
message: '',
details: new AbortDetails()
}
|
|
|
|
Public
modalEnabled
|
Type : boolean
|
Default value : true
|
|
|
import {
Component,
EventEmitter,
Input,
OnInit,
Output,
ViewEncapsulation
} from '@angular/core'
import { Router } from '@angular/router'
import { ServerType } from '@sasjs/utils/types/serverType'
import { EventService } from 'src/app/services/event.service'
import { HelperService } from 'src/app/services/helper.service'
import { SasService } from 'src/app/services/sas.service'
import { AbortDetails, InfoModal } from '../../models/InfoModal'
@Component({
selector: 'app-info-modal',
templateUrl: './info-modal.component.html',
styleUrls: ['./info-modal.component.scss'],
encapsulation: ViewEncapsulation.None,
standalone: false
})
export class InfoModalComponent implements OnInit {
@Output() onConfirmModalClick: EventEmitter<any> = new EventEmitter()
@Input() data: InfoModal = new InfoModal()
@Input() forceReload: boolean = false
public modalEnabled: boolean = true
public defaultData: InfoModal = {
modalTitle: 'Abort Message',
sasService: null,
message: '',
details: new AbortDetails()
}
constructor(
private helperService: HelperService,
private eventService: EventService,
private sasService: SasService,
private router: Router
) {}
ngOnInit() {
let newData: InfoModal = {
...this.defaultData,
...this.data
}
this.data = newData
}
/**
* Wheter or not to show the `Open configurator button`
* Button used for navigating to the `configuration` page
* Only for SAS9
* @param sasService backend service that caused this info modal to be shown
* Decision is made based on that service path
* @returns
*/
showConfiguratorButton(sasService: string | null) {
const sasjsConfig = this.sasService.getSasjsConfig()
return (
sasService?.includes('startupservice') &&
sasjsConfig.serverType === ServerType.Sas9
)
}
closeAbortModal() {
this.onConfirmModalClick.emit()
}
/**
* Whether to show the `Show log` button.
*
* The startupservice failure modal is a dead end otherwise: the adapter
* returned no log, so the only way to see the backend reason is to run the
* service through the JES / STP web app in a browser tab. Offered on every
* server type - SAS 9, Viya and SASjs Server all accept the `_program` URL.
*/
showServiceLauncher(sasService: string | null) {
return !!sasService?.includes('startupservice')
}
/**
* Runs the startupservice in a new browser window so the SAS log is
* available even when the adapter response carried none (e.g. a Viya
* execution task that timed out).
*/
openServiceInNewWindow() {
const sasjsConfig = this.sasService.getSasjsConfig()
const params: { [name: string]: string } = {}
if (sasjsConfig.contextName) {
params['_contextname'] = sasjsConfig.contextName
}
this.sasService.openServiceInNewWindow(this.data.sasService || '', params)
}
/**
* Only on SAS9, opening a backend configurator/deploy page
*/
openConfigurator() {
this.eventService.startupDataLoaded()
this.router.navigateByUrl('/deploy')
this.closeAbortModal()
}
downloadLog() {
this.helperService.downloadTextFile(
`${this.data.sasService}-LOG`,
this.data.details?.LOG || 'Error parsing the log'
)
}
openRequestsModal() {
this.eventService.openRequestsModal()
}
reload() {
location.reload()
}
}
<clr-modal
appDragNdrop
[(clrModalOpen)]="modalEnabled"
[clrModalSize]="'xl'"
[clrModalClosable]="!forceReload"
class="clr-abort-modal"
>
<h3 class="modal-title">
{{ data.modalTitle }}
@if (data.sasService && data.sasService.length > 0) {
<p class="sasService mt-0">
SAS Service: <strong>{{ data.sasService }}</strong>
</p>
}
</h3>
<div class="modal-body">
<div [innerHTML]="data.message" class="abortMsg"></div>
@if (data.details !== null) {
<div class="systext">
<p>
<strong>SYSWARNINGTEXT:</strong> {{ data.details.SYSWARNINGTEXT }}
</p>
<p><strong>SYSERRORTEXT:</strong> {{ data.details.SYSERRORTEXT }}</p>
<p><strong>MAC:</strong> {{ data.details.MAC }}</p>
<p><strong>_PROGRAM:</strong> {{ data.details._PROGRAM }}</p>
</div>
}
</div>
<div class="modal-footer">
@if (showServiceLauncher(data.sasService)) {
<button
type="button"
class="btn btn-primary"
(click)="openServiceInNewWindow()"
>
Show log
</button>
}
@if (showConfiguratorButton(data.sasService)) {
<button
type="button"
class="btn btn-primary"
(click)="openConfigurator()"
>
Open configurator
</button>
}
@if (data.details !== null) {
<button
type="button"
class="btn btn-primary"
(click)="openRequestsModal()"
>
Open requests modal
</button>
}
@if (data.details?.LOG && (data.details?.LOG?.trim())!.length > 0) {
<button type="button" class="btn btn-primary" (click)="downloadLog()">
Download log
</button>
}
@if (!forceReload) {
<button type="button" class="btn btn-primary" (click)="closeAbortModal()">
Close
</button>
}
@if (forceReload) {
<button type="button" class="btn btn-primary" (click)="reload()">
Reload
</button>
}
</div>
</clr-modal>
Legend
Html element with directive