Edit task
Phase: ربط الواجهة بالأتمتة
Start execution
Project OS prepares everything from this task's context. You review a short summary before anything runs.
A run is already in progress for this project. Finish or cancel it before starting a new one.
Execution packages
برمجة زر الفحص وتشغيل الأتمتة
DraftRepository: /app/storage/projects/cmtyf2rsm0001n5d1dyzrjw9q/repo
View / edit
## Task
برمجة زر الفحص وتشغيل الأتمتة
كتابة كود JavaScript لربط زر 'فحص المواقع الآن' لإرسال طلب تشغيل الأتمتة إلى n8n، وانتظار استلام النتائج عبر نظام Callback الخاص بـ Project OS.
Current phase: ربط الواجهة بالأتمتة
Project context: مراقب حالة المواقع — تطبيق ويب عربي بسيط وحديث باسم "مراقب حالة المواقع"
## Project requirements (authoritative)
The full project description below is the authoritative requirement source. Concrete values it specifies (site URLs, names, labels, texts) are part of the deliverable — never substitute placeholder or example values (e.g. example.com) for them.
أنشئ تطبيق ويب عربي بسيط وحديث باسم "مراقب حالة المواقع".
الهدف من المشروع هو مراقبة حالة ثلاثة مواقع:
1. Project OS
https://projectos.smvapp.cloud
2. n8n
https://n8n.smvapp.cloud
3. Student Tutor
https://student.smvapp.cloud
الواجهة باللغة العربية وباتجاه RTL.
تحتوي الصفحة على عنوان:
"مراقب حالة المواقع"
ووصف قصير:
"تحقق من حالة خدماتك ومواقعك من مكان واحد."
اعرض المواقع الثلاثة في بطاقات واضحة وجميلة.
كل بطاقة تعرض:
- اسم الموقع
- حالة الموقع: يعمل / متوقف / لم يتم الفحص بعد
- HTTP Status عند توفره
- وقت آخر فحص
أضف زرًا رئيسيًا واضحًا:
"فحص المواقع الآن"
المطلوب أن يكون فحص المواقع Automation حقيقية عبر n8n، وليس محاكاة داخل JavaScript.
عند طلب الفحص:
Project OS يشغّل Automation في n8n.
n8n يقوم بإجراء HTTP Request حقيقي للمواقع الثلاثة.
ثم يعيد نتائج الفحص إلى Project OS عبر نظام Automation/Callback الموجود.
بعد اكتمال Automation يجب أن يتمكن Project OS من إظهار نتيجة التشغيل وحالة نجاحه أو فشله.
لا تستخدم بيانات وهمية لإثبات نجاح الفحص.
لا تعتبر المشروع ناجحًا إذا كانت الواجهة فقط تعمل بدون تنفيذ n8n الحقيقي.
التصميم:
- حديث وبسيط
- متجاوب مع الهاتف والحاسوب
- بطاقات مرتبة
- ألوان واضحة لحالات النجاح والفشل
- RTL كامل
- لا تضف صفحات أو خصائص غير ضرورية
هذا مشروع اختبار صغير، لذلك حافظ على الخطة قصيرة ومتناسبة مع حجمه.
الهدف الأساسي هو إثبات الاستخدام الحقيقي لتكامل Project OS مع n8n داخل مشروع فعلي.
## Deliverable quality baseline (applies to user-facing output)
If this task produces or changes anything the user sees in a browser, the result must look deliberately crafted — never scaffold-like or raw default markup:
- Clear visual hierarchy: a real page structure with headings, grouping and whitespace — not a bare dump of unstyled elements.
- Deliberate typography and spacing: readable font sizes and line-height, consistent padding/margins; interactive controls (buttons, inputs, links) must be visibly styled, never browser-default only.
- A coherent, restrained color palette (background, text, accent) with accessible contrast.
- Responsive layout: the page must stay usable on a narrow (mobile) viewport.
- Interactions must genuinely work: every control the description asks for performs the requested behavior, and purely local behavior (e.g. a confirmation/status message on click) is implemented client-side — no external service is needed for simple local feedback.
- Accessibility basics: semantic HTML, labels for inputs, alt text for images.
- Arabic/RTL correctness: the document must set lang="ar" and dir="rtl", declare UTF-8 charset, and use natural Arabic wording and typography (no machine-stiff phrasing, no reversed or Latin-mixed layout artifacts).
This is a minimum quality floor, not a template: keep full creative freedom in design, layout and copy.
## Native automation (use this instead of building your own backend)
Native automation available for this project (Project OS platform capability).
A managed backend automation of kind 'site.check' is already provisioned for this project.
Use it from the browser via these SAME-ORIGIN endpoints (fetch, JSON):
- POST /api/app/automations/<automationId>/run body: {"sites":[{"url":"https://…","label":"…"}]}
→ 200 {runId} | 400 {error} | 404 {error} | 429 {error}. Sites: 1..20, https public hostnames only.
- GET /api/app/automations/runs/<runId> → {status, error?, result?}
status: PENDING | RUNNING | SUCCEEDED | FAILED; result = {kind:'site.check', summary, results:[{url,label?,ok,statusCode?,latencyMs?,error?}]}.
Poll the run endpoint every ~2s while status is PENDING/RUNNING (timeout ~120s), then render per-site results.
STRICT RULES:
- Check EXACTLY the target sites the project's requirements define. Never substitute invented placeholder or example domains (e.g. example.com) for the project's real targets.
- NEVER render or build fields for webhook URLs, callback URLs, tokens, credentials, run ids of the platform, or any n8n concept. The end user must never see infrastructure.
- NEVER POST to any other host from the app; the automation is invoked exclusively through the run endpoint above.
- While a run is RUNNING show a friendly 'checking…' state; on FAILED show the run's error string and per-site results if present. Never fake results.
- The <automationId> above is a stable id for this project's automation; store it as a constant, not as user input.
Acceptance criteria:
- Implement the task: برمجة زر الفحص وتشغيل الأتمتة
- Cover the task description above.
- Keep the change scoped to what this task needs.
- Do not introduce secrets or credentials in code.
- Leave the repository in a consistent state (no stray debug output).
- User-facing output must satisfy the deliverable quality baseline above (deliberate styling, responsive layout, working interactions).
- The deliverable must be a correct Arabic RTL document (lang="ar", dir="rtl", UTF-8) with polished Arabic content.Runs
- Approvedclaude · exit 0
ملاحظة واحدة لم أغيّرها عمدًا: نص خطأ الموقع يظهر كما ورد من الأتمتة (مثل `getaddrinfo ENOTFOUND…`) — هذا هو الخطأ الحقيقي وليس بيانات وهمية، وقد طلبت المتطلبات عرضه كما هو عند الفشل. إن أردت إحاطته بصياغة عربية ألطف مع إظهار التفصيل التقني تحته، أستطيع إضافة ذلك.
Repository used by this run- Repository:
- /app/storage/projects/cmtyf2rsm0001n5d1dyzrjw9q/repo
- Branch:
- main
- Baseline commit:
- 566d83836b7f3b09d7e21c821d88a13c0572d2d4
Applied to source repository: 29feec26e6afsha256:060fcc08bbdd
- Awaiting reviewclaude · exit 0
لم أستطع اختبار نقطة النهاية الفعلية من بيئة العمل هذه — لا يوجد خادم محلي ولا `curl`، ونقطة الأتمتة تعمل من أصل نفس الصفحة فقط داخل Project OS. التحقق أعلاه إذن يثبت منطق الواجهة والعرض، أما جولة الفحص الحقيقية عبر n8n فتجري بمجرد ضغط الزر داخل بيئة الاستضافة.
Repository used by this run- Repository:
- /app/storage/projects/cmtyf2rsm0001n5d1dyzrjw9q/repo
- Branch:
- main
- Baseline commit:
- 566d83836b7f3b09d7e21c821d88a13c0572d2d4
Changed files (0)
This run produced no file changes.
- Approvedopencode · exit 0
**التحقق**: اختبار وظيفي كامل (18/18 ✓) عبر محاكاة DOM ونقاط النهاية: دورة ناجحة، فشل بنتائج جزئية، PENDING ثم نجاح، فشل بلا نتائج، 400/429/انقطاع شبكة، ومهلة الاستقصاء. والمستند عربي RTL صحيح (`lang="ar"`, `dir="rtl"`, UTF-8) بتنسيق متجاوب ونفس نظام الألوان السابق.
Repository used by this run- Repository:
- /app/storage/projects/cmtyf2rsm0001n5d1dyzrjw9q/repo
- Branch:
- main
- Baseline commit:
- 3a78aef4faedd39fc2bf022f065423fe1a79fb4f
Applied to source repository: 4432d42fa6ffsha256:1fdfdea95ff7
- Awaiting reviewopencode · exit 0Repository used by this run
- Repository:
- /app/storage/projects/cmtyf2rsm0001n5d1dyzrjw9q/repo
- Branch:
- main
- Baseline commit:
- 3a78aef4faedd39fc2bf022f065423fe1a79fb4f
Changed files (0)
This run produced no file changes.
- Approvedclaude · exit 0
**التحقق:** فحص الصياغة بـ `node --check`، واختبار حي لخمس مسارات (تسليح الانتظار، تجاهل `runId` قديم، استلام عبر Callback، فشل الشبكة، استجابة مباشرة) — كلها نجحت. الوثيقة تحافظ على `lang="ar"` و`dir="rtl"` وUTF-8 مع تنسيق متجاوب ونصوص عربية طبيعية.
Repository used by this run- Repository:
- /app/storage/projects/cmtyf2rsm0001n5d1dyzrjw9q/repo
- Branch:
- main
- Baseline commit:
- 38b7b4ff00d582843d15cb094b51252b52ef6c10
Applied to source repository: f2af127718bfsha256:239d27e1d0ff