style: lint
All checks were successful
Build / Build-and-ng-test (pull_request) Successful in 3m58s

This commit is contained in:
Mihajlo Medjedovic 2024-07-03 18:01:01 +02:00
parent a3ce367950
commit 857b94f44f
26 changed files with 396 additions and 290 deletions

View File

@ -89,7 +89,9 @@ export class SasjsConfiguratorComponent implements OnInit {
*/
this.dcDirectory =
this.tmpDirectories[
['L', 'H', 'A', 'S'].includes(res.adapterResponse.SYSSCPL.substring(0, 1))
['L', 'H', 'A', 'S'].includes(
res.adapterResponse.SYSSCPL.substring(0, 1)
)
? 'linux'
: 'windows'
]

View File

@ -609,7 +609,10 @@ export class EditorComponent implements OnInit, AfterViewInit {
this.fileUploadInputCompList.first.nativeElement.value = ''
}
this.uploader.queue = []
this.eventService.catchResponseError('file upload', err.adapterResponse)
this.eventService.catchResponseError(
'file upload',
err.adapterResponse
)
}
)
}
@ -1563,7 +1566,9 @@ export class EditorComponent implements OnInit, AfterViewInit {
)
.then((res: RequestWrapperResponse) => {
if (typeof res.adapterResponse.sasparams !== 'undefined') {
this.router.navigateByUrl('/stage/' + res.adapterResponse.sasparams[0].DSID)
this.router.navigateByUrl(
'/stage/' + res.adapterResponse.sasparams[0].DSID
)
return true
}
@ -1591,7 +1596,10 @@ export class EditorComponent implements OnInit, AfterViewInit {
this.disableSubmit = true
this.submit = false
let errorText = typeof err.adapterRespnse === 'string' ? err.adapterRespnse : JSON.stringify(err.adapterRespnse)
let errorText =
typeof err.adapterRespnse === 'string'
? err.adapterRespnse
: JSON.stringify(err.adapterRespnse)
this.eventService.showAbortModal(
'editors/stagedata',

View File

@ -83,11 +83,13 @@ export class GroupComponent implements OnInit {
globals.usernav.groupList = groups
})
} else {
this.sasService.request('public/getgroups', null).then((res: RequestWrapperResponse) => {
this.loading = false
this.groups = res.adapterResponse.groups
globals.usernav.groupList = res.adapterResponse.groups
})
this.sasService
.request('public/getgroups', null)
.then((res: RequestWrapperResponse) => {
this.loading = false
this.groups = res.adapterResponse.groups
globals.usernav.groupList = res.adapterResponse.groups
})
}
} else {
this.groups = globals.usernav.groupList
@ -134,7 +136,8 @@ export class GroupComponent implements OnInit {
this.groupMemberCount = res.adapterResponse.sasmembers.length
if (res.adapterResponse.sasmembers[0] !== undefined) {
this.loading = false
this.groupUri = res.adapterResponse.sasmembers[0].URIMEM || this.paramURI
this.groupUri =
res.adapterResponse.sasmembers[0].URIMEM || this.paramURI
this.groupName = res.adapterResponse.sasmembers[0].GROUPNAME
this.groupDesc = res.adapterResponse.sasmembers[0].GROUPDESC

View File

@ -118,7 +118,11 @@ export class LicensingComponent implements OnInit {
this.sasService
.request('admin/registerkey', table)
.then((res: RequestWrapperResponse) => {
if (res.adapterResponse.return && res.adapterResponse.return[0] && res.adapterResponse.return[0].MSG === 'SUCCESS') {
if (
res.adapterResponse.return &&
res.adapterResponse.return[0] &&
res.adapterResponse.return[0].MSG === 'SUCCESS'
) {
location.replace(location.href.split('#')[0])
}
})

View File

@ -422,7 +422,9 @@ export class LineageComponent {
}
this.lineageTableName =
res.adapterResponse.info[0].LIBREF + '.' + res.adapterResponse.info[0].TABLENAME
res.adapterResponse.info[0].LIBREF +
'.' +
res.adapterResponse.info[0].TABLENAME
let dotArray = res.adapterResponse.finalfinal
let vizTmp: string = ''
@ -638,7 +640,10 @@ export class LineageComponent {
return
}
this.lineageTableName = res.adapterResponse.info[0].LIBREF + '.' + res.adapterResponse.info[0].TABNAME
this.lineageTableName =
res.adapterResponse.info[0].LIBREF +
'.' +
res.adapterResponse.info[0].TABNAME
this.lineageColumnName = res.adapterResponse.info[0].COLNAME
this.idlookup = res.adapterResponse.idlookup
@ -673,7 +678,8 @@ export class LineageComponent {
if (libraryToSelect['tables']) {
tableToSelect = libraryToSelect['tables'].find(
(table: any) => table.TABLEURI === res.adapterResponse.info[0].TABURI
(table: any) =>
table.TABLEURI === res.adapterResponse.info[0].TABURI
)
if (tableToSelect) {

View File

@ -110,44 +110,52 @@ export class MetadataComponent implements OnInit {
this.metatypesLoading = false
this.metaDataSearch = globals.metadata.metaDataSearch
} else {
this.sasService.request('metanav/metatypes', null).then((res: RequestWrapperResponse) => {
this.metaDataList = res.adapterResponse.types
globals.metadata.metaDataList = this.metaDataList
this.loading = false
this.metatypesLoading = false
})
this.sasService
.request('metanav/metatypes', null)
.then((res: RequestWrapperResponse) => {
this.metaDataList = res.adapterResponse.types
globals.metadata.metaDataList = this.metaDataList
this.loading = false
this.metatypesLoading = false
})
this.sasService.request('metanav/metarepos', null).then((res: RequestWrapperResponse) => {
let foundation = false
this.repositories = []
for (let index = 0; index < res.adapterResponse.outrepos.length; index++) {
this.repositories.push(res.adapterResponse.outrepos[index].NAME)
if (res.adapterResponse.outrepos[index].NAME === 'Foundation') {
foundation = true
this.sasService
.request('metanav/metarepos', null)
.then((res: RequestWrapperResponse) => {
let foundation = false
this.repositories = []
for (
let index = 0;
index < res.adapterResponse.outrepos.length;
index++
) {
this.repositories.push(res.adapterResponse.outrepos[index].NAME)
if (res.adapterResponse.outrepos[index].NAME === 'Foundation') {
foundation = true
}
}
}
if (foundation) {
this.repository = 'Foundation'
} else {
this.repository = res.adapterResponse.outrepos[0].NAME
}
globals.metadata.metaRepositories = this.repositories
globals.metadata.selectedRepository = this.repository
if (this.objectRoute) {
this.eventService.closeSidebar()
this.showData = true
let name = ''
let id = this.route.snapshot.params['objectID']
// let temp = this.router.url.split("%20").join(" ").split("/").reverse();
this.metaObjectList = []
this.metaObjectList.push({ ID: id, NAME: name })
this.metaObjectShowList = this.metaObjectList
this.metaObjectOnClick(
this.metaObjectShowList[0].ID,
this.metaObjectShowList[0]
)
}
})
if (foundation) {
this.repository = 'Foundation'
} else {
this.repository = res.adapterResponse.outrepos[0].NAME
}
globals.metadata.metaRepositories = this.repositories
globals.metadata.selectedRepository = this.repository
if (this.objectRoute) {
this.eventService.closeSidebar()
this.showData = true
let name = ''
let id = this.route.snapshot.params['objectID']
// let temp = this.router.url.split("%20").join(" ").split("/").reverse();
this.metaObjectList = []
this.metaObjectList.push({ ID: id, NAME: name })
this.metaObjectShowList = this.metaObjectList
this.metaObjectOnClick(
this.metaObjectShowList[0].ID,
this.metaObjectShowList[0]
)
}
})
}
}
@ -184,56 +192,64 @@ export class MetadataComponent implements OnInit {
const data: any = {
SASControlTable: [{ metatype: $event, repo: this.repository }]
}
this.sasService.request('metanav/metaobjects', data).then((res: RequestWrapperResponse) => {
this.metaObjectList = res.adapterResponse.objects
this.getMetaObjectAttributes(this.metaObjectSize)
this.loading = false
this.assoTypeSelected = $event
this.eventService.closeSidebar()
this.showData = true
})
this.sasService
.request('metanav/metaobjects', data)
.then((res: RequestWrapperResponse) => {
this.metaObjectList = res.adapterResponse.objects
this.getMetaObjectAttributes(this.metaObjectSize)
this.loading = false
this.assoTypeSelected = $event
this.eventService.closeSidebar()
this.showData = true
})
}
public async selectmetaObject($event: any, metaData?: any) {
let data: any = {
SASControlTable: [{ objecturi: $event }]
}
this.sasService.request('metanav/metadetails', data).then((res: RequestWrapperResponse) => {
this.metaObjectAssociations = res.adapterResponse.associations
this.root$ = of(this.getAssosiationsCount(res.adapterResponse.associations))
this.showAcc = true
this.showTable = true
let metaObjectName = res.adapterResponse.attributes.find(
(x: any) => x.NAME === 'Name'
).VALUE
this.assoObjectSelected = metaObjectName
metaData.NAME = metaObjectName
let url = this.router.url
if (this.objectRoute) {
// this.location.replaceState(url.slice(0, url.lastIndexOf("object")) + "object/" + $event.slice(1 + $event.indexOf("\\")) + "/" + escape(metaData.NAME));
this.location.replaceState(
url.slice(0, url.lastIndexOf('object')) +
'object/' +
$event.slice(1 + $event.indexOf('\\'))
this.sasService
.request('metanav/metadetails', data)
.then((res: RequestWrapperResponse) => {
this.metaObjectAssociations = res.adapterResponse.associations
this.root$ = of(
this.getAssosiationsCount(res.adapterResponse.associations)
)
} else {
// this.location.replaceState(url + "/object/" + $event.slice(1 + $event.indexOf("\\")) + "/" + escape(metaData.NAME));
this.location.replaceState(
url + '/object/' + $event.slice(1 + $event.indexOf('\\'))
)
}
this.metaObjectAttributes = res.adapterResponse.attributes
})
this.showAcc = true
this.showTable = true
let metaObjectName = res.adapterResponse.attributes.find(
(x: any) => x.NAME === 'Name'
).VALUE
this.assoObjectSelected = metaObjectName
metaData.NAME = metaObjectName
let url = this.router.url
if (this.objectRoute) {
// this.location.replaceState(url.slice(0, url.lastIndexOf("object")) + "object/" + $event.slice(1 + $event.indexOf("\\")) + "/" + escape(metaData.NAME));
this.location.replaceState(
url.slice(0, url.lastIndexOf('object')) +
'object/' +
$event.slice(1 + $event.indexOf('\\'))
)
} else {
// this.location.replaceState(url + "/object/" + $event.slice(1 + $event.indexOf("\\")) + "/" + escape(metaData.NAME));
this.location.replaceState(
url + '/object/' + $event.slice(1 + $event.indexOf('\\'))
)
}
this.metaObjectAttributes = res.adapterResponse.attributes
})
}
public async selectAssosiationsDetails($event: any, metaData?: any) {
let data: any = {
SASControlTable: [{ objecturi: $event }]
}
this.sasService.request('metanav/metadetails', data).then((res: RequestWrapperResponse) => {
this.metaObjectAttributes = res.adapterResponse.attributes
this.showTable = true
})
this.sasService
.request('metanav/metadetails', data)
.then((res: RequestWrapperResponse) => {
this.metaObjectAttributes = res.adapterResponse.attributes
this.showTable = true
})
}
public getAssosiationsCount(assosiationList: Array<any>) {

View File

@ -1,7 +1,7 @@
import { DcValidator } from "../shared/dc-validator/dc-validator"
import { FileUploadEncoding } from "./FileUploadEncoding"
import { FileUploader } from "./FileUploader.class"
import { ExcelRule } from "./TableData"
import { DcValidator } from '../shared/dc-validator/dc-validator'
import { FileUploadEncoding } from './FileUploadEncoding'
import { FileUploader } from './FileUploader.class'
import { ExcelRule } from './TableData'
export interface ParseParams {
file: File
@ -20,4 +20,4 @@ export interface ParseParams {
dateTimeHeaders: string[]
xlRules: ExcelRule[]
encoding?: FileUploadEncoding
}
}

View File

@ -1,5 +1,5 @@
import { FileUploader } from "./FileUploader.class"
import SheetInfo from "./SheetInfo"
import { FileUploader } from './FileUploader.class'
import SheetInfo from './SheetInfo'
export interface ParseResult {
/**
@ -12,4 +12,4 @@ export interface ParseResult {
headerShow?: string[]
rangeSheetRes?: SheetInfo
uploader: FileUploader
}
}

View File

@ -1,4 +1,4 @@
export interface UploadFileResponse {
adapterResponse: any,
adapterResponse: any
log?: string
}
}

View File

@ -1,4 +1,4 @@
export interface RequestWrapperResponse<responseType = any> {
adapterResponse: responseType
log?: string
}
}

View File

@ -60,7 +60,7 @@
<ng-container *ngIf="!dataset.submitResult">
<ng-container *ngIf="dataset.datasource">
<cds-icon
*ngIf="!(dataset.datasource.length && dataset.parseResult)"
*ngIf="!(dataset.datasource.length && dataset.parseResult)"
status="danger"
shape="exclamation-circle"
></cds-icon>
@ -71,15 +71,9 @@
</ng-container>
<ng-container *ngIf="!dataset.datasource">
<cds-icon
*ngIf="!dataset.parsingTable"
shape="table"
></cds-icon>
<cds-icon *ngIf="!dataset.parsingTable" shape="table"></cds-icon>
<clr-spinner
*ngIf="dataset.parsingTable"
clrSmall
></clr-spinner>
<clr-spinner *ngIf="dataset.parsingTable" clrSmall></clr-spinner>
</ng-container>
</ng-container>
@ -197,7 +191,9 @@
</div>
</ng-container>
<ng-container *ngIf="parsedDatasets.length && !submittedCsvDatasets.length">
<ng-container
*ngIf="parsedDatasets.length && !submittedCsvDatasets.length"
>
<div
*ngIf="!activeParsedDataset"
class="no-table-selected pointer-events-none"
@ -213,14 +209,21 @@
</div>
<ng-container *ngIf="activeParsedDataset">
<div *ngIf="activeParsedDataset.submitResult" class="d-flex clr-justify-content-between p-10 mt-15 submission-results">
<div
*ngIf="activeParsedDataset.submitResult"
class="d-flex clr-justify-content-between p-10 mt-15 submission-results"
>
<div>
<p cds-text="secondary regular" class="mb-10">
Submit Status:
<span *ngIf="activeParsedDataset.submitResult?.success" class="color-green"
<span
*ngIf="activeParsedDataset.submitResult?.success"
class="color-green"
><strong>SUCCESS</strong></span
>
<span *ngIf="activeParsedDataset.submitResult?.error" class="color-red"
<span
*ngIf="activeParsedDataset.submitResult?.error"
class="color-red"
><strong>ERROR</strong></span
>
</p>
@ -234,7 +237,9 @@
<div>
<button
*ngIf="!submittingCsv && activeParsedDataset.submitResult?.error"
*ngIf="
!submittingCsv && activeParsedDataset.submitResult?.error
"
(click)="reSubmitTable(activeParsedDataset)"
class="btn btn-primary mt-10"
[clrLoading]="submitLoading"
@ -244,7 +249,9 @@
<button
(click)="
downloadFile(
activeParsedDataset.submitResult.log || activeParsedDataset.submitResult.success || activeParsedDataset.submitResult.error
activeParsedDataset.submitResult.log ||
activeParsedDataset.submitResult.success ||
activeParsedDataset.submitResult.error
)
"
class="btn btn-primary-outline mt-10"
@ -254,7 +261,10 @@
</div>
</div>
<div *ngIf="activeParsedDataset.submitResult?.error" class="error-field mt-15">
<div
*ngIf="activeParsedDataset.submitResult?.error"
class="error-field mt-15"
>
<div class="log-wrapper">
{{ activeParsedDataset.submitResult?.error | json }}
</div>
@ -277,9 +287,14 @@
</ng-container>
<ng-container *ngIf="!activeParsedDataset.parseResult">
<strong *ngIf="!activeParsedDataset.parsingTable">No data found</strong>
<strong *ngIf="!activeParsedDataset.parsingTable"
>No data found</strong
>
<span *ngIf="activeParsedDataset.parsingTable" class="d-flex clr-align-items-center">
<span
*ngIf="activeParsedDataset.parsingTable"
class="d-flex clr-align-items-center"
>
<strong>Searching for the data...</strong>
<clr-spinner class="ml-5" clrSmall></clr-spinner>
</span>
@ -386,7 +401,9 @@
</p>
<p cds-text="secondary regular" class="mb-10">
Status:
<span *ngIf="activeSubmittedCsvDataset.success" class="color-green"
<span
*ngIf="activeSubmittedCsvDataset.success"
class="color-green"
><strong>SUCCESS</strong></span
>
<span *ngIf="activeSubmittedCsvDataset.error" class="color-red"
@ -405,7 +422,8 @@
<button
(click)="
downloadFile(
activeSubmittedCsvDataset.success || activeSubmittedCsvDataset.error
activeSubmittedCsvDataset.success ||
activeSubmittedCsvDataset.error
)
"
class="btn btn-primary-outline mt-10"

View File

@ -17,9 +17,7 @@ import { DcValidator } from '../shared/dc-validator/dc-validator'
import { ExcelRule } from '../models/TableData'
import { HotTableInterface } from '../models/HotTable.interface'
import { Col } from '../shared/dc-validator/models/col.model'
import {
SpreadsheetService
} from '../services/spreadsheet.service'
import { SpreadsheetService } from '../services/spreadsheet.service'
import Handsontable from 'handsontable'
import { HotTableRegisterer } from '@handsontable/angular'
import { EditorsStageDataSASResponse } from '../models/sas/editors-stagedata.model'
@ -199,7 +197,10 @@ export class MultiDatasetComponent implements OnInit {
// For EXCEL if multiple files, we only take one (the first one)
this.selectedFile = event.target.files[0]
if (this.selectedFile) this.selectedFile.sizeMB = this.spreadsheetService.bytesToMB(this.selectedFile.size)
if (this.selectedFile)
this.selectedFile.sizeMB = this.spreadsheetService.bytesToMB(
this.selectedFile.size
)
this.initUserInputHot()
this.onAutoDetectColumns()
@ -521,18 +522,21 @@ export class MultiDatasetComponent implements OnInit {
let passwordError = false
await this.parseExcelSheetNames()
.then((sheetNames) => {
this.sheetNames = sheetNames
})
.catch((err) => {
if (err.includes('password')) {
passwordError = true
}
})
.then((sheetNames) => {
this.sheetNames = sheetNames
})
.catch((err) => {
if (err.includes('password')) {
passwordError = true
}
})
if (passwordError) {
this.onDiscardFile()
this.eventService.showInfoModal('Locked file', 'We failed to unlock the file.')
this.eventService.showInfoModal(
'Locked file',
'We failed to unlock the file.'
)
return
}
@ -598,7 +602,9 @@ export class MultiDatasetComponent implements OnInit {
return this.parsedDatasets.find((dataset) => dataset.active)
}
public get activeSubmittedCsvDataset(): SubmittedCsvDatasetResult | undefined {
public get activeSubmittedCsvDataset():
| SubmittedCsvDatasetResult
| undefined {
return this.submittedCsvDatasets.find((dataset) => dataset.active)
}
@ -634,7 +640,7 @@ export class MultiDatasetComponent implements OnInit {
}
public get excelsSubmitted(): boolean {
return !!this.parsedDatasets.filter(ds => ds.submitResult).length
return !!this.parsedDatasets.filter((ds) => ds.submitResult).length
}
public downloadFile(response: any) {
@ -844,14 +850,16 @@ export class MultiDatasetComponent implements OnInit {
return new Promise((resolve, reject) => {
if (!this.selectedFile) return resolve([])
this.spreadsheetService.parseExcelSheetNames(this.selectedFile)
.then((parsed) => {
if (parsed.password) this.selectedFile!.password = parsed.password
this.spreadsheetService
.parseExcelSheetNames(this.selectedFile)
.then((parsed) => {
if (parsed.password) this.selectedFile!.password = parsed.password
return resolve(parsed.sheetNames)
}).catch((err) => {
return reject(err)
})
return resolve(parsed.sheetNames)
})
.catch((err) => {
return reject(err)
})
})
}
@ -1004,8 +1012,8 @@ export interface DatasetsObject extends EditorsGetDataServiceResponse {
export interface ParsedDataset {
libds: string
parseResult?: ParseResult
datasetInfo: DatasetsObject,
submitResult?: SubmittedDatasetResult,
datasetInfo: DatasetsObject
submitResult?: SubmittedDatasetResult
datasource?: any[]
includeInSubmission: boolean
status?: 'success' | 'error'
@ -1015,7 +1023,7 @@ export interface ParsedDataset {
export interface SubmittedDatasetResult {
success: EditorsStageDataSASResponse | undefined
error: any,
error: any
log?: string
}
@ -1027,6 +1035,6 @@ export interface SubmittedCsvDatasetResult {
}
export interface SelectedFile extends File {
sizeMB?: number,
sizeMB?: number
password?: string
}
}

View File

@ -48,61 +48,69 @@ export class RoleComponent implements OnInit {
} else {
if (globals.usernav.roleList === undefined) {
this.loading = true
this.sasService.request('usernav/userroles', null).then((res: RequestWrapperResponse) => {
this.loading = false
this.roles = res.adapterResponse.roles
globals.usernav.roleList = res.adapterResponse.roles
if (this.paramPresent) {
if (this.roles !== undefined) {
let validRole = this.findRole(this.roles, this.paramURI)
if (validRole !== false) {
this.loading = true
let data = { iwant: [{ roleid: this.paramURI }] }
this.sasService
.request('usernav/usermembersbyrole', data)
.then((res: RequestWrapperResponse) => {
this.loading = false
this.roleMembers = res.adapterResponse.sasmembers
this.roleMembersCount = res.adapterResponse.sasmembers.length
this.roleGroups = res.adapterResponse.sasgroups
this.roleGroupsCount = res.adapterResponse.sasgroups.length
this.roleUri = validRole.ROLEURI
this.roleName = validRole.ROLENAME
this.roleDesc = validRole.ROLEDESC
})
this.sasService
.request('usernav/userroles', null)
.then((res: RequestWrapperResponse) => {
this.loading = false
this.roles = res.adapterResponse.roles
globals.usernav.roleList = res.adapterResponse.roles
if (this.paramPresent) {
if (this.roles !== undefined) {
let validRole = this.findRole(this.roles, this.paramURI)
if (validRole !== false) {
this.loading = true
let data = { iwant: [{ roleid: this.paramURI }] }
this.sasService
.request('usernav/usermembersbyrole', data)
.then((res: RequestWrapperResponse) => {
this.loading = false
this.roleMembers = res.adapterResponse.sasmembers
this.roleMembersCount =
res.adapterResponse.sasmembers.length
this.roleGroups = res.adapterResponse.sasgroups
this.roleGroupsCount =
res.adapterResponse.sasgroups.length
this.roleUri = validRole.ROLEURI
this.roleName = validRole.ROLENAME
this.roleDesc = validRole.ROLEDESC
})
}
}
}
}
})
})
} else {
this.roles = globals.usernav.roleList
this.roleSearch = globals.usernav.roleSearch
this.sasService.request('usernav/userroles', null).then((res: RequestWrapperResponse) => {
this.roles = res.adapterResponse.roles
globals.usernav.roleList = res.adapterResponse.roles
this.sasService
.request('usernav/userroles', null)
.then((res: RequestWrapperResponse) => {
this.roles = res.adapterResponse.roles
globals.usernav.roleList = res.adapterResponse.roles
if (this.paramPresent) {
if (this.roles !== undefined) {
let validRole = this.findRole(this.roles, this.paramURI)
if (validRole !== false) {
this.loading = true
let data = { iwant: [{ roleid: this.paramURI }] }
this.sasService
.request('usernav/usermembersbyrole', data)
.then((res: RequestWrapperResponse) => {
this.loading = false
this.roleMembers = res.adapterResponse.sasmembers
this.roleMembersCount = res.adapterResponse.sasmembers.length
this.roleGroups = res.adapterResponse.sasgroups
this.roleGroupsCount = res.adapterResponse.sasgroups.length
this.roleUri = validRole.ROLEURI
this.roleName = validRole.ROLENAME
this.roleDesc = validRole.ROLEDESC
})
if (this.paramPresent) {
if (this.roles !== undefined) {
let validRole = this.findRole(this.roles, this.paramURI)
if (validRole !== false) {
this.loading = true
let data = { iwant: [{ roleid: this.paramURI }] }
this.sasService
.request('usernav/usermembersbyrole', data)
.then((res: RequestWrapperResponse) => {
this.loading = false
this.roleMembers = res.adapterResponse.sasmembers
this.roleMembersCount =
res.adapterResponse.sasmembers.length
this.roleGroups = res.adapterResponse.sasgroups
this.roleGroupsCount =
res.adapterResponse.sasgroups.length
this.roleUri = validRole.ROLEURI
this.roleName = validRole.ROLENAME
this.roleDesc = validRole.ROLEDESC
})
}
}
}
}
})
})
}
}
}

View File

@ -87,7 +87,10 @@ export class AppService {
let missingProps: string[] = []
if (!res.adapterResponse.globvars || (res.adapterResponse.globvars && !res.adapterResponse.globvars[0]))
if (
!res.adapterResponse.globvars ||
(res.adapterResponse.globvars && !res.adapterResponse.globvars[0])
)
missingProps.push('Globvars')
if (!res.adapterResponse.sasdatasets) missingProps.push('Sasdatasets')
if (!res.adapterResponse.saslibs) missingProps.push('Saslibs')

View File

@ -59,10 +59,8 @@ export class SasStoreService {
) {
const tables: any = {}
tables[tableName] = [tableData]
const res: RequestWrapperResponse<EditorsGetDataSASResponse> = await this.sasService.request(
program,
tables
)
const res: RequestWrapperResponse<EditorsGetDataSASResponse> =
await this.sasService.request(program, tables)
const response: EditorsGetDataServiceResponse = {
data: res.adapterResponse,
libds: libds

View File

@ -121,7 +121,9 @@ export class SasService {
})
.then(
(res: any) => {
const sasRequest = this.sasjsAdapter.getSasRequests().find(rq => rq.serviceLink === url)
const sasRequest = this.sasjsAdapter
.getSasRequests()
.find((rq) => rq.serviceLink === url)
if (res.login === false) {
this.shouldLogin.next(true)
@ -209,7 +211,9 @@ export class SasService {
(err: { error: ErrorBody | undefined }) => {
console.error(err)
const sasRequest = this.sasjsAdapter.getSasRequests().find(rq => rq.serviceLink === url)
const sasRequest = this.sasjsAdapter
.getSasRequests()
.find((rq) => rq.serviceLink === url)
if (err.error) {
let errorMessage: string | undefined = err.error.message
@ -259,23 +263,34 @@ export class SasService {
* @param params Aditional parameters eg. { debug: false }
* @returns HTTP Response
*/
public uploadFile(sasService: string, files: UploadFile[], params: any): Promise<UploadFileResponse> {
public uploadFile(
sasService: string,
files: UploadFile[],
params: any
): Promise<UploadFileResponse> {
return new Promise((resolve, reject) => {
this.sasjsAdapter.uploadFile(sasService, files, params).then(res => {
const sasRequest = this.sasjsAdapter.getSasRequests().find(rq => rq.serviceLink === 'services/editors/loadfile')
this.sasjsAdapter.uploadFile(sasService, files, params).then(
(res) => {
const sasRequest = this.sasjsAdapter
.getSasRequests()
.find((rq) => rq.serviceLink === 'services/editors/loadfile')
resolve({
adapterResponse: res,
log: sasRequest?.logFile
})
}, (err) => {
const sasRequest = this.sasjsAdapter.getSasRequests().find(rq => rq.serviceLink === 'services/editors/loadfile')
resolve({
adapterResponse: res,
log: sasRequest?.logFile
})
},
(err) => {
const sasRequest = this.sasjsAdapter
.getSasRequests()
.find((rq) => rq.serviceLink === 'services/editors/loadfile')
reject({
response: err,
log: sasRequest?.logFile
})
})
reject({
response: err,
log: sasRequest?.logFile
})
}
)
})
}

View File

@ -1,7 +1,5 @@
import { Injectable } from '@angular/core'
import {
ExcelPasswordModalService,
} from '../shared/excel-password-modal/excel-password-modal.service'
import { ExcelPasswordModalService } from '../shared/excel-password-modal/excel-password-modal.service'
import { EventService } from './event.service'
import { LicenceService } from './licence.service'
import { SpreadsheetUtil } from '../shared/spreadsheet-util/spreadsheet-util'
@ -21,9 +19,7 @@ export class SpreadsheetService {
private excelPasswordModalService: ExcelPasswordModalService,
private eventService: EventService,
private licenceService: LicenceService
) {
}
) {}
public parseExcelFile(
parseParams: ParseParams,
@ -43,35 +39,35 @@ export class SpreadsheetService {
}
/**
* Read the file minimally just to get the sheet names, not reading full file
* to help boost the performance
*
* @returns sheet names in string array
*/
public async parseExcelSheetNames(file: File): Promise<{
sheetNames: string[],
password?: string
}> {
return new Promise((resolve, reject) => {
const reader = new FileReader()
* Read the file minimally just to get the sheet names, not reading full file
* to help boost the performance
*
* @returns sheet names in string array
*/
public async parseExcelSheetNames(file: File): Promise<{
sheetNames: string[]
password?: string
}> {
return new Promise((resolve, reject) => {
const reader = new FileReader()
if (!file) {
console.warn('file is missing')
return resolve({ sheetNames: [] })
}
if (!file) {
console.warn('file is missing')
return resolve({ sheetNames: [] })
}
reader.onload = async (event: ProgressEvent<FileReader>) => {
if (!event?.target) {
console.warn('File reader event.target is missing')
return
}
reader.onload = async (event: ProgressEvent<FileReader>) => {
if (!event?.target) {
console.warn('File reader event.target is missing')
return
}
let wb: XLSX.WorkBook | undefined = undefined
let fileUnlocking: boolean = false
let password: string | undefined
const data = event.target.result
let wb: XLSX.WorkBook | undefined = undefined
let fileUnlocking: boolean = false
let password: string | undefined
const data = event.target.result
try {
try {
wb = XLSX.read(data, {
// Load file minimally to parse sheets
bookSheets: true,
@ -107,7 +103,8 @@ export class SpreadsheetService {
}
}
if (!password) return reject('Invalid password, failed to decrypt the file')
if (!password)
return reject('Invalid password, failed to decrypt the file')
} else {
fileUnlocking = false
return reject('No password provided')
@ -130,29 +127,33 @@ export class SpreadsheetService {
} catch (e) {
console.error(e)
}
}
}
reader.onerror = function (ex) {
console.log(ex)
}
reader.onerror = function (ex) {
console.log(ex)
}
reader.readAsBinaryString(file)
})
}
reader.readAsBinaryString(file)
})
}
public bytesToMB(size: number): number {
return parseFloat((size / (1024*1024)).toFixed(2))
return parseFloat((size / (1024 * 1024)).toFixed(2))
}
/**
* When excel is password protected we will display the password prompt for user to type password in.
* @returns Password user input or undefined if discarded by user
*/
private promptExcelPassword = (options?: OpenOptions): Promise<string | undefined> => {
private promptExcelPassword = (
options?: OpenOptions
): Promise<string | undefined> => {
return new Promise((resolve, reject) => {
this.excelPasswordModalService.open(options).subscribe((result: Result) => {
resolve(result.password)
})
this.excelPasswordModalService
.open(options)
.subscribe((result: Result) => {
resolve(result.password)
})
})
}
}

View File

@ -1,8 +1,6 @@
import { Component } from '@angular/core'
import { Observable } from 'rxjs'
import {
ExcelPasswordModalService
} from './excel-password-modal.service'
import { ExcelPasswordModalService } from './excel-password-modal.service'
import { Options } from './models/options.interface'
@Component({

View File

@ -4,4 +4,4 @@ export interface OpenOptions {
export interface Options extends OpenOptions {
open: boolean
}
}

View File

@ -1,3 +1,3 @@
export interface Result {
password: string | undefined
}
}

View File

@ -1,5 +1,3 @@
export class RandomClass {
constructor(jo: string) {
}
}
constructor(jo: string) {}
}

View File

@ -1,13 +1,23 @@
import { isSpecialMissing } from '@sasjs/utils/input/validators'
import { dateFormat, dateToUtcTime, dateToTime } from "src/app/editor/utils/date.utils"
import { getMissingHeaders, excelDateToJSDate } from "src/app/editor/utils/grid.utils"
import { isStringNumber, isStringDecimal } from "src/app/editor/utils/types.utils"
import { FileUploader } from "src/app/models/FileUploader.class"
import SheetInfo from "src/app/models/SheetInfo"
import { blobToFile } from "src/app/xlmap/utils/file.utils"
import {
dateFormat,
dateToUtcTime,
dateToTime
} from 'src/app/editor/utils/date.utils'
import {
getMissingHeaders,
excelDateToJSDate
} from 'src/app/editor/utils/grid.utils'
import {
isStringNumber,
isStringDecimal
} from 'src/app/editor/utils/types.utils'
import { FileUploader } from 'src/app/models/FileUploader.class'
import SheetInfo from 'src/app/models/SheetInfo'
import { blobToFile } from 'src/app/xlmap/utils/file.utils'
import * as XLSX from '@sheet/crypto'
import { LicenceState } from "src/app/models/LicenceState"
import { BehaviorSubject } from "rxjs"
import { LicenceState } from 'src/app/models/LicenceState'
import { BehaviorSubject } from 'rxjs'
import { ParseParams } from 'src/app/models/ParseParams.interface'
import { ParseResult } from 'src/app/models/ParseResult.interface'
import { OpenOptions } from '../excel-password-modal/models/options.interface'
@ -55,7 +65,6 @@ export class SpreadsheetUtil {
const sizeInMB = this.bytesToMB(parseParams.file.size)
if (sizeInMB > 2) {
}
let data: any[] = []
@ -441,27 +450,30 @@ export class SpreadsheetUtil {
}
public bytesToMB(size: number): number {
return parseFloat((size / (1024*1024)).toFixed(2))
return parseFloat((size / (1024 * 1024)).toFixed(2))
}
private xlsxRead(data: any, opts?: XLSX.ParsingOptions | undefined): XLSX.WorkBook {
private xlsxRead(
data: any,
opts?: XLSX.ParsingOptions | undefined
): XLSX.WorkBook {
if (typeof Worker !== 'undefined') {
// Create a new
const worker = new Worker(new URL('../../spreadsheet.worker', import.meta.url));
worker.onmessage = ({ data }) => {
};
const worker = new Worker(
new URL('../../spreadsheet.worker', import.meta.url)
)
worker.onmessage = ({ data }) => {}
worker.postMessage({
data,
opts
});
})
return XLSX.read(data, opts) // Put in worker
return XLSX.read(data, opts) // Put in worker
} else {
// Web workers are not supported in this environment.
// You should add a fallback so that your program still executes correctly.
return XLSX.read(data, opts)
return XLSX.read(data, opts)
}
}
@ -901,4 +913,4 @@ export class SpreadsheetUtil {
}
return binary
}
}
}

View File

@ -53,7 +53,11 @@ export class TermsComponent implements OnInit, AfterViewInit {
this.sasService
.request(`public/registeruser`, table)
.then((res: RequestWrapperResponse) => {
if (res.adapterResponse.return && res.adapterResponse.return[0] && res.adapterResponse.return[0].MSG === 'SUCCESS') {
if (
res.adapterResponse.return &&
res.adapterResponse.return[0] &&
res.adapterResponse.return[0].MSG === 'SUCCESS'
) {
location.reload()
}
})

View File

@ -4,9 +4,9 @@ import * as XLSX from '@sheet/crypto'
addEventListener('message', ({ data }) => {
const input = data as {
data: any,
data: any
opts?: XLSX.ParsingOptions | undefined
}
console.log('input', input)
});
})

View File

@ -184,7 +184,9 @@ export class StageComponent implements OnInit {
.then((res: RequestWrapperResponse<EditorsRestoreServiceResponse>) => {
if (res.adapterResponse.restore_out) {
this.route.navigate([`/stage`]).then(() => {
this.route.navigate([`/stage/${res.adapterResponse.restore_out[0].LOADREF}`])
this.route.navigate([
`/stage/${res.adapterResponse.restore_out[0].LOADREF}`
])
})
}
})

View File

@ -293,7 +293,9 @@ export class ViewerComponent implements AfterContentInit, AfterViewInit {
this.libinfo = null
this.sasStoreService.refreshLibInfo(this.lib).then(
async (res: RequestWrapperResponse<PublicRefreshlibinfoServiceResponse>) => {
async (
res: RequestWrapperResponse<PublicRefreshlibinfoServiceResponse>
) => {
this.libinfo = res.adapterResponse.libinfo
globals.viewer.libinfo = this.libinfo