-
Notifications
You must be signed in to change notification settings - Fork 35
Onboarding Project: Maxwill #48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
MaxTF141
wants to merge
42
commits into
IMQS:master
Choose a base branch
from
MaxTF141:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
3a4e462
update
MaxTF141 8a555a7
Fixed the table filling the entire screen and started on the search. …
MaxTF141 75dc47a
Added a new function that can load records based on the screen size. …
MaxTF141 476cad9
Updated functionality to display number of records according to heigh…
MaxTF141 b11aad3
Fixed resizing issue by putting a debounce delay on the window resize.
MaxTF141 6d8b880
updated my pagination in relation to the search function
MaxTF141 ecf387c
During resizing this version of the project change the start and end …
MaxTF141 441ca1d
updated. When adjusting height the first record of the page stays the…
MaxTF141 c948341
update
MaxTF141 700d931
Merge branch 'master' of github.com:MaxTF141/onboard-javascript into …
MaxTF141 090f7cd
updated
MaxTF141 9005d45
Fixed my last value's page and the pagination when going back and for…
MaxTF141 86fb0dd
Fixed my paginapages when resizing and starting id's on smaller numbe…
MaxTF141 3b5990f
Formatted
MaxTF141 db01e42
Almost done with the requested changes
MaxTF141 2764976
Restructured my global variables and changed it to properties.
MaxTF141 df647ea
Added semicolons
MaxTF141 f8f8d24
updated the search input to not take letter and symbols
MaxTF141 44b81a7
Added user only allowing to type letters it the search bar and a ente…
MaxTF141 ab121b8
Small changes
MaxTF141 0f4c00b
Added a Class and are handling all my api calls in the Class. And did…
MaxTF141 088d73b
Moved my class to a seperate file and replaced try, catch with .then(…
MaxTF141 975bc24
Update
MaxTF141 3fb7c44
update
MaxTF141 ad77763
Delete apiManager.js
MaxTF141 8704cb7
Delete ApiManager.js
MaxTF141 cff0b57
Delete apiManager.js.map
MaxTF141 3198ed0
Delete ApiManager.js.map
MaxTF141 530cef4
removed js files
MaxTF141 48d8158
Merge branch 'master' of github.com:MaxTF141/onboard-javascript
MaxTF141 53ca9e5
requested changes still in progress
MaxTF141 765552d
set starting value of records to zero and made small requested change…
MaxTF141 59da1fc
Did the requested changes.
MaxTF141 d9882f8
update
MaxTF141 18ee383
Did the requested changes
MaxTF141 ff94cd8
small update
MaxTF141 99ca15c
Did most of the requested changes
MaxTF141 12164f0
Updated calculations for more precision
MaxTF141 43bef10
Updated comments.
MaxTF141 9b9bcc6
Did all the requested changes including error handling
MaxTF141 e2e0439
Update
MaxTF141 1d6c7ba
Update
MaxTF141 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| /node_modules | ||
| app.js | ||
| app.js.map | ||
| apiManager.js | ||
| apiManager.js.map |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "version": "0.2.0", | ||
| "configurations": [ | ||
| { | ||
| "type": "chrome", | ||
| "request": "launch", | ||
| "name": "Debug in Chrome", | ||
| "url": "http://localhost:2050/", | ||
| "webRoot": "${workspaceFolder}", | ||
| "sourceMapPathOverrides": { | ||
| "webpack:///./*": "${webRoot}/*" | ||
| } | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "version": "2.0.0", | ||
| "tasks": [ | ||
| { | ||
| "type": "typescript", | ||
| "tsconfig": "tsconfig.json", | ||
| "option": "watch", | ||
| "problemMatcher": [ | ||
| "$tsc-watch" | ||
| ], | ||
| "group": "build", | ||
| "label": "tsc: watch - tsconfig.json" | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| class ApiManager { | ||
|
|
||
| private mainUrl: string; | ||
|
|
||
| constructor(mainUrl: string) { | ||
| this.mainUrl = mainUrl; | ||
| } | ||
|
|
||
| private fetchJson(url: string): Promise<any> { | ||
| return fetch(url) | ||
| .then(res => { | ||
| if (res.ok) { | ||
| return res.json(); | ||
| } else { | ||
| throw new Error(`HTTP error! Status: ${res.status}`); | ||
| } | ||
| }) | ||
| .catch(error => { | ||
| throw new Error(`Fetch failed: ${error}`); | ||
| }); | ||
| } | ||
|
|
||
| /** Retrieves records from the api */ | ||
| getRecords(fromID: number, toID: number): Promise<string[][]> { | ||
| return this.fetchJson(`${this.mainUrl}/records?from=${fromID}&to=${toID}`); | ||
| } | ||
|
|
||
| /** Retrieves columns from the api */ | ||
| getColumns(): Promise<string[]> { | ||
| return this.fetchJson(`${this.mainUrl}/columns`); | ||
| } | ||
|
|
||
| /** Retrieves the number of records there are */ | ||
| getRecordCount(): Promise<number> { | ||
| return fetch(`${this.mainUrl}/recordCount`) | ||
| .then(res => { | ||
| if (res.ok) { | ||
| return res.text(); | ||
| } else { | ||
| throw new Error(`HTTP error? Status: ${res.status}`); | ||
| } | ||
| }) | ||
| .then(recordCount => { | ||
| return parseInt(recordCount); | ||
| }) | ||
| .catch(error => { | ||
| throw error; | ||
| }); | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I seriously want to ask you to cache the record count result.
It is the type of call you can make once and trust that it won't change again.
It is a different case if you are working with live data but in your case, you are not.
I would've made that assumption. You can make the fetch once and save it when this class gets instantiated. Then return the result with
getRecordCountwhen you need it. Less chatting to your backend.However, there is nothing wrong with what you did, as this is a good approach in some cases.