From 62eee763b261ab6b3debf8f9e187126907cc24fc Mon Sep 17 00:00:00 2001 From: "sam.moloi" Date: Thu, 19 Aug 2021 15:50:43 +0200 Subject: [PATCH 01/50] Fixed repo clone --- .vscode/launch.json | 15 ++ .vscode/settings.json | 2 + app.ts | 374 ++++++++++++++++++++++++++++++++++++++++++ index.html | 25 ++- package-lock.json | 124 ++++++++++++++ package.json | 24 +++ style.css | 91 ++++++++++ tsconfig.json | 2 +- 8 files changed, 654 insertions(+), 3 deletions(-) create mode 100644 .vscode/launch.json create mode 100644 .vscode/settings.json create mode 100644 app.ts create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 style.css diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..7a9dfa04 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,15 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "pwa-chrome", + "request": "launch", + "name": "Launch Chrome against localhost", + "url": "http://localhost:8080", + "webRoot": "${workspaceFolder}" + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..7a73a41b --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/app.ts b/app.ts new file mode 100644 index 00000000..ce6cfca0 --- /dev/null +++ b/app.ts @@ -0,0 +1,374 @@ +namespace onboardproject { + + module onboardprojects { + + //Variable declarations + let Load = 50,previous: number[],previousprocess: number; + + // region API Call + // Trigger async function + async function getRecordCountCall() : Promise { + + const response = await fetch('http://localhost:2050/recordCount'); + + let promise = new Promise((res, rej) => { + setTimeout(() => res("Now it's done!"), 50) + }); + + if(!response.ok){ + + const message = `An error has occured: ${response.status}`; + + throw new Error(message); + + console.log(message) + }else{ + + return await response.json(); + + console.log(response); + } + } + + + // log response or catch error of fetch promise + getRecordCountCall().then(data => console.log(data)).catch(reason => console.log(reason.message)) + + // Trigger async function + async function getColumnNamesCall() : Promise{ + + const response = await fetch('http://localhost:2050/columns'); + + let promise = new Promise((res, rej) => { + + setTimeout(() => res("Now it's done!"),50) + }); + + if(!response.ok){ + + const message = `An error has occured: ${response.status}`; + + throw new Error(message); + + }else{ + + return await response.json(); + + console.log(response); + } + } + + // trigger async function + // log response or catch error of fetch promise + getColumnNamesCall().then(data => console.log(data)).catch(reason => console.log(reason.message)) + + + async function getRecordsCall(fromID: number, toID: number): Promise { + + const response = await fetch(`http://localhost:2050/records?from=${(fromID)}&to=${(toID)}`); + + + let promise = new Promise((res, rej) => { + setTimeout(() => res("Now it's done!"), 50) + }); + + if(!response.ok){ + + const message = `An error has occured: ${response.status}`; + throw new Error(message); + + }else{ + + return await response.json(); + + console.log(response); + } + } + +// function requestcolumns( +// method: 'GET', +// url: 'http://localhost:2050/columns', +// content?: Request, +// callback?: (response: Response) => void, +// errorCallback?: (err: any) => void) { +// const request = new XMLHttpRequest(); +// request.open(method, url, true); +// request.onload = function () { +// if (this.status >= 200 && this.status < 400) { +// // Success! +// const data = JSON.parse(this.response) as Response; +// callback && callback(data); +// } else { +// // We reached our target server, but it returned an error + +// console.log("Error 404"); +// } +// }; +// } + + //region Data Loading methods + async function LoadRecordsData(fromID: number, toID: number): Promise { + + try { + + const recordsvalue = await getRecordsCall(fromID, toID) + + let DisplayContent = ''; + + for (const record of recordsvalue) { + + DisplayContent += ``; + + for (const column of record) { + + DisplayContent += `${column}`; + } + + DisplayContent += ''; + + $("#wrapper-table-content-body").empty(); + + $("#wrapper-table-content-body").append(DisplayContent); + } + + } catch (error) { + + console.log("Error " + error) + } + + return [fromID, toID]; + } + + + + + function RecordsFromCursor(cursor: number[]): Promise { + + cursor = cursor.sort((a,b) => {return a-b}); + + + return LoadRecordsData(cursor[0], cursor[1]); + + + + + // throw new Error("Error"); + + } + + + window.onresize = () => { + + try { + const nextToId = calculateToId(previous[0]); + clearTimeout(Load); + Load = setTimeout(async () => { + const recordCount = await getRecordCountCall(); + if (nextToId >= recordCount - 1) { + const fromId = recordCount - 1 - (calculateToId(previous[0]) - previous[0]); + const toId = recordCount - 1; + previous = await LoadRecordsData(fromId, toId); + + } else { + previous = await LoadRecordsData(previous[0], nextToId) + } + }, 10); + + + } catch (error) { + + // throw new Error("Error" + error); + + } + } + + + + + // Handlers + async function LoadPageContent(fromID: number, toID: number): Promise { + + try { + let DisplayContent = ""; + const columns = await getColumnNamesCall(); + for (const column of columns) { + DisplayContent += `${column}`; + + $("#wrapper-table-header-row").empty(); + $("#wrapper-table-header-row").append(DisplayContent); + } + + } catch (error) { + + console.log("Error " + error) ; + + } + + return await LoadRecordsData(fromID, toID); + } + + function ConvertNumber(input: string | number, parseAsInt: boolean = true) : number { + + switch (typeof input) { + case ('string'): + if (parseAsInt == true) { + return parseInt(input as string); + } + return parseFloat(input as string); + case ("number"): + return input as number; + default: + return 0; + } + + throw new Error("Error"); + + } + + function calculateToId(fromId: number): number { + + const possibleRecordsData = Math.floor((window.innerHeight - ($("#form-content").innerHeight() as number)) / 37); + const possibleId = fromId + possibleRecordsData; + + let recordDisplayset = 0; + switch(recordDisplayset){ + case 0 : + window.innerHeight <= 646; + break; + case 1 : + window.innerHeight <= 969; + break; + case 2: + window.innerHeight <= 1938; + break; + default : + recordDisplayset = 15; + break; + } + + + return recordDisplayset + possibleId; + } + + + +function nextPageResize(previous: number[]): number { + + const fromID = ConvertNumber(previous.sort((a, b) => {return a - b})[0]); + const toID = ConvertNumber(previous.sort((a, b) => {return a - b})[1]); + const documentHeight = $(window).innerHeight() as number - ($(`#table-row-${fromID}`).height() as number); + + for (let i = fromID; i <= toID; i++) { + const elementHeightOffset = ($(`#table-row-${i}`).offset() as JQueryCoordinates).top; + + if (elementHeightOffset < documentHeight) continue; + return i; + } + return toID; +} + + +function previousPageResize(previous: number[]): number[] { + + const toId = calculateToId(previous[0] - (nextPageResize(previous) - previous[0])); + return [previous[0] - (nextPageResize(previous) - previous[0]), toId]; } + + window.onload = async () => { + + try { + previous = await LoadPageContent(0, calculateToId(0)); + + $("#previous").click(async () => { + + const CountData = await getRecordCountCall(); + previous = previousPageResize(previous); + let fromId = previous[0] >= 0 ? previous[0] : 0; + const possibleStep = calculateToId(fromId) - fromId; + let toId = (previous[0] >= 0 ? previous[1] : possibleStep); + fromId = fromId == CountData - 1 ? fromId - possibleStep : fromId; + toId = toId <= CountData - 1 ? toId : CountData - 1; + previous = await LoadRecordsData(fromId, toId); + + }); + + } catch (error) { + + + + +} + + +$("#next").click(async () => { + + + try { + const recordCount = await getRecordCountCall(); + + const fromId = nextPageResize(previous); + const possibleStep = calculateToId(fromId) - fromId; + + if (fromId <= recordCount - possibleStep - 1) { + const toId = fromId + possibleStep <= recordCount - 1 ? fromId + possibleStep : recordCount - 1; + previous = await LoadRecordsData(fromId, toId); + } else if (fromId <= recordCount - 1) { + + previous = await LoadRecordsData(recordCount - 1 - (calculateToId(fromId) - fromId), recordCount - 1); + + } else { + + + console.log("Test is working "); + } + + } catch (error) { + + + } + +}); + + + $("#go-button").click(async () => { + + try { + + const recordCount = await getRecordCountCall(); + + const fromId = ConvertNumber($("#index").val() as string, false); + + const possibleStep = calculateToId(fromId) - fromId; + + if (fromId < 0){ + + alert('only insert Id greater than or equal to 0'); + + } else { + + if (Math.floor(fromId).toString() == fromId.toString() === true) { + + if ( fromId > recordCount - possibleStep ) { + + alert(`You may not insert a desired Id greater than ${recordCount - possibleStep}`); + + + } else { + + let toId = (fromId) + possibleStep < recordCount ? (fromId) + possibleStep : recordCount - 1; + previous = await LoadRecordsData(fromId, toId); + + } + + } else { + + console.log("Test is working "); + + } + } + + } catch (error) { + } + }); + } + } +} diff --git a/index.html b/index.html index add5e736..32d1e867 100644 --- a/index.html +++ b/index.html @@ -2,11 +2,32 @@ JS Onboard Project + + + - -

Hello

+ +
+ Go To Start Index: + + + +
+ + + + + + + +
+ + + + + diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..78fcafc1 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,124 @@ +{ + "name": "onboard-javascript", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "@types/jquery": "^3.5.6", + "query-string": "^7.0.1" + } + }, + "node_modules/@types/jquery": { + "version": "3.5.6", + "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.5.6.tgz", + "integrity": "sha512-SmgCQRzGPId4MZQKDj9Hqc6kSXFNWZFHpELkyK8AQhf8Zr6HKfCzFv9ZC1Fv3FyQttJZOlap3qYb12h61iZAIg==", + "dependencies": { + "@types/sizzle": "*" + } + }, + "node_modules/@types/sizzle": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.3.tgz", + "integrity": "sha512-JYM8x9EGF163bEyhdJBpR2QX1R5naCJHC8ucJylJ3w9/CVBaskdQ8WqBf8MmQrd1kRvp/a4TS8HJ+bxzR7ZJYQ==" + }, + "node_modules/decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", + "engines": { + "node": ">=0.10" + } + }, + "node_modules/filter-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/filter-obj/-/filter-obj-1.1.0.tgz", + "integrity": "sha1-mzERErxsYSehbgFsbF1/GeCAXFs=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/query-string": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-7.0.1.tgz", + "integrity": "sha512-uIw3iRvHnk9to1blJCG3BTc+Ro56CBowJXKmNNAm3RulvPBzWLRqKSiiDk+IplJhsydwtuNMHi8UGQFcCLVfkA==", + "dependencies": { + "decode-uri-component": "^0.2.0", + "filter-obj": "^1.1.0", + "split-on-first": "^1.0.0", + "strict-uri-encode": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/split-on-first": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/split-on-first/-/split-on-first-1.1.0.tgz", + "integrity": "sha512-43ZssAJaMusuKWL8sKUBQXHWOpq8d6CfN/u1p4gUzfJkM05C8rxTmYrkIPTXapZpORA6LkkzcUulJ8FqA7Uudw==", + "engines": { + "node": ">=6" + } + }, + "node_modules/strict-uri-encode": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz", + "integrity": "sha1-ucczDHBChi9rFC3CdLvMWGbONUY=", + "engines": { + "node": ">=4" + } + } + }, + "dependencies": { + "@types/jquery": { + "version": "3.5.6", + "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.5.6.tgz", + "integrity": "sha512-SmgCQRzGPId4MZQKDj9Hqc6kSXFNWZFHpELkyK8AQhf8Zr6HKfCzFv9ZC1Fv3FyQttJZOlap3qYb12h61iZAIg==", + "requires": { + "@types/sizzle": "*" + } + }, + "@types/sizzle": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.3.tgz", + "integrity": "sha512-JYM8x9EGF163bEyhdJBpR2QX1R5naCJHC8ucJylJ3w9/CVBaskdQ8WqBf8MmQrd1kRvp/a4TS8HJ+bxzR7ZJYQ==" + }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" + }, + "filter-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/filter-obj/-/filter-obj-1.1.0.tgz", + "integrity": "sha1-mzERErxsYSehbgFsbF1/GeCAXFs=" + }, + "query-string": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-7.0.1.tgz", + "integrity": "sha512-uIw3iRvHnk9to1blJCG3BTc+Ro56CBowJXKmNNAm3RulvPBzWLRqKSiiDk+IplJhsydwtuNMHi8UGQFcCLVfkA==", + "requires": { + "decode-uri-component": "^0.2.0", + "filter-obj": "^1.1.0", + "split-on-first": "^1.0.0", + "strict-uri-encode": "^2.0.0" + } + }, + "split-on-first": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/split-on-first/-/split-on-first-1.1.0.tgz", + "integrity": "sha512-43ZssAJaMusuKWL8sKUBQXHWOpq8d6CfN/u1p4gUzfJkM05C8rxTmYrkIPTXapZpORA6LkkzcUulJ8FqA7Uudw==" + }, + "strict-uri-encode": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz", + "integrity": "sha1-ucczDHBChi9rFC3CdLvMWGbONUY=" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 00000000..274aac87 --- /dev/null +++ b/package.json @@ -0,0 +1,24 @@ +{ + "name": "onboard-javascript", + "version": "1.0.0", + "description": "This is a JavaScript project for all new developers to complete before venturing into our web frontend codebase.", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "build": "tsc -w --project ./" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/SAMMOLOI/onboard-javascript.git" + }, + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/SAMMOLOI/onboard-javascript/issues" + }, + "homepage": "https://github.com/SAMMOLOI/onboard-javascript#readme", + "dependencies": { + "@types/jquery": "^3.5.6", + "query-string": "^7.0.1" + } +} diff --git a/style.css b/style.css new file mode 100644 index 00000000..d300cb4d --- /dev/null +++ b/style.css @@ -0,0 +1,91 @@ + + table tr td,table tr td{ + text-align: center; + COLOR: white; + border: 1px solid; + } + +tr td { + height: 26px; + + } + + @media only screen and (max-width: 500px) { + table,thead,tbody,th,td,tr { + display: block; + COLOR: white; + } + + thead tr { + display: none; + COLOR: white; + } + + tr { + border: 1px solid #ccc; + } + + td { + border: none; + border-bottom: 1px solid #eee; + position: relative; + padding-left: 50%; + white-space: normal; + text-align:left; + min-height: 10px; + overflow: hidden; + word-break:break-all; + } + + td:before { + position: absolute; + top: 6px; + left: 6px; + width: 45%; + padding-right: 10px; + text-align:left; + font-weight: bold; + content: attr(data-title); + } + } + + body{ + + overflow: hidden; + background: -webkit-linear-gradient(left, #25c481, #25b7c4); + background: linear-gradient(to right, #25c481, #25b7c4); + font-family: 'Roboto', sans-serif; + color: white; + } + + #wrapper-table{ + width:100%; + height:1000%; + table-layout: fixed; +} + + +#form-content{ + + text-align: center; + +} + +table{ + width:100%; + table-layout: fixed; +} + +h4{ + font-size: 20px; + color: #fff; + text-transform: uppercase; + font-weight: 300; + text-align: center; + margin-bottom: 15px; +} + +#wrapper-table-content-body{ + + font-size: 12px; +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index dbf43618..3a7c4ca5 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,6 +17,6 @@ ], }, "include": [ - "./**/*.ts" + "./**/*.ts" ] } From fd004452810e99889d8c81cefd654428446b02eb Mon Sep 17 00:00:00 2001 From: "sam.moloi" Date: Fri, 20 Aug 2021 13:37:49 +0200 Subject: [PATCH 02/50] update --- app.ts | 611 ++++++++++++++++++++++----------------------------------- 1 file changed, 239 insertions(+), 372 deletions(-) diff --git a/app.ts b/app.ts index ce6cfca0..91996a58 100644 --- a/app.ts +++ b/app.ts @@ -1,374 +1,241 @@ namespace onboardproject { - - module onboardprojects { - - //Variable declarations - let Load = 50,previous: number[],previousprocess: number; - - // region API Call - // Trigger async function - async function getRecordCountCall() : Promise { - - const response = await fetch('http://localhost:2050/recordCount'); - - let promise = new Promise((res, rej) => { - setTimeout(() => res("Now it's done!"), 50) - }); - - if(!response.ok){ - - const message = `An error has occured: ${response.status}`; - - throw new Error(message); - - console.log(message) - }else{ - - return await response.json(); - - console.log(response); - } - } - - - // log response or catch error of fetch promise - getRecordCountCall().then(data => console.log(data)).catch(reason => console.log(reason.message)) - - // Trigger async function - async function getColumnNamesCall() : Promise{ - - const response = await fetch('http://localhost:2050/columns'); - - let promise = new Promise((res, rej) => { - - setTimeout(() => res("Now it's done!"),50) - }); - - if(!response.ok){ - - const message = `An error has occured: ${response.status}`; - - throw new Error(message); - - }else{ - - return await response.json(); - - console.log(response); - } - } - - // trigger async function - // log response or catch error of fetch promise - getColumnNamesCall().then(data => console.log(data)).catch(reason => console.log(reason.message)) - - - async function getRecordsCall(fromID: number, toID: number): Promise { - - const response = await fetch(`http://localhost:2050/records?from=${(fromID)}&to=${(toID)}`); - - - let promise = new Promise((res, rej) => { - setTimeout(() => res("Now it's done!"), 50) - }); - - if(!response.ok){ - - const message = `An error has occured: ${response.status}`; - throw new Error(message); - - }else{ - - return await response.json(); - - console.log(response); - } - } - -// function requestcolumns( -// method: 'GET', -// url: 'http://localhost:2050/columns', -// content?: Request, -// callback?: (response: Response) => void, -// errorCallback?: (err: any) => void) { -// const request = new XMLHttpRequest(); -// request.open(method, url, true); -// request.onload = function () { -// if (this.status >= 200 && this.status < 400) { -// // Success! -// const data = JSON.parse(this.response) as Response; -// callback && callback(data); -// } else { -// // We reached our target server, but it returned an error - -// console.log("Error 404"); -// } -// }; -// } - - //region Data Loading methods - async function LoadRecordsData(fromID: number, toID: number): Promise { - - try { - - const recordsvalue = await getRecordsCall(fromID, toID) - - let DisplayContent = ''; - - for (const record of recordsvalue) { - - DisplayContent += ``; - - for (const column of record) { - - DisplayContent += `${column}`; - } - - DisplayContent += ''; - - $("#wrapper-table-content-body").empty(); - - $("#wrapper-table-content-body").append(DisplayContent); - } - - } catch (error) { - - console.log("Error " + error) - } - - return [fromID, toID]; - } - - - - - function RecordsFromCursor(cursor: number[]): Promise { - - cursor = cursor.sort((a,b) => {return a-b}); - - - return LoadRecordsData(cursor[0], cursor[1]); - - - - - // throw new Error("Error"); - - } - - - window.onresize = () => { - - try { - const nextToId = calculateToId(previous[0]); - clearTimeout(Load); - Load = setTimeout(async () => { - const recordCount = await getRecordCountCall(); - if (nextToId >= recordCount - 1) { - const fromId = recordCount - 1 - (calculateToId(previous[0]) - previous[0]); - const toId = recordCount - 1; - previous = await LoadRecordsData(fromId, toId); - - } else { - previous = await LoadRecordsData(previous[0], nextToId) - } - }, 10); - - - } catch (error) { - - // throw new Error("Error" + error); - - } - } - - - - - // Handlers - async function LoadPageContent(fromID: number, toID: number): Promise { - - try { - let DisplayContent = ""; - const columns = await getColumnNamesCall(); - for (const column of columns) { - DisplayContent += `${column}`; - - $("#wrapper-table-header-row").empty(); - $("#wrapper-table-header-row").append(DisplayContent); - } - - } catch (error) { - - console.log("Error " + error) ; - - } - - return await LoadRecordsData(fromID, toID); - } - - function ConvertNumber(input: string | number, parseAsInt: boolean = true) : number { - - switch (typeof input) { - case ('string'): - if (parseAsInt == true) { - return parseInt(input as string); - } - return parseFloat(input as string); - case ("number"): - return input as number; - default: - return 0; - } - - throw new Error("Error"); - - } - - function calculateToId(fromId: number): number { - - const possibleRecordsData = Math.floor((window.innerHeight - ($("#form-content").innerHeight() as number)) / 37); - const possibleId = fromId + possibleRecordsData; - - let recordDisplayset = 0; - switch(recordDisplayset){ - case 0 : - window.innerHeight <= 646; - break; - case 1 : - window.innerHeight <= 969; - break; - case 2: - window.innerHeight <= 1938; - break; - default : - recordDisplayset = 15; - break; - } - - - return recordDisplayset + possibleId; - } - - - -function nextPageResize(previous: number[]): number { - - const fromID = ConvertNumber(previous.sort((a, b) => {return a - b})[0]); - const toID = ConvertNumber(previous.sort((a, b) => {return a - b})[1]); - const documentHeight = $(window).innerHeight() as number - ($(`#table-row-${fromID}`).height() as number); - - for (let i = fromID; i <= toID; i++) { - const elementHeightOffset = ($(`#table-row-${i}`).offset() as JQueryCoordinates).top; - - if (elementHeightOffset < documentHeight) continue; - return i; - } - return toID; -} - - -function previousPageResize(previous: number[]): number[] { - - const toId = calculateToId(previous[0] - (nextPageResize(previous) - previous[0])); - return [previous[0] - (nextPageResize(previous) - previous[0]), toId]; } - - window.onload = async () => { - - try { - previous = await LoadPageContent(0, calculateToId(0)); - - $("#previous").click(async () => { - - const CountData = await getRecordCountCall(); - previous = previousPageResize(previous); - let fromId = previous[0] >= 0 ? previous[0] : 0; - const possibleStep = calculateToId(fromId) - fromId; - let toId = (previous[0] >= 0 ? previous[1] : possibleStep); - fromId = fromId == CountData - 1 ? fromId - possibleStep : fromId; - toId = toId <= CountData - 1 ? toId : CountData - 1; - previous = await LoadRecordsData(fromId, toId); - - }); - - } catch (error) { - - - - + module onboardprojects { + //Variable declarations + let Load = 50, previous: number[], previousprocess: number; + // region API Call + // Trigger async function + async function getRecordCountCall(): Promise { + const response = await fetch('http://localhost:2050/recordCount'); + let promise = new Promise((res, rej) => { + setTimeout(() => res("Now it's done!"), 50) + }); + if (!response.ok) { + const message = `An error has occured: ${response.status}`; + throw new Error(message); + console.log(message) + } else { + return await response.json(); + console.log(response); + } + } + // log response or catch error of fetch promise + getRecordCountCall().then(data => console.log(data)).catch(reason => console.log(reason.message)) + // Trigger async function + async function getColumnNamesCall(): Promise { + const response = await fetch('http://localhost:2050/columns'); + let promise = new Promise((res, rej) => { + setTimeout(() => res("Now it's done!"), 50) + }); + if (!response.ok) { + const message = `An error has occured: ${response.status}`; + throw new Error(message); + } else { + return await response.json(); + console.log(response); + } + } + // trigger async function + // log response or catch error of fetch promise + getColumnNamesCall().then(data => console.log(data)).catch(reason => console.log(reason.message)) + async function getRecordsCall(fromID: number, toID: number): Promise { + const response = await fetch(`http://localhost:2050/records?from=${(fromID)}&to=${(toID)}`); + let promise = new Promise((res, rej) => { + setTimeout(() => res("Now it's done!"), 50) + }); + if (!response.ok) { + const message = `An error has occured: ${response.status}`; + throw new Error(message); + } else { + return await response.json(); + console.log(response); + } + } + // function requestcolumns( + // method: 'GET', + // url: 'http://localhost:2050/columns', + // content?: Request, + // callback?: (response: Response) => void, + // errorCallback?: (err: any) => void) { + // const request = new XMLHttpRequest(); + // request.open(method, url, true); + // request.onload = function () { + // if (this.status >= 200 && this.status < 400) { + // // Success! + // const data = JSON.parse(this.response) as Response; + // callback && callback(data); + // } else { + // // We reached our target server, but it returned an error + + // console.log("Error 404"); + // } + // }; + // } + //region Data Loading methods + async function LoadRecordsData(fromID: number, toID: number): Promise { + try { + const recordsvalue = await getRecordsCall(fromID, toID) + let DisplayContent = ''; + for (const record of recordsvalue) { + DisplayContent += ``; + for (const column of record) { + DisplayContent += `${column}`; + } + DisplayContent += ''; + $("#wrapper-table-content-body").empty(); + $("#wrapper-table-content-body").append(DisplayContent); + } + } catch (error) { + console.log("Error " + error) + } + return [fromID, toID]; + } + function RecordsFromCursor(cursor: number[]): Promise { + cursor = cursor.sort((a, b) => { return a - b }); + return LoadRecordsData(cursor[0], cursor[1]); + // throw new Error("Error"); + } + window.onresize = () => { + try { + const nextToId = calculateToId(previous[0]); + clearTimeout(Load); + Load = setTimeout(async () => { + const recordCount = await getRecordCountCall(); + if (nextToId >= recordCount - 1) { + const fromId = recordCount - 1 - (calculateToId(previous[0]) - previous[0]); + const toId = recordCount - 1; + previous = await LoadRecordsData(fromId, toId); + } else { + previous = await LoadRecordsData(previous[0], nextToId) + } + }, 10); + } catch (error) { + // throw new Error("Error" + error); + } + } + // Handlers + async function LoadPageContent(fromID: number, toID: number): Promise { + + try { + let DisplayContent = ""; + const columns = await getColumnNamesCall(); + for (const column of columns) { + DisplayContent += `${column}`; + + $("#wrapper-table-header-row").empty(); + $("#wrapper-table-header-row").append(DisplayContent); + } + + } catch (error) { + + console.log("Error " + error); + + } + return await LoadRecordsData(fromID, toID); + } + function ConvertNumber(input: string | number, parseAsInt: boolean = true): number { + switch (typeof input) { + case ('string'): + if (parseAsInt == true) { + return parseInt(input as string); + } + return parseFloat(input as string); + case ("number"): + return input as number; + default: + return 0; + } + throw new Error("Error"); + } + function calculateToId(fromId: number): number { + const possibleRecordsData = Math.floor((window.innerHeight - ($("#form-content").innerHeight() as number)) / 37); + const possibleId = fromId + possibleRecordsData; + + let recordDisplayset = 0; + switch (recordDisplayset) { + case 0: + window.innerHeight <= 646; + break; + case 1: + window.innerHeight <= 969; + break; + case 2: + window.innerHeight <= 1938; + break; + default: + recordDisplayset = 15; + break; + } + return recordDisplayset + possibleId; + } + function nextPageResize(previous: number[]): number { + const fromID = ConvertNumber(previous.sort((a, b) => { return a - b })[0]); + const toID = ConvertNumber(previous.sort((a, b) => { return a - b })[1]); + const documentHeight = $(window).innerHeight() as number - ($(`#table-row-${fromID}`).height() as number); + for (let i = fromID; i <= toID; i++) { + const elementHeightOffset = ($(`#table-row-${i}`).offset() as JQueryCoordinates).top; + if (elementHeightOffset < documentHeight) continue; + return i; + } + return toID; + } + function previousPageResize(previous: number[]): number[] { + const toId = calculateToId(previous[0] - (nextPageResize(previous) - previous[0])); + return [previous[0] - (nextPageResize(previous) - previous[0]), toId]; + } + window.onload = async () => { + try { + previous = await LoadPageContent(0, calculateToId(0)); + $("#previous").click(async () => { + const CountData = await getRecordCountCall(); + previous = previousPageResize(previous); + let fromId = previous[0] >= 0 ? previous[0] : 0; + const possibleStep = calculateToId(fromId) - fromId; + let toId = (previous[0] >= 0 ? previous[1] : possibleStep); + fromId = fromId == CountData - 1 ? fromId - possibleStep : fromId; + toId = toId <= CountData - 1 ? toId : CountData - 1; + previous = await LoadRecordsData(fromId, toId); + }); + } catch (error) { + } + $("#next").click(async () => { + try { + const recordCount = await getRecordCountCall(); + const fromId = nextPageResize(previous); + const possibleStep = calculateToId(fromId) - fromId; + if (fromId <= recordCount - possibleStep - 1) { + const toId = fromId + possibleStep <= recordCount - 1 ? fromId + possibleStep : recordCount - 1; + previous = await LoadRecordsData(fromId, toId); + } else if (fromId <= recordCount - 1) { + + previous = await LoadRecordsData(recordCount - 1 - (calculateToId(fromId) - fromId), recordCount - 1); + } else { + console.log("Test is working "); + } + } catch (error) { + } + }); + $("#go-button").click(async () => { + try { + const recordCount = await getRecordCountCall(); + const fromId = ConvertNumber($("#index").val() as string, false); + const possibleStep = calculateToId(fromId) - fromId; + if (fromId < 0) { + alert('only insert Id greater than or equal to 0'); + } else { + if (Math.floor(fromId).toString() == fromId.toString() === true) { + if (fromId > recordCount - possibleStep) { + alert(`You may not insert a desired Id greater than ${recordCount - possibleStep}`); + } else { + let toId = (fromId) + possibleStep < recordCount ? (fromId) + possibleStep : recordCount - 1; + previous = await LoadRecordsData(fromId, toId); + } + } else { + console.log("Test is working "); + } + } + } catch (error) { + } + }); + } + } } - - -$("#next").click(async () => { - - - try { - const recordCount = await getRecordCountCall(); - - const fromId = nextPageResize(previous); - const possibleStep = calculateToId(fromId) - fromId; - - if (fromId <= recordCount - possibleStep - 1) { - const toId = fromId + possibleStep <= recordCount - 1 ? fromId + possibleStep : recordCount - 1; - previous = await LoadRecordsData(fromId, toId); - } else if (fromId <= recordCount - 1) { - - previous = await LoadRecordsData(recordCount - 1 - (calculateToId(fromId) - fromId), recordCount - 1); - - } else { - - - console.log("Test is working "); - } - - } catch (error) { - - - } - -}); - - - $("#go-button").click(async () => { - - try { - - const recordCount = await getRecordCountCall(); - - const fromId = ConvertNumber($("#index").val() as string, false); - - const possibleStep = calculateToId(fromId) - fromId; - - if (fromId < 0){ - - alert('only insert Id greater than or equal to 0'); - - } else { - - if (Math.floor(fromId).toString() == fromId.toString() === true) { - - if ( fromId > recordCount - possibleStep ) { - - alert(`You may not insert a desired Id greater than ${recordCount - possibleStep}`); - - - } else { - - let toId = (fromId) + possibleStep < recordCount ? (fromId) + possibleStep : recordCount - 1; - previous = await LoadRecordsData(fromId, toId); - - } - - } else { - - console.log("Test is working "); - - } - } - - } catch (error) { - } - }); - } - } -} From 4731cd9168412e1f60e51f4ef1c2c941e490018f Mon Sep 17 00:00:00 2001 From: "sam.moloi" Date: Fri, 20 Aug 2021 13:41:20 +0200 Subject: [PATCH 03/50] update --- app.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app.ts b/app.ts index 91996a58..d19f169a 100644 --- a/app.ts +++ b/app.ts @@ -120,15 +120,11 @@ namespace onboardproject { const columns = await getColumnNamesCall(); for (const column of columns) { DisplayContent += `${column}`; - $("#wrapper-table-header-row").empty(); $("#wrapper-table-header-row").append(DisplayContent); } - } catch (error) { - console.log("Error " + error); - } return await LoadRecordsData(fromID, toID); } From c7cac80d792b12cbaf945256b8da47453b1c1b33 Mon Sep 17 00:00:00 2001 From: "sam.moloi" Date: Mon, 23 Aug 2021 11:12:28 +0200 Subject: [PATCH 04/50] update --- app.ts | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/app.ts b/app.ts index d19f169a..c8b2a72e 100644 --- a/app.ts +++ b/app.ts @@ -6,9 +6,9 @@ namespace onboardproject { // Trigger async function async function getRecordCountCall(): Promise { const response = await fetch('http://localhost:2050/recordCount'); - let promise = new Promise((res, rej) => { - setTimeout(() => res("Now it's done!"), 50) - }); + // let promise = new Promise((res, rej) => { + // setTimeout(() => res("Now it's done!"), 50) + // }); if (!response.ok) { const message = `An error has occured: ${response.status}`; throw new Error(message); @@ -23,9 +23,10 @@ namespace onboardproject { // Trigger async function async function getColumnNamesCall(): Promise { const response = await fetch('http://localhost:2050/columns'); - let promise = new Promise((res, rej) => { - setTimeout(() => res("Now it's done!"), 50) - }); + + // let promise = new Promise((res, rej) => { + // setTimeout(() => res("Now it's done!"), 50) + // }); if (!response.ok) { const message = `An error has occured: ${response.status}`; throw new Error(message); @@ -39,9 +40,9 @@ namespace onboardproject { getColumnNamesCall().then(data => console.log(data)).catch(reason => console.log(reason.message)) async function getRecordsCall(fromID: number, toID: number): Promise { const response = await fetch(`http://localhost:2050/records?from=${(fromID)}&to=${(toID)}`); - let promise = new Promise((res, rej) => { - setTimeout(() => res("Now it's done!"), 50) - }); + // let promise = new Promise((res, rej) => { + // setTimeout(() => res("Now it's done!"), 50) + // }); if (!response.ok) { const message = `An error has occured: ${response.status}`; throw new Error(message); From eeb8e5458b2d25599305494116af4cb4ab86aaf1 Mon Sep 17 00:00:00 2001 From: "sam.moloi" Date: Mon, 23 Aug 2021 13:43:13 +0200 Subject: [PATCH 05/50] update --- app.ts | 5 +- index.html | 15 ++---- style.css | 153 ++++++++++++++++++++++++++--------------------------- 3 files changed, 84 insertions(+), 89 deletions(-) diff --git a/app.ts b/app.ts index c8b2a72e..3eb34ffa 100644 --- a/app.ts +++ b/app.ts @@ -144,7 +144,8 @@ namespace onboardproject { throw new Error("Error"); } function calculateToId(fromId: number): number { - const possibleRecordsData = Math.floor((window.innerHeight - ($("#form-content").innerHeight() as number)) / 37); + + const possibleRecordsData = Math.max((window.innerHeight - ($("#form-content").innerHeight() as number))); const possibleId = fromId + possibleRecordsData; let recordDisplayset = 0; @@ -164,6 +165,8 @@ namespace onboardproject { } return recordDisplayset + possibleId; } + + function nextPageResize(previous: number[]): number { const fromID = ConvertNumber(previous.sort((a, b) => { return a - b })[0]); const toID = ConvertNumber(previous.sort((a, b) => { return a - b })[1]); diff --git a/index.html b/index.html index 32d1e867..e01b7b07 100644 --- a/index.html +++ b/index.html @@ -1,8 +1,8 @@ + JS Onboard Project - @@ -10,25 +10,18 @@
- Go To Start Index: + Go To Start Index:
- - -
- - - - - + + - diff --git a/style.css b/style.css index d300cb4d..cdaee093 100644 --- a/style.css +++ b/style.css @@ -1,91 +1,90 @@ - - table tr td,table tr td{ - text-align: center; - COLOR: white; - border: 1px solid; - } - -tr td { - height: 26px; - - } - - @media only screen and (max-width: 500px) { - table,thead,tbody,th,td,tr { - display: block; - COLOR: white; - } - - thead tr { - display: none; - COLOR: white; - } +body { + overflow: hidden; + background: -webkit-linear-gradient(left, #25c481, #25b7c4); + background: linear-gradient(to right, #25c481, #25b7c4); + font-family: 'Roboto', sans-serif; + color: white; +} - tr { - border: 1px solid #ccc; - } +#wrapper-table { + width: 100%; + height: 1000%; + table-layout: fixed; +} - td { - border: none; - border-bottom: 1px solid #eee; - position: relative; - padding-left: 50%; - white-space: normal; - text-align:left; - min-height: 10px; - overflow: hidden; - word-break:break-all; - } +#form-content { + text-align: center; +} - td:before { - position: absolute; - top: 6px; - left: 6px; - width: 45%; - padding-right: 10px; - text-align:left; - font-weight: bold; - content: attr(data-title); - } - } +table { + width: 100%; + table-layout: fixed; +} - body{ +h4 { + font-size: 20px; + color: #fff; + text-transform: uppercase; + font-weight: 300; + text-align: center; + margin-bottom: 15px; +} - overflow: hidden; - background: -webkit-linear-gradient(left, #25c481, #25b7c4); - background: linear-gradient(to right, #25c481, #25b7c4); - font-family: 'Roboto', sans-serif; - color: white; - } +#wrapper-table-content-body { + font-size: 12px; +} - #wrapper-table{ - width:100%; - height:1000%; - table-layout: fixed; +table tr td { + text-align: center; + color: white; + border: 1px solid; } - -#form-content{ +tr td { + height: 26px; +} - text-align: center; +@media only screen and (max-width: 500px) { -} + table, + thead, + tbody, + th, + td, + tr { + display: block; + COLOR: white; + } -table{ - width:100%; - table-layout: fixed; -} + thead tr { + display: none; + COLOR: white; + } -h4{ - font-size: 20px; - color: #fff; - text-transform: uppercase; - font-weight: 300; - text-align: center; - margin-bottom: 15px; -} + tr { + border: 1px solid #ccc; + } -#wrapper-table-content-body{ + td { + border: none; + border-bottom: 1px solid #eee; + position: relative; + padding-left: 50%; + white-space: normal; + text-align: left; + min-height: 10px; + overflow: hidden; + word-break: break-all; + } - font-size: 12px; -} \ No newline at end of file + td:before { + position: absolute; + top: 6px; + left: 6px; + width: 45%; + padding-right: 10px; + text-align: left; + font-weight: bold; + content: attr(data-title); + } +} From c6524011232281765bd52eb22a284aa63cdf7e2f Mon Sep 17 00:00:00 2001 From: "sam.moloi" Date: Mon, 23 Aug 2021 14:00:13 +0200 Subject: [PATCH 06/50] update --- app.ts | 110 +++++++++++++++++++++++++++++---------------------------- 1 file changed, 56 insertions(+), 54 deletions(-) diff --git a/app.ts b/app.ts index 3eb34ffa..cc03bc2a 100644 --- a/app.ts +++ b/app.ts @@ -1,7 +1,15 @@ +import { data } from "jquery"; + namespace onboardproject { module onboardprojects { + //Variable declarations - let Load = 50, previous: number[], previousprocess: number; + let Load = 50; + + let previous: number[]; + + let previousprocess: number; + // region API Call // Trigger async function async function getRecordCountCall(): Promise { @@ -11,19 +19,16 @@ namespace onboardproject { // }); if (!response.ok) { const message = `An error has occured: ${response.status}`; - throw new Error(message); + //throw new Error(message); console.log(message) } else { - return await response.json(); console.log(response); } + return await response.json(); } - // log response or catch error of fetch promise - getRecordCountCall().then(data => console.log(data)).catch(reason => console.log(reason.message)) // Trigger async function async function getColumnNamesCall(): Promise { const response = await fetch('http://localhost:2050/columns'); - // let promise = new Promise((res, rej) => { // setTimeout(() => res("Now it's done!"), 50) // }); @@ -35,9 +40,7 @@ namespace onboardproject { console.log(response); } } - // trigger async function - // log response or catch error of fetch promise - getColumnNamesCall().then(data => console.log(data)).catch(reason => console.log(reason.message)) + async function getRecordsCall(fromID: number, toID: number): Promise { const response = await fetch(`http://localhost:2050/records?from=${(fromID)}&to=${(toID)}`); // let promise = new Promise((res, rej) => { @@ -51,6 +54,7 @@ namespace onboardproject { console.log(response); } } + // function requestcolumns( // method: 'GET', // url: 'http://localhost:2050/columns', @@ -73,20 +77,17 @@ namespace onboardproject { // } //region Data Loading methods async function LoadRecordsData(fromID: number, toID: number): Promise { - try { - const recordsvalue = await getRecordsCall(fromID, toID) - let DisplayContent = ''; - for (const record of recordsvalue) { - DisplayContent += ``; - for (const column of record) { - DisplayContent += `${column}`; - } - DisplayContent += ''; - $("#wrapper-table-content-body").empty(); - $("#wrapper-table-content-body").append(DisplayContent); + + const recordsvalue = await getRecordsCall(fromID, toID) + let DisplayContent = ''; + for (const record of recordsvalue) { + DisplayContent += ``; + for (const column of record) { + DisplayContent += `${column}`; } - } catch (error) { - console.log("Error " + error) + DisplayContent += ''; + $("#wrapper-table-content-body").empty(); + $("#wrapper-table-content-body").append(DisplayContent); } return [fromID, toID]; } @@ -165,8 +166,6 @@ namespace onboardproject { } return recordDisplayset + possibleId; } - - function nextPageResize(previous: number[]): number { const fromID = ConvertNumber(previous.sort((a, b) => { return a - b })[0]); const toID = ConvertNumber(previous.sort((a, b) => { return a - b })[1]); @@ -183,20 +182,26 @@ namespace onboardproject { return [previous[0] - (nextPageResize(previous) - previous[0]), toId]; } window.onload = async () => { - try { - previous = await LoadPageContent(0, calculateToId(0)); - $("#previous").click(async () => { - const CountData = await getRecordCountCall(); - previous = previousPageResize(previous); - let fromId = previous[0] >= 0 ? previous[0] : 0; - const possibleStep = calculateToId(fromId) - fromId; - let toId = (previous[0] >= 0 ? previous[1] : possibleStep); - fromId = fromId == CountData - 1 ? fromId - possibleStep : fromId; - toId = toId <= CountData - 1 ? toId : CountData - 1; - previous = await LoadRecordsData(fromId, toId); - }); - } catch (error) { - } + + // trigger async function + // log response or catch error of fetch promise + getColumnNamesCall().then(data => console.log(data)).catch(reason => console.log(reason.message)); + + // log response or catch error of fetch promise + getRecordCountCall().then(data => console.log(data)).catch(reason => console.log(reason.message)); + + previous = await LoadPageContent(0, calculateToId(0)); + $("#previous").click(async () => { + const CountData = await getRecordCountCall(); + previous = previousPageResize(previous); + let fromId = previous[0] >= 0 ? previous[0] : 0; + const possibleStep = calculateToId(fromId) - fromId; + let toId = (previous[0] >= 0 ? previous[1] : possibleStep); + fromId = fromId == CountData - 1 ? fromId - possibleStep : fromId; + toId = toId <= CountData - 1 ? toId : CountData - 1; + previous = await LoadRecordsData(fromId, toId); + }); + $("#next").click(async () => { try { const recordCount = await getRecordCountCall(); @@ -215,25 +220,22 @@ namespace onboardproject { } }); $("#go-button").click(async () => { - try { - const recordCount = await getRecordCountCall(); - const fromId = ConvertNumber($("#index").val() as string, false); - const possibleStep = calculateToId(fromId) - fromId; - if (fromId < 0) { - alert('only insert Id greater than or equal to 0'); - } else { - if (Math.floor(fromId).toString() == fromId.toString() === true) { - if (fromId > recordCount - possibleStep) { - alert(`You may not insert a desired Id greater than ${recordCount - possibleStep}`); - } else { - let toId = (fromId) + possibleStep < recordCount ? (fromId) + possibleStep : recordCount - 1; - previous = await LoadRecordsData(fromId, toId); - } + const recordCount = await getRecordCountCall(); + const fromId = ConvertNumber($("#index").val() as string, false); + const possibleStep = calculateToId(fromId) - fromId; + if (fromId < 0) { + alert('only insert Id greater than or equal to 0'); + } else { + if (Math.floor(fromId).toString() == fromId.toString() === true) { + if (fromId > recordCount - possibleStep) { + alert(`You may not insert a desired Id greater than ${recordCount - possibleStep}`); } else { - console.log("Test is working "); + let toId = (fromId) + possibleStep < recordCount ? (fromId) + possibleStep : recordCount - 1; + previous = await LoadRecordsData(fromId, toId); } + } else { + console.log("Test is working "); } - } catch (error) { } }); } From 031b6149c73f94bf99d4ed0ff965f1eb598d7e1e Mon Sep 17 00:00:00 2001 From: "sam.moloi" Date: Mon, 23 Aug 2021 14:40:07 +0200 Subject: [PATCH 07/50] update --- app.ts | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/app.ts b/app.ts index cc03bc2a..db2097cd 100644 --- a/app.ts +++ b/app.ts @@ -1,6 +1,7 @@ import { data } from "jquery"; namespace onboardproject { + module onboardprojects { //Variable declarations @@ -116,17 +117,12 @@ namespace onboardproject { } // Handlers async function LoadPageContent(fromID: number, toID: number): Promise { - - try { - let DisplayContent = ""; - const columns = await getColumnNamesCall(); - for (const column of columns) { - DisplayContent += `${column}`; - $("#wrapper-table-header-row").empty(); - $("#wrapper-table-header-row").append(DisplayContent); - } - } catch (error) { - console.log("Error " + error); + let DisplayContent = ""; + const columns = await getColumnNamesCall(); + for (const column of columns) { + DisplayContent += `${column}`; + $("#wrapper-table-header-row").empty(); + $("#wrapper-table-header-row").append(DisplayContent); } return await LoadRecordsData(fromID, toID); } @@ -182,11 +178,10 @@ namespace onboardproject { return [previous[0] - (nextPageResize(previous) - previous[0]), toId]; } window.onload = async () => { - // trigger async function // log response or catch error of fetch promise getColumnNamesCall().then(data => console.log(data)).catch(reason => console.log(reason.message)); - + // trigger async function // log response or catch error of fetch promise getRecordCountCall().then(data => console.log(data)).catch(reason => console.log(reason.message)); From 027b329540f26ef12d4e226136cfb1f9e2d9d0eb Mon Sep 17 00:00:00 2001 From: "sam.moloi" Date: Mon, 23 Aug 2021 16:24:22 +0200 Subject: [PATCH 08/50] update --- app.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/app.ts b/app.ts index db2097cd..7f431116 100644 --- a/app.ts +++ b/app.ts @@ -141,7 +141,6 @@ namespace onboardproject { throw new Error("Error"); } function calculateToId(fromId: number): number { - const possibleRecordsData = Math.max((window.innerHeight - ($("#form-content").innerHeight() as number))); const possibleId = fromId + possibleRecordsData; From 909ce8fc3afc82e25d578b80c4d5af1ac0428004 Mon Sep 17 00:00:00 2001 From: "sam.moloi" Date: Mon, 23 Aug 2021 17:02:04 +0200 Subject: [PATCH 09/50] update --- app.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app.ts b/app.ts index 7f431116..45097bbf 100644 --- a/app.ts +++ b/app.ts @@ -55,7 +55,6 @@ namespace onboardproject { console.log(response); } } - // function requestcolumns( // method: 'GET', // url: 'http://localhost:2050/columns', @@ -78,7 +77,6 @@ namespace onboardproject { // } //region Data Loading methods async function LoadRecordsData(fromID: number, toID: number): Promise { - const recordsvalue = await getRecordsCall(fromID, toID) let DisplayContent = ''; for (const record of recordsvalue) { @@ -138,12 +136,11 @@ namespace onboardproject { default: return 0; } - throw new Error("Error"); + // throw new Error("Error"); } function calculateToId(fromId: number): number { const possibleRecordsData = Math.max((window.innerHeight - ($("#form-content").innerHeight() as number))); const possibleId = fromId + possibleRecordsData; - let recordDisplayset = 0; switch (recordDisplayset) { case 0: @@ -177,6 +174,7 @@ namespace onboardproject { return [previous[0] - (nextPageResize(previous) - previous[0]), toId]; } window.onload = async () => { + // trigger async function // log response or catch error of fetch promise getColumnNamesCall().then(data => console.log(data)).catch(reason => console.log(reason.message)); @@ -195,7 +193,6 @@ namespace onboardproject { toId = toId <= CountData - 1 ? toId : CountData - 1; previous = await LoadRecordsData(fromId, toId); }); - $("#next").click(async () => { try { const recordCount = await getRecordCountCall(); From 1de2f8ddebac5ebb928c6dec25773d00a9c84e79 Mon Sep 17 00:00:00 2001 From: "sam.moloi" Date: Mon, 23 Aug 2021 17:03:42 +0200 Subject: [PATCH 10/50] update --- app.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app.ts b/app.ts index 45097bbf..d3bea2b5 100644 --- a/app.ts +++ b/app.ts @@ -1,14 +1,13 @@ import { data } from "jquery"; namespace onboardproject { - module onboardprojects { - //Variable declarations + //Load Variable declarations let Load = 50; - + // Previous Variable declarations let previous: number[]; - + //Previous Process Variable declarations let previousprocess: number; // region API Call From fa958184d4e5b4c5d3436ce893f847fedfa85d17 Mon Sep 17 00:00:00 2001 From: "sam.moloi" Date: Mon, 23 Aug 2021 17:08:43 +0200 Subject: [PATCH 11/50] update --- app.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app.ts b/app.ts index d3bea2b5..d5003ee3 100644 --- a/app.ts +++ b/app.ts @@ -173,7 +173,6 @@ namespace onboardproject { return [previous[0] - (nextPageResize(previous) - previous[0]), toId]; } window.onload = async () => { - // trigger async function // log response or catch error of fetch promise getColumnNamesCall().then(data => console.log(data)).catch(reason => console.log(reason.message)); @@ -181,7 +180,9 @@ namespace onboardproject { // log response or catch error of fetch promise getRecordCountCall().then(data => console.log(data)).catch(reason => console.log(reason.message)); + //Loading Content Function previous = await LoadPageContent(0, calculateToId(0)); + //click function for previewing page $("#previous").click(async () => { const CountData = await getRecordCountCall(); previous = previousPageResize(previous); @@ -192,6 +193,7 @@ namespace onboardproject { toId = toId <= CountData - 1 ? toId : CountData - 1; previous = await LoadRecordsData(fromId, toId); }); + //click function for Skipping to next page $("#next").click(async () => { try { const recordCount = await getRecordCountCall(); @@ -209,6 +211,7 @@ namespace onboardproject { } catch (error) { } }); + //Searching function for index $("#go-button").click(async () => { const recordCount = await getRecordCountCall(); const fromId = ConvertNumber($("#index").val() as string, false); From 0e43a234640532b2dde0eacc75611b0718eb5714 Mon Sep 17 00:00:00 2001 From: "sam.moloi" Date: Tue, 24 Aug 2021 08:36:05 +0200 Subject: [PATCH 12/50] update --- app.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app.ts b/app.ts index d5003ee3..0b647078 100644 --- a/app.ts +++ b/app.ts @@ -40,7 +40,6 @@ namespace onboardproject { console.log(response); } } - async function getRecordsCall(fromID: number, toID: number): Promise { const response = await fetch(`http://localhost:2050/records?from=${(fromID)}&to=${(toID)}`); // let promise = new Promise((res, rej) => { @@ -137,6 +136,7 @@ namespace onboardproject { } // throw new Error("Error"); } + function calculateToId(fromId: number): number { const possibleRecordsData = Math.max((window.innerHeight - ($("#form-content").innerHeight() as number))); const possibleId = fromId + possibleRecordsData; @@ -157,6 +157,7 @@ namespace onboardproject { } return recordDisplayset + possibleId; } + function nextPageResize(previous: number[]): number { const fromID = ConvertNumber(previous.sort((a, b) => { return a - b })[0]); const toID = ConvertNumber(previous.sort((a, b) => { return a - b })[1]); @@ -168,10 +169,12 @@ namespace onboardproject { } return toID; } + function previousPageResize(previous: number[]): number[] { const toId = calculateToId(previous[0] - (nextPageResize(previous) - previous[0])); return [previous[0] - (nextPageResize(previous) - previous[0]), toId]; } + window.onload = async () => { // trigger async function // log response or catch error of fetch promise From b2e0238ee9c139c9e3b4fc7bd3709a51fa1572e7 Mon Sep 17 00:00:00 2001 From: "sam.moloi" Date: Tue, 24 Aug 2021 09:06:28 +0200 Subject: [PATCH 13/50] update --- app.ts | 60 ++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 35 insertions(+), 25 deletions(-) diff --git a/app.ts b/app.ts index 0b647078..0dbda2b0 100644 --- a/app.ts +++ b/app.ts @@ -5,8 +5,10 @@ namespace onboardproject { //Load Variable declarations let Load = 50; + // Previous Variable declarations let previous: number[]; + //Previous Process Variable declarations let previousprocess: number; @@ -19,13 +21,14 @@ namespace onboardproject { // }); if (!response.ok) { const message = `An error has occured: ${response.status}`; - //throw new Error(message); + throw new Error(message); console.log(message) } else { console.log(response); } - return await response.json(); + return response.json(); } + // Trigger async function async function getColumnNamesCall(): Promise { const response = await fetch('http://localhost:2050/columns'); @@ -36,10 +39,11 @@ namespace onboardproject { const message = `An error has occured: ${response.status}`; throw new Error(message); } else { - return await response.json(); + return response.json(); console.log(response); } } + async function getRecordsCall(fromID: number, toID: number): Promise { const response = await fetch(`http://localhost:2050/records?from=${(fromID)}&to=${(toID)}`); // let promise = new Promise((res, rej) => { @@ -49,10 +53,11 @@ namespace onboardproject { const message = `An error has occured: ${response.status}`; throw new Error(message); } else { - return await response.json(); + return response.json(); console.log(response); } } + // function requestcolumns( // method: 'GET', // url: 'http://localhost:2050/columns', @@ -73,6 +78,7 @@ namespace onboardproject { // } // }; // } + //region Data Loading methods async function LoadRecordsData(fromID: number, toID: number): Promise { const recordsvalue = await getRecordsCall(fromID, toID) @@ -88,29 +94,13 @@ namespace onboardproject { } return [fromID, toID]; } + function RecordsFromCursor(cursor: number[]): Promise { cursor = cursor.sort((a, b) => { return a - b }); return LoadRecordsData(cursor[0], cursor[1]); // throw new Error("Error"); } - window.onresize = () => { - try { - const nextToId = calculateToId(previous[0]); - clearTimeout(Load); - Load = setTimeout(async () => { - const recordCount = await getRecordCountCall(); - if (nextToId >= recordCount - 1) { - const fromId = recordCount - 1 - (calculateToId(previous[0]) - previous[0]); - const toId = recordCount - 1; - previous = await LoadRecordsData(fromId, toId); - } else { - previous = await LoadRecordsData(previous[0], nextToId) - } - }, 10); - } catch (error) { - // throw new Error("Error" + error); - } - } + // Handlers async function LoadPageContent(fromID: number, toID: number): Promise { let DisplayContent = ""; @@ -120,8 +110,9 @@ namespace onboardproject { $("#wrapper-table-header-row").empty(); $("#wrapper-table-header-row").append(DisplayContent); } - return await LoadRecordsData(fromID, toID); + return LoadRecordsData(fromID, toID); } + function ConvertNumber(input: string | number, parseAsInt: boolean = true): number { switch (typeof input) { case ('string'): @@ -176,12 +167,31 @@ namespace onboardproject { } window.onload = async () => { + + window.onresize = () => { + try { + const nextToId = calculateToId(previous[0]); + clearTimeout(Load); + Load = setTimeout(async () => { + const recordCount = await getRecordCountCall(); + if (nextToId >= recordCount - 1) { + const fromId = recordCount - 1 - (calculateToId(previous[0]) - previous[0]); + const toId = recordCount - 1; + previous = await LoadRecordsData(fromId, toId); + } else { + previous = await LoadRecordsData(previous[0], nextToId) + } + }, 10); + } catch (error) { + // throw new Error("Error" + error); + } + } // trigger async function // log response or catch error of fetch promise - getColumnNamesCall().then(data => console.log(data)).catch(reason => console.log(reason.message)); + // getColumnNamesCall().then(data => console.log(data)).catch(reason => console.log(reason.message)); // trigger async function // log response or catch error of fetch promise - getRecordCountCall().then(data => console.log(data)).catch(reason => console.log(reason.message)); + // getRecordCountCall().then(data => console.log(data)).catch(reason => console.log(reason.message)); //Loading Content Function previous = await LoadPageContent(0, calculateToId(0)); From 32a64cc1d95359b83cefece0682bb1ce20336cc5 Mon Sep 17 00:00:00 2001 From: "sam.moloi" Date: Tue, 24 Aug 2021 09:18:32 +0200 Subject: [PATCH 14/50] update --- app.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app.ts b/app.ts index 0dbda2b0..1e4839b6 100644 --- a/app.ts +++ b/app.ts @@ -22,7 +22,7 @@ namespace onboardproject { if (!response.ok) { const message = `An error has occured: ${response.status}`; throw new Error(message); - console.log(message) + // console.log(message) } else { console.log(response); } @@ -81,7 +81,7 @@ namespace onboardproject { //region Data Loading methods async function LoadRecordsData(fromID: number, toID: number): Promise { - const recordsvalue = await getRecordsCall(fromID, toID) + const recordsvalue = await getRecordsCall(fromID, toID); let DisplayContent = ''; for (const record of recordsvalue) { DisplayContent += ``; @@ -95,6 +95,7 @@ namespace onboardproject { return [fromID, toID]; } + // function RecordsFromCursor(cursor: number[]): Promise { cursor = cursor.sort((a, b) => { return a - b }); return LoadRecordsData(cursor[0], cursor[1]); @@ -128,6 +129,7 @@ namespace onboardproject { // throw new Error("Error"); } + // function calculateToId(fromId: number): number { const possibleRecordsData = Math.max((window.innerHeight - ($("#form-content").innerHeight() as number))); const possibleId = fromId + possibleRecordsData; @@ -219,7 +221,6 @@ namespace onboardproject { previous = await LoadRecordsData(recordCount - 1 - (calculateToId(fromId) - fromId), recordCount - 1); } else { - console.log("Test is working "); } } catch (error) { } @@ -240,7 +241,7 @@ namespace onboardproject { previous = await LoadRecordsData(fromId, toId); } } else { - console.log("Test is working "); + } } }); From 4f10567160224f742c7150e5752313004e2f2b4e Mon Sep 17 00:00:00 2001 From: "sam.moloi" Date: Tue, 24 Aug 2021 09:29:46 +0200 Subject: [PATCH 15/50] update --- app.ts | 1 - index.html | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app.ts b/app.ts index 1e4839b6..fdd90d05 100644 --- a/app.ts +++ b/app.ts @@ -22,7 +22,6 @@ namespace onboardproject { if (!response.ok) { const message = `An error has occured: ${response.status}`; throw new Error(message); - // console.log(message) } else { console.log(response); } diff --git a/index.html b/index.html index e01b7b07..787d4bd8 100644 --- a/index.html +++ b/index.html @@ -10,7 +10,7 @@
- Go To Start Index: + Go To Start Index: From 97d4868bba01a4dd6749501be6e8fa566ada296b Mon Sep 17 00:00:00 2001 From: "sam.moloi" Date: Tue, 24 Aug 2021 10:23:02 +0200 Subject: [PATCH 16/50] update --- .vscode/settings.json | 3 ++- app.ts | 1 - dist/app.min.js | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 dist/app.min.js diff --git a/.vscode/settings.json b/.vscode/settings.json index 7a73a41b..7f5e3f8d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,2 +1,3 @@ { -} \ No newline at end of file + "compile-hero.disable-compile-files-on-did-save-code": false +} diff --git a/app.ts b/app.ts index fdd90d05..b1894f6f 100644 --- a/app.ts +++ b/app.ts @@ -127,7 +127,6 @@ namespace onboardproject { } // throw new Error("Error"); } - // function calculateToId(fromId: number): number { const possibleRecordsData = Math.max((window.innerHeight - ($("#form-content").innerHeight() as number))); diff --git a/dist/app.min.js b/dist/app.min.js new file mode 100644 index 00000000..a1ee13ef --- /dev/null +++ b/dist/app.min.js @@ -0,0 +1 @@ +var __awaiter=this&&this.__awaiter||function(t,i,c,u){return new(c=c||Promise)(function(r,e){function n(t){try{a(u.next(t))}catch(t){e(t)}}function o(t){try{a(u.throw(t))}catch(t){e(t)}}function a(t){var e;t.done?r(t.value):((e=t.value)instanceof c?e:new c(function(t){t(e)})).then(n,o)}a((u=u.apply(t,i||[])).next())})},__generator=this&&this.__generator||function(r,n){var o,a,i,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(o)throw new TypeError("Generator is already executing.");for(;c;)try{if(o=1,a&&(i=2&e[0]?a.return:e[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,e[1])).done)return i;switch(a=0,i&&(e=[2&e[0],i.value]),e[0]){case 0:case 1:i=e;break;case 4:return c.label++,{value:e[1],done:!1};case 5:c.label++,a=e[1],e=[0];continue;case 7:e=c.ops.pop(),c.trys.pop();continue;default:if(!(i=0<(i=c.trys).length&&i[i.length-1])&&(6===e[0]||2===e[0])){c=0;continue}if(3===e[0]&&(!i||e[1]>i[0]&&e[1]',i=0,c=a;i'+u+"";r+="",$("#wrapper-table-content-body").empty(),$("#wrapper-table-content-body").append(r)}return[2,[s,l]]}})})}function r(i,c){return __awaiter(this,void 0,Promise,function(){var e,r,n,o,a;return __generator(this,function(t){switch(t.label){case 0:return e="",[4,function(){return __awaiter(this,void 0,Promise,function(){var e,r;return __generator(this,function(t){switch(t.label){case 0:return[4,fetch("http://localhost:2050/columns")];case 1:if((e=t.sent()).ok)return[2,e.json()];throw r="An error has occured: "+e.status,new Error(r)}})})}()];case 1:for(r=t.sent(),n=0,o=r;n'+a+"",$("#wrapper-table-header-row").empty(),$("#wrapper-table-header-row").append(e);return[2,s(i,c)]}})})}function a(t,e){switch(void 0===e&&(e=!0),typeof t){case"string":return 1==e?parseInt(t):parseFloat(t);case"number":return t;default:return 0}}function l(t){var e=t+Math.max(window.innerHeight-$("#form-content").innerHeight()),r=0;switch(r){case 0:case 1:case 2:window.innerHeight;break;default:r=15}return r+e}function f(t){for(var e=a(t.sort(function(t,e){return t-e})[0]),r=a(t.sort(function(t,e){return t-e})[1]),n=$(window).innerHeight()-$("#table-row-"+e).height(),o=e;o<=r;o++){if(!($("#table-row-"+o).offset().top Date: Tue, 24 Aug 2021 11:26:07 +0200 Subject: [PATCH 17/50] update --- app.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app.ts b/app.ts index b1894f6f..08576283 100644 --- a/app.ts +++ b/app.ts @@ -127,6 +127,7 @@ namespace onboardproject { } // throw new Error("Error"); } + // function calculateToId(fromId: number): number { const possibleRecordsData = Math.max((window.innerHeight - ($("#form-content").innerHeight() as number))); @@ -223,6 +224,7 @@ namespace onboardproject { } catch (error) { } }); + //Searching function for index $("#go-button").click(async () => { const recordCount = await getRecordCountCall(); From 2672789c3e0b97d08a1165d4a1c456734be371e3 Mon Sep 17 00:00:00 2001 From: "sam.moloi" Date: Tue, 24 Aug 2021 11:47:20 +0200 Subject: [PATCH 18/50] update --- app.ts | 8 +++++++- dist/app.min.js | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app.ts b/app.ts index 08576283..06dc312d 100644 --- a/app.ts +++ b/app.ts @@ -43,6 +43,7 @@ namespace onboardproject { } } + // Trigger async function async function getRecordsCall(fromID: number, toID: number): Promise { const response = await fetch(`http://localhost:2050/records?from=${(fromID)}&to=${(toID)}`); // let promise = new Promise((res, rej) => { @@ -94,7 +95,7 @@ namespace onboardproject { return [fromID, toID]; } - // + // Load Records Function function RecordsFromCursor(cursor: number[]): Promise { cursor = cursor.sort((a, b) => { return a - b }); return LoadRecordsData(cursor[0], cursor[1]); @@ -113,6 +114,7 @@ namespace onboardproject { return LoadRecordsData(fromID, toID); } + // Conversion Method function ConvertNumber(input: string | number, parseAsInt: boolean = true): number { switch (typeof input) { case ('string'): @@ -150,6 +152,7 @@ namespace onboardproject { return recordDisplayset + possibleId; } + // function nextPageResize(previous: number[]): number { const fromID = ConvertNumber(previous.sort((a, b) => { return a - b })[0]); const toID = ConvertNumber(previous.sort((a, b) => { return a - b })[1]); @@ -220,6 +223,9 @@ namespace onboardproject { previous = await LoadRecordsData(recordCount - 1 - (calculateToId(fromId) - fromId), recordCount - 1); } else { + + throw new Error("Error 404"); + } } catch (error) { } diff --git a/dist/app.min.js b/dist/app.min.js index a1ee13ef..e61f91c5 100644 --- a/dist/app.min.js +++ b/dist/app.min.js @@ -1 +1 @@ -var __awaiter=this&&this.__awaiter||function(t,i,c,u){return new(c=c||Promise)(function(r,e){function n(t){try{a(u.next(t))}catch(t){e(t)}}function o(t){try{a(u.throw(t))}catch(t){e(t)}}function a(t){var e;t.done?r(t.value):((e=t.value)instanceof c?e:new c(function(t){t(e)})).then(n,o)}a((u=u.apply(t,i||[])).next())})},__generator=this&&this.__generator||function(r,n){var o,a,i,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(o)throw new TypeError("Generator is already executing.");for(;c;)try{if(o=1,a&&(i=2&e[0]?a.return:e[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,e[1])).done)return i;switch(a=0,i&&(e=[2&e[0],i.value]),e[0]){case 0:case 1:i=e;break;case 4:return c.label++,{value:e[1],done:!1};case 5:c.label++,a=e[1],e=[0];continue;case 7:e=c.ops.pop(),c.trys.pop();continue;default:if(!(i=0<(i=c.trys).length&&i[i.length-1])&&(6===e[0]||2===e[0])){c=0;continue}if(3===e[0]&&(!i||e[1]>i[0]&&e[1]',i=0,c=a;i'+u+"";r+="",$("#wrapper-table-content-body").empty(),$("#wrapper-table-content-body").append(r)}return[2,[s,l]]}})})}function r(i,c){return __awaiter(this,void 0,Promise,function(){var e,r,n,o,a;return __generator(this,function(t){switch(t.label){case 0:return e="",[4,function(){return __awaiter(this,void 0,Promise,function(){var e,r;return __generator(this,function(t){switch(t.label){case 0:return[4,fetch("http://localhost:2050/columns")];case 1:if((e=t.sent()).ok)return[2,e.json()];throw r="An error has occured: "+e.status,new Error(r)}})})}()];case 1:for(r=t.sent(),n=0,o=r;n'+a+"",$("#wrapper-table-header-row").empty(),$("#wrapper-table-header-row").append(e);return[2,s(i,c)]}})})}function a(t,e){switch(void 0===e&&(e=!0),typeof t){case"string":return 1==e?parseInt(t):parseFloat(t);case"number":return t;default:return 0}}function l(t){var e=t+Math.max(window.innerHeight-$("#form-content").innerHeight()),r=0;switch(r){case 0:case 1:case 2:window.innerHeight;break;default:r=15}return r+e}function f(t){for(var e=a(t.sort(function(t,e){return t-e})[0]),r=a(t.sort(function(t,e){return t-e})[1]),n=$(window).innerHeight()-$("#table-row-"+e).height(),o=e;o<=r;o++){if(!($("#table-row-"+o).offset().topi[0]&&t[1]',i=0,c=a;i'+u+"";e+="",$("#wrapper-table-content-body").empty(),$("#wrapper-table-content-body").append(e)}return[2,[s,l]]}})})}function e(i,c){return __awaiter(this,void 0,Promise,function(){var t,e,n,o,a;return __generator(this,function(r){switch(r.label){case 0:return t="",[4,function(){return __awaiter(this,void 0,Promise,function(){var t,e;return __generator(this,function(r){switch(r.label){case 0:return[4,fetch("http://localhost:2050/columns")];case 1:if((t=r.sent()).ok)return[2,t.json()];throw e="An error has occured: "+t.status,new Error(e)}})})}()];case 1:for(e=r.sent(),n=0,o=e;n'+a+"",$("#wrapper-table-header-row").empty(),$("#wrapper-table-header-row").append(t);return[2,s(i,c)]}})})}function a(r,t){switch(void 0===t&&(t=!0),typeof r){case"string":return 1==t?parseInt(r):parseFloat(r);case"number":return r;default:return 0}}function l(r){var t=r+Math.max(window.innerHeight-$("#form-content").innerHeight()),e=0;switch(e){case 0:case 1:case 2:window.innerHeight;break;default:e=15}return e+t}function h(r){for(var t=a(r.sort(function(r,t){return r-t})[0]),e=a(r.sort(function(r,t){return r-t})[1]),n=$(window).innerHeight()-$("#table-row-"+t).height(),o=t;o<=e;o++){if(!($("#table-row-"+o).offset().top Date: Tue, 24 Aug 2021 12:00:24 +0200 Subject: [PATCH 19/50] update --- app.ts | 3 +-- dist/app.min.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app.ts b/app.ts index 06dc312d..cfd09796 100644 --- a/app.ts +++ b/app.ts @@ -190,6 +190,7 @@ namespace onboardproject { // throw new Error("Error" + error); } } + // trigger async function // log response or catch error of fetch promise // getColumnNamesCall().then(data => console.log(data)).catch(reason => console.log(reason.message)); @@ -246,8 +247,6 @@ namespace onboardproject { let toId = (fromId) + possibleStep < recordCount ? (fromId) + possibleStep : recordCount - 1; previous = await LoadRecordsData(fromId, toId); } - } else { - } } }); diff --git a/dist/app.min.js b/dist/app.min.js index e61f91c5..6a786a5e 100644 --- a/dist/app.min.js +++ b/dist/app.min.js @@ -1 +1 @@ -var __awaiter=this&&this.__awaiter||function(r,i,c,u){return new(c=c||Promise)(function(e,t){function n(r){try{a(u.next(r))}catch(r){t(r)}}function o(r){try{a(u.throw(r))}catch(r){t(r)}}function a(r){var t;r.done?e(r.value):((t=r.value)instanceof c?t:new c(function(r){r(t)})).then(n,o)}a((u=u.apply(r,i||[])).next())})},__generator=this&&this.__generator||function(e,n){var o,a,i,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},r={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function t(t){return function(r){return function(t){if(o)throw new TypeError("Generator is already executing.");for(;c;)try{if(o=1,a&&(i=2&t[0]?a.return:t[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,t[1])).done)return i;switch(a=0,i&&(t=[2&t[0],i.value]),t[0]){case 0:case 1:i=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,a=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(i=0<(i=c.trys).length&&i[i.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!i||t[1]>i[0]&&t[1]',i=0,c=a;i'+u+"";e+="",$("#wrapper-table-content-body").empty(),$("#wrapper-table-content-body").append(e)}return[2,[s,l]]}})})}function e(i,c){return __awaiter(this,void 0,Promise,function(){var t,e,n,o,a;return __generator(this,function(r){switch(r.label){case 0:return t="",[4,function(){return __awaiter(this,void 0,Promise,function(){var t,e;return __generator(this,function(r){switch(r.label){case 0:return[4,fetch("http://localhost:2050/columns")];case 1:if((t=r.sent()).ok)return[2,t.json()];throw e="An error has occured: "+t.status,new Error(e)}})})}()];case 1:for(e=r.sent(),n=0,o=e;n'+a+"",$("#wrapper-table-header-row").empty(),$("#wrapper-table-header-row").append(t);return[2,s(i,c)]}})})}function a(r,t){switch(void 0===t&&(t=!0),typeof r){case"string":return 1==t?parseInt(r):parseFloat(r);case"number":return r;default:return 0}}function l(r){var t=r+Math.max(window.innerHeight-$("#form-content").innerHeight()),e=0;switch(e){case 0:case 1:case 2:window.innerHeight;break;default:e=15}return e+t}function h(r){for(var t=a(r.sort(function(r,t){return r-t})[0]),e=a(r.sort(function(r,t){return r-t})[1]),n=$(window).innerHeight()-$("#table-row-"+t).height(),o=t;o<=e;o++){if(!($("#table-row-"+o).offset().topi[0]&&r[1]',i=0,c=a;i'+u+"";e+="",$("#wrapper-table-content-body").empty(),$("#wrapper-table-content-body").append(e)}return[2,[s,l]]}})})}function e(i,c){return __awaiter(this,void 0,Promise,function(){var r,e,n,o,a;return __generator(this,function(t){switch(t.label){case 0:return r="",[4,function(){return __awaiter(this,void 0,Promise,function(){var r,e;return __generator(this,function(t){switch(t.label){case 0:return[4,fetch("http://localhost:2050/columns")];case 1:if((r=t.sent()).ok)return[2,r.json()];throw e="An error has occured: "+r.status,new Error(e)}})})}()];case 1:for(e=t.sent(),n=0,o=e;n'+a+"",$("#wrapper-table-header-row").empty(),$("#wrapper-table-header-row").append(r);return[2,s(i,c)]}})})}function a(t,r){switch(void 0===r&&(r=!0),typeof t){case"string":return 1==r?parseInt(t):parseFloat(t);case"number":return t;default:return 0}}function l(t){var r=t+Math.max(window.innerHeight-$("#form-content").innerHeight()),e=0;switch(e){case 0:case 1:case 2:window.innerHeight;break;default:e=15}return e+r}function h(t){for(var r=a(t.sort(function(t,r){return t-r})[0]),e=a(t.sort(function(t,r){return t-r})[1]),n=$(window).innerHeight()-$("#table-row-"+r).height(),o=r;o<=e;o++){if(!($("#table-row-"+o).offset().top Date: Tue, 24 Aug 2021 15:07:33 +0200 Subject: [PATCH 20/50] update --- app.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/app.ts b/app.ts index cfd09796..499da6e2 100644 --- a/app.ts +++ b/app.ts @@ -170,6 +170,7 @@ namespace onboardproject { return [previous[0] - (nextPageResize(previous) - previous[0]), toId]; } + //Onload Function window.onload = async () => { window.onresize = () => { From ea585f37254cc89d046d506a527cbb5f9a442792 Mon Sep 17 00:00:00 2001 From: "sam.moloi" Date: Tue, 24 Aug 2021 15:10:07 +0200 Subject: [PATCH 21/50] update --- app.ts | 11 +++++------ dist/app.min.js | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app.ts b/app.ts index 499da6e2..d53af878 100644 --- a/app.ts +++ b/app.ts @@ -124,10 +124,7 @@ namespace onboardproject { return parseFloat(input as string); case ("number"): return input as number; - default: - return 0; - } - // throw new Error("Error"); + default:Next_Page_Resize } // @@ -152,7 +149,7 @@ namespace onboardproject { return recordDisplayset + possibleId; } - // + //Next_Page_Resize Function function nextPageResize(previous: number[]): number { const fromID = ConvertNumber(previous.sort((a, b) => { return a - b })[0]); const toID = ConvertNumber(previous.sort((a, b) => { return a - b })[1]); @@ -165,6 +162,7 @@ namespace onboardproject { return toID; } + //Previous_Page_Resize Function function previousPageResize(previous: number[]): number[] { const toId = calculateToId(previous[0] - (nextPageResize(previous) - previous[0])); return [previous[0] - (nextPageResize(previous) - previous[0]), toId]; @@ -191,7 +189,6 @@ namespace onboardproject { // throw new Error("Error" + error); } } - // trigger async function // log response or catch error of fetch promise // getColumnNamesCall().then(data => console.log(data)).catch(reason => console.log(reason.message)); @@ -201,6 +198,7 @@ namespace onboardproject { //Loading Content Function previous = await LoadPageContent(0, calculateToId(0)); + //click function for previewing page $("#previous").click(async () => { const CountData = await getRecordCountCall(); @@ -212,6 +210,7 @@ namespace onboardproject { toId = toId <= CountData - 1 ? toId : CountData - 1; previous = await LoadRecordsData(fromId, toId); }); + //click function for Skipping to next page $("#next").click(async () => { try { diff --git a/dist/app.min.js b/dist/app.min.js index 6a786a5e..8d370b40 100644 --- a/dist/app.min.js +++ b/dist/app.min.js @@ -1 +1 @@ -var __awaiter=this&&this.__awaiter||function(t,i,c,u){return new(c=c||Promise)(function(e,r){function n(t){try{a(u.next(t))}catch(t){r(t)}}function o(t){try{a(u.throw(t))}catch(t){r(t)}}function a(t){var r;t.done?e(t.value):((r=t.value)instanceof c?r:new c(function(t){t(r)})).then(n,o)}a((u=u.apply(t,i||[])).next())})},__generator=this&&this.__generator||function(e,n){var o,a,i,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},t={next:r(0),throw:r(1),return:r(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function r(r){return function(t){return function(r){if(o)throw new TypeError("Generator is already executing.");for(;c;)try{if(o=1,a&&(i=2&r[0]?a.return:r[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,r[1])).done)return i;switch(a=0,i&&(r=[2&r[0],i.value]),r[0]){case 0:case 1:i=r;break;case 4:return c.label++,{value:r[1],done:!1};case 5:c.label++,a=r[1],r=[0];continue;case 7:r=c.ops.pop(),c.trys.pop();continue;default:if(!(i=0<(i=c.trys).length&&i[i.length-1])&&(6===r[0]||2===r[0])){c=0;continue}if(3===r[0]&&(!i||r[1]>i[0]&&r[1]',i=0,c=a;i'+u+"";e+="",$("#wrapper-table-content-body").empty(),$("#wrapper-table-content-body").append(e)}return[2,[s,l]]}})})}function e(i,c){return __awaiter(this,void 0,Promise,function(){var r,e,n,o,a;return __generator(this,function(t){switch(t.label){case 0:return r="",[4,function(){return __awaiter(this,void 0,Promise,function(){var r,e;return __generator(this,function(t){switch(t.label){case 0:return[4,fetch("http://localhost:2050/columns")];case 1:if((r=t.sent()).ok)return[2,r.json()];throw e="An error has occured: "+r.status,new Error(e)}})})}()];case 1:for(e=t.sent(),n=0,o=e;n'+a+"",$("#wrapper-table-header-row").empty(),$("#wrapper-table-header-row").append(r);return[2,s(i,c)]}})})}function a(t,r){switch(void 0===r&&(r=!0),typeof t){case"string":return 1==r?parseInt(t):parseFloat(t);case"number":return t;default:return 0}}function l(t){var r=t+Math.max(window.innerHeight-$("#form-content").innerHeight()),e=0;switch(e){case 0:case 1:case 2:window.innerHeight;break;default:e=15}return e+r}function h(t){for(var r=a(t.sort(function(t,r){return t-r})[0]),e=a(t.sort(function(t,r){return t-r})[1]),n=$(window).innerHeight()-$("#table-row-"+r).height(),o=r;o<=e;o++){if(!($("#table-row-"+o).offset().topi[0]&&t[1] Date: Tue, 24 Aug 2021 15:24:35 +0200 Subject: [PATCH 22/50] update --- app.ts | 10 ++++++---- dist/app.min.js | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app.ts b/app.ts index d53af878..4a0da398 100644 --- a/app.ts +++ b/app.ts @@ -114,7 +114,7 @@ namespace onboardproject { return LoadRecordsData(fromID, toID); } - // Conversion Method + // Conversion Function function ConvertNumber(input: string | number, parseAsInt: boolean = true): number { switch (typeof input) { case ('string'): @@ -124,7 +124,10 @@ namespace onboardproject { return parseFloat(input as string); case ("number"): return input as number; - default:Next_Page_Resize + default: + return 0; + } + // throw new Error("Error"); } // @@ -171,6 +174,7 @@ namespace onboardproject { //Onload Function window.onload = async () => { + //On Resize_Function window.onresize = () => { try { const nextToId = calculateToId(previous[0]); @@ -189,10 +193,8 @@ namespace onboardproject { // throw new Error("Error" + error); } } - // trigger async function // log response or catch error of fetch promise // getColumnNamesCall().then(data => console.log(data)).catch(reason => console.log(reason.message)); - // trigger async function // log response or catch error of fetch promise // getRecordCountCall().then(data => console.log(data)).catch(reason => console.log(reason.message)); diff --git a/dist/app.min.js b/dist/app.min.js index 8d370b40..6a786a5e 100644 --- a/dist/app.min.js +++ b/dist/app.min.js @@ -1 +1 @@ -var __awaiter=this&&this.__awaiter||function(e,i,u,c){return new(u=u||Promise)(function(n,t){function r(e){try{a(c.next(e))}catch(e){t(e)}}function o(e){try{a(c.throw(e))}catch(e){t(e)}}function a(e){var t;e.done?n(e.value):((t=e.value)instanceof u?t:new u(function(e){e(t)})).then(r,o)}a((c=c.apply(e,i||[])).next())})},__generator=this&&this.__generator||function(n,r){var o,a,i,u={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(o)throw new TypeError("Generator is already executing.");for(;u;)try{if(o=1,a&&(i=2&t[0]?a.return:t[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,t[1])).done)return i;switch(a=0,i&&(t=[2&t[0],i.value]),t[0]){case 0:case 1:i=t;break;case 4:return u.label++,{value:t[1],done:!1};case 5:u.label++,a=t[1],t=[0];continue;case 7:t=u.ops.pop(),u.trys.pop();continue;default:if(!(i=0<(i=u.trys).length&&i[i.length-1])&&(6===t[0]||2===t[0])){u=0;continue}if(3===t[0]&&(!i||t[1]>i[0]&&t[1]i[0]&&r[1]',i=0,c=a;i'+u+"";e+="",$("#wrapper-table-content-body").empty(),$("#wrapper-table-content-body").append(e)}return[2,[s,l]]}})})}function e(i,c){return __awaiter(this,void 0,Promise,function(){var r,e,n,o,a;return __generator(this,function(t){switch(t.label){case 0:return r="",[4,function(){return __awaiter(this,void 0,Promise,function(){var r,e;return __generator(this,function(t){switch(t.label){case 0:return[4,fetch("http://localhost:2050/columns")];case 1:if((r=t.sent()).ok)return[2,r.json()];throw e="An error has occured: "+r.status,new Error(e)}})})}()];case 1:for(e=t.sent(),n=0,o=e;n'+a+"",$("#wrapper-table-header-row").empty(),$("#wrapper-table-header-row").append(r);return[2,s(i,c)]}})})}function a(t,r){switch(void 0===r&&(r=!0),typeof t){case"string":return 1==r?parseInt(t):parseFloat(t);case"number":return t;default:return 0}}function l(t){var r=t+Math.max(window.innerHeight-$("#form-content").innerHeight()),e=0;switch(e){case 0:case 1:case 2:window.innerHeight;break;default:e=15}return e+r}function h(t){for(var r=a(t.sort(function(t,r){return t-r})[0]),e=a(t.sort(function(t,r){return t-r})[1]),n=$(window).innerHeight()-$("#table-row-"+r).height(),o=r;o<=e;o++){if(!($("#table-row-"+o).offset().top Date: Tue, 24 Aug 2021 15:25:12 +0200 Subject: [PATCH 23/50] update --- app.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app.ts b/app.ts index 4a0da398..82a2390c 100644 --- a/app.ts +++ b/app.ts @@ -165,15 +165,15 @@ namespace onboardproject { return toID; } - //Previous_Page_Resize Function - function previousPageResize(previous: number[]): number[] { - const toId = calculateToId(previous[0] - (nextPageResize(previous) - previous[0])); - return [previous[0] - (nextPageResize(previous) - previous[0]), toId]; - } - //Onload Function window.onload = async () => { + //Previous_Page_Resize Function + function previousPageResize(previous: number[]): number[] { + const toId = calculateToId(previous[0] - (nextPageResize(previous) - previous[0])); + return [previous[0] - (nextPageResize(previous) - previous[0]), toId]; + } + //On Resize_Function window.onresize = () => { try { From 1baa7d2a944ca3a900b2bf74f40e0bff5e6c0614 Mon Sep 17 00:00:00 2001 From: "sam.moloi" Date: Tue, 24 Aug 2021 15:28:04 +0200 Subject: [PATCH 24/50] update --- app.ts | 4 ++-- dist/app.min.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app.ts b/app.ts index 82a2390c..35e1273c 100644 --- a/app.ts +++ b/app.ts @@ -186,9 +186,9 @@ namespace onboardproject { const toId = recordCount - 1; previous = await LoadRecordsData(fromId, toId); } else { - previous = await LoadRecordsData(previous[0], nextToId) + previous = await LoadRecordsData(previous[0], nextToId); } - }, 10); + }, 250); } catch (error) { // throw new Error("Error" + error); } diff --git a/dist/app.min.js b/dist/app.min.js index 6a786a5e..55a57272 100644 --- a/dist/app.min.js +++ b/dist/app.min.js @@ -1 +1 @@ -var __awaiter=this&&this.__awaiter||function(t,i,c,u){return new(c=c||Promise)(function(e,r){function n(t){try{a(u.next(t))}catch(t){r(t)}}function o(t){try{a(u.throw(t))}catch(t){r(t)}}function a(t){var r;t.done?e(t.value):((r=t.value)instanceof c?r:new c(function(t){t(r)})).then(n,o)}a((u=u.apply(t,i||[])).next())})},__generator=this&&this.__generator||function(e,n){var o,a,i,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},t={next:r(0),throw:r(1),return:r(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function r(r){return function(t){return function(r){if(o)throw new TypeError("Generator is already executing.");for(;c;)try{if(o=1,a&&(i=2&r[0]?a.return:r[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,r[1])).done)return i;switch(a=0,i&&(r=[2&r[0],i.value]),r[0]){case 0:case 1:i=r;break;case 4:return c.label++,{value:r[1],done:!1};case 5:c.label++,a=r[1],r=[0];continue;case 7:r=c.ops.pop(),c.trys.pop();continue;default:if(!(i=0<(i=c.trys).length&&i[i.length-1])&&(6===r[0]||2===r[0])){c=0;continue}if(3===r[0]&&(!i||r[1]>i[0]&&r[1]',i=0,c=a;i'+u+"";e+="",$("#wrapper-table-content-body").empty(),$("#wrapper-table-content-body").append(e)}return[2,[s,l]]}})})}function e(i,c){return __awaiter(this,void 0,Promise,function(){var r,e,n,o,a;return __generator(this,function(t){switch(t.label){case 0:return r="",[4,function(){return __awaiter(this,void 0,Promise,function(){var r,e;return __generator(this,function(t){switch(t.label){case 0:return[4,fetch("http://localhost:2050/columns")];case 1:if((r=t.sent()).ok)return[2,r.json()];throw e="An error has occured: "+r.status,new Error(e)}})})}()];case 1:for(e=t.sent(),n=0,o=e;n'+a+"",$("#wrapper-table-header-row").empty(),$("#wrapper-table-header-row").append(r);return[2,s(i,c)]}})})}function a(t,r){switch(void 0===r&&(r=!0),typeof t){case"string":return 1==r?parseInt(t):parseFloat(t);case"number":return t;default:return 0}}function l(t){var r=t+Math.max(window.innerHeight-$("#form-content").innerHeight()),e=0;switch(e){case 0:case 1:case 2:window.innerHeight;break;default:e=15}return e+r}function h(t){for(var r=a(t.sort(function(t,r){return t-r})[0]),e=a(t.sort(function(t,r){return t-r})[1]),n=$(window).innerHeight()-$("#table-row-"+r).height(),o=r;o<=e;o++){if(!($("#table-row-"+o).offset().topi[0]&&r[1]',i=0,c=a;i'+u+"";e+="",$("#wrapper-table-content-body").empty(),$("#wrapper-table-content-body").append(e)}return[2,[s,l]]}})})}function e(i,c){return __awaiter(this,void 0,Promise,function(){var r,e,n,o,a;return __generator(this,function(t){switch(t.label){case 0:return r="",[4,function(){return __awaiter(this,void 0,Promise,function(){var r,e;return __generator(this,function(t){switch(t.label){case 0:return[4,fetch("http://localhost:2050/columns")];case 1:if((r=t.sent()).ok)return[2,r.json()];throw e="An error has occured: "+r.status,new Error(e)}})})}()];case 1:for(e=t.sent(),n=0,o=e;n'+a+"",$("#wrapper-table-header-row").empty(),$("#wrapper-table-header-row").append(r);return[2,s(i,c)]}})})}function a(t,r){switch(void 0===r&&(r=!0),typeof t){case"string":return 1==r?parseInt(t):parseFloat(t);case"number":return t;default:return 0}}function l(t){var r=t+Math.max(window.innerHeight-$("#form-content").innerHeight()),e=0;switch(e){case 0:case 1:case 2:window.innerHeight;break;default:e=15}return e+r}function h(t){for(var r=a(t.sort(function(t,r){return t-r})[0]),e=a(t.sort(function(t,r){return t-r})[1]),n=$(window).innerHeight()-$("#table-row-"+r).height(),o=r;o<=e;o++){if(!($("#table-row-"+o).offset().top Date: Tue, 24 Aug 2021 15:32:01 +0200 Subject: [PATCH 25/50] update --- app.ts | 3 +-- dist/app.min.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app.ts b/app.ts index 35e1273c..7ba76a79 100644 --- a/app.ts +++ b/app.ts @@ -124,9 +124,8 @@ namespace onboardproject { return parseFloat(input as string); case ("number"): return input as number; - default: - return 0; } + return 0; // throw new Error("Error"); } diff --git a/dist/app.min.js b/dist/app.min.js index 55a57272..df807e4f 100644 --- a/dist/app.min.js +++ b/dist/app.min.js @@ -1 +1 @@ -var __awaiter=this&&this.__awaiter||function(t,i,c,u){return new(c=c||Promise)(function(e,r){function n(t){try{a(u.next(t))}catch(t){r(t)}}function o(t){try{a(u.throw(t))}catch(t){r(t)}}function a(t){var r;t.done?e(t.value):((r=t.value)instanceof c?r:new c(function(t){t(r)})).then(n,o)}a((u=u.apply(t,i||[])).next())})},__generator=this&&this.__generator||function(e,n){var o,a,i,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},t={next:r(0),throw:r(1),return:r(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function r(r){return function(t){return function(r){if(o)throw new TypeError("Generator is already executing.");for(;c;)try{if(o=1,a&&(i=2&r[0]?a.return:r[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,r[1])).done)return i;switch(a=0,i&&(r=[2&r[0],i.value]),r[0]){case 0:case 1:i=r;break;case 4:return c.label++,{value:r[1],done:!1};case 5:c.label++,a=r[1],r=[0];continue;case 7:r=c.ops.pop(),c.trys.pop();continue;default:if(!(i=0<(i=c.trys).length&&i[i.length-1])&&(6===r[0]||2===r[0])){c=0;continue}if(3===r[0]&&(!i||r[1]>i[0]&&r[1]',i=0,c=a;i'+u+"";e+="",$("#wrapper-table-content-body").empty(),$("#wrapper-table-content-body").append(e)}return[2,[s,l]]}})})}function e(i,c){return __awaiter(this,void 0,Promise,function(){var r,e,n,o,a;return __generator(this,function(t){switch(t.label){case 0:return r="",[4,function(){return __awaiter(this,void 0,Promise,function(){var r,e;return __generator(this,function(t){switch(t.label){case 0:return[4,fetch("http://localhost:2050/columns")];case 1:if((r=t.sent()).ok)return[2,r.json()];throw e="An error has occured: "+r.status,new Error(e)}})})}()];case 1:for(e=t.sent(),n=0,o=e;n'+a+"",$("#wrapper-table-header-row").empty(),$("#wrapper-table-header-row").append(r);return[2,s(i,c)]}})})}function a(t,r){switch(void 0===r&&(r=!0),typeof t){case"string":return 1==r?parseInt(t):parseFloat(t);case"number":return t;default:return 0}}function l(t){var r=t+Math.max(window.innerHeight-$("#form-content").innerHeight()),e=0;switch(e){case 0:case 1:case 2:window.innerHeight;break;default:e=15}return e+r}function h(t){for(var r=a(t.sort(function(t,r){return t-r})[0]),e=a(t.sort(function(t,r){return t-r})[1]),n=$(window).innerHeight()-$("#table-row-"+r).height(),o=r;o<=e;o++){if(!($("#table-row-"+o).offset().topi[0]&&t[1]',i=0,c=a;i'+u+"";e+="",$("#wrapper-table-content-body").empty(),$("#wrapper-table-content-body").append(e)}return[2,[s,l]]}})})}function e(i,c){return __awaiter(this,void 0,Promise,function(){var t,e,n,o,a;return __generator(this,function(r){switch(r.label){case 0:return t="",[4,function(){return __awaiter(this,void 0,Promise,function(){var t,e;return __generator(this,function(r){switch(r.label){case 0:return[4,fetch("http://localhost:2050/columns")];case 1:if((t=r.sent()).ok)return[2,t.json()];throw e="An error has occured: "+t.status,new Error(e)}})})}()];case 1:for(e=r.sent(),n=0,o=e;n'+a+"",$("#wrapper-table-header-row").empty(),$("#wrapper-table-header-row").append(t);return[2,s(i,c)]}})})}function a(r,t){switch(void 0===t&&(t=!0),typeof r){case"string":return 1==t?parseInt(r):parseFloat(r);case"number":return r}return 0}function l(r){var t=r+Math.max(window.innerHeight-$("#form-content").innerHeight()),e=0;switch(e){case 0:case 1:case 2:window.innerHeight;break;default:e=15}return e+t}function h(r){for(var t=a(r.sort(function(r,t){return r-t})[0]),e=a(r.sort(function(r,t){return r-t})[1]),n=$(window).innerHeight()-$("#table-row-"+t).height(),o=t;o<=e;o++){if(!($("#table-row-"+o).offset().top Date: Tue, 24 Aug 2021 15:35:10 +0200 Subject: [PATCH 26/50] update --- app.ts | 3 +++ dist/app.min.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app.ts b/app.ts index 7ba76a79..4b59c81b 100644 --- a/app.ts +++ b/app.ts @@ -91,6 +91,9 @@ namespace onboardproject { DisplayContent += ''; $("#wrapper-table-content-body").empty(); $("#wrapper-table-content-body").append(DisplayContent); + + throw new Error("Error No data"); + } return [fromID, toID]; } diff --git a/dist/app.min.js b/dist/app.min.js index df807e4f..e5b635e3 100644 --- a/dist/app.min.js +++ b/dist/app.min.js @@ -1 +1 @@ -var __awaiter=this&&this.__awaiter||function(r,i,c,u){return new(c=c||Promise)(function(e,t){function n(r){try{a(u.next(r))}catch(r){t(r)}}function o(r){try{a(u.throw(r))}catch(r){t(r)}}function a(r){var t;r.done?e(r.value):((t=r.value)instanceof c?t:new c(function(r){r(t)})).then(n,o)}a((u=u.apply(r,i||[])).next())})},__generator=this&&this.__generator||function(e,n){var o,a,i,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},r={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function t(t){return function(r){return function(t){if(o)throw new TypeError("Generator is already executing.");for(;c;)try{if(o=1,a&&(i=2&t[0]?a.return:t[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,t[1])).done)return i;switch(a=0,i&&(t=[2&t[0],i.value]),t[0]){case 0:case 1:i=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,a=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(i=0<(i=c.trys).length&&i[i.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!i||t[1]>i[0]&&t[1]',i=0,c=a;i'+u+"";e+="",$("#wrapper-table-content-body").empty(),$("#wrapper-table-content-body").append(e)}return[2,[s,l]]}})})}function e(i,c){return __awaiter(this,void 0,Promise,function(){var t,e,n,o,a;return __generator(this,function(r){switch(r.label){case 0:return t="",[4,function(){return __awaiter(this,void 0,Promise,function(){var t,e;return __generator(this,function(r){switch(r.label){case 0:return[4,fetch("http://localhost:2050/columns")];case 1:if((t=r.sent()).ok)return[2,t.json()];throw e="An error has occured: "+t.status,new Error(e)}})})}()];case 1:for(e=r.sent(),n=0,o=e;n'+a+"",$("#wrapper-table-header-row").empty(),$("#wrapper-table-header-row").append(t);return[2,s(i,c)]}})})}function a(r,t){switch(void 0===t&&(t=!0),typeof r){case"string":return 1==t?parseInt(r):parseFloat(r);case"number":return r}return 0}function l(r){var t=r+Math.max(window.innerHeight-$("#form-content").innerHeight()),e=0;switch(e){case 0:case 1:case 2:window.innerHeight;break;default:e=15}return e+t}function h(r){for(var t=a(r.sort(function(r,t){return r-t})[0]),e=a(r.sort(function(r,t){return r-t})[1]),n=$(window).innerHeight()-$("#table-row-"+t).height(),o=t;o<=e;o++){if(!($("#table-row-"+o).offset().topi[0]&&t[1]',i=0,c=a;i'+u+"";throw e+="",$("#wrapper-table-content-body").empty(),$("#wrapper-table-content-body").append(e),new Error("Error No data")}return[2,[s,l]]}})})}function e(i,c){return __awaiter(this,void 0,Promise,function(){var t,e,n,o,a;return __generator(this,function(r){switch(r.label){case 0:return t="",[4,function(){return __awaiter(this,void 0,Promise,function(){var t,e;return __generator(this,function(r){switch(r.label){case 0:return[4,fetch("http://localhost:2050/columns")];case 1:if((t=r.sent()).ok)return[2,t.json()];throw e="An error has occured: "+t.status,new Error(e)}})})}()];case 1:for(e=r.sent(),n=0,o=e;n'+a+"",$("#wrapper-table-header-row").empty(),$("#wrapper-table-header-row").append(t);return[2,s(i,c)]}})})}function a(r,t){switch(void 0===t&&(t=!0),typeof r){case"string":return 1==t?parseInt(r):parseFloat(r);case"number":return r}return 0}function l(r){var t=r+Math.max(window.innerHeight-$("#form-content").innerHeight()),e=0;switch(e){case 0:case 1:case 2:window.innerHeight;break;default:e=15}return e+t}function h(r){for(var t=a(r.sort(function(r,t){return r-t})[0]),e=a(r.sort(function(r,t){return r-t})[1]),n=$(window).innerHeight()-$("#table-row-"+t).height(),o=t;o<=e;o++){if(!($("#table-row-"+o).offset().top Date: Tue, 24 Aug 2021 15:36:22 +0200 Subject: [PATCH 27/50] update --- app.ts | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/app.ts b/app.ts index 4b59c81b..1470ec03 100644 --- a/app.ts +++ b/app.ts @@ -58,27 +58,6 @@ namespace onboardproject { } } - // function requestcolumns( - // method: 'GET', - // url: 'http://localhost:2050/columns', - // content?: Request, - // callback?: (response: Response) => void, - // errorCallback?: (err: any) => void) { - // const request = new XMLHttpRequest(); - // request.open(method, url, true); - // request.onload = function () { - // if (this.status >= 200 && this.status < 400) { - // // Success! - // const data = JSON.parse(this.response) as Response; - // callback && callback(data); - // } else { - // // We reached our target server, but it returned an error - - // console.log("Error 404"); - // } - // }; - // } - //region Data Loading methods async function LoadRecordsData(fromID: number, toID: number): Promise { const recordsvalue = await getRecordsCall(fromID, toID); From 980ab3fef3fd092df6ceab83aab79749964b6292 Mon Sep 17 00:00:00 2001 From: "sam.moloi" Date: Tue, 24 Aug 2021 15:46:06 +0200 Subject: [PATCH 28/50] update --- app.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app.ts b/app.ts index 1470ec03..c1eb604e 100644 --- a/app.ts +++ b/app.ts @@ -157,6 +157,7 @@ namespace onboardproject { //On Resize_Function window.onresize = () => { + try { const nextToId = calculateToId(previous[0]); clearTimeout(Load); @@ -173,6 +174,8 @@ namespace onboardproject { } catch (error) { // throw new Error("Error" + error); } + + } // log response or catch error of fetch promise // getColumnNamesCall().then(data => console.log(data)).catch(reason => console.log(reason.message)); From aa08fe6696aa42e254efe204c635632a7aa11c81 Mon Sep 17 00:00:00 2001 From: "sam.moloi" Date: Tue, 24 Aug 2021 16:17:01 +0200 Subject: [PATCH 29/50] update --- app.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/app.ts b/app.ts index c1eb604e..1b5e45ba 100644 --- a/app.ts +++ b/app.ts @@ -12,7 +12,7 @@ namespace onboardproject { //Previous Process Variable declarations let previousprocess: number; - // region API Call + // Trigger async function async function getRecordCountCall(): Promise { const response = await fetch('http://localhost:2050/recordCount'); @@ -70,9 +70,7 @@ namespace onboardproject { DisplayContent += ''; $("#wrapper-table-content-body").empty(); $("#wrapper-table-content-body").append(DisplayContent); - throw new Error("Error No data"); - } return [fromID, toID]; } @@ -207,12 +205,9 @@ namespace onboardproject { const toId = fromId + possibleStep <= recordCount - 1 ? fromId + possibleStep : recordCount - 1; previous = await LoadRecordsData(fromId, toId); } else if (fromId <= recordCount - 1) { - previous = await LoadRecordsData(recordCount - 1 - (calculateToId(fromId) - fromId), recordCount - 1); } else { - throw new Error("Error 404"); - } } catch (error) { } From 07be5f0a102496e6982a5b62303b4896b19026b7 Mon Sep 17 00:00:00 2001 From: "sam.moloi" Date: Tue, 24 Aug 2021 16:44:03 +0200 Subject: [PATCH 30/50] update --- app.ts | 11 +++++------ dist/app.min.js | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app.ts b/app.ts index 1b5e45ba..2ff02fb9 100644 --- a/app.ts +++ b/app.ts @@ -22,9 +22,10 @@ namespace onboardproject { if (!response.ok) { const message = `An error has occured: ${response.status}`; throw new Error(message); - } else { - console.log(response); } + //else { + // console.log(response); + // } return response.json(); } @@ -39,7 +40,7 @@ namespace onboardproject { throw new Error(message); } else { return response.json(); - console.log(response); + // console.log(response); } } @@ -54,7 +55,7 @@ namespace onboardproject { throw new Error(message); } else { return response.json(); - console.log(response); + // console.log(response); } } @@ -172,8 +173,6 @@ namespace onboardproject { } catch (error) { // throw new Error("Error" + error); } - - } // log response or catch error of fetch promise // getColumnNamesCall().then(data => console.log(data)).catch(reason => console.log(reason.message)); diff --git a/dist/app.min.js b/dist/app.min.js index e5b635e3..5637ac95 100644 --- a/dist/app.min.js +++ b/dist/app.min.js @@ -1 +1 @@ -var __awaiter=this&&this.__awaiter||function(r,i,c,u){return new(c=c||Promise)(function(e,t){function n(r){try{a(u.next(r))}catch(r){t(r)}}function o(r){try{a(u.throw(r))}catch(r){t(r)}}function a(r){var t;r.done?e(r.value):((t=r.value)instanceof c?t:new c(function(r){r(t)})).then(n,o)}a((u=u.apply(r,i||[])).next())})},__generator=this&&this.__generator||function(e,n){var o,a,i,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},r={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function t(t){return function(r){return function(t){if(o)throw new TypeError("Generator is already executing.");for(;c;)try{if(o=1,a&&(i=2&t[0]?a.return:t[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,t[1])).done)return i;switch(a=0,i&&(t=[2&t[0],i.value]),t[0]){case 0:case 1:i=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,a=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(i=0<(i=c.trys).length&&i[i.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!i||t[1]>i[0]&&t[1]',i=0,c=a;i'+u+"";throw e+="",$("#wrapper-table-content-body").empty(),$("#wrapper-table-content-body").append(e),new Error("Error No data")}return[2,[s,l]]}})})}function e(i,c){return __awaiter(this,void 0,Promise,function(){var t,e,n,o,a;return __generator(this,function(r){switch(r.label){case 0:return t="",[4,function(){return __awaiter(this,void 0,Promise,function(){var t,e;return __generator(this,function(r){switch(r.label){case 0:return[4,fetch("http://localhost:2050/columns")];case 1:if((t=r.sent()).ok)return[2,t.json()];throw e="An error has occured: "+t.status,new Error(e)}})})}()];case 1:for(e=r.sent(),n=0,o=e;n'+a+"",$("#wrapper-table-header-row").empty(),$("#wrapper-table-header-row").append(t);return[2,s(i,c)]}})})}function a(r,t){switch(void 0===t&&(t=!0),typeof r){case"string":return 1==t?parseInt(r):parseFloat(r);case"number":return r}return 0}function l(r){var t=r+Math.max(window.innerHeight-$("#form-content").innerHeight()),e=0;switch(e){case 0:case 1:case 2:window.innerHeight;break;default:e=15}return e+t}function h(r){for(var t=a(r.sort(function(r,t){return r-t})[0]),e=a(r.sort(function(r,t){return r-t})[1]),n=$(window).innerHeight()-$("#table-row-"+t).height(),o=t;o<=e;o++){if(!($("#table-row-"+o).offset().topi[0]&&t[1]',i=0,c=a;i'+u+"";throw e+="",$("#wrapper-table-content-body").empty(),$("#wrapper-table-content-body").append(e),new Error("Error No data")}return[2,[s,l]]}})})}function e(i,c){return __awaiter(this,void 0,Promise,function(){var t,e,n,o,a;return __generator(this,function(r){switch(r.label){case 0:return t="",[4,function(){return __awaiter(this,void 0,Promise,function(){var t,e;return __generator(this,function(r){switch(r.label){case 0:return[4,fetch("http://localhost:2050/columns")];case 1:if((t=r.sent()).ok)return[2,t.json()];throw e="An error has occured: "+t.status,new Error(e)}})})}()];case 1:for(e=r.sent(),n=0,o=e;n'+a+"",$("#wrapper-table-header-row").empty(),$("#wrapper-table-header-row").append(t);return[2,s(i,c)]}})})}function a(r,t){switch(void 0===t&&(t=!0),typeof r){case"string":return 1==t?parseInt(r):parseFloat(r);case"number":return r}return 0}function l(r){var t=r+Math.max(window.innerHeight-$("#form-content").innerHeight()),e=0;switch(e){case 0:case 1:case 2:window.innerHeight;break;default:e=15}return e+t}function h(r){for(var t=a(r.sort(function(r,t){return r-t})[0]),e=a(r.sort(function(r,t){return r-t})[1]),n=$(window).innerHeight()-$("#table-row-"+t).height(),o=t;o<=e;o++){if(!($("#table-row-"+o).offset().top Date: Tue, 24 Aug 2021 16:44:47 +0200 Subject: [PATCH 31/50] update --- app.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/app.ts b/app.ts index 2ff02fb9..eab5d36f 100644 --- a/app.ts +++ b/app.ts @@ -12,7 +12,6 @@ namespace onboardproject { //Previous Process Variable declarations let previousprocess: number; - // Trigger async function async function getRecordCountCall(): Promise { const response = await fetch('http://localhost:2050/recordCount'); From 53b603ddc103495e61ae9b684d5eabb2ca7fc4c1 Mon Sep 17 00:00:00 2001 From: "sam.moloi" Date: Tue, 24 Aug 2021 18:24:40 +0200 Subject: [PATCH 32/50] update --- app.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app.ts b/app.ts index eab5d36f..832d7a59 100644 --- a/app.ts +++ b/app.ts @@ -39,7 +39,7 @@ namespace onboardproject { throw new Error(message); } else { return response.json(); - // console.log(response); + } } @@ -54,7 +54,6 @@ namespace onboardproject { throw new Error(message); } else { return response.json(); - // console.log(response); } } From 39faae77c5e6020f7f91155869a72a84c53dc7ec Mon Sep 17 00:00:00 2001 From: "sam.moloi" Date: Wed, 25 Aug 2021 10:52:49 +0200 Subject: [PATCH 33/50] update --- app.ts | 11 ++--------- dist/app.min.js | 2 +- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/app.ts b/app.ts index 832d7a59..f829593f 100644 --- a/app.ts +++ b/app.ts @@ -22,9 +22,6 @@ namespace onboardproject { const message = `An error has occured: ${response.status}`; throw new Error(message); } - //else { - // console.log(response); - // } return response.json(); } @@ -37,10 +34,8 @@ namespace onboardproject { if (!response.ok) { const message = `An error has occured: ${response.status}`; throw new Error(message); - } else { - return response.json(); - } + return response.json(); } // Trigger async function @@ -52,9 +47,8 @@ namespace onboardproject { if (!response.ok) { const message = `An error has occured: ${response.status}`; throw new Error(message); - } else { - return response.json(); } + return response.json(); } //region Data Loading methods @@ -105,7 +99,6 @@ namespace onboardproject { return input as number; } return 0; - // throw new Error("Error"); } // diff --git a/dist/app.min.js b/dist/app.min.js index 5637ac95..8b8dc539 100644 --- a/dist/app.min.js +++ b/dist/app.min.js @@ -1 +1 @@ -var __awaiter=this&&this.__awaiter||function(r,i,c,u){return new(c=c||Promise)(function(e,t){function n(r){try{a(u.next(r))}catch(r){t(r)}}function o(r){try{a(u.throw(r))}catch(r){t(r)}}function a(r){var t;r.done?e(r.value):((t=r.value)instanceof c?t:new c(function(r){r(t)})).then(n,o)}a((u=u.apply(r,i||[])).next())})},__generator=this&&this.__generator||function(e,n){var o,a,i,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},r={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function t(t){return function(r){return function(t){if(o)throw new TypeError("Generator is already executing.");for(;c;)try{if(o=1,a&&(i=2&t[0]?a.return:t[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,t[1])).done)return i;switch(a=0,i&&(t=[2&t[0],i.value]),t[0]){case 0:case 1:i=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,a=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(i=0<(i=c.trys).length&&i[i.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!i||t[1]>i[0]&&t[1]',i=0,c=a;i'+u+"";throw e+="",$("#wrapper-table-content-body").empty(),$("#wrapper-table-content-body").append(e),new Error("Error No data")}return[2,[s,l]]}})})}function e(i,c){return __awaiter(this,void 0,Promise,function(){var t,e,n,o,a;return __generator(this,function(r){switch(r.label){case 0:return t="",[4,function(){return __awaiter(this,void 0,Promise,function(){var t,e;return __generator(this,function(r){switch(r.label){case 0:return[4,fetch("http://localhost:2050/columns")];case 1:if((t=r.sent()).ok)return[2,t.json()];throw e="An error has occured: "+t.status,new Error(e)}})})}()];case 1:for(e=r.sent(),n=0,o=e;n'+a+"",$("#wrapper-table-header-row").empty(),$("#wrapper-table-header-row").append(t);return[2,s(i,c)]}})})}function a(r,t){switch(void 0===t&&(t=!0),typeof r){case"string":return 1==t?parseInt(r):parseFloat(r);case"number":return r}return 0}function l(r){var t=r+Math.max(window.innerHeight-$("#form-content").innerHeight()),e=0;switch(e){case 0:case 1:case 2:window.innerHeight;break;default:e=15}return e+t}function h(r){for(var t=a(r.sort(function(r,t){return r-t})[0]),e=a(r.sort(function(r,t){return r-t})[1]),n=$(window).innerHeight()-$("#table-row-"+t).height(),o=t;o<=e;o++){if(!($("#table-row-"+o).offset().topi[0]&&t[1]',i=0,c=a;i'+u+"";throw e+="",$("#wrapper-table-content-body").empty(),$("#wrapper-table-content-body").append(e),new Error("Error No data")}return[2,[s,l]]}})})}function e(i,c){return __awaiter(this,void 0,Promise,function(){var t,e,n,o,a;return __generator(this,function(r){switch(r.label){case 0:return t="",[4,function(){return __awaiter(this,void 0,Promise,function(){var t,e;return __generator(this,function(r){switch(r.label){case 0:return[4,fetch("http://localhost:2050/columns")];case 1:if(!(t=r.sent()).ok)throw e="An error has occured: "+t.status,new Error(e);return[2,t.json()]}})})}()];case 1:for(e=r.sent(),n=0,o=e;n'+a+"",$("#wrapper-table-header-row").empty(),$("#wrapper-table-header-row").append(t);return[2,s(i,c)]}})})}function a(r,t){switch(void 0===t&&(t=!0),typeof r){case"string":return 1==t?parseInt(r):parseFloat(r);case"number":return r}return 0}function l(r){var t=r+Math.max(window.innerHeight-$("#form-content").innerHeight()),e=0;switch(e){case 0:case 1:case 2:window.innerHeight;break;default:e=15}return e+t}function h(r){for(var t=a(r.sort(function(r,t){return r-t})[0]),e=a(r.sort(function(r,t){return r-t})[1]),n=$(window).innerHeight()-$("#table-row-"+t).height(),o=t;o<=e;o++){if(!($("#table-row-"+o).offset().top Date: Wed, 25 Aug 2021 11:02:12 +0200 Subject: [PATCH 34/50] update --- app.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.ts b/app.ts index f829593f..8c29dea5 100644 --- a/app.ts +++ b/app.ts @@ -101,7 +101,7 @@ namespace onboardproject { return 0; } - // + // Height Diplay Function function calculateToId(fromId: number): number { const possibleRecordsData = Math.max((window.innerHeight - ($("#form-content").innerHeight() as number))); const possibleId = fromId + possibleRecordsData; From 88d921bff2e46450bad7785feef68947552a1ab2 Mon Sep 17 00:00:00 2001 From: "sam.moloi" Date: Wed, 25 Aug 2021 11:51:13 +0200 Subject: [PATCH 35/50] update --- app.ts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/app.ts b/app.ts index 8c29dea5..493744cc 100644 --- a/app.ts +++ b/app.ts @@ -15,9 +15,6 @@ namespace onboardproject { // Trigger async function async function getRecordCountCall(): Promise { const response = await fetch('http://localhost:2050/recordCount'); - // let promise = new Promise((res, rej) => { - // setTimeout(() => res("Now it's done!"), 50) - // }); if (!response.ok) { const message = `An error has occured: ${response.status}`; throw new Error(message); @@ -28,9 +25,6 @@ namespace onboardproject { // Trigger async function async function getColumnNamesCall(): Promise { const response = await fetch('http://localhost:2050/columns'); - // let promise = new Promise((res, rej) => { - // setTimeout(() => res("Now it's done!"), 50) - // }); if (!response.ok) { const message = `An error has occured: ${response.status}`; throw new Error(message); @@ -41,9 +35,6 @@ namespace onboardproject { // Trigger async function async function getRecordsCall(fromID: number, toID: number): Promise { const response = await fetch(`http://localhost:2050/records?from=${(fromID)}&to=${(toID)}`); - // let promise = new Promise((res, rej) => { - // setTimeout(() => res("Now it's done!"), 50) - // }); if (!response.ok) { const message = `An error has occured: ${response.status}`; throw new Error(message); From a3298044685754a24749bc6f648398d7e3b568aa Mon Sep 17 00:00:00 2001 From: "sam.moloi" Date: Wed, 25 Aug 2021 11:53:09 +0200 Subject: [PATCH 36/50] update --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 0872c36c..c46e82dd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /node_modules app.js app.js.map +dist.min.js From 7939c12ff6232c37e6fc4d126b00571d9ec651f6 Mon Sep 17 00:00:00 2001 From: "sam.moloi" Date: Wed, 25 Aug 2021 13:34:33 +0200 Subject: [PATCH 37/50] update --- app.ts | 3 +-- dist/app.min.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app.ts b/app.ts index 493744cc..017ad531 100644 --- a/app.ts +++ b/app.ts @@ -3,7 +3,7 @@ import { data } from "jquery"; namespace onboardproject { module onboardprojects { - //Load Variable declarations + // Load Variable declarations let Load = 50; // Previous Variable declarations @@ -54,7 +54,6 @@ namespace onboardproject { DisplayContent += ''; $("#wrapper-table-content-body").empty(); $("#wrapper-table-content-body").append(DisplayContent); - throw new Error("Error No data"); } return [fromID, toID]; } diff --git a/dist/app.min.js b/dist/app.min.js index 8b8dc539..44f0d7b4 100644 --- a/dist/app.min.js +++ b/dist/app.min.js @@ -1 +1 @@ -var __awaiter=this&&this.__awaiter||function(r,i,c,u){return new(c=c||Promise)(function(e,t){function n(r){try{a(u.next(r))}catch(r){t(r)}}function o(r){try{a(u.throw(r))}catch(r){t(r)}}function a(r){var t;r.done?e(r.value):((t=r.value)instanceof c?t:new c(function(r){r(t)})).then(n,o)}a((u=u.apply(r,i||[])).next())})},__generator=this&&this.__generator||function(e,n){var o,a,i,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},r={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function t(t){return function(r){return function(t){if(o)throw new TypeError("Generator is already executing.");for(;c;)try{if(o=1,a&&(i=2&t[0]?a.return:t[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,t[1])).done)return i;switch(a=0,i&&(t=[2&t[0],i.value]),t[0]){case 0:case 1:i=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,a=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(i=0<(i=c.trys).length&&i[i.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!i||t[1]>i[0]&&t[1]',i=0,c=a;i'+u+"";throw e+="",$("#wrapper-table-content-body").empty(),$("#wrapper-table-content-body").append(e),new Error("Error No data")}return[2,[s,l]]}})})}function e(i,c){return __awaiter(this,void 0,Promise,function(){var t,e,n,o,a;return __generator(this,function(r){switch(r.label){case 0:return t="",[4,function(){return __awaiter(this,void 0,Promise,function(){var t,e;return __generator(this,function(r){switch(r.label){case 0:return[4,fetch("http://localhost:2050/columns")];case 1:if(!(t=r.sent()).ok)throw e="An error has occured: "+t.status,new Error(e);return[2,t.json()]}})})}()];case 1:for(e=r.sent(),n=0,o=e;n'+a+"",$("#wrapper-table-header-row").empty(),$("#wrapper-table-header-row").append(t);return[2,s(i,c)]}})})}function a(r,t){switch(void 0===t&&(t=!0),typeof r){case"string":return 1==t?parseInt(r):parseFloat(r);case"number":return r}return 0}function l(r){var t=r+Math.max(window.innerHeight-$("#form-content").innerHeight()),e=0;switch(e){case 0:case 1:case 2:window.innerHeight;break;default:e=15}return e+t}function h(r){for(var t=a(r.sort(function(r,t){return r-t})[0]),e=a(r.sort(function(r,t){return r-t})[1]),n=$(window).innerHeight()-$("#table-row-"+t).height(),o=t;o<=e;o++){if(!($("#table-row-"+o).offset().topi[0]&&t[1]',i=0,c=a;i'+u+"";e+="",$("#wrapper-table-content-body").empty(),$("#wrapper-table-content-body").append(e)}return[2,[s,l]]}})})}function e(i,c){return __awaiter(this,void 0,Promise,function(){var t,e,n,o,a;return __generator(this,function(r){switch(r.label){case 0:return t="",[4,function(){return __awaiter(this,void 0,Promise,function(){var t,e;return __generator(this,function(r){switch(r.label){case 0:return[4,fetch("http://localhost:2050/columns")];case 1:if(!(t=r.sent()).ok)throw e="An error has occured: "+t.status,new Error(e);return[2,t.json()]}})})}()];case 1:for(e=r.sent(),n=0,o=e;n'+a+"",$("#wrapper-table-header-row").empty(),$("#wrapper-table-header-row").append(t);return[2,s(i,c)]}})})}function a(r,t){switch(void 0===t&&(t=!0),typeof r){case"string":return 1==t?parseInt(r):parseFloat(r);case"number":return r}return 0}function l(r){var t=r+Math.max(window.innerHeight-$("#form-content").innerHeight()),e=0;switch(e){case 0:case 1:case 2:window.innerHeight;break;default:e=15}return e+t}function h(r){for(var t=a(r.sort(function(r,t){return r-t})[0]),e=a(r.sort(function(r,t){return r-t})[1]),n=$(window).innerHeight()-$("#table-row-"+t).height(),o=t;o<=e;o++){if(!($("#table-row-"+o).offset().top Date: Wed, 25 Aug 2021 13:55:18 +0200 Subject: [PATCH 38/50] update --- app.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.ts b/app.ts index 017ad531..31326017 100644 --- a/app.ts +++ b/app.ts @@ -9,7 +9,7 @@ namespace onboardproject { // Previous Variable declarations let previous: number[]; - //Previous Process Variable declarations + // Previous Process Variable declarations let previousprocess: number; // Trigger async function From bcc9696dc2b176a78b272aa6c207b5e70ecb1aa8 Mon Sep 17 00:00:00 2001 From: "sam.moloi" Date: Wed, 25 Aug 2021 13:58:03 +0200 Subject: [PATCH 39/50] update --- app.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app.ts b/app.ts index 31326017..ffeff25a 100644 --- a/app.ts +++ b/app.ts @@ -42,7 +42,7 @@ namespace onboardproject { return response.json(); } - //region Data Loading methods + // Region Data Loading methods async function LoadRecordsData(fromID: number, toID: number): Promise { const recordsvalue = await getRecordsCall(fromID, toID); let DisplayContent = ''; @@ -113,7 +113,7 @@ namespace onboardproject { return recordDisplayset + possibleId; } - //Next_Page_Resize Function + // Next_Page_Resize Function function nextPageResize(previous: number[]): number { const fromID = ConvertNumber(previous.sort((a, b) => { return a - b })[0]); const toID = ConvertNumber(previous.sort((a, b) => { return a - b })[1]); @@ -126,16 +126,16 @@ namespace onboardproject { return toID; } - //Onload Function + // Onload Function window.onload = async () => { - //Previous_Page_Resize Function + // Previous_Page_Resize Function function previousPageResize(previous: number[]): number[] { const toId = calculateToId(previous[0] - (nextPageResize(previous) - previous[0])); return [previous[0] - (nextPageResize(previous) - previous[0]), toId]; } - //On Resize_Function + // On Resize_Function window.onresize = () => { try { @@ -163,7 +163,7 @@ namespace onboardproject { //Loading Content Function previous = await LoadPageContent(0, calculateToId(0)); - //click function for previewing page + // Click function for previewing page $("#previous").click(async () => { const CountData = await getRecordCountCall(); previous = previousPageResize(previous); @@ -175,7 +175,7 @@ namespace onboardproject { previous = await LoadRecordsData(fromId, toId); }); - //click function for Skipping to next page + // Click function for Skipping to next page $("#next").click(async () => { try { const recordCount = await getRecordCountCall(); @@ -193,7 +193,7 @@ namespace onboardproject { } }); - //Searching function for index + // Searching function for index $("#go-button").click(async () => { const recordCount = await getRecordCountCall(); const fromId = ConvertNumber($("#index").val() as string, false); From f7fe9a7a0b3ce08f16d921e268aaddfdc275efda Mon Sep 17 00:00:00 2001 From: "sam.moloi" Date: Wed, 25 Aug 2021 14:06:49 +0200 Subject: [PATCH 40/50] update --- app.ts | 8 ++++---- dist/app.min.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app.ts b/app.ts index ffeff25a..da1bafe4 100644 --- a/app.ts +++ b/app.ts @@ -13,23 +13,23 @@ namespace onboardproject { let previousprocess: number; // Trigger async function - async function getRecordCountCall(): Promise { + async function getRecordCountCall(): Promise { const response = await fetch('http://localhost:2050/recordCount'); if (!response.ok) { const message = `An error has occured: ${response.status}`; throw new Error(message); } - return response.json(); + //return response.json(); } // Trigger async function - async function getColumnNamesCall(): Promise { + async function getColumnNamesCall(): Promise { const response = await fetch('http://localhost:2050/columns'); if (!response.ok) { const message = `An error has occured: ${response.status}`; throw new Error(message); } - return response.json(); + //return response.json(); } // Trigger async function diff --git a/dist/app.min.js b/dist/app.min.js index 44f0d7b4..b7b5b1ec 100644 --- a/dist/app.min.js +++ b/dist/app.min.js @@ -1 +1 @@ -var __awaiter=this&&this.__awaiter||function(r,i,c,u){return new(c=c||Promise)(function(e,t){function n(r){try{a(u.next(r))}catch(r){t(r)}}function o(r){try{a(u.throw(r))}catch(r){t(r)}}function a(r){var t;r.done?e(r.value):((t=r.value)instanceof c?t:new c(function(r){r(t)})).then(n,o)}a((u=u.apply(r,i||[])).next())})},__generator=this&&this.__generator||function(e,n){var o,a,i,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},r={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function t(t){return function(r){return function(t){if(o)throw new TypeError("Generator is already executing.");for(;c;)try{if(o=1,a&&(i=2&t[0]?a.return:t[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,t[1])).done)return i;switch(a=0,i&&(t=[2&t[0],i.value]),t[0]){case 0:case 1:i=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,a=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(i=0<(i=c.trys).length&&i[i.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!i||t[1]>i[0]&&t[1]',i=0,c=a;i'+u+"";e+="",$("#wrapper-table-content-body").empty(),$("#wrapper-table-content-body").append(e)}return[2,[s,l]]}})})}function e(i,c){return __awaiter(this,void 0,Promise,function(){var t,e,n,o,a;return __generator(this,function(r){switch(r.label){case 0:return t="",[4,function(){return __awaiter(this,void 0,Promise,function(){var t,e;return __generator(this,function(r){switch(r.label){case 0:return[4,fetch("http://localhost:2050/columns")];case 1:if(!(t=r.sent()).ok)throw e="An error has occured: "+t.status,new Error(e);return[2,t.json()]}})})}()];case 1:for(e=r.sent(),n=0,o=e;n'+a+"",$("#wrapper-table-header-row").empty(),$("#wrapper-table-header-row").append(t);return[2,s(i,c)]}})})}function a(r,t){switch(void 0===t&&(t=!0),typeof r){case"string":return 1==t?parseInt(r):parseFloat(r);case"number":return r}return 0}function l(r){var t=r+Math.max(window.innerHeight-$("#form-content").innerHeight()),e=0;switch(e){case 0:case 1:case 2:window.innerHeight;break;default:e=15}return e+t}function h(r){for(var t=a(r.sort(function(r,t){return r-t})[0]),e=a(r.sort(function(r,t){return r-t})[1]),n=$(window).innerHeight()-$("#table-row-"+t).height(),o=t;o<=e;o++){if(!($("#table-row-"+o).offset().topi[0]&&t[1]',i=0,c=a;i'+u+"";e+="",$("#wrapper-table-content-body").empty(),$("#wrapper-table-content-body").append(e)}return[2,[s,l]]}})})}function e(i,c){return __awaiter(this,void 0,Promise,function(){var t,e,n,o,a;return __generator(this,function(r){switch(r.label){case 0:return t="",[4,function(){return __awaiter(this,void 0,Promise,function(){var t,e;return __generator(this,function(r){switch(r.label){case 0:return[4,fetch("http://localhost:2050/columns")];case 1:if(!(t=r.sent()).ok)throw e="An error has occured: "+t.status,new Error(e);return[2]}})})}()];case 1:for(e=r.sent(),n=0,o=e;n'+a+"",$("#wrapper-table-header-row").empty(),$("#wrapper-table-header-row").append(t);return[2,s(i,c)]}})})}function a(r,t){switch(void 0===t&&(t=!0),typeof r){case"string":return 1==t?parseInt(r):parseFloat(r);case"number":return r}return 0}function l(r){var t=r+Math.max(window.innerHeight-$("#form-content").innerHeight()),e=0;switch(e){case 0:case 1:case 2:window.innerHeight;break;default:e=15}return e+t}function h(r){for(var t=a(r.sort(function(r,t){return r-t})[0]),e=a(r.sort(function(r,t){return r-t})[1]),n=$(window).innerHeight()-$("#table-row-"+t).height(),o=t;o<=e;o++){if(!($("#table-row-"+o).offset().top Date: Wed, 25 Aug 2021 14:34:02 +0200 Subject: [PATCH 41/50] update --- app.ts | 30 +++++++++++++++--------------- dist/app.min.js | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/app.ts b/app.ts index da1bafe4..a33b973d 100644 --- a/app.ts +++ b/app.ts @@ -33,7 +33,7 @@ namespace onboardproject { } // Trigger async function - async function getRecordsCall(fromID: number, toID: number): Promise { + async function getRecordsCall(fromID: number, toID: number): Promise { const response = await fetch(`http://localhost:2050/records?from=${(fromID)}&to=${(toID)}`); if (!response.ok) { const message = `An error has occured: ${response.status}`; @@ -43,7 +43,7 @@ namespace onboardproject { } // Region Data Loading methods - async function LoadRecordsData(fromID: number, toID: number): Promise { + async function LoadRecordsData(fromID: number, toID: number): Promise { const recordsvalue = await getRecordsCall(fromID, toID); let DisplayContent = ''; for (const record of recordsvalue) { @@ -55,18 +55,18 @@ namespace onboardproject { $("#wrapper-table-content-body").empty(); $("#wrapper-table-content-body").append(DisplayContent); } - return [fromID, toID]; + // return [fromID, toID]; } // Load Records Function - function RecordsFromCursor(cursor: number[]): Promise { + function RecordsFromCursor(cursor: number[]): Promise { cursor = cursor.sort((a, b) => { return a - b }); - return LoadRecordsData(cursor[0], cursor[1]); + //return LoadRecordsData(cursor[0], cursor[1]); // throw new Error("Error"); } // Handlers - async function LoadPageContent(fromID: number, toID: number): Promise { + async function LoadPageContent(fromID: number, toID: number): Promise { let DisplayContent = ""; const columns = await getColumnNamesCall(); for (const column of columns) { @@ -74,7 +74,7 @@ namespace onboardproject { $("#wrapper-table-header-row").empty(); $("#wrapper-table-header-row").append(DisplayContent); } - return LoadRecordsData(fromID, toID); + // return LoadRecordsData(fromID, toID); } // Conversion Function @@ -146,9 +146,9 @@ namespace onboardproject { if (nextToId >= recordCount - 1) { const fromId = recordCount - 1 - (calculateToId(previous[0]) - previous[0]); const toId = recordCount - 1; - previous = await LoadRecordsData(fromId, toId); + //previous = await LoadRecordsData(fromId, toId); } else { - previous = await LoadRecordsData(previous[0], nextToId); + //previous = await LoadRecordsData(previous[0], nextToId); } }, 250); } catch (error) { @@ -161,7 +161,7 @@ namespace onboardproject { // getRecordCountCall().then(data => console.log(data)).catch(reason => console.log(reason.message)); //Loading Content Function - previous = await LoadPageContent(0, calculateToId(0)); + //previous = await LoadPageContent(0, calculateToId(0)); // Click function for previewing page $("#previous").click(async () => { @@ -172,7 +172,7 @@ namespace onboardproject { let toId = (previous[0] >= 0 ? previous[1] : possibleStep); fromId = fromId == CountData - 1 ? fromId - possibleStep : fromId; toId = toId <= CountData - 1 ? toId : CountData - 1; - previous = await LoadRecordsData(fromId, toId); + //previous = await LoadRecordsData(fromId, toId); }); // Click function for Skipping to next page @@ -183,9 +183,9 @@ namespace onboardproject { const possibleStep = calculateToId(fromId) - fromId; if (fromId <= recordCount - possibleStep - 1) { const toId = fromId + possibleStep <= recordCount - 1 ? fromId + possibleStep : recordCount - 1; - previous = await LoadRecordsData(fromId, toId); + // previous = await LoadRecordsData(fromId, toId); } else if (fromId <= recordCount - 1) { - previous = await LoadRecordsData(recordCount - 1 - (calculateToId(fromId) - fromId), recordCount - 1); + //previous = await LoadRecordsData(recordCount - 1 - (calculateToId(fromId) - fromId), recordCount - 1); } else { throw new Error("Error 404"); } @@ -193,7 +193,7 @@ namespace onboardproject { } }); - // Searching function for index + //Searching function for index $("#go-button").click(async () => { const recordCount = await getRecordCountCall(); const fromId = ConvertNumber($("#index").val() as string, false); @@ -206,7 +206,7 @@ namespace onboardproject { alert(`You may not insert a desired Id greater than ${recordCount - possibleStep}`); } else { let toId = (fromId) + possibleStep < recordCount ? (fromId) + possibleStep : recordCount - 1; - previous = await LoadRecordsData(fromId, toId); + // previous = await LoadRecordsData(fromId, toId); } } } diff --git a/dist/app.min.js b/dist/app.min.js index b7b5b1ec..7f1288b2 100644 --- a/dist/app.min.js +++ b/dist/app.min.js @@ -1 +1 @@ -var __awaiter=this&&this.__awaiter||function(r,i,c,u){return new(c=c||Promise)(function(e,t){function n(r){try{a(u.next(r))}catch(r){t(r)}}function o(r){try{a(u.throw(r))}catch(r){t(r)}}function a(r){var t;r.done?e(r.value):((t=r.value)instanceof c?t:new c(function(r){r(t)})).then(n,o)}a((u=u.apply(r,i||[])).next())})},__generator=this&&this.__generator||function(e,n){var o,a,i,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},r={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function t(t){return function(r){return function(t){if(o)throw new TypeError("Generator is already executing.");for(;c;)try{if(o=1,a&&(i=2&t[0]?a.return:t[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,t[1])).done)return i;switch(a=0,i&&(t=[2&t[0],i.value]),t[0]){case 0:case 1:i=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,a=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(i=0<(i=c.trys).length&&i[i.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!i||t[1]>i[0]&&t[1]',i=0,c=a;i'+u+"";e+="",$("#wrapper-table-content-body").empty(),$("#wrapper-table-content-body").append(e)}return[2,[s,l]]}})})}function e(i,c){return __awaiter(this,void 0,Promise,function(){var t,e,n,o,a;return __generator(this,function(r){switch(r.label){case 0:return t="",[4,function(){return __awaiter(this,void 0,Promise,function(){var t,e;return __generator(this,function(r){switch(r.label){case 0:return[4,fetch("http://localhost:2050/columns")];case 1:if(!(t=r.sent()).ok)throw e="An error has occured: "+t.status,new Error(e);return[2]}})})}()];case 1:for(e=r.sent(),n=0,o=e;n'+a+"",$("#wrapper-table-header-row").empty(),$("#wrapper-table-header-row").append(t);return[2,s(i,c)]}})})}function a(r,t){switch(void 0===t&&(t=!0),typeof r){case"string":return 1==t?parseInt(r):parseFloat(r);case"number":return r}return 0}function l(r){var t=r+Math.max(window.innerHeight-$("#form-content").innerHeight()),e=0;switch(e){case 0:case 1:case 2:window.innerHeight;break;default:e=15}return e+t}function h(r){for(var t=a(r.sort(function(r,t){return r-t})[0]),e=a(r.sort(function(r,t){return r-t})[1]),n=$(window).innerHeight()-$("#table-row-"+t).height(),o=t;o<=e;o++){if(!($("#table-row-"+o).offset().topa[0]&&r[1] Date: Wed, 25 Aug 2021 14:38:52 +0200 Subject: [PATCH 42/50] update --- app.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app.ts b/app.ts index a33b973d..5d944e28 100644 --- a/app.ts +++ b/app.ts @@ -7,7 +7,10 @@ namespace onboardproject { let Load = 50; // Previous Variable declarations - let previous: number[]; + let previous: number; + + // Previous Variable declarations + let previousdata: number; // Previous Process Variable declarations let previousprocess: number; From 14fbe670bd1a5e4a10e263be20ffb3ae5b5f320c Mon Sep 17 00:00:00 2001 From: "sam.moloi" Date: Wed, 25 Aug 2021 14:40:36 +0200 Subject: [PATCH 43/50] update --- app.ts | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/app.ts b/app.ts index 5d944e28..5d7a08ed 100644 --- a/app.ts +++ b/app.ts @@ -1,6 +1,7 @@ import { data } from "jquery"; namespace onboardproject { + module onboardprojects { // Load Variable declarations @@ -9,7 +10,7 @@ namespace onboardproject { // Previous Variable declarations let previous: number; - // Previous Variable declarations + // Previous data Variable declarations let previousdata: number; // Previous Process Variable declarations @@ -49,15 +50,17 @@ namespace onboardproject { async function LoadRecordsData(fromID: number, toID: number): Promise { const recordsvalue = await getRecordsCall(fromID, toID); let DisplayContent = ''; - for (const record of recordsvalue) { - DisplayContent += ``; - for (const column of record) { - DisplayContent += `${column}`; + for () + + for (const record of recordsvalue) { + DisplayContent += ``; + for (const column of record) { + DisplayContent += `${column}`; + } + DisplayContent += ''; + $("#wrapper-table-content-body").empty(); + $("#wrapper-table-content-body").append(DisplayContent); } - DisplayContent += ''; - $("#wrapper-table-content-body").empty(); - $("#wrapper-table-content-body").append(DisplayContent); - } // return [fromID, toID]; } From 6b254958c4759f5166883352e519b9758f8f28ea Mon Sep 17 00:00:00 2001 From: "sam.moloi" Date: Wed, 25 Aug 2021 14:41:22 +0200 Subject: [PATCH 44/50] update --- app.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/app.ts b/app.ts index 5d7a08ed..1db975b5 100644 --- a/app.ts +++ b/app.ts @@ -26,6 +26,7 @@ namespace onboardproject { //return response.json(); } + // Trigger async function async function getColumnNamesCall(): Promise { const response = await fetch('http://localhost:2050/columns'); From ae33eae407f65aa870aa8f107446ee224638a256 Mon Sep 17 00:00:00 2001 From: "sam.moloi" Date: Wed, 25 Aug 2021 16:01:43 +0200 Subject: [PATCH 45/50] update --- app.ts | 34 ++++++++++++++-------------------- dist/app.min.js | 2 +- 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/app.ts b/app.ts index 1db975b5..129ad056 100644 --- a/app.ts +++ b/app.ts @@ -10,9 +10,6 @@ namespace onboardproject { // Previous Variable declarations let previous: number; - // Previous data Variable declarations - let previousdata: number; - // Previous Process Variable declarations let previousprocess: number; @@ -26,7 +23,6 @@ namespace onboardproject { //return response.json(); } - // Trigger async function async function getColumnNamesCall(): Promise { const response = await fetch('http://localhost:2050/columns'); @@ -38,7 +34,7 @@ namespace onboardproject { } // Trigger async function - async function getRecordsCall(fromID: number, toID: number): Promise { + async function getRecordsCall(fromID: number, toID: number): Promise { const response = await fetch(`http://localhost:2050/records?from=${(fromID)}&to=${(toID)}`); if (!response.ok) { const message = `An error has occured: ${response.status}`; @@ -51,17 +47,15 @@ namespace onboardproject { async function LoadRecordsData(fromID: number, toID: number): Promise { const recordsvalue = await getRecordsCall(fromID, toID); let DisplayContent = ''; - for () - - for (const record of recordsvalue) { - DisplayContent += ``; - for (const column of record) { - DisplayContent += `${column}`; - } - DisplayContent += ''; - $("#wrapper-table-content-body").empty(); - $("#wrapper-table-content-body").append(DisplayContent); + for (const records of recordsvalue) { + DisplayContent += ``; + for (const column of record) { + DisplayContent += `${column}`; } + DisplayContent += ''; + $("#wrapper-table-content-body").empty(); + $("#wrapper-table-content-body").append(DisplayContent); + } // return [fromID, toID]; } @@ -100,7 +94,7 @@ namespace onboardproject { // Height Diplay Function function calculateToId(fromId: number): number { - const possibleRecordsData = Math.max((window.innerHeight - ($("#form-content").innerHeight() as number))); + const possibleRecordsData = Math.max((window.innerHeight - ($("#form-content").innerHeight() as number)) / 37); const possibleId = fromId + possibleRecordsData; let recordDisplayset = 0; switch (recordDisplayset) { @@ -146,12 +140,12 @@ namespace onboardproject { window.onresize = () => { try { - const nextToId = calculateToId(previous[0]); + const nextToId = calculateToId(previous); clearTimeout(Load); Load = setTimeout(async () => { const recordCount = await getRecordCountCall(); if (nextToId >= recordCount - 1) { - const fromId = recordCount - 1 - (calculateToId(previous[0]) - previous[0]); + const fromId = recordCount - 1 - (calculateToId(previous) - previous); const toId = recordCount - 1; //previous = await LoadRecordsData(fromId, toId); } else { @@ -174,9 +168,9 @@ namespace onboardproject { $("#previous").click(async () => { const CountData = await getRecordCountCall(); previous = previousPageResize(previous); - let fromId = previous[0] >= 0 ? previous[0] : 0; + let fromId = previous >= 0 ? previous : 0; const possibleStep = calculateToId(fromId) - fromId; - let toId = (previous[0] >= 0 ? previous[1] : possibleStep); + let toId = (previous >= 0 ? previous : possibleStep); fromId = fromId == CountData - 1 ? fromId - possibleStep : fromId; toId = toId <= CountData - 1 ? toId : CountData - 1; //previous = await LoadRecordsData(fromId, toId); diff --git a/dist/app.min.js b/dist/app.min.js index 7f1288b2..278224ec 100644 --- a/dist/app.min.js +++ b/dist/app.min.js @@ -1 +1 @@ -var __awaiter=this&&this.__awaiter||function(t,a,u,c){return new(u=u||Promise)(function(n,r){function e(t){try{i(c.next(t))}catch(t){r(t)}}function o(t){try{i(c.throw(t))}catch(t){r(t)}}function i(t){var r;t.done?n(t.value):((r=t.value)instanceof u?r:new u(function(t){t(r)})).then(e,o)}i((c=c.apply(t,a||[])).next())})},__generator=this&&this.__generator||function(n,e){var o,i,a,u={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},t={next:r(0),throw:r(1),return:r(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function r(r){return function(t){return function(r){if(o)throw new TypeError("Generator is already executing.");for(;u;)try{if(o=1,i&&(a=2&r[0]?i.return:r[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,r[1])).done)return a;switch(i=0,a&&(r=[2&r[0],a.value]),r[0]){case 0:case 1:a=r;break;case 4:return u.label++,{value:r[1],done:!1};case 5:u.label++,i=r[1],r=[0];continue;case 7:r=u.ops.pop(),u.trys.pop();continue;default:if(!(a=0<(a=u.trys).length&&a[a.length-1])&&(6===r[0]||2===r[0])){u=0;continue}if(3===r[0]&&(!a||r[1]>a[0]&&r[1]a[0]&&r[1] Date: Wed, 25 Aug 2021 16:56:35 +0200 Subject: [PATCH 46/50] update --- app.ts | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/app.ts b/app.ts index 129ad056..49f17e0f 100644 --- a/app.ts +++ b/app.ts @@ -20,7 +20,6 @@ namespace onboardproject { const message = `An error has occured: ${response.status}`; throw new Error(message); } - //return response.json(); } // Trigger async function @@ -30,7 +29,6 @@ namespace onboardproject { const message = `An error has occured: ${response.status}`; throw new Error(message); } - //return response.json(); } // Trigger async function @@ -56,14 +54,11 @@ namespace onboardproject { $("#wrapper-table-content-body").empty(); $("#wrapper-table-content-body").append(DisplayContent); } - // return [fromID, toID]; } // Load Records Function function RecordsFromCursor(cursor: number[]): Promise { cursor = cursor.sort((a, b) => { return a - b }); - //return LoadRecordsData(cursor[0], cursor[1]); - // throw new Error("Error"); } // Handlers @@ -75,7 +70,6 @@ namespace onboardproject { $("#wrapper-table-header-row").empty(); $("#wrapper-table-header-row").append(DisplayContent); } - // return LoadRecordsData(fromID, toID); } // Conversion Function @@ -156,10 +150,6 @@ namespace onboardproject { // throw new Error("Error" + error); } } - // log response or catch error of fetch promise - // getColumnNamesCall().then(data => console.log(data)).catch(reason => console.log(reason.message)); - // log response or catch error of fetch promise - // getRecordCountCall().then(data => console.log(data)).catch(reason => console.log(reason.message)); //Loading Content Function //previous = await LoadPageContent(0, calculateToId(0)); @@ -194,19 +184,30 @@ namespace onboardproject { } }); - //Searching function for index + + + + + + + + + + $("#go-button").click(async () => { const recordCount = await getRecordCountCall(); const fromId = ConvertNumber($("#index").val() as string, false); const possibleStep = calculateToId(fromId) - fromId; if (fromId < 0) { alert('only insert Id greater than or equal to 0'); - } else { + } + else { if (Math.floor(fromId).toString() == fromId.toString() === true) { if (fromId > recordCount - possibleStep) { alert(`You may not insert a desired Id greater than ${recordCount - possibleStep}`); } else { let toId = (fromId) + possibleStep < recordCount ? (fromId) + possibleStep : recordCount - 1; + // previous = await LoadRecordsData(fromId, toId); } } From 6aa32a9d135915e8e803d860a5fa7677813eca08 Mon Sep 17 00:00:00 2001 From: "sam.moloi" Date: Wed, 25 Aug 2021 16:59:00 +0200 Subject: [PATCH 47/50] update --- app.ts | 3 +-- dist/app.min.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app.ts b/app.ts index 49f17e0f..207d05b6 100644 --- a/app.ts +++ b/app.ts @@ -89,7 +89,6 @@ namespace onboardproject { // Height Diplay Function function calculateToId(fromId: number): number { const possibleRecordsData = Math.max((window.innerHeight - ($("#form-content").innerHeight() as number)) / 37); - const possibleId = fromId + possibleRecordsData; let recordDisplayset = 0; switch (recordDisplayset) { case 0: @@ -105,7 +104,7 @@ namespace onboardproject { recordDisplayset = 15; break; } - return recordDisplayset + possibleId; + return recordDisplayset; } // Next_Page_Resize Function diff --git a/dist/app.min.js b/dist/app.min.js index 278224ec..d3c4a09f 100644 --- a/dist/app.min.js +++ b/dist/app.min.js @@ -1 +1 @@ -var __awaiter=this&&this.__awaiter||function(t,a,u,c){return new(u=u||Promise)(function(n,r){function e(t){try{i(c.next(t))}catch(t){r(t)}}function o(t){try{i(c.throw(t))}catch(t){r(t)}}function i(t){var r;t.done?n(t.value):((r=t.value)instanceof u?r:new u(function(t){t(r)})).then(e,o)}i((c=c.apply(t,a||[])).next())})},__generator=this&&this.__generator||function(n,e){var o,i,a,u={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},t={next:r(0),throw:r(1),return:r(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function r(r){return function(t){return function(r){if(o)throw new TypeError("Generator is already executing.");for(;u;)try{if(o=1,i&&(a=2&r[0]?i.return:r[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,r[1])).done)return a;switch(i=0,a&&(r=[2&r[0],a.value]),r[0]){case 0:case 1:a=r;break;case 4:return u.label++,{value:r[1],done:!1};case 5:u.label++,i=r[1],r=[0];continue;case 7:r=u.ops.pop(),u.trys.pop();continue;default:if(!(a=0<(a=u.trys).length&&a[a.length-1])&&(6===r[0]||2===r[0])){u=0;continue}if(3===r[0]&&(!a||r[1]>a[0]&&r[1]a[0]&&r[1] Date: Wed, 25 Aug 2021 17:05:55 +0200 Subject: [PATCH 48/50] update --- app.ts | 5 +++-- dist/app.min.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app.ts b/app.ts index 207d05b6..0c71e1f1 100644 --- a/app.ts +++ b/app.ts @@ -125,8 +125,9 @@ namespace onboardproject { // Previous_Page_Resize Function function previousPageResize(previous: number[]): number[] { - const toId = calculateToId(previous[0] - (nextPageResize(previous) - previous[0])); - return [previous[0] - (nextPageResize(previous) - previous[0]), toId]; + let nextPage = nextPageResize([]); + const toId = calculateToId(previous[0] - nextPage); + return [previous[0] - (nextPage - previous[0]), toId]; } // On Resize_Function diff --git a/dist/app.min.js b/dist/app.min.js index d3c4a09f..cdc85bc6 100644 --- a/dist/app.min.js +++ b/dist/app.min.js @@ -1 +1 @@ -var __awaiter=this&&this.__awaiter||function(t,a,u,c){return new(u=u||Promise)(function(n,r){function e(t){try{i(c.next(t))}catch(t){r(t)}}function o(t){try{i(c.throw(t))}catch(t){r(t)}}function i(t){var r;t.done?n(t.value):((r=t.value)instanceof u?r:new u(function(t){t(r)})).then(e,o)}i((c=c.apply(t,a||[])).next())})},__generator=this&&this.__generator||function(n,e){var o,i,a,u={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},t={next:r(0),throw:r(1),return:r(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function r(r){return function(t){return function(r){if(o)throw new TypeError("Generator is already executing.");for(;u;)try{if(o=1,i&&(a=2&r[0]?i.return:r[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,r[1])).done)return a;switch(i=0,a&&(r=[2&r[0],a.value]),r[0]){case 0:case 1:a=r;break;case 4:return u.label++,{value:r[1],done:!1};case 5:u.label++,i=r[1],r=[0];continue;case 7:r=u.ops.pop(),u.trys.pop();continue;default:if(!(a=0<(a=u.trys).length&&a[a.length-1])&&(6===r[0]||2===r[0])){u=0;continue}if(3===r[0]&&(!a||r[1]>a[0]&&r[1]a[0]&&r[1] Date: Wed, 25 Aug 2021 17:13:52 +0200 Subject: [PATCH 49/50] update --- app.ts | 12 +----------- dist/app.min.js | 2 +- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/app.ts b/app.ts index 0c71e1f1..0fed9e3a 100644 --- a/app.ts +++ b/app.ts @@ -111,7 +111,7 @@ namespace onboardproject { function nextPageResize(previous: number[]): number { const fromID = ConvertNumber(previous.sort((a, b) => { return a - b })[0]); const toID = ConvertNumber(previous.sort((a, b) => { return a - b })[1]); - const documentHeight = $(window).innerHeight() as number - ($(`#table-row-${fromID}`).height() as number); + const documentHeight = Math.max((window.innerHeight - ($(`#table-row-${fromID}`).height() as number))); for (let i = fromID; i <= toID; i++) { const elementHeightOffset = ($(`#table-row-${i}`).offset() as JQueryCoordinates).top; if (elementHeightOffset < documentHeight) continue; @@ -184,16 +184,6 @@ namespace onboardproject { } }); - - - - - - - - - - $("#go-button").click(async () => { const recordCount = await getRecordCountCall(); const fromId = ConvertNumber($("#index").val() as string, false); diff --git a/dist/app.min.js b/dist/app.min.js index cdc85bc6..2be374c1 100644 --- a/dist/app.min.js +++ b/dist/app.min.js @@ -1 +1 @@ -var __awaiter=this&&this.__awaiter||function(t,a,u,c){return new(u=u||Promise)(function(n,r){function e(t){try{i(c.next(t))}catch(t){r(t)}}function o(t){try{i(c.throw(t))}catch(t){r(t)}}function i(t){var r;t.done?n(t.value):((r=t.value)instanceof u?r:new u(function(t){t(r)})).then(e,o)}i((c=c.apply(t,a||[])).next())})},__generator=this&&this.__generator||function(n,e){var o,i,a,u={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},t={next:r(0),throw:r(1),return:r(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function r(r){return function(t){return function(r){if(o)throw new TypeError("Generator is already executing.");for(;u;)try{if(o=1,i&&(a=2&r[0]?i.return:r[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,r[1])).done)return a;switch(i=0,a&&(r=[2&r[0],a.value]),r[0]){case 0:case 1:a=r;break;case 4:return u.label++,{value:r[1],done:!1};case 5:u.label++,i=r[1],r=[0];continue;case 7:r=u.ops.pop(),u.trys.pop();continue;default:if(!(a=0<(a=u.trys).length&&a[a.length-1])&&(6===r[0]||2===r[0])){u=0;continue}if(3===r[0]&&(!a||r[1]>a[0]&&r[1]a[0]&&r[1] Date: Wed, 25 Aug 2021 17:18:43 +0200 Subject: [PATCH 50/50] update --- app.ts | 14 -------------- dist/app.min.js | 2 +- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/app.ts b/app.ts index 0fed9e3a..680c4299 100644 --- a/app.ts +++ b/app.ts @@ -90,20 +90,6 @@ namespace onboardproject { function calculateToId(fromId: number): number { const possibleRecordsData = Math.max((window.innerHeight - ($("#form-content").innerHeight() as number)) / 37); let recordDisplayset = 0; - switch (recordDisplayset) { - case 0: - window.innerHeight <= 646; - break; - case 1: - window.innerHeight <= 969; - break; - case 2: - window.innerHeight <= 1938; - break; - default: - recordDisplayset = 15; - break; - } return recordDisplayset; } diff --git a/dist/app.min.js b/dist/app.min.js index 2be374c1..da011ac4 100644 --- a/dist/app.min.js +++ b/dist/app.min.js @@ -1 +1 @@ -var __awaiter=this&&this.__awaiter||function(t,a,u,c){return new(u=u||Promise)(function(n,r){function e(t){try{i(c.next(t))}catch(t){r(t)}}function o(t){try{i(c.throw(t))}catch(t){r(t)}}function i(t){var r;t.done?n(t.value):((r=t.value)instanceof u?r:new u(function(t){t(r)})).then(e,o)}i((c=c.apply(t,a||[])).next())})},__generator=this&&this.__generator||function(n,e){var o,i,a,u={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},t={next:r(0),throw:r(1),return:r(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function r(r){return function(t){return function(r){if(o)throw new TypeError("Generator is already executing.");for(;u;)try{if(o=1,i&&(a=2&r[0]?i.return:r[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,r[1])).done)return a;switch(i=0,a&&(r=[2&r[0],a.value]),r[0]){case 0:case 1:a=r;break;case 4:return u.label++,{value:r[1],done:!1};case 5:u.label++,i=r[1],r=[0];continue;case 7:r=u.ops.pop(),u.trys.pop();continue;default:if(!(a=0<(a=u.trys).length&&a[a.length-1])&&(6===r[0]||2===r[0])){u=0;continue}if(3===r[0]&&(!a||r[1]>a[0]&&r[1]a[0]&&r[1]