Add minimal add-in playgrounds and orchestrator
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 81 B |
Binary file not shown.
|
After Width: | Height: | Size: 81 B |
Binary file not shown.
|
After Width: | Height: | Size: 81 B |
Binary file not shown.
|
After Width: | Height: | Size: 81 B |
@@ -0,0 +1,16 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Commands</title>
|
||||
<script src="https://appsforoffice.microsoft.com/lib/1.1/hosted/office.js" type="text/javascript"></script>
|
||||
<script>
|
||||
Office.onReady(function() { console.log('Commands page Office.onReady'); });
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Commands placeholder</h2>
|
||||
<p>This file is referenced by the manifest and is not used for the minimal sample.</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,8 @@
|
||||
body{ font-family: Segoe UI, Arial, Helvetica, sans-serif; background:#fff; color:#111; }
|
||||
.container{ padding:18px; width:380px }
|
||||
header h1{ margin:6px 0 4px; font-size:18px }
|
||||
.muted{ color:#666; font-size:12px; margin-bottom:12px }
|
||||
.primary{ display:inline-block; background:#0078d4; color:#fff; padding:10px 14px; border-radius:6px; border:0; cursor:pointer; font-size:14px }
|
||||
#status{ margin-top:12px; font-size:13px }
|
||||
#status .ok{ color:green }
|
||||
#status .err{ color:crimson }
|
||||
@@ -0,0 +1,30 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Minimal Playground Add-in</title>
|
||||
<link rel="stylesheet" href="/taskpane.css" />
|
||||
<!-- Office.js is REQUIRED for Office Add-ins -->
|
||||
<script src="https://appsforoffice.microsoft.com/lib/1.1/hosted/office.js" type="text/javascript"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<header>
|
||||
<h1>Minimal Playground Add-in</h1>
|
||||
<p class="muted">One button → generates Managers Info PDF & uploads to SharePoint</p>
|
||||
</header>
|
||||
|
||||
<main>
|
||||
<button id="uploadBtn" class="primary">Upload Managers Info</button>
|
||||
<div id="status" aria-live="polite"></div>
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
<small>Dev only — runs locally against the playground server</small>
|
||||
</footer>
|
||||
</div>
|
||||
<script src="/taskpane.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,30 @@
|
||||
// Minimal add-in taskpane script — one button that calls the playground server
|
||||
// Wait for Office to be ready before attaching event handlers
|
||||
Office.onReady(function(info) {
|
||||
// info.host will be 'Excel' when running in Excel
|
||||
console.log('Office.onReady fired, host:', info.host);
|
||||
|
||||
const uploadBtn = document.getElementById('uploadBtn');
|
||||
const status = document.getElementById('status');
|
||||
|
||||
function setStatus(text, ok) {
|
||||
status.innerHTML = '<div class="' + (ok ? 'ok' : 'err') + '">' + text + '</div>';
|
||||
}
|
||||
|
||||
uploadBtn.addEventListener('click', async function() {
|
||||
uploadBtn.disabled = true;
|
||||
setStatus('Starting upload...');
|
||||
try {
|
||||
const res = await fetch('http://localhost:3002/api/upload-managers', { method: 'POST' });
|
||||
const json = await res.json();
|
||||
if (!res.ok) throw new Error(json && json.error ? json.error : 'Unknown response');
|
||||
var link = (json.result && json.result.share && json.result.share.link) ? json.result.share.link.webUrl : 'unknown';
|
||||
setStatus('Upload finished. Share link: ' + link, true);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
setStatus('Upload failed: ' + (err.message || err), false);
|
||||
} finally {
|
||||
uploadBtn.disabled = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user