Initial Commit ...
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
|
||||
### FILE: C:\Users\hkhazaeeasl\Documents\Projets\xRMAWorkspace\xUiExt\src\index.html
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="fa" dir="rtl">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>افزونه من</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Segoe UI', sans-serif;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
#result {
|
||||
margin-top: 15px;
|
||||
font-weight: bold;
|
||||
color: #107c10;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h2>👋 سلام از افزونه من!</h2>
|
||||
<p>اطلاعات پروژه جاری:</p>
|
||||
<div id="result">در حال اتصال...</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
### FILE: C:\Users\hkhazaeeasl\Documents\Projets\xRMAWorkspace\xUiExt\src\index.ts
|
||||
|
||||
import * as SDK from "azure-devops-extension-sdk";
|
||||
import { CommonServiceIds, IProjectPageService } from "azure-devops-extension-api";
|
||||
|
||||
async function initialize() {
|
||||
// ۱. مقداردهی اولیه — همیشه اولین قدم
|
||||
await SDK.init();
|
||||
|
||||
// ۲. انتظار برای آماده شدن SDK — قبل از هر فراخوانی دیگر
|
||||
await SDK.ready();
|
||||
|
||||
// ۳. اکنون امن است که سرویسها را فراخوانی کنید
|
||||
const projectService = await SDK.getService<IProjectPageService>(
|
||||
CommonServiceIds.ProjectPageService
|
||||
);
|
||||
const project = await projectService.getProject();
|
||||
|
||||
// ۴. نمایش نتیجه در صفحه
|
||||
const el = document.getElementById("result");
|
||||
if (el) {
|
||||
el.textContent = `پروژه جاری: ${project?.name ?? "نامشخص"}`;
|
||||
}
|
||||
|
||||
// ۵. اطلاعدادن به میزبان که بارگذاری کامل شد
|
||||
SDK.notifyLoadSucceeded();
|
||||
}
|
||||
|
||||
initialize().catch((err) => {
|
||||
console.error("خطا در راهاندازی افزونه:", err);
|
||||
const el = document.getElementById("result");
|
||||
if (el) el.textContent = "خطا در اتصال به Azure DevOps";
|
||||
});
|
||||
Reference in New Issue
Block a user