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

feat: 104 Export menu plugin #342

Merged
merged 6 commits into from
Oct 14, 2024
Merged

feat: 104 Export menu plugin #342

merged 6 commits into from
Oct 14, 2024

Conversation

clepski
Copy link

@clepski clepski commented Oct 7, 2024

  • Add Menu Plugin which creates and downloads a CSV list of all 104 signals

closes #334

Copy link

@trusz trusz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this is somewhat Alliander specific. Should we separate it from the other plugins?
What do you think @Sander3003?

Comment on lines +79 to +88
const a = document.createElement('a');
a.download = this.docName + '-104-signals.csv';
a.href = URL.createObjectURL(csvBlob);
a.dataset.downloadurl = ['text/csv', a.download, a.href].join(':');
a.style.display = 'none';

document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(a.href);
Copy link

@trusz trusz Oct 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nice hack. I assume there is no other way to do this

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pretty much copied the code from here https://github.com/com-pas/compas-open-scd/blob/main/packages/compas-open-scd/src/menu/ExportIEDParams.ts#L296

After googling for a while the hidden <a> element seems to be the only way, we might want to look for a way to make this function reuseable, because at the moment it has been copied at least three times between different plugins.

@trusz
Copy link

trusz commented Oct 9, 2024

We will leave the plugin in this repo for the time being.

@clepski clepski merged commit c72d953 into main Oct 14, 2024
6 checks passed
@clepski clepski deleted the feat/334-104-export-menu-plugin branch October 14, 2024 08:32
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.

Generate a CSV file containing 104 information from the IEC 61850 SCL file
2 participants