fix: addressing PR comments
Some checks failed
Build / Build-and-ng-test (pull_request) Failing after 43s

This commit is contained in:
Mihajlo Medjedovic 2024-06-27 11:00:19 +02:00
parent fa04d7bf4e
commit d94df7f0eb
29 changed files with 55 additions and 125 deletions

View File

@ -15,9 +15,6 @@ context('editor tests: ', function () {
this.beforeEach(() => {
cy.visit(hostUrl + appLocation)
// cy.get('input.username').type(username)
// cy.get('input.password').type(password)
// cy.get('.login-group button').click()
visitPage('home')
})
@ -118,10 +115,6 @@ context('editor tests: ', function () {
})
})
})
this.afterEach(() => {
// cy.visit(`${hostUrl}/SASLogon/logout`)
})
})
const clickOnEdit = (callback?: any) => {

View File

@ -9,6 +9,10 @@ const serverType = Cypress.env('serverType')
const libraryToOpenIncludes = Cypress.env(`libraryToOpenIncludes_${serverType}`)
const fixturePath = 'excels_multi_load/'
const library = 'DC996664'
const mpeXTestTable = 'MPE_X_TEST'
const mpeTablesTable = 'MPE_TABLES'
context('excel multi load tests: ', function () {
this.beforeAll(() => {
cy.visit(`${hostUrl}/SASLogon/logout`)
@ -17,9 +21,6 @@ context('excel multi load tests: ', function () {
this.beforeEach(() => {
cy.visit(hostUrl + appLocation)
// cy.get('input.username').type(username)
// cy.get('input.password').type(password)
// cy.get('.login-group button').click()
visitPage('home/multi-load')
@ -34,11 +35,11 @@ context('excel multi load tests: ', function () {
it('1 | Uploads Excel file with multiple sheets, 3 sheets including data, 2 sheets matched with dataset', (done) => {
attachExcelFile('multi_load_test_2.xlsx', () => {
checkHotUserDatasetTable('hotTableUserDataset', [
['DC996664', 'MPE_X_TEST'],
['DC996664', 'MPE_TABLES']
[library, mpeXTestTable],
[library, mpeTablesTable]
], () => {
cy.get('#continue-btn').trigger('click').then(() => {
checkIfTreeHasTables(['DC996664.MPE_X_TEST', 'DC996664.MPE_TABLES'], undefined, (includes: boolean) => {
checkIfTreeHasTables([`${library}.${mpeXTestTable}`, `${library}.${mpeTablesTable}`], undefined, (includes: boolean) => {
if (includes) {
// MPE_TABLES sheet does not have data so 1 error image must be shown
hasErrorTables(1, (valid: boolean) => {
@ -54,11 +55,11 @@ context('excel multi load tests: ', function () {
it('2 | Uploads Excel file with multiple sheets, 2 sheets matched with dataset, 1 matched sheet does not have data', (done) => {
attachExcelFile('multi_load_test_1.xlsx', () => {
checkHotUserDatasetTable('hotTableUserDataset', [
['DC996664', 'MPE_X_TEST'],
['DC996664', 'MPE_TABLES']
[library, mpeXTestTable],
[library, mpeTablesTable]
], () => {
cy.get('#continue-btn').trigger('click').then(() => {
checkIfTreeHasTables(['DC996664.MPE_X_TEST', 'DC996664.MPE_TABLES'], 'DC996664.MPE_X_TEST', (includes: boolean) => {
checkIfTreeHasTables([`${library}.${mpeXTestTable}`, `${library}.${mpeTablesTable}`], `${library}.${mpeXTestTable}`, (includes: boolean) => {
if (includes) {
cy.get('#hotTable').should('be.visible').then(() => {
checkHotUserDatasetTable('hotTable', [
@ -84,11 +85,11 @@ context('excel multi load tests: ', function () {
it('3 | Uploads Excel file with multiple sheets, 1 sheets has 2 tables', (done) => {
attachExcelFile('multi_load_test_1.xlsx', () => {
checkHotUserDatasetTable('hotTableUserDataset', [
['DC996664', 'MPE_X_TEST'],
['DC996664', 'MPE_TABLES']
[library, mpeXTestTable],
[library, mpeTablesTable]
], () => {
cy.get('#continue-btn').trigger('click').then(() => {
checkIfTreeHasTables(['DC996664.MPE_X_TEST', 'DC996664.MPE_TABLES'], 'DC996664.MPE_X_TEST', (includes: boolean) => {
checkIfTreeHasTables([`${library}.${mpeXTestTable}`, `${library}.${mpeTablesTable}`], `${library}.${mpeXTestTable}`, (includes: boolean) => {
if (includes) {
cy.get('#hotTable').should('be.visible').then(() => {
checkHotUserDatasetTable('hotTable', [
@ -125,7 +126,6 @@ context('excel multi load tests: ', function () {
this.afterEach(() => {
colorLog(`TEST END -------------`, '#3498DB')
// cy.visit(`${hostUrl}/SASLogon/logout`)
})
})

View File

@ -17,9 +17,6 @@ context('excel tests: ', function () {
this.beforeEach(() => {
cy.visit(hostUrl + appLocation)
// cy.get('input.username').type(username)
// cy.get('input.password').type(password)
// cy.get('.login-group button').click()
visitPage('home')
@ -337,7 +334,6 @@ context('excel tests: ', function () {
this.afterEach(() => {
colorLog(`TEST END -------------`, '#3498DB')
// cy.visit(`${hostUrl}/SASLogon/logout`)
})
})

View File

@ -15,9 +15,7 @@ context('filtering tests: ', function () {
this.beforeEach(() => {
cy.visit(hostUrl + appLocation, { timeout: longerCommandTimeout })
// cy.get('input.username').type(username)
// cy.get('input.password').type(password)
// cy.get('.login-group button').click()
visitPage('home')
})
@ -174,10 +172,6 @@ context('filtering tests: ', function () {
// })
// })
// })
this.afterEach(() => {
// cy.visit(`${hostUrl}/SASLogon/logout`)
})
})
const checkInfoBarIncludes = (text: string, callback: any) => {

View File

@ -23,15 +23,12 @@ interface EditConfigTableCells {
context('licensing tests: ', function () {
this.beforeAll(() => {
// cy.visit(`${hostUrl}/SASLogon/logout`)
cy.loginAndUpdateValidKey()
})
this.beforeEach(() => {
cy.visit(hostUrl + appLocation)
// cy.get('input.username').type(username)
// cy.get('input.password').type(password)
// cy.get('.login-group button').click()
visitPage('home')
})
@ -375,9 +372,7 @@ context('licensing tests: ', function () {
})
}
this.afterEach(() => {
// cy.visit(`${hostUrl}/SASLogon/logout`)
})
})
const logout = (callback?: any) => {

View File

@ -18,9 +18,6 @@ context('liveness tests: ', function () {
this.beforeEach(() => {
cy.visit(hostUrl + appLocation)
// cy.get('input.username').type(username)
// cy.get('input.password').type(password)
// cy.get('.login-group button').click()
visitPage('home')
})

View File

@ -16,7 +16,6 @@ context('editor tests: ', function () {
this.beforeEach(() => {
cy.visit(hostUrl + appLocation)
cy.wait(2000)
cy.get('body').then(($body) => {
@ -393,10 +392,6 @@ context('editor tests: ', function () {
// }
// )
// })
this.afterEach(() => {
// cy.visit(`${hostUrl}/SASLogon/logout`)
})
})
const removeAllColumns = () => {

View File

@ -15,9 +15,6 @@ context('editor tests: ', function () {
this.beforeEach(() => {
cy.visit(hostUrl + appLocation)
// cy.get('input.username').type(username)
// cy.get('input.password').type(password)
// cy.get('.login-group button').click()
visitPage('home')
})
@ -118,10 +115,6 @@ context('editor tests: ', function () {
})
})
})
this.afterEach(() => {
// cy.visit(`${hostUrl}/SASLogon/logout`)
})
})
const clickOnEdit = (callback?: any) => {

View File

@ -19,9 +19,6 @@ context('excel tests: ', function () {
this.beforeEach(() => {
cy.visit(hostUrl + appLocation)
// cy.get('input.username').type(username)
// cy.get('input.password').type(password)
// cy.get('.login-group button').click()
visitPage('home')
@ -339,7 +336,6 @@ context('excel tests: ', function () {
this.afterEach(() => {
colorLog(`TEST END -------------`, '#3498DB')
// cy.visit(`${hostUrl}/SASLogon/logout`)
})
})

View File

@ -15,9 +15,7 @@ context('filtering tests: ', function () {
this.beforeEach(() => {
cy.visit(hostUrl + appLocation, { timeout: longerCommandTimeout })
// cy.get('input.username').type(username)
// cy.get('input.password').type(password)
// cy.get('.login-group button').click()
visitPage('home')
})
@ -173,10 +171,6 @@ context('filtering tests: ', function () {
})
})
})
this.afterEach(() => {
// cy.visit(`${hostUrl}/SASLogon/logout`)
})
})
const checkInfoBarIncludes = (text: string, callback: any) => {

View File

@ -23,15 +23,12 @@ interface EditConfigTableCells {
context('licensing tests: ', function () {
this.beforeAll(() => {
// cy.visit(`${hostUrl}/SASLogon/logout`)
cy.loginAndUpdateValidKey()
})
this.beforeEach(() => {
cy.visit(hostUrl + appLocation)
// cy.get('input.username').type(username)
// cy.get('input.password').type(password)
// cy.get('.login-group button').click()
visitPage('home')
})
@ -375,9 +372,7 @@ context('licensing tests: ', function () {
})
}
this.afterEach(() => {
// cy.visit(`${hostUrl}/SASLogon/logout`)
})
})
const logout = (callback?: any) => {

View File

@ -18,9 +18,6 @@ context('liveness tests: ', function () {
this.beforeEach(() => {
cy.visit(hostUrl + appLocation)
// cy.get('input.username').type(username)
// cy.get('input.password').type(password)
// cy.get('.login-group button').click()
visitPage('home')
})

View File

@ -17,7 +17,6 @@ context('editor tests: ', function () {
this.beforeEach(() => {
cy.visit(hostUrl + appLocation)
cy.wait(2000)
cy.get('body').then(($body) => {
@ -386,10 +385,6 @@ context('editor tests: ', function () {
}
)
})
this.afterEach(() => {
// cy.visit(`${hostUrl}/SASLogon/logout`)
})
})
const checkColumns = (columns: string[], callback: () => void) => {

View File

@ -43,6 +43,10 @@ export interface XLMapListItem {
targetDS: string
}
export interface HandsontableStaticConfig {
darkTableHeaderClass: string
}
/**
* Cached filtering values across whole app (editor, viewer, viewboxes)
* Cached lineage libraries, tables
@ -62,6 +66,7 @@ export const globals: {
viyaApi: any
usernav: any
operators: any
handsontable: HandsontableStaticConfig
[key: string]: any
} = {
rootParam: <string>'',
@ -140,5 +145,8 @@ export const globals: {
operators: {
numOperators: ['=', '<', '>', '<=', '>=', 'BETWEEN', 'IN', 'NOT IN', 'NE'],
charOperators: ['=', '<', '>', '<=', '>=', 'CONTAINS', 'IN', 'NOT IN', 'NE']
},
handsontable: {
darkTableHeaderClass: 'darkTH'
}
}

View File

@ -2468,7 +2468,7 @@ export class EditorComponent implements OnInit, AfterViewInit {
}
// Dark mode
th.classList.add('darkTH')
th.classList.add(globals.handsontable.darkTableHeaderClass)
},
afterGetCellMeta: (
row: number,

View File

@ -3,7 +3,6 @@ import { Component, OnInit, OnDestroy } from '@angular/core'
@Component({
selector: 'app-multi-dataset-route',
templateUrl: './multi-dataset-route.component.html',
styleUrls: ['./multi-dataset-route.component.scss'],
host: {
class: 'content-container'
}

View File

@ -100,7 +100,7 @@ export class SasStoreService {
tables[tableName] = [tableParams]
let res: any = await this.sasService.request(program, tables, null, {
let res = await this.sasService.request<EditorsStageDataSASResponse>(program, tables, null, {
suppressErrorAbortModal: suppressErrorSuccessMessages,
suppressSuccessAbortModal: suppressErrorSuccessMessages
})

View File

@ -97,12 +97,12 @@ export class SasService {
* for example to suppress error or success abort modals after request is finished
* @returns
*/
public request(
public request<responseType = any>(
url: string,
data: any,
config?: any,
wrapperOptions?: RequestWrapperOptions
): Promise<any> {
): Promise<responseType> {
url = 'services/' + url
if (!wrapperOptions) wrapperOptions = {}

View File

@ -95,10 +95,10 @@ export class SpreadsheetService {
): Promise<ParseResult | undefined> {
return new Promise((resolve, reject) => {
let data: any[] = []
let uploader: FileUploader = parseParams.uploader || new FileUploader()
const uploader: FileUploader = parseParams.uploader || new FileUploader()
let file: File = parseParams.file
let filename = file.name
const file: File = parseParams.file
const filename = file.name
if (!parseParams.encoding) parseParams.encoding = 'UTF-8'
@ -485,7 +485,7 @@ export class SpreadsheetService {
let sheetName: string = ''
let isComplete = false
let missingHeaders: string[] = []
let csvArrayHeaders: string[] = [
const csvArrayHeaders: string[] = [
'_____DELETE__THIS__RECORD_____',
...parseParams.headerArray
]
@ -637,7 +637,7 @@ export class SpreadsheetService {
parseParams: ParseParams
): Array<any> {
let headersFound = false
let missingErrorArray = []
const missingErrorArray = []
let j = 0
while (j < row.length) {
@ -747,7 +747,8 @@ export class SpreadsheetService {
* @param ws worksheet to be updated
*/
private update_sheet_range(ws: XLSX.WorkSheet) {
var range = { s: { r: Infinity, c: Infinity }, e: { r: 0, c: 0 } }
const range = { s: { r: Infinity, c: Infinity }, e: { r: 0, c: 0 } }
Object.keys(ws)
.filter(function (x) {
return x.charAt(0) != '!'
@ -772,26 +773,6 @@ export class SpreadsheetService {
this.excelPasswordModalService.open().subscribe((result: Result) => {
resolve(result.password)
})
// Focus the password field
// setTimeout(() => {
// const filePasswordInputElement: any =
// document.querySelector('#filePasswordInput')
// if (filePasswordInputElement) {
// filePasswordInputElement.focus()
// filePasswordInputElement.value = ''
// }
// }, 100)
// this.filePasswordSubject.subscribe((password: string | undefined) => {
// this.fileUnlockError = false
// if (password) {
// resolve(password)
// } else {
// resolve(undefined)
// }
// })
})
}
@ -801,7 +782,7 @@ export class SpreadsheetService {
parseParams: ParseParams
) {
if (parseParams.dateHeaders.length > 0) {
let dateCols: number[] = []
const dateCols: number[] = []
parseParams.dateHeaders.forEach((element) => {
if (headers.indexOf(element) !== -1) {
dateCols.push(headers.indexOf(element))
@ -865,7 +846,7 @@ export class SpreadsheetService {
dateTimeCols.forEach((element) => {
const obj = row[element]
if (isStringNumber(obj.v) || isStringDecimal(obj.v)) {
let date = excelDateToJSDate(Number(obj.v))
const date = excelDateToJSDate(Number(obj.v))
obj.v = dateFormat(date) + ' ' + dateToUtcTime(date)
} else {
if (obj.v.indexOf(' ') === -1 && obj.v.indexOf(':') !== -1) {
@ -873,7 +854,7 @@ export class SpreadsheetService {
str = str + ' ' + obj.v.substring(obj.v.indexOf(':') + 1)
obj.v = str
}
let date = new Date(obj.v)
const date = new Date(obj.v)
if (date.toUTCString() !== 'Invalid Date') {
obj.v = dateFormat(date) + ' ' + dateToTime(date)
}

View File

@ -7,8 +7,7 @@ import {
@Component({
selector: 'app-excel-password-modal',
templateUrl: './excel-password-modal.component.html',
styleUrl: './excel-password-modal.component.scss'
templateUrl: './excel-password-modal.component.html'
})
export class ExcelPasswordModalComponent {
options$: Observable<Options>

View File

@ -1,3 +1,5 @@
import { globals } from "../../_globals"
/**
* Function reused in HOT instances to add a class used for dark mode
*/
@ -7,5 +9,5 @@ export const baseAfterGetColHeader = (
headerLevel: number
) => {
// Dark mode
TH.classList.add('darkTH')
TH.classList.add(globals.handsontable.darkTableHeaderClass)
}

View File

@ -434,7 +434,7 @@ export class ViewboxesComponent implements OnInit, AfterViewInit, OnDestroy {
if (isPKCol) th.classList.add('primaryKeyHeaderStyle')
// Dark mode
th.classList.add('darkTH')
th.classList.add(globals.handsontable.darkTableHeaderClass)
}
})
hotInstance?.render()

View File

@ -35,7 +35,7 @@ export class StageComponent implements OnInit {
maxRows: this.licenceState.value.stage_rows_allowed || Infinity,
afterGetColHeader: (column, th, headerLevel) => {
// Dark mode
th.classList.add('darkTH')
th.classList.add(globals.handsontable.darkTableHeaderClass)
}
}

View File

@ -9,7 +9,7 @@ import {
import { SasStoreService } from '../services/sas-store.service'
import { Subscription } from 'rxjs'
import { Params, Router } from '@angular/router'
import { Router } from '@angular/router'
import { ActivatedRoute } from '@angular/router'
import { globals } from '../_globals'
@ -18,7 +18,6 @@ import { HelperService } from '../services/helper.service'
import { HotTableRegisterer } from '@handsontable/angular'
import { SasService } from '../services/sas.service'
import { SASjsConfig } from '@sasjs/adapter'
import { AppService } from '../services/app.service'
import { QueryComponent } from '../query/query.component'
import { FilterGroup, FilterQuery } from '../models/FilterQuery'
@ -118,7 +117,7 @@ export class ViewerComponent implements AfterContentInit, AfterViewInit {
},
afterGetColHeader: (col: number, th: any, headerLevel: number) => {
// Dark mode
th.classList.add('darkTH')
th.classList.add(globals.handsontable.darkTableHeaderClass)
},
rowHeaderWidth: 15,
rowHeights: 20,
@ -1076,7 +1075,7 @@ export class ViewerComponent implements AfterContentInit, AfterViewInit {
if (isPKCol) th.classList.add('primaryKeyHeaderStyle')
// Dark mode
th.classList.add('darkTH')
th.classList.add(globals.handsontable.darkTableHeaderClass)
}
})
}

View File

@ -145,7 +145,7 @@ export class XLMapComponent implements AfterContentInit, AfterViewInit, OnInit {
public afterGetColHeader(column: number, th: any) {
// Dark mode
th.classList.add('darkTH')
th.classList.add(globals.handsontable.darkTableHeaderClass)
}
public xlmapOnClick(xlmap: XLMapListItem) {

View File

@ -1,4 +1,6 @@
$headerBackground: #314351;
$trackColor: #3b5268;
$thumbColor: #273849;
$thumbColor: #273849;
$codeBorder: #e2e2e2;

View File

@ -103,7 +103,7 @@ body[cds-theme="light"] {
white-space: pre-wrap;
border-radius: 3px;
border: 1px solid #e2e2e2;
border: 1px solid $codeBorder;
height: 48vh;
overflow: auto;