Muhammad Labeeb f14516793e
Fix UI bugs and add new features
* fix ui bugs

* fix warning on plugin enable

* add tooltip

* change install icon

* stop autoscroll on user scroll

* add separate js for logs scrolling

* redirect to marketplace from plugins detail page

* home page goes to installed plugins

* add tab for local launch

* add simple toast

* add toast

* show toast after command completed

* fix toast ui

* add toast after local launch

* add cancel button

* change naming

* separate pagination handlers

* refractor plugins installed

* remove repitition of modal

* rename local launch

* fix toast on mobile

* hide pagination if not required

* disable auto remove toast

* remove ask local launch flag

* use success message instead of exit code

* show enable toggle after installation is completed

* update page button dynamically

* fix typo local launch

* remove repeating declaration

* dynamic cancel button on local launch

* refresh redirects to plugin store

* fix toast error

* remove sysmodules pop

* fix alignment

* add advanced tab

* add advanced tab

* add click dependency

* move autocomplete to tutorclient

* fix make command typo

* ui enhancements

* improve advenced tab search bar

* make plugins card clickable

* add enabled disabled to marketplce

* add dynamic search

* update comments

* move warning js to proper template

* only 1 modal button

* fix missing modal button

* config multi set

* add command to logs, prevent multiple toasts on pages with logs

* do not display repeated toast for anything

* fix local launch cancellation

* change icons

* small ui fixes

* my plugins now clickable

* single function for execution cancellation

* switch fix

* reset log creation logic

* single config update button

* move toast logic to frontend

* just values in config fields

* fix checkbox value error

* add htmx indicator

* no toast for plugin disable

* separate toast manager

* update only changed config items

* fix templated value updates

* rename launch platform

* change dropdown style

* do not run commands if thread is alive

* fix warning

* cancelling local launch does not remove warning cookies

* resolve js code comments

* do not show toast when last log file is null

* allow cancellation even after page reload

* update shared template context

* create separate utils

* single view for set and unset

* add plugin name to url

* fix cancel button

* adjust modal size
2025-03-24 18:59:29 +05:00

98 lines
3.1 KiB
HTML

{% extends "_base_header.html" %}
{% block page_title %}
Advanced Mode
{% endblock %}
{% block page_description %}
Search for any tutor command and execute it with a single click.
{% endblock %}
{% block page_button %}
{% endblock %}
{% block searchbar %}
{% endblock %}
{% block warning %}
{% endblock %}
{% set sidebar_active_tab = "advanced" %}
{% block workspace_content %}
<div class="command-input">
<form method="post" action="{{ url_for('command') }}">
<input type="text" id="command" name="command" placeholder="Type a command..." autocomplete="off">
<button type="submit" class="run-command-button">Run Command</button>
<button hx-post="{{ url_for('cli_stop')}}" hx-trigger="click" hx-swap="none" class="cancel-command-button" type="button">Cancel</button>
</form>
</div>
<div class="suggestions hidden" id="suggestions"></div>
{% endblock %}
{% block scripts %}
<script>
runCommandButton = document.querySelector('.run-command-button')
cancelCommandButton = document.querySelector('.cancel-command-button')
function ShowRunCommandButton(){
runCommandButton.style.display = 'block';
cancelCommandButton.style.display = 'none';
}
function ShowCancelCommandButton(){
runCommandButton.style.display = 'none';
cancelCommandButton.style.display = 'block';
}
ShowRunCommandButton();
const commandInput = document.getElementById('command');
const suggestionsElement = document.getElementById('suggestions');
commandInput.addEventListener('input', async () => {
const command = commandInput.value;
if (command){
suggestionsElement.classList.remove('hidden');
const response = await fetch('/suggest', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ command })
});
const suggestions = await response.json();
// Display suggestions
suggestionsElement.innerHTML = '';
suggestions.forEach(suggestion => {
const div = document.createElement('div');
div.textContent = suggestion.text;
div.addEventListener('click', () => {
// When a suggestion is clicked, update the input
commandInput.value = command.substring(0, command.lastIndexOf(' ') + 1) + div.textContent;
commandInput.focus();
suggestionsElement.innerHTML = '';
});
suggestionsElement.appendChild(div);
});
} else {
suggestionsElement.classList.add('hidden');
}
});
commandInput.addEventListener('focus', () => {
suggestionsElement.classList.remove('hidden');
});
commandInput.addEventListener('blur', () => {
setTimeout(() => {
suggestionsElement.classList.add('hidden');
}, 200);
});
</script>
<script src="{{ url_for('static', filename='js/logs.js') }}"></script>
{% endblock %}