Spaces:
Running
Running
Download components/process.js from idhyksi097/quantumos-hypervisor: direct link, hf CLI and curl.
- Browser
- Download file 3.96 kB
-
https://huggingface.co/spaces/idhyksi097/quantumos-hypervisor/resolve/main/components/process.js
- Command line
-
hf download hf://spaces/idhyksi097/quantumos-hypervisor/components/process.js
-
curl -L -o process.js https://huggingface.co/spaces/idhyksi097/quantumos-hypervisor/resolve/main/components/process.js
3.96 kB
| class QuantumProcess extends HTMLElement { | |
| constructor() { | |
| super(); | |
| this.attachShadow({ mode: 'open' }); | |
| this.shadowRoot.innerHTML = ` | |
| <style> | |
| :host { | |
| display: block; | |
| background: rgba(40, 40, 60, 0.9); | |
| border-radius: 8px; | |
| padding: 15px; | |
| margin-bottom: 15px; | |
| border-left: 4px solid var(--system-accent); | |
| box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3); | |
| } | |
| .process-header { | |
| display: flex; | |
| align-items: center; | |
| margin-bottom: 10px; | |
| } | |
| .process-icon { | |
| margin-right: 10px; | |
| color: var(--system-accent); | |
| } | |
| .process-title { | |
| flex: 1; | |
| font-weight: 500; | |
| } | |
| .process-pid { | |
| opacity: 0.7; | |
| font-size: 0.8em; | |
| } | |
| .process-stats { | |
| display: flex; | |
| gap: 15px; | |
| margin-top: 10px; | |
| } | |
| .stat { | |
| display: flex; | |
| flex-direction: column; | |
| } | |
| .stat-value { | |
| font-weight: 500; | |
| } | |
| .stat-label { | |
| font-size: 0.7em; | |
| opacity: 0.7; | |
| } | |
| .process-controls { | |
| display: flex; | |
| gap: 10px; | |
| margin-top: 15px; | |
| } | |
| .control-btn { | |
| padding: 5px 10px; | |
| border-radius: 4px; | |
| border: none; | |
| cursor: pointer; | |
| font-size: 0.8em; | |
| } | |
| .suspend { | |
| background: var(--system-warning); | |
| } | |
| .terminate { | |
| background: var(--system-danger); | |
| } | |
| </style> | |
| <div class="process-header"> | |
| <i class="process-icon fas fa-microchip"></i> | |
| <div class="process-title"><slot name="name"></slot></div> | |
| <div class="process-pid">PID: <slot name="pid"></slot></div> | |
| </div> | |
| <div class="process-stats"> | |
| <div class="stat"> | |
| <span class="stat-value"><slot name="cpu">0%</slot></span> | |
| <span class="stat-label">CPU</span> | |
| </div> | |
| <div class="stat"> | |
| <span class="stat-value"><slot name="memory">0MB</slot></span> | |
| <span class="stat-label">Memory</span> | |
| </div> | |
| <div class="stat"> | |
| <span class="stat-value"><slot name="uptime">00:00</slot></span> | |
| <span class="stat-label">Uptime</span> | |
| </div> | |
| </div> | |
| <div class="process-controls"> | |
| <button class="control-btn suspend">Suspend</button> | |
| <button class="control-btn terminate">Terminate</button> | |
| </div> | |
| `; | |
| } | |
| connectedCallback() { | |
| this.shadowRoot.querySelector('.terminate').addEventListener('click', () => { | |
| this.dispatchEvent(new CustomEvent('terminate', { | |
| bubbles: true, | |
| composed: true, | |
| detail: { pid: this.getAttribute('data-pid') } | |
| })); | |
| }); | |
| } | |
| } | |
| customElements.define('quantum-process', QuantumProcess); |