4
0

ExecutionButton.js 880 B

12345678910111213141516171819202122232425262728293031323334
  1. import { ExecutionFeedbackButton } from './ExecutionFeedbackButton.js'
  2. class ExecutionButton extends ExecutionFeedbackButton {
  3. constructFromJson (json) {
  4. this.executionTrackingId = json
  5. this.ellapsed = 0
  6. this.appendChild(document.createElement('button'))
  7. this.isWaiting = true
  8. this.setAttribute('id', 'execution-' + json)
  9. this.btn = this.querySelector('button')
  10. this.btn.innerText = 'Executing...'
  11. this.btn.onclick = () => {
  12. this.show()
  13. }
  14. this.domTitle = this.btn
  15. }
  16. show () {
  17. window.executionDialog.reset()
  18. window.executionDialog.show()
  19. window.executionDialog.fetchExecutionResult(this.executionTrackingId)
  20. }
  21. onExecStatusChanged () {
  22. this.domTitle.innerText = this.ellapsed + 's'
  23. this.btn.title = this.ellapsed + ' seconds'
  24. }
  25. }
  26. window.customElements.define('execution-button', ExecutionButton)