Segnalazione #71
App host
0%
Description
Porting del vecchio plugin host
Associated revisions
Add host urls. refs: #71
Install host draft app. refs: #71
Merge branch 'master' into t71. refs: #71
Show buttons for groups and current group in the page. refs: #71
Filter and show host list. Draft. refs: #71
Get all info from every host. refs: #71
Hit the octofuss database only once. refs: #71
Show data in a table. refs: #71
Show table only if there are hosts in the group. refs: #71
Add TODO button to edit cluster. refs: #71
Use icons and strings to make easier to choose if we prefer one or the other (both it's too much, maybe). refs: #71
Better I think. refs: #71
Draft group_edit view. refs: #71
Load string and gettext string for groups. refs: #71
Draft initial edit_group view and template. refs: #71
Hit the octofuss database only when creating hosts list. refs: #71
First chunk of code to get the actions via ajax. refs: #71
Sort actions by order. In the old code this was done in javascript. refs: #71
Work in progress to add widgets in the HTML code via javascript, based on actions got via ajax call. refs: #71
Not working. Commit to allow some sort of pair programming. refs: #71
Show dummy buttons for nudge actions. refs: #71
Add a dummy alert via the onclick attribute. refs: #71
Somewhat show also freeform widgets. refs: #71
The onclick attribute is for the button, not the input. refs: #71
Add draft choice action. To be at least tried with a group/cluster with a choice action among its actions. refs: #71
Merge branch 'master' into t71. refs: #71
Merge branch 'master' into t71. refs: #71
Merge branch 'master' into t71. refs: #71
WIP actions jquery-ui widget. refs: #71
WIP group_edit.html template for the new jquery-ui widget. refs: #71
groups are a 3-tuple now (think about simplifying things. refs: #71
Port also freeform action code (which was not complete) from old code to jquery-ui widget. refs: #71
Add draft choice_action() to the widget. refs: #71
Add ActionAJAX view in a very draft shape, and refactor an ActionsMixin out of the two views. refs: #71
Remove code from here. refs: #71
Typo. refs: #71
Allow creation of a dummy url. refs: #71
Explicit the limited choices for action in the url, adding also _action to allow creating a dummy url. refs: #71
Build the right url in nudge actions for groups/clusters. refs: #71
Draft ajax POST. refs: #71
Take the CSRF token from the template context and save it in options. refs: #71
Dummy post(). refs: #71
Make the AJAX POST. refs: #71
Implement draft for nudge actions in group/cluster. No checking and no testing at the moment, but it seems to work prett good. refs: #71
Fix nudge. refs: #71
Cleanup. refs: #71
Add freeform. refs: #71
Add choice, not testable in editgroup. refs: #71
Implement ActionAJAX.post() a little more, with some error checking and messaging. refs: #71
Try to work to support HTTP 200 and errors. refs: #71
Merge branch 't71' of https://work.fuss.bz.it/git/octonet into t71. refs: #71
Fix for all not working. refs: #71
Fix response. refs: #71
Inject error message. refs: #71
Fix avahi group button. refs: #71
Merge branch 'master' into t71. refs: #71
Add support for success/error also to freeform widget. refs: #71
Initial commit for HostEdit. refs: #71
Move actions.js. refs: #71
Load actions.js. refs: #71
Fix. refs: #71
Add links and buttons to edit host. refs: #71
Add draft host_edit.html template. refs: #71
Get info from host. refs: #71
Show hostname instead of a complete dict. refs: #71
Show host informations. refs: #71
WIP JS code in the template. refs: #71
Fix for host actions. refs: #71
Fix action_url for host editing. refs: #71
First tests for the host app. refs: #71
Add another test. refs: #71
Add some test for host:action_ajax view. refs: #71
Add a test, refactor a little, and add comments. refs: #71
Refactored a LoginMixin, to deduplicate copypasted code. refs: #71
Add another test. refs: #71
Avoid exception in 'all' hosts page. refs: #71
Show back buttons with HTTP_REFERER. refs: #71
Add quote_plus and unquote_plus custom filters. refs: #71
unquote_plus group names in group list. refs: #71
Use unquote_plus template filter also here. refs: #71
unquote_plus also when editing cluster. refs: #71
Use decodeURIComponent to show unquoted strings for cluster names. refs: #71
Keep commented out urls of different 'experiments'. refs: #71
Merge branch 'master' into t71. refs: #71
Add some tests for host action. refs: #71
Add other tests for cluster. refs: #71
Refactor some tests, writing a mixin that allows to deduplicate code and to test the same things for hosts and clusters. refs: #71
Refactor also the other tests. refs: #71
Further refactor. refs: #71
Comments. refs: #71
Add tests for the host creation. Not working. refs: #71
value comes from POST, not from kwargs. refs: #71
Merge branch 'master' into t71. refs: #71
debug prints. refs: #71
Don't show edit button in 'all' hosts list page. refs: #71
Redirect to host:list if host:group_edit is manually called for 'all' group. refs: #71
Put this test in 'standby', priority is to deliver a usable UI to get feedback from users. refs: #71
Add forgotten super(). refs: #71
Use the right field. refs: #71
Add draft completion widget in actions.js. refs: #71
Load select2 in group_edit.html and host_edit.html. refs: #71
Enable select2 for every select in the page, after having been rendered all the actions widgets. refs: #71
Add draft ajax view to get completion options for given action and target. refs: #71
As js files do not have access to django template tags, add an option to the actions widget initialization. refs: #71
Add the draft invocation of the new AJAX view in the completion widget initialization. refs: #71
Fix regex. refs: #71
Pass action_completion_url to the constructor. refs: #71
Set base_path in the action's JSON. refs: #71
Implement ActionCompletionAJAX.get(). refs: #71
Implement the select population in actions.js. refs: #71
Merge branch 'master' into t71. refs: #71
History
Updated by Mark Caglienzi over 7 years ago
- Status changed from Nuovo to In elaborazione
- Assignee set to Mark Caglienzi
Updated by Mark Caglienzi over 7 years ago
- View di elenco macchine, con filtro per gruppi/cluster funzionante (senza il javascript della pagina vecchia, da indagare)
- View di editing del gruppo abbozzata, e iniziale studio di tutta l'architettura javascript sottostante nel software vecchio (grazie Enrico per il supporto stamattina)
Da capire come sia meglio procedere. Io opterei per una riscrittura del javascript con jQuery anziché mantenere e riadattare il codice vecchio.
Questo è a grandi linee il funzionamento della pagina vecchia (lo scrivo qui per ricordarmi qualcosa quando ci tornerò su lunedì):- Ogni cluster ha delle proprie action, che possono anche cambiare nel tempo (per questo tutta l'architettura è dinamica e controllata via javascript e chiamate web asincrone), e che sono date da
octofussd
(facendo una query a/cluster/$NOMEGRUPPO/:actions:
) - Ogni action, querata su
octofussd
, restituisce un JSON con i dati necessari (il tipo di action, il messaggio, eccetera) - Questo JSON viene usato dal javascript nella pagina per istanziare il pannello con i widget per quella determinata action (se è 'reboot', basterà un bottone. Se è 'cambia nome alla macchina' ci vorrà un campo testo, e così via)
- On load della pagina c'è una chiamata all'istanziazione di questi widget, che vengono rigenerati anche dal bottone refresh
Il codice javascript (sempre del vecchio octonet) si trova in octonet/static/javascript/actions.js
, la parte python è in octonet/actions.py
, e al solito octonet/plugins/host/controllers.py
.
Updated by Enrico Zini over 7 years ago
Sono d'accordissimo sul riscrivere il codice vecchio con jQuery piuttosto di riadattarlo.
Le action non ci sono solo nei cluster ma anche nei singoli host; per esempio, posso fare reboot di una macchina o di tutte le macchine di un gruppo.
Updated by Enrico Zini over 7 years ago
- Assignee changed from Enrico Zini to Mark Caglienzi
Te la riassegno, l'avevo presa per sbaglio con git tl
Updated by Mark Caglienzi over 7 years ago
- Dopo brainstorming di ieri in ufficio con Enrico, riscrittura dei pezzi di javascript per le action come un widget jquery-ui
- Implementazione di una bozza di view ajax per fare le azioni
- Ora nella pagina di gruppi/cluster se si preme "Edit" vengono creati i widget (nudge, freeform, choice al momento)
- I bottoni di tipo nudge sembra che invochino correttamente la view ajax di backend
Codice pushato nel branch per l'eventuale review dello stato parziale
Updated by Mark Caglienzi over 7 years ago
- Parte di editing di cluster/gruppo fatta (aggiustati anche i problemi del bottone di editing rispetto ad alcuni gruppi)
- Iniziata parte di editing della singola macchina
- Refactoring di
actions.js
fatto da Enrico in #76 tirato dentro - Un po' di pair programming per particolari qua e là riguardanti le actions
- Mancano i test di tutta l'app (buona parte del suo funzionamento è fatto via javascript)
- Manca il controllo dell'input dei vari pezzi di infrastruttura riguardo i gruppi (:avahi: / avahi, encode/decode dei nomi di gruppo, ecc...) e il relativo testing
Updated by Mark Caglienzi over 7 years ago
- Fatta l'ossatura dell'editing di host
- E in questo caso compare anche un widget di tipo choice con la select (che nell'edit di cluster non compariva perché non necessario)
- Nella pagina di elenco host il nome di ogni host è un link al suo edit, e c'è anche un bottone di editing (da capire poi se si vogliono mantenere entrambi per dare flessibilità, o tenerne uno solo per semplificare l'interfaccia)
- Poi mi sono dedicato a scrivere un po' di test per l'app
- Attualmente ci sono 12 test che fanno alcune prove per le due view principali:
actions_ajax
(che dà l'elenco delle action per un cluster o un host) eaction_ajax
(che fa l'action richiesta sul cluster o sull'host). - I test usano
MockTree
ovviamente, per non "sporcare" il database in uso di octofussd, e ho cercato di separare i test in classi diverse, secondo la view che testano.
I test riguardano il funzionamento solo via AJAX, e il verbo giusto (solo GET per actions_ajax
e solo POST per action_ajax
), e i vari tipi di response nei vari casi (ad esempio action_ajax
dà 500 se si fa una POST AJAX a una action che non esiste, eccetera).
Mancano da aggiungere dei test, ma ora che c'è un draft di testsuite per l'app non dovrebbe essere troppo difficoltoso.
E sicuramente ci vorrà review della parte di frontend e di backend, e un po' di UI love.
Updated by Mark Caglienzi over 7 years ago
- Mergiato master via via per non rimanere troppo disallineato
- Refactoring dei test di host in modo da avere mixin per far girare i test delle view actions e action su host e cluster
- Aggiunta di qualche test
- Aggiunta di bottoni back (con referrer) alla UI
- Fix di qualche bug trovato oggi (ad esempio nella view action per le action di tipo freeform, che prendeva il valore da kwargs anziché da POST (e quindi di fatto era sempre vuoto))
- Problema visto oggi in serata e quindi da indagare: il test aggiunto riguardo alla creazione di un host in un cluster sembra dire che il codice non funzioni a dovere (ci sono delle print di debug nel test relativo), mentre provare ad aggiungere un host a un cluster nella UI sembra funzionare (probabilmente è un bug di MockTree?)
Codice pushato nel branch t71
Updated by Mark Caglienzi over 7 years ago
- Status changed from In elaborazione to Commenti
- Assignee changed from Mark Caglienzi to Christopher R. Gabriel
- App host mergiata in master
- Aggiunti i campi relativi alle action di tipo completion (necessarie per l'editing di host)
- Le completion sono state implementate come select, popolate via AJAX da una view che restituisce il risultato di
candidate
nel tree della action, con l'aggiunta di una voce "vuota" con stringa "-----" (si può anche scegliere di mettere una stringa tipo "Please select..." ma dato che la cosa è implementata nel fileactions.js
bisognerà passare la stringa tradotta tramite la view in qualche modo, visto che nei file javascript non c'è accesso al sottosistema django di i18n. - A tutte le select è stato aggiunto il supporto alla ricerca con select2 (in fondo a
actions.js
) - La scrittura dei test è stata momentaneamente accantonata per permettere di avere l'app provabile e agevolare i feedback. In un secondo momento si potranno scrivere i test dopo validazione del funzionamento.
- Piccoli fix vari
Updated by Christopher R. Gabriel over 7 years ago
- Status changed from Commenti to Chiuso
Ok, chiudo per aprire ticket specifici.
Add draft host app. refs: #71