From 8c30d9d171d66a882329c4f7b3a88e64f6a56544 Mon Sep 17 00:00:00 2001 From: Suman Maity Date: Sun, 11 Aug 2024 20:44:48 +0530 Subject: [PATCH] feat: Introduce individual view preference for user without build monitor --- .../components/FailureGridCell.test.js | 11 +- .../__tests__/components/GridCell.test.js | 19 +- frontend/__tests__/components/Job.test.js | 85 ++++----- .../components/WorkflowDashboard.test.js | 41 +++-- .../__snapshots__/GridCell.test.js.snap | 142 +++++++++++---- .../WorkflowDashboard.test.js.snap | 164 +++++++++++++++--- frontend/src/components/Dashboard.vue | 19 +- frontend/src/components/FailureGridCell.vue | 5 + frontend/src/components/GridCell.vue | 16 +- frontend/src/components/Job.vue | 5 + frontend/src/components/Preferences.vue | 12 ++ frontend/src/services/preferences.js | 9 + 12 files changed, 405 insertions(+), 123 deletions(-) diff --git a/frontend/__tests__/components/FailureGridCell.test.js b/frontend/__tests__/components/FailureGridCell.test.js index 33b9b0bc..46997d1e 100644 --- a/frontend/__tests__/components/FailureGridCell.test.js +++ b/frontend/__tests__/components/FailureGridCell.test.js @@ -10,7 +10,10 @@ describe('', () => { }; }); - it('should render grid cell', () => { + it.each([ + [false], + [true] + ])('should render grid cell when buildMonitorViewEnabled = %s', (buildMonitorViewEnabled) => { const createdAt = '2022-08-15T02:20:34Z'; const name = 'test name'; @@ -22,7 +25,8 @@ describe('', () => { name, url, createdAt - } + }, + buildMonitorViewEnabled } }); @@ -37,7 +41,8 @@ describe('', () => { name, showRelativeTime: true, status: 'failure', - url + url, + buildMonitorViewEnabled }); }); }); diff --git a/frontend/__tests__/components/GridCell.test.js b/frontend/__tests__/components/GridCell.test.js index 4abb3b86..871de156 100644 --- a/frontend/__tests__/components/GridCell.test.js +++ b/frontend/__tests__/components/GridCell.test.js @@ -6,7 +6,8 @@ describe('', () => { const defaultProps = { name: 'webpack-cli :: webpack-cli :: Lint Commit Messages', url: 'https://github.com/webpack/webpack-cli/runs/7858502725', - lastExecutedTime: '2022-08-16T03:45:02.000Z' + lastExecutedTime: '2022-08-16T03:45:02.000Z', + buildMonitorViewEnabled: true }; const rootId = `${defaultProps.name.replaceAll(/[\\:\s]/g, '-')}`; @@ -41,6 +42,20 @@ describe('', () => { expect(wrapper.html()).toMatchSnapshot(); }); + it('should render grid cell when build monitor view is disabled', () => { + const wrapper = mount(GridCell, { + props: { ...defaultProps, buildMonitorViewEnabled: false } + }); + expect(wrapper.html()).toMatchSnapshot(); + }); + + it('should render in progress grid cell when build monitor view is disabled', () => { + const wrapper = mount(GridCell, { + props: { ...defaultProps, inProgress: true, buildMonitorViewEnabled: false } + }); + expect(wrapper.html()).toMatchSnapshot(); + }); + it.each([ [true, true, true], [false, true, true], @@ -59,7 +74,7 @@ describe('', () => { await requestAnimationFrameAsPromise(); expect(wrapper.find(`[test-id="${rootId}-toolbar"]`).exists()).toBeTruthy(); }); - expect(wrapper.html()).toMatchSnapshot(); + expect(wrapper.html()).toMatchSnapshot(); }); it.each([ diff --git a/frontend/__tests__/components/Job.test.js b/frontend/__tests__/components/Job.test.js index bb48fad6..3ff8dfdc 100644 --- a/frontend/__tests__/components/Job.test.js +++ b/frontend/__tests__/components/Job.test.js @@ -13,47 +13,54 @@ describe('', () => { lastBuildTime: '2022-08-15T02:20:34Z' }; - it.each([ - ['Sleeping', 'Success', false, false, false], - ['Sleeping', 'Success', true, false, false], - ['Sleeping', 'Failure', false, true, false], - ['Sleeping', 'Unknown', false, true, false], - ['Sleeping', 'Exception', false, true, false], - ['Building', 'Success', false, false, true], - ['Building', 'Failure', false, false, true], - ['Building', 'Unknown', false, false, true], - ['Building', 'Exception', false, false, true], - ['CheckingModifications', 'Success', false, false, false], - ['CheckingModifications', 'Failure', false, true, false], - ['CheckingModifications', 'Unknown', false, true, false], - ['CheckingModifications', 'Exception', false, true, false] - ])('should render job grid when activity is %s and last build status is %s and hidden is %s', - async (activity, lastBuildStatus, hidden, showRelativeTime, inProgress) => { - const wrapper = shallowMount(Job, { - props: { - content: { ...jobDetails, activity, lastBuildStatus }, - hidden - } - }); + describe.each([ + [true], + [false] + ])('when build monitor view enabled = %s', (buildMonitorViewEnabled) => { + it.each([ + ['Sleeping', 'Success', false, false, false], + ['Sleeping', 'Success', true, false, false], + ['Sleeping', 'Failure', false, true, false], + ['Sleeping', 'Unknown', false, true, false], + ['Sleeping', 'Exception', false, true, false], + ['Building', 'Success', false, false, true], + ['Building', 'Failure', false, false, true], + ['Building', 'Unknown', false, false, true], + ['Building', 'Exception', false, false, true], + ['CheckingModifications', 'Success', false, false, false], + ['CheckingModifications', 'Failure', false, true, false], + ['CheckingModifications', 'Unknown', false, true, false], + ['CheckingModifications', 'Exception', false, true, false] + ])('should render job grid when activity is %s and last build status is %s and hidden is %s', + async (activity, lastBuildStatus, hidden, showRelativeTime, inProgress) => { + const wrapper = shallowMount(Job, { + props: { + content: { ...jobDetails, activity, lastBuildStatus }, + hidden, + buildMonitorViewEnabled + } + }); - const gridCellComponent = wrapper.findComponent(GridCell); + const gridCellComponent = wrapper.findComponent(GridCell); - expect(gridCellComponent.exists()).toBeTruthy(); + expect(gridCellComponent.exists()).toBeTruthy(); - expect(gridCellComponent.props()).toEqual({ - lastExecutedTime: jobDetails.lastBuildTime, - url: jobDetails.webUrl, - name: jobDetails.name, - hidden, - displayToggleVisibility: true, - showRelativeTime, - status: lastBuildStatus, - inProgress - }); + expect(gridCellComponent.props()).toEqual({ + lastExecutedTime: jobDetails.lastBuildTime, + url: jobDetails.webUrl, + name: jobDetails.name, + hidden, + displayToggleVisibility: true, + showRelativeTime, + status: lastBuildStatus, + inProgress, + buildMonitorViewEnabled + }); - await gridCellComponent.vm.$emit('toggle-visibility', jobDetails.name); - const emitted = wrapper.emitted(); - expect(emitted).toHaveProperty('toggleVisibility'); - expect(emitted.toggleVisibility).toEqual([[jobDetails.name]]); - }); + await gridCellComponent.vm.$emit('toggle-visibility', jobDetails.name); + const emitted = wrapper.emitted(); + expect(emitted).toHaveProperty('toggleVisibility'); + expect(emitted.toggleVisibility).toEqual([[jobDetails.name]]); + }); + }); }); diff --git a/frontend/__tests__/components/WorkflowDashboard.test.js b/frontend/__tests__/components/WorkflowDashboard.test.js index b6a87594..0dc121d3 100644 --- a/frontend/__tests__/components/WorkflowDashboard.test.js +++ b/frontend/__tests__/components/WorkflowDashboard.test.js @@ -58,6 +58,7 @@ describe('', () => { beforeEach(() => { getVersion.mockReturnValueOnce('3.3.0'); + vi.spyOn(preferences, 'enableBuildMonitorView', 'get').mockReturnValueOnce(true); }); afterEach(() => { @@ -106,24 +107,30 @@ describe('', () => { }); }); - it('should render dashboard with all job details', async () => { - vi.spyOn(preferences, 'showHealthyBuilds', 'get').mockReturnValueOnce(true); - vi.spyOn(preferences, 'enableMaxIdleTimeOptimization', 'get').mockReturnValueOnce(true); - vi.spyOn(preferences, 'maxIdleTime', 'get').mockReturnValueOnce(10); - vi.spyOn(preferences, 'showBuildsDueToTriggeredEvents', 'get').mockReturnValueOnce([]); - vi.spyOn(preferences, 'hiddenElements', 'get').mockReturnValueOnce({}); + it.each([ + [true], + [false] + ])('should render dashboard with all job details when build monitor view enabled = %s', + async (buildMonitorViewEnabled) => { + vi.spyOn(preferences, 'showHealthyBuilds', 'get').mockReturnValueOnce(true); + vi.spyOn(preferences, 'enableMaxIdleTimeOptimization', 'get').mockReturnValueOnce(true); + vi.spyOn(preferences, 'maxIdleTime', 'get').mockReturnValueOnce(10); + vi.spyOn(preferences, 'showBuildsDueToTriggeredEvents', 'get').mockReturnValueOnce([]); + vi.spyOn(preferences, 'hiddenElements', 'get').mockReturnValueOnce({}); + vi.spyOn(preferences, 'enableBuildMonitorView', 'get').mockReturnValueOnce(buildMonitorViewEnabled); - fetchCctrayJson.mockResolvedValueOnce([jobDetails1, jobDetails2]); + fetchCctrayJson.mockResolvedValueOnce([jobDetails1, jobDetails2]); - const workflowDashboardWrapper = mountWithWrapper(WorkflowDashboard); + const workflowDashboardWrapper = mountWithWrapper(WorkflowDashboard); - await flushPromises(); + await flushPromises(); - const jobComponents = workflowDashboardWrapper.findAllComponents(Job); + const jobComponents = workflowDashboardWrapper.findAllComponents(Job); - expect(jobComponents).length(2); - expect(workflowDashboardWrapper.html()).toMatchSnapshot(); - }); + expect(jobComponents).length(2); + await workflowDashboardWrapper.vm.$nextTick(); + expect(workflowDashboardWrapper.html()).toMatchSnapshot(); + }); it('should hide success job details', async () => { vi.spyOn(preferences, 'showHealthyBuilds', 'get').mockReturnValueOnce(false); @@ -379,9 +386,13 @@ describe('', () => { }); describe('Timers', () => { - beforeEach(vi.useFakeTimers); + beforeEach(() => { + vi.useFakeTimers(); + }); - afterEach(vi.useRealTimers); + afterEach(() => { + vi.useRealTimers(); + }); it('should fetch data after every certain interval', async () => { vi.spyOn(preferences, 'showHealthyBuilds', 'get').mockReturnValueOnce(true); diff --git a/frontend/__tests__/components/__snapshots__/GridCell.test.js.snap b/frontend/__tests__/components/__snapshots__/GridCell.test.js.snap index 3e738ff1..e9f61138 100644 --- a/frontend/__tests__/components/__snapshots__/GridCell.test.js.snap +++ b/frontend/__tests__/components/__snapshots__/GridCell.test.js.snap @@ -19,7 +19,7 @@ exports[` > should flip back once mouse is moved away when hidden=fa -
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -50,7 +50,7 @@ exports[` > should flip back once mouse is moved away when hidden=fa -
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -92,7 +92,7 @@ exports[` > should flip back once mouse is moved away when hidden=fa -
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -123,7 +123,7 @@ exports[` > should flip back once mouse is moved away when hidden=fa -
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -165,7 +165,7 @@ exports[` > should flip back once mouse is moved away when hidden=tr -
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -196,7 +196,7 @@ exports[` > should flip back once mouse is moved away when hidden=tr -
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -238,7 +238,7 @@ exports[` > should flip back once mouse is moved away when hidden=tr -
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -269,7 +269,7 @@ exports[` > should flip back once mouse is moved away when hidden=tr -
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -311,7 +311,7 @@ exports[` > should flip on hover when hidden=false, displayToggleVis -
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -367,7 +367,7 @@ exports[` > should flip on hover when hidden=false, displayToggleVis -
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -434,7 +434,7 @@ exports[` > should flip on hover when hidden=false, displayToggleVis -
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -501,7 +501,7 @@ exports[` > should flip on hover when hidden=false, displayToggleVis -
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -579,7 +579,7 @@ exports[` > should flip on hover when hidden=true, displayToggleVisi -
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -635,7 +635,7 @@ exports[` > should flip on hover when hidden=true, displayToggleVisi -
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -702,7 +702,7 @@ exports[` > should flip on hover when hidden=true, displayToggleVisi -
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -769,7 +769,7 @@ exports[` > should flip on hover when hidden=true, displayToggleVisi -
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -828,6 +828,37 @@ exports[` > should flip on hover when hidden=true, displayToggleVisi `; +exports[` > should render grid cell when build monitor view is disabled 1`] = ` +
+ +
+ +
+ + +
webpack-cli :: webpack-cli :: Lint Commit Messages
+ + + + + + + + +
+`; + exports[` > should render grid cell when inProgress=false, status=FAILURE, hidden=undefined, displayToggleVisibility=undefined, showRelativeTime=undefined 1`] = `
@@ -847,7 +878,7 @@ exports[` > should render grid cell when inProgress=false, status=FA
-
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -878,7 +909,7 @@ exports[` > should render grid cell when inProgress=false, status=SU -
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -909,7 +940,7 @@ exports[` > should render grid cell when inProgress=false, status=fa -
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -951,7 +982,7 @@ exports[` > should render grid cell when inProgress=false, status=fa -
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -993,7 +1024,7 @@ exports[` > should render grid cell when inProgress=false, status=ra -
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -1024,7 +1055,7 @@ exports[` > should render grid cell when inProgress=false, status=su -
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -1066,7 +1097,7 @@ exports[` > should render grid cell when inProgress=false, status=su -
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -1097,7 +1128,7 @@ exports[` > should render grid cell when inProgress=false, status=un -
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -1128,7 +1159,7 @@ exports[` > should render grid cell when inProgress=false, status=un -
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -1159,7 +1190,7 @@ exports[` > should render grid cell when inProgress=true, status=FAI -
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -1198,7 +1229,7 @@ exports[` > should render grid cell when inProgress=true, status=SUC -
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -1237,7 +1268,7 @@ exports[` > should render grid cell when inProgress=true, status=fai -
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -1276,7 +1307,7 @@ exports[` > should render grid cell when inProgress=true, status=fai -
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -1326,7 +1357,7 @@ exports[` > should render grid cell when inProgress=true, status=ran -
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -1365,7 +1396,7 @@ exports[` > should render grid cell when inProgress=true, status=suc -
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -1404,7 +1435,7 @@ exports[` > should render grid cell when inProgress=true, status=suc -
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -1454,7 +1485,7 @@ exports[` > should render grid cell when inProgress=true, status=suc -
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -1493,7 +1524,7 @@ exports[` > should render grid cell when inProgress=true, status=und -
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -1532,7 +1563,7 @@ exports[` > should render grid cell when inProgress=true, status=unk -
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -1571,7 +1602,7 @@ exports[` > should render grid cell when inProgress=undefined, statu -
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -1582,3 +1613,42 @@ exports[` > should render grid cell when inProgress=undefined, statu `; + +exports[` > should render in progress grid cell when build monitor view is disabled 1`] = ` +
+ +
+ +
+ + +
webpack-cli :: webpack-cli :: Lint Commit Messages
+ + + + +
+ +
+
+ +
+
+ +
+ + + +
+`; diff --git a/frontend/__tests__/components/__snapshots__/WorkflowDashboard.test.js.snap b/frontend/__tests__/components/__snapshots__/WorkflowDashboard.test.js.snap index c7ae2e54..9082ebb3 100644 --- a/frontend/__tests__/components/__snapshots__/WorkflowDashboard.test.js.snap +++ b/frontend/__tests__/components/__snapshots__/WorkflowDashboard.test.js.snap @@ -4,7 +4,7 @@ exports[` > No contents > should show no contents when ther
-
+
@@ -124,7 +124,7 @@ exports[` > should display hidden jobs when user clicks on
-
+
@@ -144,7 +144,7 @@ exports[` > should display hidden jobs when user clicks on
-
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -189,7 +189,7 @@ exports[` > should display hidden jobs when user clicks on
-
+
@@ -209,7 +209,7 @@ exports[` > should display hidden jobs when user clicks on
-
webpack-cli :: Cancel :: Cancel Previous Runs
+
webpack-cli :: Cancel :: Cancel Previous Runs
@@ -277,7 +277,7 @@ exports[` > should hide job details depends previous config
-
+
@@ -297,7 +297,7 @@ exports[` > should hide job details depends previous config
-
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -386,7 +386,7 @@ exports[` > should hide job details when user clicks on hid
-
+
@@ -406,7 +406,7 @@ exports[` > should hide job details when user clicks on hid
-
webpack-cli :: Cancel :: Cancel Previous Runs
+
webpack-cli :: Cancel :: Cancel Previous Runs
@@ -447,7 +447,7 @@ exports[` > should hide job details when user clicks on hid
-
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -504,7 +504,7 @@ exports[` > should hide job details when user clicks on hid
-
+
@@ -524,7 +524,7 @@ exports[` > should hide job details when user clicks on hid
-
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -613,7 +613,7 @@ exports[` > should not remove hidden jobs toolbar when hidd
-
+
@@ -633,7 +633,7 @@ exports[` > should not remove hidden jobs toolbar when hidd
-
webpack-cli :: Cancel :: Cancel Previous Runs
+
webpack-cli :: Cancel :: Cancel Previous Runs
@@ -689,7 +689,7 @@ exports[` > should not remove hidden jobs toolbar when hidd
-
+
@@ -709,7 +709,7 @@ exports[` > should not remove hidden jobs toolbar when hidd
-
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -766,7 +766,7 @@ exports[` > should put hidden jobs to normal job list when
-
+
@@ -786,7 +786,7 @@ exports[` > should put hidden jobs to normal job list when
-
webpack-cli :: Cancel :: Cancel Previous Runs
+
webpack-cli :: Cancel :: Cancel Previous Runs
@@ -827,7 +827,125 @@ exports[` > should put hidden jobs to normal job list when
-
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
+ + + + + + + + +
+
+
+ + + + + + + +`; + +exports[` > should render dashboard with all job details when build monitor view enabled = false 1`] = ` +
+
+
+
+ +
+ + +
+
+
+
+ + Gitaction Board + (v3.3.0) +
+
+
+
+
+
+ + Workflow Jobs +
+
+
+
+ +
+ + + +
+ +
+
+
+
+ +
+ +
+ + +
webpack-cli :: Cancel :: Cancel Previous Runs
+ + + + + + + +
+ + +
+
+ + +
+ + + + +
+
+
+
+ +
+ +
+ + +
webpack-cli :: webpack-cli :: Lint Commit Messages
@@ -848,7 +966,7 @@ exports[` > should put hidden jobs to normal job list when
`; -exports[` > should render dashboard with all job details 1`] = ` +exports[` > should render dashboard with all job details when build monitor view enabled = true 1`] = `
@@ -884,7 +1002,7 @@ exports[` > should render dashboard with all job details 1`
-
+
@@ -904,7 +1022,7 @@ exports[` > should render dashboard with all job details 1`
-
webpack-cli :: Cancel :: Cancel Previous Runs
+
webpack-cli :: Cancel :: Cancel Previous Runs
@@ -945,7 +1063,7 @@ exports[` > should render dashboard with all job details 1`
-
webpack-cli :: webpack-cli :: Lint Commit Messages
+
webpack-cli :: webpack-cli :: Lint Commit Messages
diff --git a/frontend/src/components/Dashboard.vue b/frontend/src/components/Dashboard.vue index e7c26b74..f1a2d689 100644 --- a/frontend/src/components/Dashboard.vue +++ b/frontend/src/components/Dashboard.vue @@ -14,7 +14,7 @@ > @@ -58,7 +59,7 @@ > @@ -138,6 +140,12 @@ export default { }, hiddenContents() { return this.contents.filter(this.isHidden); + }, + buildMonitorViewEnabled() { + return preferences.enableBuildMonitorView; + }, + viewPreferenceClass() { + return this.buildMonitorViewEnabled ? 'build-monitor' : 'individual'; } }, mounted() { @@ -219,6 +227,13 @@ export default { .grid-cells { display: grid; + + &.build-monitor { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); + } + + &.individual { + grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); + } } diff --git a/frontend/src/components/FailureGridCell.vue b/frontend/src/components/FailureGridCell.vue index 5a2c67e7..69a03c44 100644 --- a/frontend/src/components/FailureGridCell.vue +++ b/frontend/src/components/FailureGridCell.vue @@ -5,6 +5,7 @@ :name="content.name" status="failure" show-relative-time + :build-monitor-view-enabled="buildMonitorViewEnabled" /> @@ -18,6 +19,10 @@ export default { content: { type: Object, required: true + }, + buildMonitorViewEnabled: { + type: Boolean, + required: true } } }; diff --git a/frontend/src/components/GridCell.vue b/frontend/src/components/GridCell.vue index b3a6041c..094c658c 100644 --- a/frontend/src/components/GridCell.vue +++ b/frontend/src/components/GridCell.vue @@ -3,13 +3,13 @@ - + {{ name }} @@ -69,7 +69,7 @@ @@ -114,6 +114,10 @@ export default { showRelativeTime: { type: Boolean, default: false + }, + buildMonitorViewEnabled: { + type: Boolean, + required: true } }, emits: ['toggleVisibility'], @@ -136,6 +140,12 @@ export default { default: return 'failure'; } + }, + gridHeight() { + return this.buildMonitorViewEnabled ? 90 : 120; + }, + inProgressIndicatorHeight() { + return this.buildMonitorViewEnabled ? 15 : 10; } } }; diff --git a/frontend/src/components/Job.vue b/frontend/src/components/Job.vue index cdbe98f3..ec7dc1c9 100644 --- a/frontend/src/components/Job.vue +++ b/frontend/src/components/Job.vue @@ -8,6 +8,7 @@ :hidden="hidden" :in-progress="isInProgress" :status="content.lastBuildStatus" + :build-monitor-view-enabled="buildMonitorViewEnabled" @toggle-visibility="toggleVisibility" /> @@ -27,6 +28,10 @@ export default { hidden: { type: Boolean, required: true + }, + buildMonitorViewEnabled: { + type: Boolean, + required: true } }, emits: ['toggleVisibility'], diff --git a/frontend/src/components/Preferences.vue b/frontend/src/components/Preferences.vue index 0784bd64..77cd2a3f 100644 --- a/frontend/src/components/Preferences.vue +++ b/frontend/src/components/Preferences.vue @@ -18,6 +18,15 @@ @update:model-value="modelValueUpdated" /> + + +