@@ -18,7 +13,13 @@
{{ codeItem }}
-
+
@@ -48,6 +49,7 @@ export default {
mouseIsDown: false,
mouseMoved: false,
expanded: false,
+ lastPos: 0,
};
},
computed: {
@@ -61,6 +63,18 @@ export default {
return this.expanded ? ["fas", "compress-alt"] : ["fas", "expand-alt"];
},
},
+ updated() {
+ try {
+ var codeDiv = this.$el.querySelector(".code");
+ if (codeDiv.scrollTop + codeDiv.offsetHeight >= this.lastPos - 5) {
+ // scroll is at the bottom
+ codeDiv.scrollTop = codeDiv.scrollHeight;
+ }
+ this.lastPos = codeDiv.scrollHeight;
+ } catch (exception) {
+ console.debug("Code div is not present");
+ }
+ },
methods: {
toggleExpanded() {
this.mouseIsDown = false;
@@ -80,4 +94,8 @@ export default {
padding: 0;
margin: 0;
}
+.code {
+ max-height: 50em;
+ overflow: auto;
+}
diff --git a/client/src/components/JobInformation/JobInformation.test.js b/client/src/components/JobInformation/JobInformation.test.js
index df8448c4d1dd..8cc65b9499c3 100644
--- a/client/src/components/JobInformation/JobInformation.test.js
+++ b/client/src/components/JobInformation/JobInformation.test.js
@@ -1,32 +1,45 @@
+import "tests/jest/mockHelpPopovers";
+
import { mount } from "@vue/test-utils";
-import axios from "axios";
-import MockAdapter from "axios-mock-adapter";
import flushPromises from "flush-promises";
import { getLocalVue } from "tests/jest/helpers";
-import JobInformation from "./JobInformation";
+import { useServerMock } from "@/api/client/__mocks__";
+
import jobResponse from "./testData/jobInformationResponse.json";
+import JobInformation from "./JobInformation.vue";
+
jest.mock("app");
const JOB_ID = "test_id";
const localVue = getLocalVue();
+const { server, http } = useServerMock();
+
describe("JobInformation/JobInformation.vue", () => {
let wrapper;
let jobInfoTable;
- let axiosMock;
beforeEach(() => {
- axiosMock = new MockAdapter(axios);
- axiosMock.onGet(new RegExp(`api/configuration/decode/*`)).reply(200, { decoded_id: 123 });
- axiosMock.onGet("/api/jobs/test_id?full=True").reply(200, jobResponse);
- axiosMock.onGet("/api/invocations?job_id=test_id").reply(200, []);
- });
-
- afterEach(() => {
- axiosMock.restore();
+ server.use(
+ http.get("/api/configuration/decode/{encoded_id}", ({ response }) => {
+ return response(200).json({ decoded_id: 123 });
+ }),
+ http.get("/api/jobs/{job_id}", ({ response }) => {
+ return response(200).json(jobResponse);
+ }),
+ http.get("/api/invocations", ({ response }) => {
+ return response(200).json([]);
+ }),
+ http.get("/api/jobs/{job_id}/console_output", ({ response }) => {
+ return response(200).json({
+ stdout: "stdout",
+ stderr: "stderr",
+ });
+ })
+ );
});
const verifyValues = (rendered_entries, infoTable, backendResponse) => {
diff --git a/client/src/components/JobInformation/JobInformation.vue b/client/src/components/JobInformation/JobInformation.vue
index 085cf6fec0bb..22871692e6fe 100644
--- a/client/src/components/JobInformation/JobInformation.vue
+++ b/client/src/components/JobInformation/JobInformation.vue
@@ -1,19 +1,21 @@
|