🐛 Reset host removal button on cancel

master
Tiana Lemesle 2 years ago
parent 0cff0bb951
commit cba4e51cc4
  1. 9
      lib/tui/index.js

@ -212,10 +212,15 @@ const getViews = screen => {
const selectedHostText = text(undefined, undefined, selectedHostForm);
const selectedHostActions = flexContainer({ top: 2, width: 75 }, selectedHostForm);
const cancelButton = button({ content: 'Cancel' }, undefined, selectedHostActions);
const connectButton = button({ content: 'Connect' }, { color: 'green' }, selectedHostActions);
button({ content: 'Edit' }, undefined, selectedHostActions)
.on('press', () => callback({ action: 'edit', host: selectedHost }));
const removeButton = button({ content: 'Remove' }, { color: 'yellow' }, selectedHostActions);
cancelButton.on('press', () => {
selectedHostForm.hide();
screen.render();
hostsTable.focus();
removeButton.setContent('Remove');
});
hostsTable.rows.on('select', (undefined, index) => {
selectedHost = hosts[index];
@ -224,15 +229,11 @@ const getViews = screen => {
screen.render();
cancelButton.focus();
});
const connectButton = button({ content: 'Connect' }, { color: 'green' }, selectedHostActions)
connectButton.on('press', () => {
connectButton.setContent('Connecting');
screen.render();
callback({ action: 'connect', host: selectedHost });
});
button({ content: 'Edit' }, undefined, selectedHostActions)
.on('press', () => callback({ action: 'edit', host: selectedHost }));
const removeButton = button({ content: 'Remove' }, { color: 'yellow' }, selectedHostActions);
removeButton.on('press', () => {
if(removeButton.content === 'Remove'){
removeButton.setContent('Confirm');

Loading…
Cancel
Save