Skip to content
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

NNS1-3450: Utility function to download .csv file #5812

Merged
merged 25 commits into from
Nov 21, 2024
Merged

Conversation

yhabib
Copy link
Contributor

@yhabib yhabib commented Nov 19, 2024

Motivation

NNS1-3450 will require functionality to download .csv files.

Changes

  • New utility function to download a string in csv format as a .csv file.

Tests

  • Unit tests for the utility functions.
  • I tested it manually by adding a dummy button to the UI. I called the function with different inputs and checked that the downloaded file met expectations.

Todos

  • Add entry to changelog (if necessary).
    Not necessary

Prev PR: #5815 | Next PR: #5813

@yhabib yhabib requested a review from a team as a code owner November 19, 2024 10:55
frontend/src/lib/utils/export-to-csv.utils.ts Outdated Show resolved Hide resolved
frontend/src/lib/utils/export-to-csv.utils.ts Outdated Show resolved Hide resolved
frontend/src/lib/utils/export-to-csv.utils.ts Outdated Show resolved Hide resolved
frontend/src/lib/utils/export-to-csv.utils.ts Outdated Show resolved Hide resolved
frontend/src/lib/utils/export-to-csv.utils.ts Outdated Show resolved Hide resolved
frontend/src/lib/utils/export-to-csv.utils.ts Show resolved Hide resolved
frontend/src/tests/lib/utils/export-to-csv.utils.spec.ts Outdated Show resolved Hide resolved
frontend/src/tests/lib/utils/export-to-csv.utils.spec.ts Outdated Show resolved Hide resolved
frontend/src/tests/lib/utils/export-to-csv.utils.spec.ts Outdated Show resolved Hide resolved
@peterpeterparker
Copy link
Member

Randomly spotted this PR and just wanted to let know there is already a utils called save.utils.ts in NNS dapp which seems unused and untested. So you might want to delete this particular module afterwards. Just sharing in case unknown.

github-merge-queue bot pushed a commit that referenced this pull request Nov 20, 2024
…ing (#5815)

# Motivation

NNS1-3450 will require functionality to download .csv files.

# Changes

- New utility function to convert an object into a string in csv format.

# Tests

- Unit tests for the utility function

# Todos

- [ ] Add entry to changelog (if necessary).
Not necessary.

Nex PR: #5812
@yhabib yhabib force-pushed the NNS1-3450/download-csv branch from f5a69f1 to d4b544b Compare November 20, 2024 22:15
@yhabib yhabib force-pushed the NNS1-3450/download-csv branch from 8624a9a to d354151 Compare November 20, 2024 22:20
@yhabib yhabib requested review from mstrasinskis and removed request for mstrasinskis and dskloetd November 20, 2024 22:21
@yhabib yhabib requested a review from dskloetd November 21, 2024 05:53
@yhabib yhabib force-pushed the NNS1-3450/download-csv branch from 61ca380 to 313f79f Compare November 21, 2024 08:22
@yhabib yhabib requested a review from dskloetd November 21, 2024 08:38
@yhabib yhabib requested a review from dskloetd November 21, 2024 09:25
@yhabib yhabib enabled auto-merge November 21, 2024 10:13
@yhabib yhabib added this pull request to the merge queue Nov 21, 2024
Merged via the queue into main with commit a546a0a Nov 21, 2024
30 checks passed
@yhabib yhabib deleted the NNS1-3450/download-csv branch November 21, 2024 10:35
github-merge-queue bot pushed a commit that referenced this pull request Nov 21, 2024
…ng after a delay. (#5834)

# Motivation

NNS1-3450 will download a csv where show the users the date at which
their neuron will dissolve. Eg:

| Neuron Id  |  Dissolve Delay | Dissolve Date |
| ------------- | ------------- |-------------|
| 12345  | 1day, 1hours  | Nov 22, 2024 |

# Changes

- Adds new date utility function `getFutureDateFromDelayInSeconds`

# Tests

- Unit tests

# Todos

- [ ] Add entry to changelog (if necessary).
Not necessary

Prev PR: #5812 | Next PR: #5836
github-merge-queue bot pushed a commit that referenced this pull request Nov 25, 2024
# Motivation

CSV files can include metadata that appears before the table. For
example:

<img width="1459" alt="Screenshot 2024-11-22 at 16 50 10"
src="https://github.com/user-attachments/assets/441944c6-4484-4174-a2a8-7c19513dd566">

# Changes

- Adds a new parameter `metadata` that if present is render before the
table. When present it shifts the table two columns to the right.

# Tests

- Unit test
- Manually tested in #5813

# Todos

- [ ] Add entry to changelog (if necessary).
Not necessary

Prev PR: #5812 | Next PR: #5813
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants