-
Notifications
You must be signed in to change notification settings - Fork 7
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
Import SATF Library Sequence #1592
base: develop
Are you sure you want to change the base?
Conversation
Is this branch supposed to merge into #1574? It looks like a lot of the same changes. |
4c910c8
to
98330e2
Compare
Yeah it is branched from 1574 and since that was merged in the first 4 fell off. It should now all be new code |
@@ -86,6 +125,18 @@ | |||
> | |||
New Sequence | |||
</button> | |||
|
|||
<button |
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.
Can we change the flow of this container to keep these buttons on the same line instead of wrapping to the next line if there isn't enough screen space?
@@ -59,6 +63,41 @@ | |||
const workspaceId = getSearchParameterNumber(SearchParameters.WORKSPACE_ID); | |||
goto(`${base}/sequencing/new${workspaceId ? `?${SearchParameters.WORKSPACE_ID}=${workspaceId}` : ''}`); | |||
} | |||
|
|||
async function importLibarySequences(): Promise<void> { | |||
const workspaceId = getSearchParameterNumber(SearchParameters.WORKSPACE_ID); |
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.
workspaceId
already exists in the component as a state variable. Can we use that instead of fetching it from the URL again?
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.
Thanks for pointing that out
async function importLibarySequences(): Promise<void> { | ||
const workspaceId = getSearchParameterNumber(SearchParameters.WORKSPACE_ID); | ||
if (workspaceId === null) { | ||
console.log("Workspace doesn't exist"); |
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.
Our current convention for most complicated modals is to call them from an effects function as well as showing toasts. Would you mind moving this into one?
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.
Ahhh, got it. I moved part of this function to the effects.ts
if (confirm && value) { | ||
const fileName = await value.libraryFile.name; | ||
const type = fileName.slice(fileName.lastIndexOf('.') + 1); | ||
if (type !== 'satf') { |
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.
Are files that contain satf code, but don't have the extension on it allowed? If the file extension is required, then you can specify valid file extensions to disallow unsupported files from even being selected also.
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.
Good point. I add accept=".satf"
to only allow for satfs to be imported. From what I have seen these files are always appended with .satf
showFailureToast('Library Import: Unsupported file type'); | ||
return; | ||
} | ||
const contents = await value.libraryFile.text(); |
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 think you might need to add a try/catch for if it's unable to read the file.
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.
Got it I added a try-catch
: 'UNKNOWN'; | ||
default: | ||
throw Error(`unknown argument type ${parameter.type}`); | ||
console.log(`Unknown argument type ${parameter.type}`); |
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 think the util file should not be in charge of logging. It would be more reusable if the consuming functions using this function are responsible for how they report errors.
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.
Got it. I removed the logging. It is returning a value with an error so it stand out to the users that the variable type is incorrect.
The issues is the auto-complete feature for variables
will attempts to fill in values for the user by default. These values are coming from a parent sequence file being invoked or called by the @ACTIVATE
or @LOAD
directive . If there is an issue I still want to display valid parameters.
ex.
C @ACTIVATE("SEQ1") 1 "hello" ERROR:tempurture FALSE
Before the autocomplete will fail and the user will not see any arguments. In order to see what these argument are the user will have to open "SEQ1" in a new tab. Also it lets them know that SEQ1
has an issue so go fix it.
const fileName = await value.libraryFile.name; | ||
const type = fileName.slice(fileName.lastIndexOf('.') + 1); | ||
if (type !== 'satf') { | ||
console.log(`Unsupported file type ${type}`); |
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.
Do we need to log here if we're already showing the toast?
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.
Nope, just for debugging. I removed it.
This modal allows you to select a parcel and import a library sequence file
The linter incorrectly reported errors for values within a valid range when multiple ranges were defined. For example, if the ranges were 5-10 and 11-20, the linter would erroneously flag the value 8 as invalid because it falls outside the 11-20 range, even though it is valid within the 5-10 range.
…invalid variable types. Allow autocomplete to succeed and show the ERROR parameter value. The user will see this error in the editor and manually have to fix it.
The linter will complain if there is a command with no arguments even though the command itself doesn't have any argument defined in the command dictionary.
There shouldn't be any parenthesis and commas in the SeqN generation
98330e2
to
f45cb60
Compare
Closes #1591
Library Sequence Modal:
Linting Bugfix:
Autocomplete Bugfix:
SATF/SASF Library
TESTING
banana_library.txt