MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / displayAIInsights

Function displayAIInsights

web/scripts/ragnar_modern.js:15296–15372  ·  view source on GitHub ↗
(insights)

Source from the content-addressed store, hash-verified

15294
15295 } catch (error) {
15296 console.error('Error fixing git config:', error);
15297 addConsoleMessage(`Failed to fix git configuration: ${error.message}`, 'error');
15298 const updateBtn = document.getElementById('update-btn');
15299 updateBtn.disabled = false;
15300 updateElement('update-btn-text', 'Fix Git Config');
15301 }
15302}
15303
15304async function resolveGitConflicts() {
15305 return runUpdate('/api/system/resolve-conflicts', 'Repair Git State',
15306 'Clearing the conflicted state and updating...');
15307}
15308
15309async function performUpdate() {
15310 const gateApproved = await ensureReleaseGateAcknowledged();
15311 if (!gateApproved) {
15312 addConsoleMessage('Update postponed until the release window opens.', 'info');
15313 return;
15314 }
15315
15316 if (!confirm('This will update the system and restart the service. Continue?')) {
15317 return;
15318 }
15319
15320 return runUpdate('/api/system/update', 'Update System', 'Starting system update...');
15321}
15322
15323// Kept for older callers/bookmarks: dirty checkouts no longer need their own
15324// endpoint, the update path handles them.
15325async function autoStashAndUpdate() {
15326 return performUpdate();
15327}
15328
15329// One implementation behind every button that updates the box, so the progress
15330// reporting and the failure reporting cannot drift apart between them.
15331async function runUpdate(endpoint, idleLabel, startMessage) {
15332 const updateBtn = document.getElementById('update-btn');
15333
15334 const setButtonState = (busy, label) => {
15335 if (!updateBtn) {
15336 return;
15337 }
15338 updateBtn.disabled = !!busy;
15339 updateBtn.className = busy
15340 ? 'w-full bg-gray-600 text-white py-2 px-4 rounded cursor-wait'
15341 : 'w-full bg-green-600 hover:bg-green-700 text-white py-2 px-4 rounded transition-colors';
15342 updateElement('update-btn-text', label);
15343 };
15344
15345 try {
15346 setButtonState(true, 'Updating...');
15347 addConsoleMessage(startMessage, 'info');
15348 updateElement('update-info', 'Updating...');
15349
15350 const data = await postAPI(endpoint, {});
15351
15352 if (!data.success) {
15353 throw Object.assign(new Error(data.error || 'Update failed'), { payload: data });

Callers 1

loadAIInsightsFunction · 0.70

Calls 2

formatAITextFunction · 0.70
splitAIContentFunction · 0.70

Tested by

no test coverage detected