fix: refactored adapter request wrapper function to return job log as well
This commit is contained in:
parent
b712f851a2
commit
67436f4ff9
@ -1,6 +1,7 @@
|
||||
import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core'
|
||||
import SASjs, { SASjsConfig } from '@sasjs/adapter'
|
||||
import { DcAdapterSettings } from 'src/app/models/DcAdapterSettings'
|
||||
import { RequestWrapperResponse } from 'src/app/models/request-wrapper/RequestWrapperResponse'
|
||||
import { DeployService } from 'src/app/services/deploy.service'
|
||||
import { EventService } from 'src/app/services/event.service'
|
||||
import { LoggerService } from 'src/app/services/logger.service'
|
||||
@ -303,10 +304,10 @@ export class ManualComponent implements OnInit {
|
||||
|
||||
this.sasService
|
||||
.request('public/startupservice', null)
|
||||
.then((res: any) => {
|
||||
this.loggerService.log(res)
|
||||
.then((res: RequestWrapperResponse) => {
|
||||
this.loggerService.log(res.adapterResponse)
|
||||
|
||||
if (res.saslibs) {
|
||||
if (res.adapterResponse.saslibs) {
|
||||
this.validationState = 'success'
|
||||
} else {
|
||||
this.validationState = 'error'
|
||||
|
@ -3,6 +3,7 @@ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'
|
||||
import SASjs, { SASjsConfig } from '@sasjs/adapter'
|
||||
import { ServerType } from '@sasjs/utils/types/serverType'
|
||||
import { DcAdapterSettings } from 'src/app/models/DcAdapterSettings'
|
||||
import { RequestWrapperResponse } from 'src/app/models/request-wrapper/RequestWrapperResponse'
|
||||
import { SASGroup } from 'src/app/models/sas/public-getgroups.model'
|
||||
import { SASjsApiServerInfo } from 'src/app/models/sasjs-api/SASjsApiServerInfo.model'
|
||||
import { SasService } from 'src/app/services/sas.service'
|
||||
@ -68,11 +69,11 @@ export class SasjsConfiguratorComponent implements OnInit {
|
||||
this.loading = true
|
||||
|
||||
this.sasService.request('usernav/usergroupsbymember', null).then(
|
||||
(res: any) => {
|
||||
this.METAPERSON = res.MF_GETUSER
|
||||
this.SYSUSERID = res.SYSUSERID
|
||||
this.SYSHOSTNAME = res.SYSHOSTNAME
|
||||
this.SYSVLONG = res.SYSVLONG
|
||||
(res: RequestWrapperResponse) => {
|
||||
this.METAPERSON = res.adapterResponse.MF_GETUSER
|
||||
this.SYSUSERID = res.adapterResponse.SYSUSERID
|
||||
this.SYSHOSTNAME = res.adapterResponse.SYSHOSTNAME
|
||||
this.SYSVLONG = res.adapterResponse.SYSVLONG
|
||||
|
||||
/*
|
||||
We would like to present a default DCPATH (deployment path) to the
|
||||
@ -88,12 +89,12 @@ export class SasjsConfiguratorComponent implements OnInit {
|
||||
*/
|
||||
this.dcDirectory =
|
||||
this.tmpDirectories[
|
||||
['L', 'H', 'A', 'S'].includes(res.SYSSCPL.substring(0, 1))
|
||||
['L', 'H', 'A', 'S'].includes(res.adapterResponse.SYSSCPL.substring(0, 1))
|
||||
? 'linux'
|
||||
: 'windows'
|
||||
]
|
||||
|
||||
this.dcAdminGroupList = res.groups
|
||||
this.dcAdminGroupList = res.adapterResponse.groups
|
||||
this.dcAdminGroup = this.dcAdminGroupList[0].GROUPNAME
|
||||
|
||||
this.loading = false
|
||||
|
@ -61,6 +61,8 @@ import {
|
||||
ParseResult,
|
||||
SpreadsheetService
|
||||
} from '../services/spreadsheet.service'
|
||||
import { UploadFileResponse } from '../models/UploadFile'
|
||||
import { RequestWrapperResponse } from '../models/request-wrapper/RequestWrapperResponse'
|
||||
|
||||
@Component({
|
||||
selector: 'app-editor',
|
||||
@ -571,20 +573,20 @@ export class EditorComponent implements OnInit, AfterViewInit {
|
||||
this.sasService
|
||||
.uploadFile(this.uploadUrl, filesToUpload, { table: this.libds })
|
||||
.then(
|
||||
(res: any) => {
|
||||
if (typeof res.sasjsAbort === 'undefined') {
|
||||
if (typeof res.sasparams === 'undefined') {
|
||||
(res: UploadFileResponse) => {
|
||||
if (typeof res.adapterResponse.sasjsAbort === 'undefined') {
|
||||
if (typeof res.adapterResponse.sasparams === 'undefined') {
|
||||
return
|
||||
} else {
|
||||
this.uploadLoading = false
|
||||
let params = res.sasparams[0]
|
||||
let params = res.adapterResponse.sasparams[0]
|
||||
this.successEnable = true
|
||||
this.tableId = params.DSID
|
||||
this.router.navigateByUrl('/stage/' + this.tableId)
|
||||
}
|
||||
} else {
|
||||
// handle succesfull response
|
||||
const abortRes = res
|
||||
const abortRes = res.adapterResponse
|
||||
const abortMsg = abortRes.sasjsAbort[0].MSG
|
||||
const macMsg = abortRes.sasjsAbort[0].MAC
|
||||
|
||||
@ -609,7 +611,7 @@ export class EditorComponent implements OnInit, AfterViewInit {
|
||||
this.fileUploadInputCompList.first.nativeElement.value = ''
|
||||
}
|
||||
this.uploader.queue = []
|
||||
this.eventService.catchResponseError('file upload', err)
|
||||
this.eventService.catchResponseError('file upload', err.adapterResponse)
|
||||
}
|
||||
)
|
||||
}
|
||||
@ -1561,9 +1563,9 @@ export class EditorComponent implements OnInit, AfterViewInit {
|
||||
'editors/stagedata',
|
||||
this.$dataFormats
|
||||
)
|
||||
.then((res: any) => {
|
||||
if (typeof res.sasparams !== 'undefined') {
|
||||
this.router.navigateByUrl('/stage/' + res.sasparams[0].DSID)
|
||||
.then((res: RequestWrapperResponse) => {
|
||||
if (typeof res.adapterResponse.sasparams !== 'undefined') {
|
||||
this.router.navigateByUrl('/stage/' + res.adapterResponse.sasparams[0].DSID)
|
||||
|
||||
return true
|
||||
}
|
||||
@ -1591,7 +1593,7 @@ export class EditorComponent implements OnInit, AfterViewInit {
|
||||
this.disableSubmit = true
|
||||
this.submit = false
|
||||
|
||||
let errorText = typeof err === 'string' ? err : JSON.stringify(err)
|
||||
let errorText = typeof err.adapterRespnse === 'string' ? err.adapterRespnse : JSON.stringify(err.adapterRespnse)
|
||||
|
||||
this.eventService.showAbortModal(
|
||||
'editors/stagedata',
|
||||
@ -1983,8 +1985,8 @@ export class EditorComponent implements OnInit, AfterViewInit {
|
||||
suppressSuccessAbortModal: true,
|
||||
suppressErrorAbortModal: true
|
||||
})
|
||||
.then((res: any) => {
|
||||
const colSource = res.dynamic_values.map(
|
||||
.then((res: RequestWrapperResponse) => {
|
||||
const colSource = res.adapterResponse.dynamic_values.map(
|
||||
(el: any) => el[this.cellValidationFields.RAW_VALUE]
|
||||
)
|
||||
|
||||
@ -1998,8 +2000,8 @@ export class EditorComponent implements OnInit, AfterViewInit {
|
||||
...this.cellValidationSource[validationSourceIndex],
|
||||
row: row,
|
||||
col: column,
|
||||
values: res.dynamic_values,
|
||||
extended_values: res.dynamic_extended_values
|
||||
values: res.adapterResponse.dynamic_values,
|
||||
extended_values: res.adapterResponse.dynamic_extended_values
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ import { ServerType } from '@sasjs/utils/types/serverType'
|
||||
import { HelperService } from '../services/helper.service'
|
||||
import { SasService } from '../services/sas.service'
|
||||
import { globals } from '../_globals'
|
||||
import { RequestWrapperResponse } from '../models/request-wrapper/RequestWrapperResponse'
|
||||
|
||||
@Component({
|
||||
selector: 'app-group',
|
||||
@ -82,10 +83,10 @@ export class GroupComponent implements OnInit {
|
||||
globals.usernav.groupList = groups
|
||||
})
|
||||
} else {
|
||||
this.sasService.request('public/getgroups', null).then((res: any) => {
|
||||
this.sasService.request('public/getgroups', null).then((res: RequestWrapperResponse) => {
|
||||
this.loading = false
|
||||
this.groups = res.groups
|
||||
globals.usernav.groupList = res.groups
|
||||
this.groups = res.adapterResponse.groups
|
||||
globals.usernav.groupList = res.adapterResponse.groups
|
||||
})
|
||||
}
|
||||
} else {
|
||||
@ -128,14 +129,14 @@ export class GroupComponent implements OnInit {
|
||||
let data = { iwant: [{ groupid: this.paramURI }] }
|
||||
this.sasService
|
||||
.request('usernav/usermembersbygroup', data)
|
||||
.then((res: any) => {
|
||||
this.groupMembers = res.sasmembers
|
||||
this.groupMemberCount = res.sasmembers.length
|
||||
if (res.sasmembers[0] !== undefined) {
|
||||
.then((res: RequestWrapperResponse) => {
|
||||
this.groupMembers = res.adapterResponse.sasmembers
|
||||
this.groupMemberCount = res.adapterResponse.sasmembers.length
|
||||
if (res.adapterResponse.sasmembers[0] !== undefined) {
|
||||
this.loading = false
|
||||
this.groupUri = res.sasmembers[0].URIMEM || this.paramURI
|
||||
this.groupName = res.sasmembers[0].GROUPNAME
|
||||
this.groupDesc = res.sasmembers[0].GROUPDESC
|
||||
this.groupUri = res.adapterResponse.sasmembers[0].URIMEM || this.paramURI
|
||||
this.groupName = res.adapterResponse.sasmembers[0].GROUPNAME
|
||||
this.groupDesc = res.adapterResponse.sasmembers[0].GROUPDESC
|
||||
|
||||
if (!this.groupName) {
|
||||
this.groupName = this.paramURI
|
||||
@ -202,13 +203,13 @@ export class GroupComponent implements OnInit {
|
||||
|
||||
this.sasService
|
||||
.request('usernav/usermembersbygroup', data)
|
||||
.then((res: any) => {
|
||||
.then((res: RequestWrapperResponse) => {
|
||||
this.loading = false
|
||||
this.groupUri = group.GROUPURI
|
||||
this.groupName = group.GROUPNAME
|
||||
this.groupDesc = group.GROUPDESC
|
||||
this.groupMembers = res.sasmembers
|
||||
this.groupMemberCount = res.sasmembers.length
|
||||
this.groupMembers = res.adapterResponse.sasmembers
|
||||
this.groupMemberCount = res.adapterResponse.sasmembers.length
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core'
|
||||
import { ActivatedRoute, Router } from '@angular/router'
|
||||
import { AppService, LicenceService, SasService } from '../services'
|
||||
import { LicenseKeyData } from '../models/LicenseKeyData'
|
||||
import { RequestWrapperResponse } from '../models/request-wrapper/RequestWrapperResponse'
|
||||
|
||||
enum LicenseActions {
|
||||
key = 'key',
|
||||
@ -116,8 +117,8 @@ export class LicensingComponent implements OnInit {
|
||||
|
||||
this.sasService
|
||||
.request('admin/registerkey', table)
|
||||
.then((res: any) => {
|
||||
if (res.return && res.return[0] && res.return[0].MSG === 'SUCCESS') {
|
||||
.then((res: RequestWrapperResponse) => {
|
||||
if (res.adapterResponse.return && res.adapterResponse.return[0] && res.adapterResponse.return[0].MSG === 'SUCCESS') {
|
||||
location.replace(location.href.split('#')[0])
|
||||
}
|
||||
})
|
||||
|
@ -9,6 +9,7 @@ import { SasService } from '../services/sas.service'
|
||||
import * as saveSvg from 'save-svg-as-png'
|
||||
import { LoggerService } from '../services/logger.service'
|
||||
import { LicenceService } from '../services/licence.service'
|
||||
import { RequestWrapperResponse } from '../models/request-wrapper/RequestWrapperResponse'
|
||||
const moment = require('moment')
|
||||
|
||||
@Component({
|
||||
@ -115,8 +116,8 @@ export class LineageComponent {
|
||||
|
||||
await this.sasService
|
||||
.request('lineage/getmetacols', libTable)
|
||||
.then((res: any) => {
|
||||
this.columnsList = res.metacols
|
||||
.then((res: RequestWrapperResponse) => {
|
||||
this.columnsList = res.adapterResponse.metacols
|
||||
if (this.columnsList && this.columnsList.length > 0) {
|
||||
// this.column = this.columnsList[0]['COLURI']
|
||||
|
||||
@ -174,8 +175,8 @@ export class LineageComponent {
|
||||
let libTable = { SASControlTable: [{ liburi: $event }] }
|
||||
await this.sasService
|
||||
.request('lineage/getmetatables', libTable)
|
||||
.then((res: any) => {
|
||||
this.tablesList = res.metatables
|
||||
.then((res: RequestWrapperResponse) => {
|
||||
this.tablesList = res.adapterResponse.metatables
|
||||
|
||||
if (this.tablesList && this.tablesList.length > 0) {
|
||||
library['tables'] = this.tablesList
|
||||
@ -295,8 +296,8 @@ export class LineageComponent {
|
||||
} else {
|
||||
await this.sasService
|
||||
.request('public/viewlibs', null)
|
||||
.then((res: any) => {
|
||||
this.libraryList = res.saslibs
|
||||
.then((res: RequestWrapperResponse) => {
|
||||
this.libraryList = res.adapterResponse.saslibs
|
||||
this.helperService.displayLibraries(this.libraryList)
|
||||
|
||||
if (this.libraryList) {
|
||||
@ -402,8 +403,8 @@ export class LineageComponent {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
this.sasService
|
||||
.request('lineage/fetchtablelineage', libTable)
|
||||
.then(async (res: any) => {
|
||||
if (res.flatdata.length > 0) {
|
||||
.then(async (res: RequestWrapperResponse) => {
|
||||
if (res.adapterResponse.flatdata.length > 0) {
|
||||
if (this.licenceService.checkLineageLimit()) {
|
||||
this.eventService.showInfoModal(
|
||||
'Notice',
|
||||
@ -421,20 +422,20 @@ export class LineageComponent {
|
||||
}
|
||||
|
||||
this.lineageTableName =
|
||||
res.info[0].LIBREF + '.' + res.info[0].TABLENAME
|
||||
res.adapterResponse.info[0].LIBREF + '.' + res.adapterResponse.info[0].TABLENAME
|
||||
|
||||
let dotArray = res.finalfinal
|
||||
let dotArray = res.adapterResponse.finalfinal
|
||||
let vizTmp: string = ''
|
||||
|
||||
for (let i = 0; i < dotArray.length; i++) {
|
||||
vizTmp += unescape(dotArray[i].LINE) + '\n'
|
||||
}
|
||||
|
||||
this.flatdata = res.flatdata
|
||||
this.flatdata = res.adapterResponse.flatdata
|
||||
|
||||
if (this.libraryList) {
|
||||
let libraryToSelect = this.libraryList.find((library: any) =>
|
||||
res.info[0].LIBURI.toUpperCase().includes(
|
||||
res.adapterResponse.info[0].LIBURI.toUpperCase().includes(
|
||||
library.LIBRARYID.toUpperCase()
|
||||
)
|
||||
)
|
||||
@ -450,7 +451,7 @@ export class LineageComponent {
|
||||
if (libraryToSelect['tables']) {
|
||||
tableToSelect = libraryToSelect['tables'].find((table: any) =>
|
||||
table.TABLEURI.toUpperCase().includes(
|
||||
res.info[0].TABLEID.toUpperCase()
|
||||
res.adapterResponse.info[0].TABLEID.toUpperCase()
|
||||
)
|
||||
)
|
||||
|
||||
@ -495,10 +496,10 @@ export class LineageComponent {
|
||||
.replace(/\sds:/g, '\nds:')
|
||||
.replace(/\s\n/g, '\n')
|
||||
|
||||
this.idlookup = res.idlookup
|
||||
this.idlookup = res.adapterResponse.idlookup
|
||||
|
||||
if (res.finalfinal.length > this.largeDotFileLimit) {
|
||||
this.largeDotFileLines = res.finalfinal.length
|
||||
if (res.adapterResponse.finalfinal.length > this.largeDotFileLimit) {
|
||||
this.largeDotFileLines = res.adapterResponse.finalfinal.length
|
||||
} else {
|
||||
this.buildGraph()
|
||||
}
|
||||
@ -619,8 +620,8 @@ export class LineageComponent {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
this.sasService
|
||||
.request('lineage/fetchcollineage', libTable)
|
||||
.then(async (res: any) => {
|
||||
if (res.flatdata.length > 0) {
|
||||
.then(async (res: RequestWrapperResponse) => {
|
||||
if (res.adapterResponse.flatdata.length > 0) {
|
||||
if (this.licenceService.checkLineageLimit()) {
|
||||
this.eventService.showInfoModal(
|
||||
'Notice',
|
||||
@ -631,18 +632,18 @@ export class LineageComponent {
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof res === 'string') {
|
||||
if (typeof res.adapterResponse === 'string') {
|
||||
this.vizInput = 'digraph G {SAS Error}'
|
||||
this.buildGraph()
|
||||
return
|
||||
}
|
||||
|
||||
this.lineageTableName = res.info[0].LIBREF + '.' + res.info[0].TABNAME
|
||||
this.lineageColumnName = res.info[0].COLNAME
|
||||
this.lineageTableName = res.adapterResponse.info[0].LIBREF + '.' + res.adapterResponse.info[0].TABNAME
|
||||
this.lineageColumnName = res.adapterResponse.info[0].COLNAME
|
||||
|
||||
this.idlookup = res.idlookup
|
||||
this.idlookup = res.adapterResponse.idlookup
|
||||
|
||||
let dotArray = res.fromsas
|
||||
let dotArray = res.adapterResponse.fromsas
|
||||
let vizTmp: string = ''
|
||||
for (let i = 0; i < dotArray.length; i++) {
|
||||
vizTmp += unescape(dotArray[i].STRING) + '\n'
|
||||
@ -653,11 +654,11 @@ export class LineageComponent {
|
||||
.replace(/\sds:/g, '\nds:')
|
||||
.replace(/\s\n/g, '\n')
|
||||
|
||||
this.flatdata = res.flatdata
|
||||
this.flatdata = res.adapterResponse.flatdata
|
||||
|
||||
if (this.libraryList) {
|
||||
let libraryToSelect = this.libraryList.find((library: any) =>
|
||||
res.info[0]?.LIBURI?.toUpperCase()?.includes(
|
||||
res.adapterResponse.info[0]?.LIBURI?.toUpperCase()?.includes(
|
||||
library?.LIBRARYID?.toUpperCase()
|
||||
)
|
||||
)
|
||||
@ -672,7 +673,7 @@ export class LineageComponent {
|
||||
|
||||
if (libraryToSelect['tables']) {
|
||||
tableToSelect = libraryToSelect['tables'].find(
|
||||
(table: any) => table.TABLEURI === res.info[0].TABURI
|
||||
(table: any) => table.TABLEURI === res.adapterResponse.info[0].TABURI
|
||||
)
|
||||
|
||||
if (tableToSelect) {
|
||||
@ -714,8 +715,8 @@ export class LineageComponent {
|
||||
}
|
||||
}
|
||||
|
||||
if (res.fromsas.length > this.largeDotFileLimit) {
|
||||
this.largeDotFileLines = res.fromsas.length
|
||||
if (res.adapterResponse.fromsas.length > this.largeDotFileLimit) {
|
||||
this.largeDotFileLines = res.adapterResponse.fromsas.length
|
||||
} else {
|
||||
this.buildGraph()
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import { SasService } from '../services/sas.service'
|
||||
import { globals } from '../_globals'
|
||||
|
||||
import { Injectable } from '@angular/core'
|
||||
import { RequestWrapperResponse } from '../models/request-wrapper/RequestWrapperResponse'
|
||||
|
||||
interface MetaData {
|
||||
NAME: any
|
||||
@ -109,26 +110,26 @@ export class MetadataComponent implements OnInit {
|
||||
this.metatypesLoading = false
|
||||
this.metaDataSearch = globals.metadata.metaDataSearch
|
||||
} else {
|
||||
this.sasService.request('metanav/metatypes', null).then((res: any) => {
|
||||
this.metaDataList = res.types
|
||||
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: any) => {
|
||||
this.sasService.request('metanav/metarepos', null).then((res: RequestWrapperResponse) => {
|
||||
let foundation = false
|
||||
this.repositories = []
|
||||
for (let index = 0; index < res.outrepos.length; index++) {
|
||||
this.repositories.push(res.outrepos[index].NAME)
|
||||
if (res.outrepos[index].NAME === 'Foundation') {
|
||||
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.outrepos[0].NAME
|
||||
this.repository = res.adapterResponse.outrepos[0].NAME
|
||||
}
|
||||
globals.metadata.metaRepositories = this.repositories
|
||||
globals.metadata.selectedRepository = this.repository
|
||||
@ -183,8 +184,8 @@ export class MetadataComponent implements OnInit {
|
||||
const data: any = {
|
||||
SASControlTable: [{ metatype: $event, repo: this.repository }]
|
||||
}
|
||||
this.sasService.request('metanav/metaobjects', data).then((res: any) => {
|
||||
this.metaObjectList = res.objects
|
||||
this.sasService.request('metanav/metaobjects', data).then((res: RequestWrapperResponse) => {
|
||||
this.metaObjectList = res.adapterResponse.objects
|
||||
this.getMetaObjectAttributes(this.metaObjectSize)
|
||||
this.loading = false
|
||||
this.assoTypeSelected = $event
|
||||
@ -197,12 +198,12 @@ export class MetadataComponent implements OnInit {
|
||||
let data: any = {
|
||||
SASControlTable: [{ objecturi: $event }]
|
||||
}
|
||||
this.sasService.request('metanav/metadetails', data).then((res: any) => {
|
||||
this.metaObjectAssociations = res.associations
|
||||
this.root$ = of(this.getAssosiationsCount(res.associations))
|
||||
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.attributes.find(
|
||||
let metaObjectName = res.adapterResponse.attributes.find(
|
||||
(x: any) => x.NAME === 'Name'
|
||||
).VALUE
|
||||
this.assoObjectSelected = metaObjectName
|
||||
@ -221,7 +222,7 @@ export class MetadataComponent implements OnInit {
|
||||
url + '/object/' + $event.slice(1 + $event.indexOf('\\'))
|
||||
)
|
||||
}
|
||||
this.metaObjectAttributes = res.attributes
|
||||
this.metaObjectAttributes = res.adapterResponse.attributes
|
||||
})
|
||||
}
|
||||
|
||||
@ -229,8 +230,8 @@ export class MetadataComponent implements OnInit {
|
||||
let data: any = {
|
||||
SASControlTable: [{ objecturi: $event }]
|
||||
}
|
||||
this.sasService.request('metanav/metadetails', data).then((res: any) => {
|
||||
this.metaObjectAttributes = res.attributes
|
||||
this.sasService.request('metanav/metadetails', data).then((res: RequestWrapperResponse) => {
|
||||
this.metaObjectAttributes = res.adapterResponse.attributes
|
||||
this.showTable = true
|
||||
})
|
||||
}
|
||||
@ -244,7 +245,7 @@ export class MetadataComponent implements OnInit {
|
||||
details: []
|
||||
})
|
||||
}
|
||||
let assocObj = assosiationsHash.get(assosiation.ASSOC)
|
||||
let assocObj: any = assosiationsHash.get(assosiation.ASSOC)
|
||||
assocObj.count++
|
||||
assocObj.details.push({
|
||||
ASSOCURI: assosiation.ASSOCURI,
|
||||
@ -254,7 +255,7 @@ export class MetadataComponent implements OnInit {
|
||||
})
|
||||
}
|
||||
let assocGrouped: Array<any> = []
|
||||
assosiationsHash.forEach(function (val, key) {
|
||||
assosiationsHash.forEach(function (val: any, key) {
|
||||
assocGrouped.push({
|
||||
ASSOC: key,
|
||||
count: val.count,
|
||||
@ -294,9 +295,9 @@ export class MetadataComponent implements OnInit {
|
||||
}
|
||||
return this.sasService
|
||||
.request('metanav/metadetails', data)
|
||||
.then((res: any) => {
|
||||
.then((res: RequestWrapperResponse) => {
|
||||
this.showTable = true
|
||||
this.metaObjectAttributes = res.attributes
|
||||
this.metaObjectAttributes = res.adapterResponse.attributes
|
||||
this.assoObjectSelected = asso.NAME
|
||||
let url = this.router.url
|
||||
if (this.objectRoute) {
|
||||
@ -314,7 +315,7 @@ export class MetadataComponent implements OnInit {
|
||||
asso.ASSOCURI.slice(1 + asso.ASSOCURI.indexOf('\\'))
|
||||
)
|
||||
}
|
||||
return this.getAssosiationsCount(res.associations)
|
||||
return this.getAssosiationsCount(res.adapterResponse.associations)
|
||||
})
|
||||
}
|
||||
|
||||
|
4
client/src/app/models/UploadFile.ts
Normal file
4
client/src/app/models/UploadFile.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export interface UploadFileResponse {
|
||||
adapterResponse: any,
|
||||
log?: string
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
export interface RequestWrapperResponse<responseType = any> {
|
||||
adapterResponse: responseType
|
||||
log?: string
|
||||
}
|
@ -22,8 +22,8 @@
|
||||
/>
|
||||
</div>
|
||||
|
||||
<ng-container *ngIf="parsedDatasets.length && !submittedDatasets.length">
|
||||
<div class="text-center mb-10">
|
||||
<ng-container *ngIf="parsedDatasets.length && !submittedCsvDatasets.length">
|
||||
<div *ngIf="!excelsSubmitted" class="text-center mb-10">
|
||||
<button (click)="onDiscard()" class="btn btn-danger btn-sm mr-10">
|
||||
Discard
|
||||
</button>
|
||||
@ -41,30 +41,60 @@
|
||||
<clr-tree-node *ngFor="let dataset of parsedDatasets">
|
||||
<button
|
||||
(click)="onParsedDatasetClick(dataset)"
|
||||
class="clr-treenode-link whitespace-nowrap"
|
||||
class="clr-treenode-link whitespace-nowrap d-flex clr-align-items-center"
|
||||
[class.active]="dataset.active"
|
||||
>
|
||||
<cds-icon
|
||||
*ngIf="!(dataset.datasource && dataset.parseResult)"
|
||||
status="danger"
|
||||
shape="exclamation-circle"
|
||||
></cds-icon>
|
||||
<cds-icon
|
||||
*ngIf="dataset.datasource && dataset.parseResult"
|
||||
shape="table"
|
||||
></cds-icon>
|
||||
{{ dataset.libds }}
|
||||
<ng-container *ngIf="dataset.submitResult">
|
||||
<cds-icon
|
||||
*ngIf="dataset.submitResult.error"
|
||||
status="danger"
|
||||
shape="exclamation-circle"
|
||||
></cds-icon>
|
||||
<cds-icon
|
||||
*ngIf="dataset.submitResult.success"
|
||||
status="success"
|
||||
shape="check-circle"
|
||||
></cds-icon>
|
||||
</ng-container>
|
||||
|
||||
<ng-container *ngIf="!dataset.submitResult">
|
||||
<ng-container *ngIf="dataset.datasource">
|
||||
<cds-icon
|
||||
*ngIf="!(dataset.datasource.length && dataset.parseResult)"
|
||||
status="danger"
|
||||
shape="exclamation-circle"
|
||||
></cds-icon>
|
||||
<cds-icon
|
||||
*ngIf="dataset.datasource.length && dataset.parseResult"
|
||||
shape="table"
|
||||
></cds-icon>
|
||||
</ng-container>
|
||||
|
||||
<ng-container *ngIf="!dataset.datasource">
|
||||
<cds-icon
|
||||
*ngIf="!dataset.parsingTable"
|
||||
shape="table"
|
||||
></cds-icon>
|
||||
|
||||
<clr-spinner
|
||||
*ngIf="dataset.parsingTable"
|
||||
clrSmall
|
||||
></clr-spinner>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
|
||||
<span class="ml-5"> {{ dataset.libds }} </span>
|
||||
</button>
|
||||
</clr-tree-node>
|
||||
</clr-tree>
|
||||
</ng-container>
|
||||
|
||||
<ng-container *ngIf="submittedDatasets.length">
|
||||
<ng-container *ngIf="submittedCsvDatasets.length">
|
||||
<p cds-text="caption" class="ml-10 mb-10 mt-10">Submitted tables:</p>
|
||||
<clr-tree>
|
||||
<clr-tree-node *ngFor="let dataset of submittedDatasets">
|
||||
<clr-tree-node *ngFor="let dataset of submittedCsvDatasets">
|
||||
<button
|
||||
(click)="onSubmittedDatasetClick(dataset)"
|
||||
(click)="onSubmittedCsvDatasetClick(dataset)"
|
||||
class="clr-treenode-link whitespace-nowrap"
|
||||
[class.active]="dataset.active"
|
||||
>
|
||||
@ -116,7 +146,7 @@
|
||||
<ng-container *ngIf="!parsedDatasets.length && selectedFile !== null">
|
||||
<div class="d-flex clr-justify-content-center mt-15">
|
||||
<div class="dataset-input-wrapper">
|
||||
<p cds-text="secondary regular" class="mb-20">
|
||||
<p cds-text="secondary regular" class="mb-5">
|
||||
Selected file: <strong>{{ selectedFile.name }}</strong>
|
||||
<clr-tooltip>
|
||||
<cds-icon
|
||||
@ -129,6 +159,9 @@
|
||||
<clr-tooltip-content> Discard the file </clr-tooltip-content>
|
||||
</clr-tooltip>
|
||||
</p>
|
||||
<p cds-text="secondary regular" class="mb-20">
|
||||
File size: <strong>{{ selectedFile.sizeMB }} MB</strong>
|
||||
</p>
|
||||
<p cds-text="secondary regular" class="mb-15">
|
||||
Paste or type the list of datasets to upload:
|
||||
</p>
|
||||
@ -151,7 +184,7 @@
|
||||
|
||||
<div class="dataset-selection-actions text-right mt-10">
|
||||
<button
|
||||
(click)="onUploadFile()"
|
||||
(click)="onStartParsingFile()"
|
||||
id="continue-btn"
|
||||
class="btn btn-primary btn-sm"
|
||||
[disabled]="!matchedDatasets.length"
|
||||
@ -164,7 +197,7 @@
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
<ng-container *ngIf="parsedDatasets.length && !submittedDatasets.length">
|
||||
<ng-container *ngIf="parsedDatasets.length && !submittedCsvDatasets.length">
|
||||
<div
|
||||
*ngIf="!activeParsedDataset"
|
||||
class="no-table-selected pointer-events-none"
|
||||
@ -180,7 +213,54 @@
|
||||
</div>
|
||||
|
||||
<ng-container *ngIf="activeParsedDataset">
|
||||
<div class="d-flex clr-justify-content-between p-10">
|
||||
<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"
|
||||
><strong>SUCCESS</strong></span
|
||||
>
|
||||
<span *ngIf="activeParsedDataset.submitResult?.error" class="color-red"
|
||||
><strong>ERROR</strong></span
|
||||
>
|
||||
</p>
|
||||
<p
|
||||
*ngIf="activeParsedDataset.submitResult?.error"
|
||||
cds-text="secondary regular"
|
||||
>
|
||||
Error details:
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<button
|
||||
*ngIf="!submittingCsv && activeParsedDataset.submitResult?.error"
|
||||
(click)="reSubmitTable(activeParsedDataset)"
|
||||
class="btn btn-primary mt-10"
|
||||
[clrLoading]="submitLoading"
|
||||
>
|
||||
Resubmit
|
||||
</button>
|
||||
<button
|
||||
(click)="
|
||||
downloadFile(
|
||||
activeParsedDataset.submitResult.log || activeParsedDataset.submitResult.success || activeParsedDataset.submitResult.error
|
||||
)
|
||||
"
|
||||
class="btn btn-primary-outline mt-10"
|
||||
>
|
||||
Download log
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf="activeParsedDataset.submitResult?.error" class="error-field mt-15">
|
||||
<div class="log-wrapper">
|
||||
{{ activeParsedDataset.submitResult?.error | json }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex clr-justify-content-between p-10 mt-15">
|
||||
<div>
|
||||
<p cds-text="secondary regular" class="mb-10">
|
||||
Found in range:
|
||||
@ -197,7 +277,12 @@
|
||||
</ng-container>
|
||||
|
||||
<ng-container *ngIf="!activeParsedDataset.parseResult">
|
||||
<strong>No data found</strong>
|
||||
<strong *ngIf="!activeParsedDataset.parsingTable">No data found</strong>
|
||||
|
||||
<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>
|
||||
</ng-container>
|
||||
</p>
|
||||
<p cds-text="secondary regular">
|
||||
@ -262,9 +347,9 @@
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
|
||||
<ng-container *ngIf="submittedDatasets.length">
|
||||
<ng-container *ngIf="submittedCsvDatasets.length">
|
||||
<div
|
||||
*ngIf="!activeSubmittedDataset"
|
||||
*ngIf="!activeSubmittedCsvDataset"
|
||||
class="no-table-selected pointer-events-none"
|
||||
>
|
||||
<clr-icon
|
||||
@ -278,31 +363,17 @@
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
<ng-container *ngIf="activeSubmittedDataset">
|
||||
<ng-container *ngIf="activeSubmittedCsvDataset">
|
||||
<div class="d-flex clr-justify-content-between p-10">
|
||||
<div>
|
||||
<p
|
||||
*ngIf="activeSubmittedDataset.parseResult"
|
||||
cds-text="secondary regular"
|
||||
class="mb-10"
|
||||
>
|
||||
Found in range:
|
||||
<strong
|
||||
>"{{
|
||||
activeSubmittedDataset.parseResult.rangeSheetRes?.sheetName
|
||||
}}"!{{
|
||||
activeSubmittedDataset.parseResult.rangeSheetRes?.rangeAddress
|
||||
}}</strong
|
||||
>
|
||||
</p>
|
||||
<p cds-text="secondary regular" class="mb-10">
|
||||
Matched with dataset:
|
||||
<strong>
|
||||
<clr-tooltip>
|
||||
<a
|
||||
clrTooltipTrigger
|
||||
[routerLink]="'/editor/' + activeSubmittedDataset.libds"
|
||||
>{{ activeSubmittedDataset.libds }}</a
|
||||
[routerLink]="'/editor/' + activeSubmittedCsvDataset.libds"
|
||||
>{{ activeSubmittedCsvDataset.libds }}</a
|
||||
>
|
||||
<clr-tooltip-content
|
||||
[clrPosition]="'top-right'"
|
||||
@ -315,15 +386,15 @@
|
||||
</p>
|
||||
<p cds-text="secondary regular" class="mb-10">
|
||||
Status:
|
||||
<span *ngIf="activeSubmittedDataset.success" class="color-green"
|
||||
<span *ngIf="activeSubmittedCsvDataset.success" class="color-green"
|
||||
><strong>SUCCESS</strong></span
|
||||
>
|
||||
<span *ngIf="activeSubmittedDataset.error" class="color-red"
|
||||
<span *ngIf="activeSubmittedCsvDataset.error" class="color-red"
|
||||
><strong>ERROR</strong></span
|
||||
>
|
||||
</p>
|
||||
<p
|
||||
*ngIf="activeSubmittedDataset.error"
|
||||
*ngIf="activeSubmittedCsvDataset.error"
|
||||
cds-text="secondary regular"
|
||||
>
|
||||
Error details:
|
||||
@ -331,18 +402,10 @@
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<button
|
||||
*ngIf="!submittingCsv && activeSubmittedDataset.error"
|
||||
(click)="reSubmitTable(activeSubmittedDataset)"
|
||||
class="btn btn-primary mt-10"
|
||||
[clrLoading]="submitLoading"
|
||||
>
|
||||
Resubmit
|
||||
</button>
|
||||
<button
|
||||
(click)="
|
||||
downloadFile(
|
||||
activeSubmittedDataset.success || activeSubmittedDataset.error
|
||||
activeSubmittedCsvDataset.success || activeSubmittedCsvDataset.error
|
||||
)
|
||||
"
|
||||
class="btn btn-primary-outline mt-10"
|
||||
@ -352,9 +415,9 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf="activeSubmittedDataset.error" class="error-field mt-15">
|
||||
<div *ngIf="activeSubmittedCsvDataset.error" class="error-field mt-15">
|
||||
<div class="log-wrapper">
|
||||
{{ activeSubmittedDataset.error | json }}
|
||||
{{ activeSubmittedCsvDataset.error | json }}
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
@ -47,4 +47,8 @@
|
||||
|
||||
.licence-limit-notice {
|
||||
color: var(--cds-alias-status-warning-dark);
|
||||
}
|
||||
|
||||
.submission-results {
|
||||
border-bottom: 1px solid #d3d3d3;
|
||||
}
|
@ -29,6 +29,8 @@ import { CellChange, ChangeSource } from 'handsontable/common'
|
||||
import { baseAfterGetColHeader } from '../shared/utils/hot.utils'
|
||||
import { ColumnSettings } from 'handsontable/settings'
|
||||
import { UploadFile } from '@sasjs/adapter'
|
||||
import { UploadFileResponse } from '../models/UploadFile'
|
||||
import { RequestWrapperResponse } from '../models/request-wrapper/RequestWrapperResponse'
|
||||
|
||||
@Component({
|
||||
selector: 'app-multi-dataset',
|
||||
@ -48,15 +50,19 @@ export class MultiDatasetComponent implements OnInit {
|
||||
public csvFiles: UploadFile[] = []
|
||||
public csvSubmitting: boolean = false
|
||||
|
||||
public selectedFile: File | null = null
|
||||
public autoDetectingColumns: boolean = false
|
||||
|
||||
public selectedFile: SelectedFile | null = null
|
||||
public parsedDatasets: ParsedDataset[] = []
|
||||
public submittedDatasets: SubmittedDatasetResult[] = []
|
||||
public submittedCsvDatasets: SubmittedCsvDatasetResult[] = []
|
||||
|
||||
public datasetsLoading: boolean = false
|
||||
public uploadLoading: boolean = false
|
||||
public submitLoading: boolean = false
|
||||
|
||||
public matchedDatasets: string[] = []
|
||||
public sheetNames: string[] = []
|
||||
|
||||
public userInputDatasets: string = ''
|
||||
|
||||
public libsAndTables: {
|
||||
@ -194,6 +200,8 @@ 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)
|
||||
|
||||
this.initUserInputHot()
|
||||
this.onAutoDetectColumns()
|
||||
} else if (matchedExtension === 'csv') {
|
||||
@ -246,7 +254,7 @@ export class MultiDatasetComponent implements OnInit {
|
||||
this.userInputDatasets = ''
|
||||
}
|
||||
|
||||
async onUploadFile() {
|
||||
async onStartParsingFile() {
|
||||
this.uploadLoading = true
|
||||
|
||||
const datasetFetchingPromises: Promise<
|
||||
@ -271,18 +279,27 @@ export class MultiDatasetComponent implements OnInit {
|
||||
|
||||
const datasetObjects = this.buildDatasetsObjects(datasets)
|
||||
|
||||
for (let datasetObject of datasetObjects) {
|
||||
datasetObjects.forEach((datasetObject) => {
|
||||
this.parsedDatasets.push({
|
||||
libds: datasetObject.libds,
|
||||
includeInSubmission: true,
|
||||
datasetInfo: datasetObject,
|
||||
parsingTable: true
|
||||
})
|
||||
})
|
||||
|
||||
for (let parsedDataset of this.parsedDatasets) {
|
||||
this.spreadsheetService
|
||||
.parseExcelFile({
|
||||
file: this.selectedFile!,
|
||||
dcValidator: datasetObject.dcValidator!,
|
||||
headerPks: datasetObject.headerPks,
|
||||
headerArray: datasetObject.headerArray,
|
||||
dcValidator: parsedDataset.datasetInfo.dcValidator!,
|
||||
headerPks: parsedDataset.datasetInfo.headerPks,
|
||||
headerArray: parsedDataset.datasetInfo.headerArray,
|
||||
headerShow: [],
|
||||
timeHeaders: datasetObject.timeHeaders,
|
||||
dateHeaders: datasetObject.dateHeaders,
|
||||
dateTimeHeaders: datasetObject.dateTimeHeaders,
|
||||
xlRules: datasetObject.xlRules
|
||||
timeHeaders: parsedDataset.datasetInfo.timeHeaders,
|
||||
dateHeaders: parsedDataset.datasetInfo.dateHeaders,
|
||||
dateTimeHeaders: parsedDataset.datasetInfo.dateTimeHeaders,
|
||||
xlRules: parsedDataset.datasetInfo.xlRules
|
||||
})
|
||||
.then((parseResult: ParseResult | undefined) => {
|
||||
console.log('parseResult', parseResult)
|
||||
@ -304,23 +321,17 @@ export class MultiDatasetComponent implements OnInit {
|
||||
datasource.push(itemObject)
|
||||
})
|
||||
|
||||
this.parsedDatasets.push({
|
||||
libds: datasetObject.libds,
|
||||
parseResult: parseResult,
|
||||
includeInSubmission: true,
|
||||
datasetInfo: datasetObject,
|
||||
datasource: datasource
|
||||
})
|
||||
parsedDataset.datasource = datasource
|
||||
parsedDataset.parseResult = parseResult
|
||||
parsedDataset.parsingTable = false
|
||||
}
|
||||
})
|
||||
.catch((error: string) => {
|
||||
console.warn('Parsing excel file error.', error)
|
||||
|
||||
this.parsedDatasets.push({
|
||||
libds: datasetObject.libds,
|
||||
includeInSubmission: false,
|
||||
datasetInfo: datasetObject
|
||||
})
|
||||
parsedDataset.datasource = []
|
||||
parsedDataset.includeInSubmission = false
|
||||
parsedDataset.parsingTable = false
|
||||
})
|
||||
}
|
||||
})
|
||||
@ -507,13 +518,13 @@ export class MultiDatasetComponent implements OnInit {
|
||||
* convention. {@link isValidDatasetFormat}
|
||||
*/
|
||||
async onAutoDetectColumns() {
|
||||
const sheetNames = await this.parseExcelSheetNames()
|
||||
this.sheetNames = await this.parseExcelSheetNames()
|
||||
|
||||
if (sheetNames) {
|
||||
if (this.sheetNames) {
|
||||
this.matchedDatasets = []
|
||||
this.userInputDatasets = ''
|
||||
|
||||
sheetNames.forEach((sheetName: string, index: number) => {
|
||||
this.sheetNames.forEach((sheetName: string, index: number) => {
|
||||
const trimmedSheetname = sheetName.trim()
|
||||
|
||||
if (
|
||||
@ -561,8 +572,8 @@ export class MultiDatasetComponent implements OnInit {
|
||||
this.initHot()
|
||||
}
|
||||
|
||||
onSubmittedDatasetClick(submittedDataset: SubmittedDatasetResult) {
|
||||
this.deselectAllSubmittedDatasets()
|
||||
onSubmittedCsvDatasetClick(submittedDataset: SubmittedCsvDatasetResult) {
|
||||
this.deselectAllSubmittedCsvDatasets()
|
||||
|
||||
submittedDataset.active = true
|
||||
}
|
||||
@ -571,8 +582,8 @@ export class MultiDatasetComponent implements OnInit {
|
||||
return this.parsedDatasets.find((dataset) => dataset.active)
|
||||
}
|
||||
|
||||
public get activeSubmittedDataset(): SubmittedDatasetResult | undefined {
|
||||
return this.submittedDatasets.find((dataset) => dataset.active)
|
||||
public get activeSubmittedCsvDataset(): SubmittedCsvDatasetResult | undefined {
|
||||
return this.submittedCsvDatasets.find((dataset) => dataset.active)
|
||||
}
|
||||
|
||||
public get notFoundDatasets(): string[] {
|
||||
@ -606,8 +617,12 @@ export class MultiDatasetComponent implements OnInit {
|
||||
return this.csvFiles.length > 0
|
||||
}
|
||||
|
||||
public get excelsSubmitted(): boolean {
|
||||
return !!this.parsedDatasets.filter(ds => ds.submitResult).length
|
||||
}
|
||||
|
||||
public downloadFile(response: any) {
|
||||
const filename = `stagedata-${this.activeSubmittedDataset?.libds}-log`
|
||||
const filename = `stagedata-${this.activeSubmittedCsvDataset?.libds}-log`
|
||||
this.helperService.downloadTextFile(filename, JSON.stringify(response))
|
||||
}
|
||||
|
||||
@ -615,7 +630,7 @@ export class MultiDatasetComponent implements OnInit {
|
||||
* Submits attached CSVs which are matched with existing datasets
|
||||
*/
|
||||
async submitCsvFiles() {
|
||||
let requestsResults: SubmittedDatasetResult[] = []
|
||||
let requestsResults: SubmittedCsvDatasetResult[] = []
|
||||
|
||||
for (let file of this.csvFiles) {
|
||||
const libds = this.parseDatasetFromCsvName(file.fileName)
|
||||
@ -626,17 +641,17 @@ export class MultiDatasetComponent implements OnInit {
|
||||
await this.sasService
|
||||
.uploadFile('services/editors/loadfile', [file], { table: libds })
|
||||
.then(
|
||||
(res: any) => {
|
||||
if (typeof res.sasjsAbort !== 'undefined') {
|
||||
error = res.sasjsAbort
|
||||
(res: UploadFileResponse) => {
|
||||
if (typeof res.adapterResponse.sasjsAbort !== 'undefined') {
|
||||
error = res.adapterResponse.sasjsAbort
|
||||
} else {
|
||||
success = res
|
||||
success = res.adapterResponse
|
||||
}
|
||||
},
|
||||
(err: any) => {
|
||||
console.error('err', err)
|
||||
|
||||
error = err
|
||||
error = err.adapterResponse
|
||||
}
|
||||
)
|
||||
|
||||
@ -647,7 +662,7 @@ export class MultiDatasetComponent implements OnInit {
|
||||
})
|
||||
}
|
||||
|
||||
this.submittedDatasets = requestsResults
|
||||
this.submittedCsvDatasets = requestsResults
|
||||
}
|
||||
|
||||
/**
|
||||
@ -678,7 +693,7 @@ export class MultiDatasetComponent implements OnInit {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends tables to the SAS sequentially
|
||||
* Sends tables found in an excel to the SAS sequentially
|
||||
*
|
||||
* @param explicitDatasets if empty all datasets will be sent, otherwise only datasets
|
||||
* in the array will be sent. eg. ['lib1.table_1', 'lib1.table_2']
|
||||
@ -688,10 +703,6 @@ export class MultiDatasetComponent implements OnInit {
|
||||
|
||||
this.submitLoading = true
|
||||
|
||||
let requestsResults: SubmittedDatasetResult[] = explicitDatasets
|
||||
? this.submittedDatasets
|
||||
: []
|
||||
|
||||
for (let table of this.parsedDatasets) {
|
||||
// Skip the table if no data inside
|
||||
if (!table.parseResult || !table.datasource) continue
|
||||
@ -733,6 +744,7 @@ export class MultiDatasetComponent implements OnInit {
|
||||
|
||||
let error
|
||||
let success
|
||||
let log
|
||||
|
||||
await this.sasStoreService
|
||||
.updateTable(
|
||||
@ -741,56 +753,47 @@ export class MultiDatasetComponent implements OnInit {
|
||||
'SASControlTable',
|
||||
'editors/stagedata',
|
||||
table.datasetInfo.data.$sasdata,
|
||||
true
|
||||
true,
|
||||
{
|
||||
debug: true
|
||||
}
|
||||
)
|
||||
.then((res: EditorsStageDataSASResponse) => {
|
||||
success = res
|
||||
.then((res: RequestWrapperResponse<EditorsStageDataSASResponse>) => {
|
||||
success = res.adapterResponse
|
||||
log = res.log
|
||||
})
|
||||
.catch((err: any) => {
|
||||
console.error('err', err)
|
||||
|
||||
error = err
|
||||
error = err.adapterResponse
|
||||
log = err.log
|
||||
})
|
||||
|
||||
const requestResult = {
|
||||
success,
|
||||
error,
|
||||
log,
|
||||
parseResult: table.parseResult,
|
||||
libds: table.libds
|
||||
}
|
||||
|
||||
// If explicit datasets are set don't just push to th array
|
||||
// instead replace if result already exist from before (this might be re-submit)
|
||||
if (explicitDatasets) {
|
||||
const existingResultIndex = requestsResults.findIndex(
|
||||
(result) => result.libds === table.libds
|
||||
)
|
||||
|
||||
if (existingResultIndex > -1) {
|
||||
requestsResults[existingResultIndex] = requestResult
|
||||
} else {
|
||||
requestsResults.push(requestResult)
|
||||
}
|
||||
} else {
|
||||
requestsResults.push(requestResult)
|
||||
}
|
||||
table.submitResult = requestResult
|
||||
}
|
||||
}
|
||||
|
||||
this.submittedDatasets = requestsResults
|
||||
this.showSubmitReasonModal = false
|
||||
this.submitLoading = false
|
||||
this.deselectAllParsedDatasets()
|
||||
}
|
||||
|
||||
async reSubmitTable(activeSubmittedDataset: SubmittedDatasetResult) {
|
||||
async reSubmitTable(activeSubmittedDataset: ParsedDataset) {
|
||||
// Submit only particular table
|
||||
await this.submitTables([activeSubmittedDataset.libds])
|
||||
|
||||
// Activate new resubmitted table
|
||||
const newSubmittedDataset = this.submittedDatasets.find(
|
||||
const newSubmittedDataset = this.parsedDatasets.find(
|
||||
(sd) => sd.libds === activeSubmittedDataset.libds
|
||||
)
|
||||
|
||||
if (newSubmittedDataset) newSubmittedDataset.active = true
|
||||
}
|
||||
|
||||
@ -815,6 +818,12 @@ export class MultiDatasetComponent implements OnInit {
|
||||
.map((row) => (row ? `${row[0]}.${row[1]}` : ''))
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
private parseExcelSheetNames(): Promise<string[]> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const reader = new FileReader()
|
||||
@ -832,6 +841,8 @@ export class MultiDatasetComponent implements OnInit {
|
||||
|
||||
const data = event.target.result
|
||||
const workbook = XLSX.read(data, {
|
||||
// Load file minimally to parse sheets
|
||||
bookSheets: true,
|
||||
type: 'binary'
|
||||
})
|
||||
|
||||
@ -977,8 +988,8 @@ export class MultiDatasetComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
private deselectAllSubmittedDatasets() {
|
||||
for (let submittedDataset of this.submittedDatasets) {
|
||||
private deselectAllSubmittedCsvDatasets() {
|
||||
for (let submittedDataset of this.submittedCsvDatasets) {
|
||||
submittedDataset.active = false
|
||||
}
|
||||
}
|
||||
@ -1001,17 +1012,28 @@ export interface DatasetsObject extends EditorsGetDataServiceResponse {
|
||||
export interface ParsedDataset {
|
||||
libds: string
|
||||
parseResult?: ParseResult
|
||||
datasetInfo: DatasetsObject
|
||||
datasetInfo: DatasetsObject,
|
||||
submitResult?: SubmittedDatasetResult,
|
||||
datasource?: any[]
|
||||
includeInSubmission: boolean
|
||||
status?: 'success' | 'error'
|
||||
active?: boolean
|
||||
parsingTable?: boolean
|
||||
}
|
||||
|
||||
export interface SubmittedDatasetResult {
|
||||
success: EditorsStageDataSASResponse | undefined
|
||||
error: any,
|
||||
log?: string
|
||||
}
|
||||
|
||||
export interface SubmittedCsvDatasetResult {
|
||||
libds: string
|
||||
success: EditorsStageDataSASResponse | undefined
|
||||
error: any
|
||||
parseResult?: ParseResult
|
||||
active?: boolean
|
||||
}
|
||||
|
||||
export interface SelectedFile extends File {
|
||||
sizeMB?: number
|
||||
}
|
@ -4,6 +4,7 @@ import { HelperService } from '../services/helper.service'
|
||||
import { Location } from '@angular/common'
|
||||
import { Router, ActivatedRoute } from '@angular/router'
|
||||
import { SasService } from '../services/sas.service'
|
||||
import { RequestWrapperResponse } from '../models/request-wrapper/RequestWrapperResponse'
|
||||
|
||||
@Component({
|
||||
selector: 'app-role',
|
||||
@ -47,10 +48,10 @@ export class RoleComponent implements OnInit {
|
||||
} else {
|
||||
if (globals.usernav.roleList === undefined) {
|
||||
this.loading = true
|
||||
this.sasService.request('usernav/userroles', null).then((res: any) => {
|
||||
this.sasService.request('usernav/userroles', null).then((res: RequestWrapperResponse) => {
|
||||
this.loading = false
|
||||
this.roles = res.roles
|
||||
globals.usernav< |