views: fix repository list in update client

Make the repository list's first element be the current repo in use.
This is needed because, otherwise, an update could inadvertently
change the repo.

Remove a print statement that is no longer needed
master
Javier Hernandez 2023-11-29 12:27:19 +01:00 committed by OpenGnSys Support Team
parent 4a70bc174c
commit 3b932fc6a8
1 changed files with 4 additions and 3 deletions

View File

@ -897,7 +897,6 @@ def action_client_update():
db_client = r.json()
form.server.data = "{0}:{1}".format(server.ip, server.port)
print("server ip:", form.server.data)
form.ip.data = db_client['ip']
form.ip.render_kw = {'readonly': True}
form.name.data = db_client['name']
@ -907,7 +906,6 @@ def action_client_update():
form.remote.data = db_client['remote']
form.maintenance.data = db_client['maintenance']
form.netiface.data = db_client['netiface']
form.repo.data = db_client['repo_id']
form.boot.render_kw = {'readonly': True}
r = server.get('/scopes')
@ -919,7 +917,10 @@ def action_client_update():
form.room.render_kw = {'readonly': True}
repositories = get_repositories(server)
form.repo.choices = [(repo["id"], repo["name"]) for repo in repositories]
form.repo.choices = [(repo["id"], repo["name"]) for repo in repositories
if db_client['repo_id'] == repo["id"]]
form.repo.choices.extend([(repo["id"], repo["name"]) for repo in repositories
if db_client['repo_id'] != repo["id"]])
form.create.render_kw = {"formaction": url_for('action_client_update')}
return render_template('actions/client_details.html', form=form,