You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RepoActionView.vue 26KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861
  1. <script>
  2. import {SvgIcon} from '../svg.js';
  3. import ActionRunStatus from './ActionRunStatus.vue';
  4. import {createApp} from 'vue';
  5. import {toggleElem} from '../utils/dom.js';
  6. import {formatDatetime} from '../utils/time.js';
  7. import {renderAnsi} from '../render/ansi.js';
  8. import {GET, POST, DELETE} from '../modules/fetch.js';
  9. const sfc = {
  10. name: 'RepoActionView',
  11. components: {
  12. SvgIcon,
  13. ActionRunStatus,
  14. },
  15. props: {
  16. runIndex: String,
  17. jobIndex: String,
  18. actionsURL: String,
  19. locale: Object,
  20. },
  21. data() {
  22. return {
  23. // internal state
  24. loading: false,
  25. intervalID: null,
  26. currentJobStepsStates: [],
  27. artifacts: [],
  28. onHoverRerunIndex: -1,
  29. menuVisible: false,
  30. isFullScreen: false,
  31. timeVisible: {
  32. 'log-time-stamp': false,
  33. 'log-time-seconds': false,
  34. },
  35. // provided by backend
  36. run: {
  37. link: '',
  38. title: '',
  39. status: '',
  40. canCancel: false,
  41. canApprove: false,
  42. canRerun: false,
  43. done: false,
  44. jobs: [
  45. // {
  46. // id: 0,
  47. // name: '',
  48. // status: '',
  49. // canRerun: false,
  50. // duration: '',
  51. // },
  52. ],
  53. commit: {
  54. localeCommit: '',
  55. localePushedBy: '',
  56. shortSHA: '',
  57. link: '',
  58. pusher: {
  59. displayName: '',
  60. link: '',
  61. },
  62. branch: {
  63. name: '',
  64. link: '',
  65. },
  66. },
  67. },
  68. currentJob: {
  69. title: '',
  70. detail: '',
  71. steps: [
  72. // {
  73. // summary: '',
  74. // duration: '',
  75. // status: '',
  76. // }
  77. ],
  78. },
  79. };
  80. },
  81. async mounted() {
  82. // load job data and then auto-reload periodically
  83. // need to await first loadJob so this.currentJobStepsStates is initialized and can be used in hashChangeListener
  84. await this.loadJob();
  85. this.intervalID = setInterval(this.loadJob, 1000);
  86. document.body.addEventListener('click', this.closeDropdown);
  87. this.hashChangeListener();
  88. window.addEventListener('hashchange', this.hashChangeListener);
  89. },
  90. beforeUnmount() {
  91. document.body.removeEventListener('click', this.closeDropdown);
  92. window.removeEventListener('hashchange', this.hashChangeListener);
  93. },
  94. unmounted() {
  95. // clear the interval timer when the component is unmounted
  96. // even our page is rendered once, not spa style
  97. if (this.intervalID) {
  98. clearInterval(this.intervalID);
  99. this.intervalID = null;
  100. }
  101. },
  102. methods: {
  103. // get the active container element, either the `job-step-logs` or the `job-log-list` in the `job-log-group`
  104. getLogsContainer(idx) {
  105. const el = this.$refs.logs[idx];
  106. return el._stepLogsActiveContainer ?? el;
  107. },
  108. // begin a log group
  109. beginLogGroup(idx) {
  110. const el = this.$refs.logs[idx];
  111. const elJobLogGroup = document.createElement('div');
  112. elJobLogGroup.classList.add('job-log-group');
  113. const elJobLogGroupSummary = document.createElement('div');
  114. elJobLogGroupSummary.classList.add('job-log-group-summary');
  115. const elJobLogList = document.createElement('div');
  116. elJobLogList.classList.add('job-log-list');
  117. elJobLogGroup.append(elJobLogGroupSummary);
  118. elJobLogGroup.append(elJobLogList);
  119. el._stepLogsActiveContainer = elJobLogList;
  120. },
  121. // end a log group
  122. endLogGroup(idx) {
  123. const el = this.$refs.logs[idx];
  124. el._stepLogsActiveContainer = null;
  125. },
  126. // show/hide the step logs for a step
  127. toggleStepLogs(idx) {
  128. this.currentJobStepsStates[idx].expanded = !this.currentJobStepsStates[idx].expanded;
  129. if (this.currentJobStepsStates[idx].expanded) {
  130. this.loadJob(); // try to load the data immediately instead of waiting for next timer interval
  131. }
  132. },
  133. // cancel a run
  134. cancelRun() {
  135. POST(`${this.run.link}/cancel`);
  136. },
  137. // approve a run
  138. approveRun() {
  139. POST(`${this.run.link}/approve`);
  140. },
  141. createLogLine(line, startTime, stepIndex) {
  142. const div = document.createElement('div');
  143. div.classList.add('job-log-line');
  144. div.setAttribute('id', `jobstep-${stepIndex}-${line.index}`);
  145. div._jobLogTime = line.timestamp;
  146. const lineNumber = document.createElement('a');
  147. lineNumber.classList.add('line-num', 'muted');
  148. lineNumber.textContent = line.index;
  149. lineNumber.setAttribute('href', `#jobstep-${stepIndex}-${line.index}`);
  150. div.append(lineNumber);
  151. // for "Show timestamps"
  152. const logTimeStamp = document.createElement('span');
  153. logTimeStamp.className = 'log-time-stamp';
  154. const date = new Date(parseFloat(line.timestamp * 1000));
  155. const timeStamp = formatDatetime(date);
  156. logTimeStamp.textContent = timeStamp;
  157. toggleElem(logTimeStamp, this.timeVisible['log-time-stamp']);
  158. // for "Show seconds"
  159. const logTimeSeconds = document.createElement('span');
  160. logTimeSeconds.className = 'log-time-seconds';
  161. const seconds = Math.floor(parseFloat(line.timestamp) - parseFloat(startTime));
  162. logTimeSeconds.textContent = `${seconds}s`;
  163. toggleElem(logTimeSeconds, this.timeVisible['log-time-seconds']);
  164. const logMessage = document.createElement('span');
  165. logMessage.className = 'log-msg';
  166. logMessage.innerHTML = renderAnsi(line.message);
  167. div.append(logTimeStamp);
  168. div.append(logMessage);
  169. div.append(logTimeSeconds);
  170. return div;
  171. },
  172. appendLogs(stepIndex, logLines, startTime) {
  173. for (const line of logLines) {
  174. // TODO: group support: ##[group]GroupTitle , ##[endgroup]
  175. const el = this.getLogsContainer(stepIndex);
  176. el.append(this.createLogLine(line, startTime, stepIndex));
  177. }
  178. },
  179. async fetchArtifacts() {
  180. const resp = await GET(`${this.actionsURL}/runs/${this.runIndex}/artifacts`);
  181. return await resp.json();
  182. },
  183. async deleteArtifact(name) {
  184. if (!window.confirm(this.locale.confirmDeleteArtifact.replace('%s', name))) return;
  185. await DELETE(`${this.run.link}/artifacts/${name}`);
  186. await this.loadJob();
  187. },
  188. async fetchJob() {
  189. const logCursors = this.currentJobStepsStates.map((it, idx) => {
  190. // cursor is used to indicate the last position of the logs
  191. // it's only used by backend, frontend just reads it and passes it back, it and can be any type.
  192. // for example: make cursor=null means the first time to fetch logs, cursor=eof means no more logs, etc
  193. return {step: idx, cursor: it.cursor, expanded: it.expanded};
  194. });
  195. const resp = await POST(`${this.actionsURL}/runs/${this.runIndex}/jobs/${this.jobIndex}`, {
  196. data: {logCursors},
  197. });
  198. return await resp.json();
  199. },
  200. async loadJob() {
  201. if (this.loading) return;
  202. try {
  203. this.loading = true;
  204. let job, artifacts;
  205. try {
  206. [job, artifacts] = await Promise.all([
  207. this.fetchJob(),
  208. this.fetchArtifacts(), // refresh artifacts if upload-artifact step done
  209. ]);
  210. } catch (err) {
  211. if (err instanceof TypeError) return; // avoid network error while unloading page
  212. throw err;
  213. }
  214. this.artifacts = artifacts['artifacts'] || [];
  215. // save the state to Vue data, then the UI will be updated
  216. this.run = job.state.run;
  217. this.currentJob = job.state.currentJob;
  218. // sync the currentJobStepsStates to store the job step states
  219. for (let i = 0; i < this.currentJob.steps.length; i++) {
  220. if (!this.currentJobStepsStates[i]) {
  221. // initial states for job steps
  222. this.currentJobStepsStates[i] = {cursor: null, expanded: false};
  223. }
  224. }
  225. // append logs to the UI
  226. for (const logs of job.logs.stepsLog) {
  227. // save the cursor, it will be passed to backend next time
  228. this.currentJobStepsStates[logs.step].cursor = logs.cursor;
  229. this.appendLogs(logs.step, logs.lines, logs.started);
  230. }
  231. if (this.run.done && this.intervalID) {
  232. clearInterval(this.intervalID);
  233. this.intervalID = null;
  234. }
  235. } finally {
  236. this.loading = false;
  237. }
  238. },
  239. isDone(status) {
  240. return ['success', 'skipped', 'failure', 'cancelled'].includes(status);
  241. },
  242. isExpandable(status) {
  243. return ['success', 'running', 'failure', 'cancelled'].includes(status);
  244. },
  245. closeDropdown() {
  246. if (this.menuVisible) this.menuVisible = false;
  247. },
  248. toggleTimeDisplay(type) {
  249. this.timeVisible[`log-time-${type}`] = !this.timeVisible[`log-time-${type}`];
  250. for (const el of this.$refs.steps.querySelectorAll(`.log-time-${type}`)) {
  251. toggleElem(el, this.timeVisible[`log-time-${type}`]);
  252. }
  253. },
  254. toggleFullScreen() {
  255. this.isFullScreen = !this.isFullScreen;
  256. const fullScreenEl = document.querySelector('.action-view-right');
  257. const outerEl = document.querySelector('.full.height');
  258. const actionBodyEl = document.querySelector('.action-view-body');
  259. const headerEl = document.querySelector('#navbar');
  260. const contentEl = document.querySelector('.page-content.repository');
  261. const footerEl = document.querySelector('.page-footer');
  262. toggleElem(headerEl, !this.isFullScreen);
  263. toggleElem(contentEl, !this.isFullScreen);
  264. toggleElem(footerEl, !this.isFullScreen);
  265. // move .action-view-right to new parent
  266. if (this.isFullScreen) {
  267. outerEl.append(fullScreenEl);
  268. } else {
  269. actionBodyEl.append(fullScreenEl);
  270. }
  271. },
  272. async hashChangeListener() {
  273. const selectedLogStep = window.location.hash;
  274. if (!selectedLogStep) return;
  275. const [_, step, _line] = selectedLogStep.split('-');
  276. if (!this.currentJobStepsStates[step]) return;
  277. if (!this.currentJobStepsStates[step].expanded && this.currentJobStepsStates[step].cursor === null) {
  278. this.currentJobStepsStates[step].expanded = true;
  279. // need to await for load job if the step log is loaded for the first time
  280. // so logline can be selected by querySelector
  281. await this.loadJob();
  282. }
  283. const logLine = this.$refs.steps.querySelector(selectedLogStep);
  284. if (!logLine) return;
  285. logLine.querySelector('.line-num').click();
  286. },
  287. },
  288. };
  289. export default sfc;
  290. export function initRepositoryActionView() {
  291. const el = document.getElementById('repo-action-view');
  292. if (!el) return;
  293. // TODO: the parent element's full height doesn't work well now,
  294. // but we can not pollute the global style at the moment, only fix the height problem for pages with this component
  295. const parentFullHeight = document.querySelector('body > div.full.height');
  296. if (parentFullHeight) parentFullHeight.style.paddingBottom = '0';
  297. const view = createApp(sfc, {
  298. runIndex: el.getAttribute('data-run-index'),
  299. jobIndex: el.getAttribute('data-job-index'),
  300. actionsURL: el.getAttribute('data-actions-url'),
  301. locale: {
  302. approve: el.getAttribute('data-locale-approve'),
  303. cancel: el.getAttribute('data-locale-cancel'),
  304. rerun: el.getAttribute('data-locale-rerun'),
  305. artifactsTitle: el.getAttribute('data-locale-artifacts-title'),
  306. areYouSure: el.getAttribute('data-locale-are-you-sure'),
  307. confirmDeleteArtifact: el.getAttribute('data-locale-confirm-delete-artifact'),
  308. rerun_all: el.getAttribute('data-locale-rerun-all'),
  309. showTimeStamps: el.getAttribute('data-locale-show-timestamps'),
  310. showLogSeconds: el.getAttribute('data-locale-show-log-seconds'),
  311. showFullScreen: el.getAttribute('data-locale-show-full-screen'),
  312. downloadLogs: el.getAttribute('data-locale-download-logs'),
  313. status: {
  314. unknown: el.getAttribute('data-locale-status-unknown'),
  315. waiting: el.getAttribute('data-locale-status-waiting'),
  316. running: el.getAttribute('data-locale-status-running'),
  317. success: el.getAttribute('data-locale-status-success'),
  318. failure: el.getAttribute('data-locale-status-failure'),
  319. cancelled: el.getAttribute('data-locale-status-cancelled'),
  320. skipped: el.getAttribute('data-locale-status-skipped'),
  321. blocked: el.getAttribute('data-locale-status-blocked'),
  322. },
  323. },
  324. });
  325. view.mount(el);
  326. }
  327. </script>
  328. <template>
  329. <div class="ui container action-view-container">
  330. <div class="action-view-header">
  331. <div class="action-info-summary">
  332. <div class="action-info-summary-title">
  333. <ActionRunStatus :locale-status="locale.status[run.status]" :status="run.status" :size="20"/>
  334. <h2 class="action-info-summary-title-text">
  335. {{ run.title }}
  336. </h2>
  337. </div>
  338. <button class="ui basic small compact button primary" @click="approveRun()" v-if="run.canApprove">
  339. {{ locale.approve }}
  340. </button>
  341. <button class="ui basic small compact button red" @click="cancelRun()" v-else-if="run.canCancel">
  342. {{ locale.cancel }}
  343. </button>
  344. <button class="ui basic small compact button tw-mr-0 link-action" :data-url="`${run.link}/rerun`" v-else-if="run.canRerun">
  345. {{ locale.rerun_all }}
  346. </button>
  347. </div>
  348. <div class="action-commit-summary">
  349. {{ run.commit.localeCommit }}
  350. <a class="muted" :href="run.commit.link">{{ run.commit.shortSHA }}</a>
  351. {{ run.commit.localePushedBy }}
  352. <a class="muted" :href="run.commit.pusher.link">{{ run.commit.pusher.displayName }}</a>
  353. <span class="ui label" v-if="run.commit.shortSHA">
  354. <a :href="run.commit.branch.link">{{ run.commit.branch.name }}</a>
  355. </span>
  356. </div>
  357. </div>
  358. <div class="action-view-body">
  359. <div class="action-view-left">
  360. <div class="job-group-section">
  361. <div class="job-brief-list">
  362. <a class="job-brief-item" :href="run.link+'/jobs/'+index" :class="parseInt(jobIndex) === index ? 'selected' : ''" v-for="(job, index) in run.jobs" :key="job.id" @mouseenter="onHoverRerunIndex = job.id" @mouseleave="onHoverRerunIndex = -1">
  363. <div class="job-brief-item-left">
  364. <ActionRunStatus :locale-status="locale.status[job.status]" :status="job.status"/>
  365. <span class="job-brief-name tw-mx-2 gt-ellipsis">{{ job.name }}</span>
  366. </div>
  367. <span class="job-brief-item-right">
  368. <SvgIcon name="octicon-sync" role="button" :data-tooltip-content="locale.rerun" class="job-brief-rerun tw-mx-2 link-action" :data-url="`${run.link}/jobs/${index}/rerun`" v-if="job.canRerun && onHoverRerunIndex === job.id"/>
  369. <span class="step-summary-duration">{{ job.duration }}</span>
  370. </span>
  371. </a>
  372. </div>
  373. </div>
  374. <div class="job-artifacts" v-if="artifacts.length > 0">
  375. <div class="job-artifacts-title">
  376. {{ locale.artifactsTitle }}
  377. </div>
  378. <ul class="job-artifacts-list">
  379. <li class="job-artifacts-item" v-for="artifact in artifacts" :key="artifact.name">
  380. <a class="job-artifacts-link" target="_blank" :href="run.link+'/artifacts/'+artifact.name">
  381. <SvgIcon name="octicon-file" class="ui text black job-artifacts-icon"/>{{ artifact.name }}
  382. </a>
  383. <a v-if="run.canDeleteArtifact" @click="deleteArtifact(artifact.name)" class="job-artifacts-delete">
  384. <SvgIcon name="octicon-trash" class="ui text black job-artifacts-icon"/>
  385. </a>
  386. </li>
  387. </ul>
  388. </div>
  389. </div>
  390. <div class="action-view-right">
  391. <div class="job-info-header">
  392. <div class="job-info-header-left">
  393. <h3 class="job-info-header-title">
  394. {{ currentJob.title }}
  395. </h3>
  396. <p class="job-info-header-detail">
  397. {{ currentJob.detail }}
  398. </p>
  399. </div>
  400. <div class="job-info-header-right">
  401. <div class="ui top right pointing dropdown custom jump item" @click.stop="menuVisible = !menuVisible" @keyup.enter="menuVisible = !menuVisible">
  402. <button class="btn gt-interact-bg tw-p-2">
  403. <SvgIcon name="octicon-gear" :size="18"/>
  404. </button>
  405. <div class="menu transition action-job-menu" :class="{visible: menuVisible}" v-if="menuVisible" v-cloak>
  406. <a class="item" @click="toggleTimeDisplay('seconds')">
  407. <i class="icon"><SvgIcon :name="timeVisible['log-time-seconds'] ? 'octicon-check' : 'gitea-empty-checkbox'"/></i>
  408. {{ locale.showLogSeconds }}
  409. </a>
  410. <a class="item" @click="toggleTimeDisplay('stamp')">
  411. <i class="icon"><SvgIcon :name="timeVisible['log-time-stamp'] ? 'octicon-check' : 'gitea-empty-checkbox'"/></i>
  412. {{ locale.showTimeStamps }}
  413. </a>
  414. <a class="item" @click="toggleFullScreen()">
  415. <i class="icon"><SvgIcon :name="isFullScreen ? 'octicon-check' : 'gitea-empty-checkbox'"/></i>
  416. {{ locale.showFullScreen }}
  417. </a>
  418. <div class="divider"/>
  419. <a :class="['item', !currentJob.steps.length ? 'disabled' : '']" :href="run.link+'/jobs/'+jobIndex+'/logs'" target="_blank">
  420. <i class="icon"><SvgIcon name="octicon-download"/></i>
  421. {{ locale.downloadLogs }}
  422. </a>
  423. </div>
  424. </div>
  425. </div>
  426. </div>
  427. <div class="job-step-container" ref="steps" v-if="currentJob.steps.length">
  428. <div class="job-step-section" v-for="(jobStep, i) in currentJob.steps" :key="i">
  429. <div class="job-step-summary" @click.stop="isExpandable(jobStep.status) && toggleStepLogs(i)" :class="[currentJobStepsStates[i].expanded ? 'selected' : '', isExpandable(jobStep.status) && 'step-expandable']">
  430. <!-- If the job is done and the job step log is loaded for the first time, show the loading icon
  431. currentJobStepsStates[i].cursor === null means the log is loaded for the first time
  432. -->
  433. <SvgIcon v-if="isDone(run.status) && currentJobStepsStates[i].expanded && currentJobStepsStates[i].cursor === null" name="octicon-sync" class="tw-mr-2 job-status-rotate"/>
  434. <SvgIcon v-else :name="currentJobStepsStates[i].expanded ? 'octicon-chevron-down': 'octicon-chevron-right'" :class="['tw-mr-2', !isExpandable(jobStep.status) && 'tw-invisible']"/>
  435. <ActionRunStatus :status="jobStep.status" class="tw-mr-2"/>
  436. <span class="step-summary-msg gt-ellipsis">{{ jobStep.summary }}</span>
  437. <span class="step-summary-duration">{{ jobStep.duration }}</span>
  438. </div>
  439. <!-- the log elements could be a lot, do not use v-if to destroy/reconstruct the DOM,
  440. use native DOM elements for "log line" to improve performance, Vue is not suitable for managing so many reactive elements. -->
  441. <div class="job-step-logs" ref="logs" v-show="currentJobStepsStates[i].expanded"/>
  442. </div>
  443. </div>
  444. </div>
  445. </div>
  446. </div>
  447. </template>
  448. <style scoped>
  449. .action-view-body {
  450. padding-top: 12px;
  451. padding-bottom: 12px;
  452. display: flex;
  453. gap: 12px;
  454. }
  455. /* ================ */
  456. /* action view header */
  457. .action-view-header {
  458. margin-top: 8px;
  459. }
  460. .action-info-summary {
  461. display: flex;
  462. align-items: center;
  463. justify-content: space-between;
  464. }
  465. .action-info-summary-title {
  466. display: flex;
  467. }
  468. .action-info-summary-title-text {
  469. font-size: 20px;
  470. margin: 0 0 0 8px;
  471. flex: 1;
  472. }
  473. .action-commit-summary {
  474. display: flex;
  475. gap: 5px;
  476. margin: 0 0 0 28px;
  477. }
  478. /* ================ */
  479. /* action view left */
  480. .action-view-left {
  481. width: 30%;
  482. max-width: 400px;
  483. position: sticky;
  484. top: 12px;
  485. max-height: 100vh;
  486. overflow-y: auto;
  487. }
  488. .job-artifacts-title {
  489. font-size: 18px;
  490. margin-top: 16px;
  491. padding: 16px 10px 0 20px;
  492. border-top: 1px solid var(--color-secondary);
  493. }
  494. .job-artifacts-item {
  495. margin: 5px 0;
  496. padding: 6px;
  497. display: flex;
  498. justify-content: space-between;
  499. }
  500. .job-artifacts-list {
  501. padding-left: 12px;
  502. list-style: none;
  503. }
  504. .job-artifacts-icon {
  505. padding-right: 3px;
  506. }
  507. .job-brief-list {
  508. display: flex;
  509. flex-direction: column;
  510. gap: 8px;
  511. }
  512. .job-brief-item {
  513. padding: 10px;
  514. border-radius: var(--border-radius);
  515. text-decoration: none;
  516. display: flex;
  517. flex-wrap: nowrap;
  518. justify-content: space-between;
  519. align-items: center;
  520. color: var(--color-text);
  521. }
  522. .job-brief-item:hover {
  523. background-color: var(--color-hover);
  524. }
  525. .job-brief-item.selected {
  526. font-weight: var(--font-weight-bold);
  527. background-color: var(--color-active);
  528. }
  529. .job-brief-item:first-of-type {
  530. margin-top: 0;
  531. }
  532. .job-brief-item .job-brief-rerun {
  533. cursor: pointer;
  534. transition: transform 0.2s;
  535. }
  536. .job-brief-item .job-brief-rerun:hover {
  537. transform: scale(130%);
  538. }
  539. .job-brief-item .job-brief-item-left {
  540. display: flex;
  541. width: 100%;
  542. min-width: 0;
  543. }
  544. .job-brief-item .job-brief-item-left span {
  545. display: flex;
  546. align-items: center;
  547. }
  548. .job-brief-item .job-brief-item-left .job-brief-name {
  549. display: block;
  550. width: 70%;
  551. }
  552. .job-brief-item .job-brief-item-right {
  553. display: flex;
  554. align-items: center;
  555. }
  556. /* ================ */
  557. /* action view right */
  558. .action-view-right {
  559. flex: 1;
  560. color: var(--color-console-fg-subtle);
  561. max-height: 100%;
  562. width: 70%;
  563. display: flex;
  564. flex-direction: column;
  565. border: 1px solid var(--color-console-border);
  566. border-radius: var(--border-radius);
  567. background: var(--color-console-bg);
  568. align-self: flex-start;
  569. }
  570. /* begin fomantic button overrides */
  571. .action-view-right .ui.button,
  572. .action-view-right .ui.button:focus {
  573. background: transparent;
  574. color: var(--color-console-fg-subtle);
  575. }
  576. .action-view-right .ui.button:hover {
  577. background: var(--color-console-hover-bg);
  578. color: var(--color-console-fg);
  579. }
  580. .action-view-right .ui.button:active {
  581. background: var(--color-console-active-bg);
  582. color: var(--color-console-fg);
  583. }
  584. /* end fomantic button overrides */
  585. /* begin fomantic dropdown menu overrides */
  586. .action-view-right .ui.dropdown .menu {
  587. background: var(--color-console-menu-bg);
  588. border-color: var(--color-console-menu-border);
  589. }
  590. .action-view-right .ui.dropdown .menu > .item {
  591. color: var(--color-console-fg);
  592. }
  593. .action-view-right .ui.dropdown .menu > .item:hover {
  594. color: var(--color-console-fg);
  595. background: var(--color-console-hover-bg);
  596. }
  597. .action-view-right .ui.dropdown .menu > .item:active {
  598. color: var(--color-console-fg);
  599. background: var(--color-console-active-bg);
  600. }
  601. .action-view-right .ui.dropdown .menu > .divider {
  602. border-top-color: var(--color-console-menu-border);
  603. }
  604. .action-view-right .ui.pointing.dropdown > .menu:not(.hidden)::after {
  605. background: var(--color-console-menu-bg);
  606. box-shadow: -1px -1px 0 0 var(--color-console-menu-border);
  607. }
  608. /* end fomantic dropdown menu overrides */
  609. .job-info-header {
  610. display: flex;
  611. justify-content: space-between;
  612. align-items: center;
  613. padding: 0 12px;
  614. position: sticky;
  615. top: 0;
  616. height: 60px;
  617. z-index: 1;
  618. }
  619. .job-info-header:has(+ .job-step-container) {
  620. border-radius: var(--border-radius) var(--border-radius) 0 0;
  621. }
  622. .job-info-header .job-info-header-title {
  623. color: var(--color-console-fg);
  624. font-size: 16px;
  625. margin: 0;
  626. }
  627. .job-info-header .job-info-header-detail {
  628. color: var(--color-console-fg-subtle);
  629. font-size: 12px;
  630. }
  631. .job-step-container {
  632. max-height: 100%;
  633. border-radius: 0 0 var(--border-radius) var(--border-radius);
  634. border-top: 1px solid var(--color-console-border);
  635. z-index: 0;
  636. }
  637. .job-step-container .job-step-summary {
  638. padding: 5px 10px;
  639. display: flex;
  640. align-items: center;
  641. border-radius: var(--border-radius);
  642. }
  643. .job-step-container .job-step-summary.step-expandable {
  644. cursor: pointer;
  645. }
  646. .job-step-container .job-step-summary.step-expandable:hover {
  647. color: var(--color-console-fg);
  648. background-color: var(--color-console-hover-bg);
  649. }
  650. .job-step-container .job-step-summary .step-summary-msg {
  651. flex: 1;
  652. }
  653. .job-step-container .job-step-summary .step-summary-duration {
  654. margin-left: 16px;
  655. }
  656. .job-step-container .job-step-summary.selected {
  657. color: var(--color-console-fg);
  658. background-color: var(--color-console-active-bg);
  659. position: sticky;
  660. top: 60px;
  661. }
  662. @media (max-width: 768px) {
  663. .action-view-body {
  664. flex-direction: column;
  665. }
  666. .action-view-left, .action-view-right {
  667. width: 100%;
  668. }
  669. .action-view-left {
  670. max-width: none;
  671. overflow-y: hidden;
  672. }
  673. }
  674. </style>
  675. <style>
  676. /* some elements are not managed by vue, so we need to use global style */
  677. .job-status-rotate {
  678. animation: job-status-rotate-keyframes 1s linear infinite;
  679. }
  680. @keyframes job-status-rotate-keyframes {
  681. 100% {
  682. transform: rotate(-360deg);
  683. }
  684. }
  685. .job-step-section {
  686. margin: 10px;
  687. }
  688. .job-step-section .job-step-logs {
  689. font-family: var(--fonts-monospace);
  690. margin: 8px 0;
  691. font-size: 12px;
  692. }
  693. .job-step-section .job-step-logs .job-log-line {
  694. display: flex;
  695. }
  696. .job-log-line:hover,
  697. .job-log-line:target {
  698. background-color: var(--color-console-hover-bg);
  699. }
  700. .job-log-line:target {
  701. scroll-margin-top: 95px;
  702. }
  703. /* class names 'log-time-seconds' and 'log-time-stamp' are used in the method toggleTimeDisplay */
  704. .job-log-line .line-num, .log-time-seconds {
  705. width: 48px;
  706. color: var(--color-text-light-3);
  707. text-align: right;
  708. user-select: none;
  709. }
  710. .job-log-line:target > .line-num {
  711. color: var(--color-primary);
  712. text-decoration: underline;
  713. }
  714. .log-time-seconds {
  715. padding-right: 2px;
  716. }
  717. .job-log-line .log-time,
  718. .log-time-stamp {
  719. color: var(--color-text-light-3);
  720. margin-left: 10px;
  721. white-space: nowrap;
  722. }
  723. .job-step-section .job-step-logs .job-log-line .log-msg {
  724. flex: 1;
  725. word-break: break-all;
  726. white-space: break-spaces;
  727. margin-left: 10px;
  728. }
  729. /* selectors here are intentionally exact to only match fullscreen */
  730. .full.height > .action-view-right {
  731. width: 100%;
  732. height: 100%;
  733. padding: 0;
  734. border-radius: 0;
  735. }
  736. .full.height > .action-view-right > .job-info-header {
  737. border-radius: 0;
  738. }
  739. .full.height > .action-view-right > .job-step-container {
  740. height: calc(100% - 60px);
  741. border-radius: 0;
  742. }
  743. /* TODO: group support
  744. .job-log-group {
  745. }
  746. .job-log-group-summary {
  747. }
  748. .job-log-list {
  749. } */
  750. </style>