Initial Commit ...
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
|
||||
### FILE: C:\Users\hkhazaeeasl\Documents\Projets\xRMAWorkspace\xUiExt\index.html
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Simple Extension</title> <!-- بارگذاری SDK رسمی Azure DevOps -->
|
||||
<script src="./js/SDK.min.js"></script>
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Segoe UI', sans-serif;
|
||||
padding: 20px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #0078d4;
|
||||
border-bottom: 2px solid #eee;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.info-card {
|
||||
background: #f8f9fa;
|
||||
padding: 15px;
|
||||
border-radius: 6px;
|
||||
margin-top: 20px;
|
||||
border-left: 4px solid #0078d4;
|
||||
}
|
||||
|
||||
button {
|
||||
background: #0078d4;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 10px 20px;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background: #005a9e;
|
||||
}
|
||||
|
||||
#result {
|
||||
margin-top: 15px;
|
||||
font-weight: bold;
|
||||
color: #107c10;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<h2>👋 سلام از افزونه من!</h2>
|
||||
<p>این یک افزونه ساده است که اطلاعات پروژه جاری را نمایش میدهد.</p> <button id="btnGetInfo">دریافت اطلاعات
|
||||
پروژه</button>
|
||||
<div id="result"></div>
|
||||
<div class="info-card"> <strong>وضعیت اتصال:</strong> <span id="status">در حال初始化...</span> </div>
|
||||
</div>
|
||||
<script src="./js/app.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -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