Compare commits
2 Commits
a0dc92c403
...
8139f495ce
Author | SHA1 | Date | |
---|---|---|---|
8139f495ce | |||
89ab296151 |
@ -8,6 +8,7 @@ import {
|
||||
} from '@angular/core'
|
||||
import SASjs, { SASjsConfig } from '@sasjs/adapter'
|
||||
import { DcAdapterSettings } from 'src/app/models/DcAdapterSettings'
|
||||
import { HelperService } from 'src/app/services'
|
||||
import { DeployService } from 'src/app/services/deploy.service'
|
||||
import { EventService } from 'src/app/services/event.service'
|
||||
import { LoggerService } from 'src/app/services/logger.service'
|
||||
@ -82,7 +83,8 @@ export class AutomaticComponent implements OnInit {
|
||||
private deployService: DeployService,
|
||||
private sasService: SasService,
|
||||
private sasViyaService: SasViyaService,
|
||||
private loggerService: LoggerService
|
||||
private loggerService: LoggerService,
|
||||
private helperService: HelperService
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
@ -325,7 +327,8 @@ export class AutomaticComponent implements OnInit {
|
||||
})
|
||||
}
|
||||
|
||||
this.updateIndexHtmlComputeContext()
|
||||
if (this.helperService.isStreamingViya())
|
||||
this.updateIndexHtmlComputeContext()
|
||||
})
|
||||
.catch((err: any) => {
|
||||
this.eventService.showAbortModal('makedata', JSON.stringify(err))
|
||||
@ -341,14 +344,20 @@ export class AutomaticComponent implements OnInit {
|
||||
}
|
||||
|
||||
/**
|
||||
* Only when on Viya, this method will update the `contextname` in the `DataController.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
|
||||
* This is needed to ensure that the DC will use the same compute context `makedata` service used to run against.
|
||||
*/
|
||||
public async updateIndexHtmlComputeContext() {
|
||||
const filenamePath = location.search.split('/').pop()
|
||||
const filename = filenamePath?.includes('.')
|
||||
? filenamePath
|
||||
: 'DataController.html'
|
||||
const filename = filenamePath?.includes('.') ? filenamePath : undefined
|
||||
|
||||
if (!filename) {
|
||||
this.eventService.showAbortModal(
|
||||
null,
|
||||
'We could not figure out the file name of `index.html` based on the url.'
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
const indexHtmlContent = await this.sasService.getFileContent(
|
||||
`${this.appLoc}/services`,
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import cloneDeep from 'lodash-es/cloneDeep'
|
||||
import * as CryptoMD5 from 'crypto-js/md5'
|
||||
import { SasService } from './sas.service'
|
||||
|
||||
const librariesToShow = 50
|
||||
|
||||
@ -12,7 +13,7 @@ export class HelperService {
|
||||
public loadMoreCount: number = librariesToShow
|
||||
public isMicrosoft: boolean = false
|
||||
|
||||
constructor() {
|
||||
constructor(private sasService: SasService) {
|
||||
this.isMicrosoft = this.isIEorEDGE()
|
||||
console.log('Is IE or Edge?', this.isMicrosoft)
|
||||
}
|
||||
@ -314,6 +315,20 @@ export class HelperService {
|
||||
}
|
||||
}
|
||||
|
||||
public isStreamingViya(): boolean {
|
||||
const serverType = this.sasService.getServerType()
|
||||
|
||||
if (serverType !== 'SASVIYA') return false
|
||||
|
||||
if (
|
||||
location.search.includes('?_file=') &&
|
||||
location.pathname.includes('/SASJobExecution')
|
||||
)
|
||||
return true
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// Required type is NodeJS.Timeout
|
||||
// But NodeJS is not available in browser so we have to go with any
|
||||
private debounceTimeout: any
|
||||
|
Reference in New Issue
Block a user