Skip to content

Expose list_images #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

Merged
merged 1 commit into from
May 5, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions tljh_repo2docker/__init__.py
Original file line number Diff line number Diff line change
@@ -52,7 +52,6 @@ def _run_in_executor(self, func, *args):
<label for='image-item-{{ loop.index0 }}' class='form-control input-group'>
<div class='col-md-1'>
<input type='radio' name='image' id='image-item-{{ loop.index0 }}' value='{{ image.image_name }}' />
<input type='hidden' name='display_name' value='{{ image.display_name }}' />
</div>
<div class='col-md-11'>
<strong>{{ image.display_name }}</strong>
@@ -99,19 +98,17 @@ def _run_in_executor(self, func, *args):
"""
)

def options_from_form(self, formdata):
async def list_images(self):
"""
Add additional image information to the user options.
Return the list of available images
"""
default_options = super().options_from_form(formdata)
default_options['display_name'] = formdata['display_name'][0]
return default_options
return await self._run_in_executor(list_images);

async def get_options_form(self):
"""
Override the default form to handle the case when there is only one image.
"""
images = await self._run_in_executor(list_images);
images = await self.list_images()
# add memory and cpu limits
for image in images:
image['mem_limit'] = image['mem_limit'] or self.mem_limit