-
Notifications
You must be signed in to change notification settings - Fork 0
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
559 GS1 codes #564
559 GS1 codes #564
Conversation
Support for viewing barcodes when unauthenticated added! |
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.
Looks awesome, heaps of work!
I tried to add a barcode and got this error
Internal error: Failed to parse response: Error("invalid type: null, expected struct Entity", line: 1, column: 6409). The response body is: {"errors":[{"message":"Non-nullable field 'code' (type String!) was not present in result from Dgraph. GraphQL error propagation triggered.","locations":[{"line":3,"column":3}],"path":
Will try to investigate further tomorrow to see what's gone wrong.
backend/service/src/barcodes/mod.rs
Outdated
|
||
match result { | ||
Some(data) => Ok(BarcodeCollection { | ||
total_length: usize_to_u32(data.data.len()), |
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.
Probably should use the actual total/count from dgraph here since you have the first/offset, it won't return the right value when you have a limit on the results less than the total available records...
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.
} | ||
|
||
if new_barcode.manufacturer.is_empty() { | ||
return Err(ModifyBarcodeError::InternalError( |
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.
return Err(ModifyBarcodeError::InternalError( | |
return Err(ModifyBarcodeError::BadUserInput( |
This is more a user error, similar for the others in validate
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.
@@ -74,6 +75,13 @@ type PropertyConfigurationItem { | |||
url: String @dgraph(pred: "url") | |||
} | |||
|
|||
type Barcode { | |||
id: ID! | |||
gtin: String! @id @dgraph(pred: "code") @search(by: [exact, trigram]) |
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 like this using code
in dgraph, kind of as our id
look up.
Have created interaction_group_id
and interaction_id
in my other PR, but definitely complicates things a little bit...
useConfirmationModal, | ||
} from 'frontend/common/src'; | ||
|
||
export const DeleteLinesDropdownItem = <T extends RecordWithId>({ |
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.
Nice! Like this component!
frontend/host/src/Site.tsx
Outdated
@@ -92,7 +92,7 @@ export const Site: FC = () => { | |||
/> | |||
} | |||
/> | |||
<Route path={'/details/:code'} element={<RedirectDetails />} /> | |||
<Route path={'/detail/:code'} element={<RedirectDetails />} /> |
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.
Was this deliberate? I can't remember what the old link was like...
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.
Oh whoops didn't realise that made it in here... when we deployed the production version i realised the old links were /detail/:code, but we'd set up the redirect off /details... will do via separate PR for clarity 😎
const countChildBarcodes = (e: EntityData) => { | ||
e.children?.forEach(c => { | ||
count += c.barcodes.length; | ||
countChildBarcodes(c); |
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.
Interesting that you can call a function you're creating as a const inside the function by the name. I guess it makes sense, but not obvious to me...
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.
Yeah... I suppose because it is defined above where it is called it all works out ok? It is a little funky though!
Oh I had this issue yesterday viewing drug details on the 'loading in standard config' branch! I think I fixed it - have just merged develop in... if you know which product you tried to create the barcode for, would you mind trying again? |
It doesn't look to be related to barcodes at all, looks like we have problem with |
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.
Looks great! Couple of comments but merge away when you're ready.
Fixes #559
Fixes #548
Description
Adds add, view and delete capability for GS1 codes, with the restriction that the related PackSize node already exists.
View all GS1 codes:
Sorting the list e.g. by manufacturer is currently not supported, and searching is also not implemented. Unfortunately, I don't think its possible for us to sort or search the whole GS1 list by product, as DGraph requires those fields to be scalar types... if that search capability is desired in future, we could duplicate the entity data onto the GS1 node to be able to search on it.
Add modal searches existing pack size entities:
See number of related GS1s (is related a better word than linked? also GS1s or GTINs?) for a unit - lower nodes collapsed by default:
Lower nodes expandable if you want them to be:
Link takes you to a filtered view of GS1s for only that product:
Add modal PackSize options are filtered accordingly:
Tests: