summaryrefslogtreecommitdiffstats
path: root/ogcp/views.py
diff options
context:
space:
mode:
authorJavier Hernandez <jhernandez@soleta.eu>2023-12-15 11:35:30 +0100
committerOpenGnSys Support Team <soporte-og@soleta.eu>2023-12-15 11:44:38 +0100
commita9d367e795a00358c8c34e205ee17beddbcd00dd (patch)
treea0cb12d705b2c7adb4143c14ff45d1155eee9e00 /ogcp/views.py
parent24aab951a8373642b36e1063789a20bb05965586 (diff)
views: Preselect client's associated repo
Make the create-image menu preselect the repo of the selected client
Diffstat (limited to 'ogcp/views.py')
-rw-r--r--ogcp/views.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/ogcp/views.py b/ogcp/views.py
index 406de44..8494d4f 100644
--- a/ogcp/views.py
+++ b/ogcp/views.py
@@ -1233,9 +1233,14 @@ def action_image_create():
f"| {PART_TYPE_CODES[part.get('code')]} "
f"{FS_CODES[part.get('filesystem')]}")
)
+ r = server.get('/client/info', payload={'client': list(ips)})
+ client_repo_id = r.json()['repo_id']
repositories = get_repositories(server)
+ form.repository.choices = [ (repo['id'], repo['name']) for repo in repositories
+ if client_repo_id == repo['id']]
for repo in repositories:
- form.repository.choices.append((repo['id'], repo['name']))
+ if client_repo_id != repo['id']:
+ form.repository.choices.append((repo['id'], repo['name']))
scopes, clients = get_scopes(set(ips))
return render_template('actions/image_create.html', form=form,