Skip to content

Agent Zero AI framework

improve: email config UI use project dropdown, toggle, trash icon with confirm, standard button styles

linuztxd91fb6c666ac
diff --git a/plugins/_email_integration/webui/config.html b/plugins/_email_integration/webui/config.html
index eb9cacf0a..21b9ce6c3 100644
--- a/plugins/_email_integration/webui/config.html
+++ b/plugins/_email_integration/webui/config.html
@@ -9,6 +9,14 @@
editing: null,
testing: null,
test_results: null,
+ projects: [],
+ async init() {
+ try {
+ const { callJsonApi } = await import('/js/api.js');
+ const res = await callJsonApi('projects', { action: 'list' });
+ this.projects = res.data || [];
+ } catch (e) { this.projects = []; }
+ },
add_handler() {
if (!config.handlers) config.handlers = [];
config.handlers.push({
@@ -77,18 +85,28 @@
<span style="font-weight: bold;" x-text="handler.name"></span>
<span style="opacity: 0.6; margin-left: 8px;" x-text="handler.enabled ? 'Enabled' : 'Disabled'"></span>
</div>
- <div style="display: flex; gap: 8px; align-items: center;">
- <label @click.stop style="display: flex; align-items: center; gap: 4px;">
- <input type="checkbox" x-model="handler.enabled" />
- </label>
- <button class="btn-cancel" @click.stop="remove_handler(idx)" style="padding: 2px 10px; font-size: 0.8rem;">Remove</button>
- </div>
+ <button class="btn btn-action delete" @click.stop="$confirmClick($event, () => remove_handler(idx))" title="Remove handler">
+ <span class="material-symbols-outlined">delete</span>
+ </button>
</div>
<!-- Expanded editor -->
<template x-if="editing === idx">
<div style="margin-top: 16px;">
+ <div class="field">
+ <div class="field-label">
+ <div class="field-title">Enabled</div>
+ <div class="field-description">Enable or disable inbox polling for this handler</div>
+ </div>
+ <div class="field-control">
+ <label class="toggle">
+ <input type="checkbox" x-model="handler.enabled" />
+ <span class="toggler"></span>
+ </label>
+ </div>
+ </div>
+
<div class="field">
<div class="field-label">
<div class="field-title">Handler Name</div>
@@ -228,10 +246,15 @@
<div class="field">
<div class="field-label">
<div class="field-title">Project</div>
- <div class="field-description">Project to activate for email chats (optional)</div>
+ <div class="field-description">Project to activate for email chats</div>
</div>
<div class="field-control">
- <input type="text" x-model="handler.project" placeholder="my-project" />
+ <select x-model="handler.project">
+ <option value="">No project</option>
+ <template x-for="proj in projects" :key="proj.name">
+ <option :value="proj.name" x-text="proj.title || proj.name"></option>
+ </template>
+ </select>
</div>
</div>
@@ -270,9 +293,8 @@
<!-- Test connection -->
<div style="margin-top: 12px; display: flex; align-items: center; gap: 12px;">
- <button class="btn-cancel" @click.stop="test_connection(idx)"
- :disabled="testing === idx"
- style="padding: 4px 16px; font-size: 0.85rem;">
+ <button class="btn btn-field" @click.stop="test_connection(idx)"
+ :disabled="testing === idx">
<span x-show="testing !== idx">Test Connection</span>
<span x-show="testing === idx">Testing...</span>
</button>
@@ -298,7 +320,7 @@
</div>
</template>
- <button class="btn-cancel" @click="add_handler()" style="margin-top: 8px; padding: 4px 16px; font-size: 0.85rem;">
+ <button class="btn btn-field" @click="add_handler()" style="margin-top: 8px;">
Add Handler
</button>
</div>