-
Notifications
You must be signed in to change notification settings - Fork 13
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
LITE-28258: list and export streams #220
Conversation
355d0bd
to
b5ba906
Compare
|
||
stream_type = 'Computed' if 'sources' in response and response['sources'] else 'Simple' | ||
input = response['samples'].get('input', {}) | ||
input_file_name = input['name'].split('/')[-1] |
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.
The input file is not mandatory. If missed, a keyerror will be raised here
raise ClickException(f'Error obtaining file {file_id} -> {file_destination}') | ||
with open(file_destination, 'wb') as f: | ||
f.write(response) | ||
console.secho( |
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.
This secho
looks weird. Better to have a separate progress for files.
'Stream Name': response['name'], | ||
'Stream Description': response['description'], | ||
'Stream Type': stream_type, | ||
'Stream Category': 'Inbound' |
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.
Inbound
shouldn't be hardcoded.
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.
It's not hardcoded, the if is nested. If the active account id is the owner of the stream then it is Inbound.
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.
👍 but check when it should be Inbound and when Outbound
origin, | ||
resource['name'], | ||
'Computed' if ('sources' in resource and resource['sources']) else 'Simple', | ||
'Inbound' if resource['owner']['id'] == active_account_id else 'Outbound', |
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.
This is not correct.
- In case of vendors, all streams are Outbound and the owner is the active account.
- In case of distributors, it will be Outbound if the owner is the same as the current active account otherwise Inbound.
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.
Agree. But if it is a Vendor, he will be the owner of all the streams so it will work. Am I right?
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.
Yes but I should be Outbound.
'Computed Stream Source ID': response['sources'][0]['id'] | ||
if stream_type == 'Computed' | ||
else '', | ||
'Computed Stream Source Name': response['sources'][0]['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.
Not type
probably name
should be taken here.
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.
Agree. So I will add also the name. We will export id, name and type.
horizontal='left', | ||
vertical='top', | ||
) | ||
task = progress.add_task('Filling transformations', total=len(transformations)) |
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.
Before adding a progress, if the len of transformations
is 0 you should return from this funciton
ws, | ||
('ID', 'Name'), | ||
) | ||
task = progress.add_task('Filling and downloading attachments', total=len(attachments)) |
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.
Before adding a progress, if the len of attachments is 0 you should return from this funciton
'Partner Name': response['context'].get('account', {}).get('name', ''), | ||
'Marketplace ID': response['context'].get('marketplace', {}).get('id', ''), | ||
'Marketplace Name': response['context'].get('marketplace', {}).get('name', ''), | ||
'Pricelist ID': response['context'].get('price_list', {}).get('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.
This field is not filled when the computed stream is attached to a pricelist.
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.
In the serializer they have the pricelist, so it should work.
'Marketplace ID': response['context'].get('marketplace', {}).get('id', ''), | ||
'Marketplace Name': response['context'].get('marketplace', {}).get('name', ''), | ||
'Pricelist ID': response['context'].get('price_list', {}).get('id', ''), | ||
'Pricelist Name': response['context'].get('price_list', {}).get('name', ''), |
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.
Also this.
b5ba906
to
3666e59
Compare
3666e59
to
2f728da
Compare
2f728da
to
f7924ad
Compare
Kudos, SonarCloud Quality Gate passed! |
origin, | ||
resource['name'], | ||
'Computed' if ('sources' in resource and resource['sources']) else 'Simple', | ||
'Inbound' if resource['owner']['id'] == active_account_id else 'Outbound', |
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.
Yes but I should be Outbound.
'Stream Name': response['name'], | ||
'Stream Description': response['description'], | ||
'Stream Type': stream_type, | ||
'Stream Category': 'Inbound' |
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.
👍 but check when it should be Inbound and when Outbound
No description provided.