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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856
  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. closeDropdown() {
  243. if (this.menuVisible) this.menuVisible = false;
  244. },
  245. toggleTimeDisplay(type) {
  246. this.timeVisible[`log-time-${type}`] = !this.timeVisible[`log-time-${type}`];
  247. for (const el of this.$refs.steps.querySelectorAll(`.log-time-${type}`)) {
  248. toggleElem(el, this.timeVisible[`log-time-${type}`]);
  249. }
  250. },
  251. toggleFullScreen() {
  252. this.isFullScreen = !this.isFullScreen;
  253. const fullScreenEl = document.querySelector('.action-view-right');
  254. const outerEl = document.querySelector('.full.height');
  255. const actionBodyEl = document.querySelector('.action-view-body');
  256. const headerEl = document.querySelector('#navbar');
  257. const contentEl = document.querySelector('.page-content.repository');
  258. const footerEl = document.querySelector('.page-footer');
  259. toggleElem(headerEl, !this.isFullScreen);
  260. toggleElem(contentEl, !this.isFullScreen);
  261. toggleElem(footerEl, !this.isFullScreen);
  262. // move .action-view-right to new parent
  263. if (this.isFullScreen) {
  264. outerEl.append(fullScreenEl);
  265. } else {
  266. actionBodyEl.append(fullScreenEl);
  267. }
  268. },
  269. async hashChangeListener() {
  270. const selectedLogStep = window.location.hash;
  271. if (!selectedLogStep) return;
  272. const [_, step, _line] = selectedLogStep.split('-');
  273. if (!this.currentJobStepsStates[step]) return;
  274. if (!this.currentJobStepsStates[step].expanded && this.currentJobStepsStates[step].cursor === null) {
  275. this.currentJobStepsStates[step].expanded = true;
  276. // need to await for load job if the step log is loaded for the first time
  277. // so logline can be selected by querySelector
  278. await this.loadJob();
  279. }
  280. const logLine = this.$refs.steps.querySelector(selectedLogStep);
  281. if (!logLine) return;
  282. logLine.querySelector('.line-num').click();
  283. },
  284. },
  285. };
  286. export default sfc;
  287. export function initRepositoryActionView() {
  288. const el = document.getElementById('repo-action-view');
  289. if (!el) return;
  290. // TODO: the parent element's full height doesn't work well now,
  291. // but we can not pollute the global style at the moment, only fix the height problem for pages with this component
  292. const parentFullHeight = document.querySelector('body > div.full.height');
  293. if (parentFullHeight) parentFullHeight.style.paddingBottom = '0';
  294. const view = createApp(sfc, {
  295. runIndex: el.getAttribute('data-run-index'),
  296. jobIndex: el.getAttribute('data-job-index'),
  297. actionsURL: el.getAttribute('data-actions-url'),
  298. locale: {
  299. approve: el.getAttribute('data-locale-approve'),
  300. cancel: el.getAttribute('data-locale-cancel'),
  301. rerun: el.getAttribute('data-locale-rerun'),
  302. artifactsTitle: el.getAttribute('data-locale-artifacts-title'),
  303. areYouSure: el.getAttribute('data-locale-are-you-sure'),
  304. confirmDeleteArtifact: el.getAttribute('data-locale-confirm-delete-artifact'),
  305. rerun_all: el.getAttribute('data-locale-rerun-all'),
  306. showTimeStamps: el.getAttribute('data-locale-show-timestamps'),
  307. showLogSeconds: el.getAttribute('data-locale-show-log-seconds'),
  308. showFullScreen: el.getAttribute('data-locale-show-full-screen'),
  309. downloadLogs: el.getAttribute('data-locale-download-logs'),
  310. status: {
  311. unknown: el.getAttribute('data-locale-status-unknown'),
  312. waiting: el.getAttribute('data-locale-status-waiting'),
  313. running: el.getAttribute('data-locale-status-running'),
  314. success: el.getAttribute('data-locale-status-success'),
  315. failure: el.getAttribute('data-locale-status-failure'),
  316. cancelled: el.getAttribute('data-locale-status-cancelled'),
  317. skipped: el.getAttribute('data-locale-status-skipped'),
  318. blocked: el.getAttribute('data-locale-status-blocked'),
  319. },
  320. },
  321. });
  322. view.mount(el);
  323. }
  324. </script>
  325. <template>
  326. <div class="ui container action-view-container">
  327. <div class="action-view-header">
  328. <div class="action-info-summary">
  329. <div class="action-info-summary-title">
  330. <ActionRunStatus :locale-status="locale.status[run.status]" :status="run.status" :size="20"/>
  331. <h2 class="action-info-summary-title-text">
  332. {{ run.title }}
  333. </h2>
  334. </div>
  335. <button class="ui basic small compact button primary" @click="approveRun()" v-if="run.canApprove">
  336. {{ locale.approve }}
  337. </button>
  338. <button class="ui basic small compact button red" @click="cancelRun()" v-else-if="run.canCancel">
  339. {{ locale.cancel }}
  340. </button>
  341. <button class="ui basic small compact button gt-mr-0 link-action" :data-url="`${run.link}/rerun`" v-else-if="run.canRerun">
  342. {{ locale.rerun_all }}
  343. </button>
  344. </div>
  345. <div class="action-commit-summary">
  346. {{ run.commit.localeCommit }}
  347. <a class="muted" :href="run.commit.link">{{ run.commit.shortSHA }}</a>
  348. {{ run.commit.localePushedBy }}
  349. <a class="muted" :href="run.commit.pusher.link">{{ run.commit.pusher.displayName }}</a>
  350. <span class="ui label" v-if="run.commit.shortSHA">
  351. <a :href="run.commit.branch.link">{{ run.commit.branch.name }}</a>
  352. </span>
  353. </div>
  354. </div>
  355. <div class="action-view-body">
  356. <div class="action-view-left">
  357. <div class="job-group-section">
  358. <div class="job-brief-list">
  359. <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">
  360. <div class="job-brief-item-left">
  361. <ActionRunStatus :locale-status="locale.status[job.status]" :status="job.status"/>
  362. <span class="job-brief-name gt-mx-3 gt-ellipsis">{{ job.name }}</span>
  363. </div>
  364. <span class="job-brief-item-right">
  365. <SvgIcon name="octicon-sync" role="button" :data-tooltip-content="locale.rerun" class="job-brief-rerun gt-mx-3 link-action" :data-url="`${run.link}/jobs/${index}/rerun`" v-if="job.canRerun && onHoverRerunIndex === job.id"/>
  366. <span class="step-summary-duration">{{ job.duration }}</span>
  367. </span>
  368. </a>
  369. </div>
  370. </div>
  371. <div class="job-artifacts" v-if="artifacts.length > 0">
  372. <div class="job-artifacts-title">
  373. {{ locale.artifactsTitle }}
  374. </div>
  375. <ul class="job-artifacts-list">
  376. <li class="job-artifacts-item" v-for="artifact in artifacts" :key="artifact.name">
  377. <a class="job-artifacts-link" target="_blank" :href="run.link+'/artifacts/'+artifact.name">
  378. <SvgIcon name="octicon-file" class="ui text black job-artifacts-icon"/>{{ artifact.name }}
  379. </a>
  380. <a v-if="run.canDeleteArtifact" @click="deleteArtifact(artifact.name)" class="job-artifacts-delete">
  381. <SvgIcon name="octicon-trash" class="ui text black job-artifacts-icon"/>
  382. </a>
  383. </li>
  384. </ul>
  385. </div>
  386. </div>
  387. <div class="action-view-right">
  388. <div class="job-info-header">
  389. <div class="job-info-header-left">
  390. <h3 class="job-info-header-title">
  391. {{ currentJob.title }}
  392. </h3>
  393. <p class="job-info-header-detail">
  394. {{ currentJob.detail }}
  395. </p>
  396. </div>
  397. <div class="job-info-header-right">
  398. <div class="ui top right pointing dropdown custom jump item" @click.stop="menuVisible = !menuVisible" @keyup.enter="menuVisible = !menuVisible">
  399. <button class="btn gt-interact-bg gt-p-3">
  400. <SvgIcon name="octicon-gear" :size="18"/>
  401. </button>
  402. <div class="menu transition action-job-menu" :class="{visible: menuVisible}" v-if="menuVisible" v-cloak>
  403. <a class="item" @click="toggleTimeDisplay('seconds')">
  404. <i class="icon"><SvgIcon :name="timeVisible['log-time-seconds'] ? 'octicon-check' : 'gitea-empty-checkbox'"/></i>
  405. {{ locale.showLogSeconds }}
  406. </a>
  407. <a class="item" @click="toggleTimeDisplay('stamp')">
  408. <i class="icon"><SvgIcon :name="timeVisible['log-time-stamp'] ? 'octicon-check' : 'gitea-empty-checkbox'"/></i>
  409. {{ locale.showTimeStamps }}
  410. </a>
  411. <a class="item" @click="toggleFullScreen()">
  412. <i class="icon"><SvgIcon :name="isFullScreen ? 'octicon-check' : 'gitea-empty-checkbox'"/></i>
  413. {{ locale.showFullScreen }}
  414. </a>
  415. <div class="divider"/>
  416. <a :class="['item', currentJob.steps.length === 0 ? 'disabled' : '']" :href="run.link+'/jobs/'+jobIndex+'/logs'" target="_blank">
  417. <i class="icon"><SvgIcon name="octicon-download"/></i>
  418. {{ locale.downloadLogs }}
  419. </a>
  420. </div>
  421. </div>
  422. </div>
  423. </div>
  424. <div class="job-step-container" ref="steps" v-if="currentJob.steps.length">
  425. <div class="job-step-section" v-for="(jobStep, i) in currentJob.steps" :key="i">
  426. <div class="job-step-summary" @click.stop="toggleStepLogs(i)" :class="currentJobStepsStates[i].expanded ? 'selected' : ''">
  427. <!-- If the job is done and the job step log is loaded for the first time, show the loading icon
  428. currentJobStepsStates[i].cursor === null means the log is loaded for the first time
  429. -->
  430. <SvgIcon v-if="isDone(run.status) && currentJobStepsStates[i].expanded && currentJobStepsStates[i].cursor === null" name="octicon-sync" class="gt-mr-3 job-status-rotate"/>
  431. <SvgIcon v-else :name="currentJobStepsStates[i].expanded ? 'octicon-chevron-down': 'octicon-chevron-right'" class="gt-mr-3"/>
  432. <ActionRunStatus :status="jobStep.status" class="gt-mr-3"/>
  433. <span class="step-summary-msg gt-ellipsis">{{ jobStep.summary }}</span>
  434. <span class="step-summary-duration">{{ jobStep.duration }}</span>
  435. </div>
  436. <!-- the log elements could be a lot, do not use v-if to destroy/reconstruct the DOM,
  437. use native DOM elements for "log line" to improve performance, Vue is not suitable for managing so many reactive elements. -->
  438. <div class="job-step-logs" ref="logs" v-show="currentJobStepsStates[i].expanded"/>
  439. </div>
  440. </div>
  441. </div>
  442. </div>
  443. </div>
  444. </template>
  445. <style scoped>
  446. .action-view-body {
  447. padding-top: 12px;
  448. padding-bottom: 12px;
  449. display: flex;
  450. gap: 12px;
  451. }
  452. /* ================ */
  453. /* action view header */
  454. .action-view-header {
  455. margin-top: 8px;
  456. }
  457. .action-info-summary {
  458. display: flex;
  459. align-items: center;
  460. justify-content: space-between;
  461. }
  462. .action-info-summary-title {
  463. display: flex;
  464. }
  465. .action-info-summary-title-text {
  466. font-size: 20px;
  467. margin: 0 0 0 8px;
  468. flex: 1;
  469. }
  470. .action-commit-summary {
  471. display: flex;
  472. gap: 5px;
  473. margin: 0 0 0 28px;
  474. }
  475. /* ================ */
  476. /* action view left */
  477. .action-view-left {
  478. width: 30%;
  479. max-width: 400px;
  480. position: sticky;
  481. top: 12px;
  482. max-height: 100vh;
  483. overflow-y: auto;
  484. }
  485. .job-artifacts-title {
  486. font-size: 18px;
  487. margin-top: 16px;
  488. padding: 16px 10px 0 20px;
  489. border-top: 1px solid var(--color-secondary);
  490. }
  491. .job-artifacts-item {
  492. margin: 5px 0;
  493. padding: 6px;
  494. display: flex;
  495. justify-content: space-between;
  496. }
  497. .job-artifacts-list {
  498. padding-left: 12px;
  499. list-style: none;
  500. }
  501. .job-artifacts-icon {
  502. padding-right: 3px;
  503. }
  504. .job-brief-list {
  505. display: flex;
  506. flex-direction: column;
  507. gap: 8px;
  508. }
  509. .job-brief-item {
  510. padding: 10px;
  511. border-radius: var(--border-radius);
  512. text-decoration: none;
  513. display: flex;
  514. flex-wrap: nowrap;
  515. justify-content: space-between;
  516. align-items: center;
  517. color: var(--color-text);
  518. }
  519. .job-brief-item:hover {
  520. background-color: var(--color-hover);
  521. }
  522. .job-brief-item.selected {
  523. font-weight: var(--font-weight-bold);
  524. background-color: var(--color-active);
  525. }
  526. .job-brief-item:first-of-type {
  527. margin-top: 0;
  528. }
  529. .job-brief-item .job-brief-rerun {
  530. cursor: pointer;
  531. transition: transform 0.2s;
  532. }
  533. .job-brief-item .job-brief-rerun:hover {
  534. transform: scale(130%);
  535. }
  536. .job-brief-item .job-brief-item-left {
  537. display: flex;
  538. width: 100%;
  539. min-width: 0;
  540. }
  541. .job-brief-item .job-brief-item-left span {
  542. display: flex;
  543. align-items: center;
  544. }
  545. .job-brief-item .job-brief-item-left .job-brief-name {
  546. display: block;
  547. width: 70%;
  548. }
  549. .job-brief-item .job-brief-item-right {
  550. display: flex;
  551. align-items: center;
  552. }
  553. /* ================ */
  554. /* action view right */
  555. .action-view-right {
  556. flex: 1;
  557. color: var(--color-console-fg-subtle);
  558. max-height: 100%;
  559. width: 70%;
  560. display: flex;
  561. flex-direction: column;
  562. border: 1px solid var(--color-console-border);
  563. border-radius: var(--border-radius);
  564. }
  565. /* begin fomantic button overrides */
  566. .action-view-right .ui.button,
  567. .action-view-right .ui.button:focus {
  568. background: transparent;
  569. color: var(--color-console-fg-subtle);
  570. }
  571. .action-view-right .ui.button:hover {
  572. background: var(--color-console-hover-bg);
  573. color: var(--color-console-fg);
  574. }
  575. .action-view-right .ui.button:active {
  576. background: var(--color-console-active-bg);
  577. color: var(--color-console-fg);
  578. }
  579. /* end fomantic button overrides */
  580. /* begin fomantic dropdown menu overrides */
  581. .action-view-right .ui.dropdown .menu {
  582. background: var(--color-console-menu-bg);
  583. border-color: var(--color-console-menu-border);
  584. }
  585. .action-view-right .ui.dropdown .menu > .item {
  586. color: var(--color-console-fg);
  587. }
  588. .action-view-right .ui.dropdown .menu > .item:hover {
  589. color: var(--color-console-fg);
  590. background: var(--color-console-hover-bg);
  591. }
  592. .action-view-right .ui.dropdown .menu > .item:active {
  593. color: var(--color-console-fg);
  594. background: var(--color-console-active-bg);
  595. }
  596. .action-view-right .ui.dropdown .menu > .divider {
  597. border-top-color: var(--color-console-menu-border);
  598. }
  599. .action-view-right .ui.pointing.dropdown > .menu:not(.hidden)::after {
  600. background: var(--color-console-menu-bg);
  601. box-shadow: -1px -1px 0 0 var(--color-console-menu-border);
  602. }
  603. /* end fomantic dropdown menu overrides */
  604. .job-info-header {
  605. display: flex;
  606. justify-content: space-between;
  607. align-items: center;
  608. padding: 0 12px;
  609. background-color: var(--color-console-bg);
  610. position: sticky;
  611. top: 0;
  612. border-radius: var(--border-radius);
  613. height: 60px;
  614. z-index: 1;
  615. }
  616. .job-info-header:has(+ .job-step-container) {
  617. border-radius: var(--border-radius) var(--border-radius) 0 0;
  618. }
  619. .job-info-header .job-info-header-title {
  620. color: var(--color-console-fg);
  621. font-size: 16px;
  622. margin: 0;
  623. }
  624. .job-info-header .job-info-header-detail {
  625. color: var(--color-console-fg-subtle);
  626. font-size: 12px;
  627. }
  628. .job-step-container {
  629. background-color: var(--color-console-bg);
  630. max-height: 100%;
  631. border-radius: 0 0 var(--border-radius) var(--border-radius);
  632. border-top: 1px solid var(--color-console-border);
  633. z-index: 0;
  634. }
  635. .job-step-container .job-step-summary {
  636. cursor: pointer;
  637. padding: 5px 10px;
  638. display: flex;
  639. align-items: center;
  640. border-radius: var(--border-radius);
  641. }
  642. .job-step-container .job-step-summary .step-summary-msg {
  643. flex: 1;
  644. }
  645. .job-step-container .job-step-summary .step-summary-duration {
  646. margin-left: 16px;
  647. }
  648. .job-step-container .job-step-summary:hover {
  649. color: var(--color-console-fg);
  650. background-color: var(--color-console-hover-bg);
  651. }
  652. .job-step-container .job-step-summary.selected {
  653. color: var(--color-console-fg);
  654. background-color: var(--color-console-active-bg);
  655. position: sticky;
  656. top: 60px;
  657. }
  658. @media (max-width: 768px) {
  659. .action-view-body {
  660. flex-direction: column;
  661. }
  662. .action-view-left, .action-view-right {
  663. width: 100%;
  664. }
  665. .action-view-left {
  666. max-width: none;
  667. overflow-y: hidden;
  668. }
  669. }
  670. </style>
  671. <style>
  672. /* some elements are not managed by vue, so we need to use global style */
  673. .job-status-rotate {
  674. animation: job-status-rotate-keyframes 1s linear infinite;
  675. }
  676. @keyframes job-status-rotate-keyframes {
  677. 100% {
  678. transform: rotate(-360deg);
  679. }
  680. }
  681. .job-step-section {
  682. margin: 10px;
  683. }
  684. .job-step-section .job-step-logs {
  685. font-family: var(--fonts-monospace);
  686. margin: 8px 0;
  687. font-size: 12px;
  688. }
  689. .job-step-section .job-step-logs .job-log-line {
  690. display: flex;
  691. }
  692. .job-log-line:hover,
  693. .job-log-line:target {
  694. background-color: var(--color-console-hover-bg);
  695. }
  696. .job-log-line:target {
  697. scroll-margin-top: 95px;
  698. }
  699. /* class names 'log-time-seconds' and 'log-time-stamp' are used in the method toggleTimeDisplay */
  700. .job-log-line .line-num, .log-time-seconds {
  701. width: 48px;
  702. color: var(--color-text-light-3);
  703. text-align: right;
  704. user-select: none;
  705. }
  706. .job-log-line:target > .line-num {
  707. color: var(--color-primary);
  708. text-decoration: underline;
  709. }
  710. .log-time-seconds {
  711. padding-right: 2px;
  712. }
  713. .job-log-line .log-time,
  714. .log-time-stamp {
  715. color: var(--color-text-light-3);
  716. margin-left: 10px;
  717. white-space: nowrap;
  718. }
  719. .job-step-section .job-step-logs .job-log-line .log-msg {
  720. flex: 1;
  721. word-break: break-all;
  722. white-space: break-spaces;
  723. margin-left: 10px;
  724. }
  725. /* selectors here are intentionally exact to only match fullscreen */
  726. .full.height > .action-view-right {
  727. width: 100%;
  728. height: 100%;
  729. padding: 0;
  730. border-radius: 0;
  731. }
  732. .full.height > .action-view-right > .job-info-header {
  733. border-radius: 0;
  734. }
  735. .full.height > .action-view-right > .job-step-container {
  736. height: calc(100% - 60px);
  737. border-radius: 0;
  738. }
  739. /* TODO: group support
  740. .job-log-group {
  741. }
  742. .job-log-group-summary {
  743. }
  744. .job-log-list {
  745. } */
  746. </style>