feat(dashboard): add npm version update notification

- Add /api/version-check endpoint to check npm registry for updates
- Create version-check.js component with update banner UI
- Add CSS styles for version update banner
- Fix hook manager button event handling (use e.currentTarget)
- Bump version to 6.1.2

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
catlog22
2025-12-09 14:36:34 +08:00
parent eb1093128e
commit 1267c8d0f4
6 changed files with 425 additions and 10 deletions

View File

@@ -330,9 +330,10 @@ function attachHookEventListeners() {
// Edit buttons
document.querySelectorAll('.hook-card button[data-action="edit"]').forEach(btn => {
btn.addEventListener('click', (e) => {
const scope = e.target.dataset.scope;
const event = e.target.dataset.event;
const index = parseInt(e.target.dataset.index);
const button = e.currentTarget;
const scope = button.dataset.scope;
const event = button.dataset.event;
const index = parseInt(button.dataset.index);
const hooks = scope === 'global' ? hookConfig.global.hooks : hookConfig.project.hooks;
const hookList = Array.isArray(hooks[event]) ? hooks[event] : [hooks[event]];
@@ -354,9 +355,10 @@ function attachHookEventListeners() {
// Delete buttons
document.querySelectorAll('.hook-card button[data-action="delete"]').forEach(btn => {
btn.addEventListener('click', async (e) => {
const scope = e.target.dataset.scope;
const event = e.target.dataset.event;
const index = parseInt(e.target.dataset.index);
const button = e.currentTarget;
const scope = button.dataset.scope;
const event = button.dataset.event;
const index = parseInt(button.dataset.index);
if (confirm(`Remove this ${event} hook?`)) {
await removeHook(scope, event, index);
@@ -367,7 +369,7 @@ function attachHookEventListeners() {
// Install project buttons
document.querySelectorAll('button[data-action="install-project"]').forEach(btn => {
btn.addEventListener('click', async (e) => {
const templateId = e.target.dataset.template;
const templateId = e.currentTarget.dataset.template;
await installHookTemplate(templateId, 'project');
});
});
@@ -375,7 +377,7 @@ function attachHookEventListeners() {
// Install global buttons
document.querySelectorAll('button[data-action="install-global"]').forEach(btn => {
btn.addEventListener('click', async (e) => {
const templateId = e.target.dataset.template;
const templateId = e.currentTarget.dataset.template;
await installHookTemplate(templateId, 'global');
});
});
@@ -383,7 +385,7 @@ function attachHookEventListeners() {
// Uninstall buttons
document.querySelectorAll('button[data-action="uninstall"]').forEach(btn => {
btn.addEventListener('click', async (e) => {
const templateId = e.target.dataset.template;
const templateId = e.currentTarget.dataset.template;
await uninstallHookTemplate(templateId);
});
});