Handle pausing of imagery from viewLargeAction - 3647 (#5901)
* get imagery view context and externally set pause and thumbnail index * Test pause/play state in realtime mode * Created an onPreviewMode change handler to be invoked from view large * Add optional chaining to method invocation * Change onItemClicked to invoke to resolve repeat large view action error
This commit is contained in:
@@ -207,6 +207,58 @@ test.describe('Example Imagery in Display Layout', () => {
|
|||||||
await page.goto(displayLayout.url);
|
await page.goto(displayLayout.url);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('View Large action pauses imagery when in realtime and returns to realtime', async ({ page }) => {
|
||||||
|
test.info().annotations.push({
|
||||||
|
type: 'issue',
|
||||||
|
description: 'https://github.com/nasa/openmct/issues/3647'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Click time conductor mode button
|
||||||
|
await page.locator('.c-mode-button').click();
|
||||||
|
|
||||||
|
// set realtime mode
|
||||||
|
await page.locator('[data-testid="conductor-modeOption-realtime"]').click();
|
||||||
|
|
||||||
|
// pause/play button
|
||||||
|
const pausePlayButton = await page.locator('.c-button.pause-play');
|
||||||
|
|
||||||
|
await expect.soft(pausePlayButton).not.toHaveClass(/is-paused/);
|
||||||
|
|
||||||
|
// Open context menu and click view large menu item
|
||||||
|
await page.locator('button[title="View menu items"]').click();
|
||||||
|
await page.locator('li[title="View Large"]').click();
|
||||||
|
await expect(pausePlayButton).toHaveClass(/is-paused/);
|
||||||
|
|
||||||
|
await page.locator('[aria-label="Close"]').click();
|
||||||
|
await expect.soft(pausePlayButton).not.toHaveClass(/is-paused/);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('View Large action leaves keeps realtime mode paused', async ({ page }) => {
|
||||||
|
test.info().annotations.push({
|
||||||
|
type: 'issue',
|
||||||
|
description: 'https://github.com/nasa/openmct/issues/3647'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Click time conductor mode button
|
||||||
|
await page.locator('.c-mode-button').click();
|
||||||
|
|
||||||
|
// set realtime mode
|
||||||
|
await page.locator('[data-testid="conductor-modeOption-realtime"]').click();
|
||||||
|
|
||||||
|
// pause/play button
|
||||||
|
const pausePlayButton = await page.locator('.c-button.pause-play');
|
||||||
|
await pausePlayButton.click();
|
||||||
|
await expect.soft(pausePlayButton).toHaveClass(/is-paused/);
|
||||||
|
|
||||||
|
// Open context menu and click view large menu item
|
||||||
|
await page.locator('button[title="View menu items"]').click();
|
||||||
|
await page.locator('li[title="View Large"]').click();
|
||||||
|
await expect(pausePlayButton).toHaveClass(/is-paused/);
|
||||||
|
|
||||||
|
await page.locator('[aria-label="Close"]').click();
|
||||||
|
await expect.soft(pausePlayButton).toHaveClass(/is-paused/);
|
||||||
|
});
|
||||||
|
|
||||||
test('Imagery View operations @unstable', async ({ page }) => {
|
test('Imagery View operations @unstable', async ({ page }) => {
|
||||||
test.info().annotations.push({
|
test.info().annotations.push({
|
||||||
type: 'issue',
|
type: 'issue',
|
||||||
|
|||||||
@@ -45,6 +45,35 @@ export default class ImageryView {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getViewContext() {
|
||||||
|
if (!this.component) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.component.$refs.ImageryContainer;
|
||||||
|
}
|
||||||
|
|
||||||
|
pause() {
|
||||||
|
const imageContext = this.getViewContext();
|
||||||
|
// persist previous pause value to return to after unpausing
|
||||||
|
this.previouslyPaused = imageContext.isPaused;
|
||||||
|
imageContext.thumbnailClicked(imageContext.focusedImageIndex);
|
||||||
|
}
|
||||||
|
unpause() {
|
||||||
|
const pausedStateBefore = this.previouslyPaused;
|
||||||
|
this.previouslyPaused = undefined; // clear value
|
||||||
|
const imageContext = this.getViewContext();
|
||||||
|
imageContext.paused(pausedStateBefore);
|
||||||
|
}
|
||||||
|
|
||||||
|
onPreviewModeChange({ isPreviewing } = {}) {
|
||||||
|
if (isPreviewing) {
|
||||||
|
this.pause();
|
||||||
|
} else {
|
||||||
|
this.unpause();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
destroy() {
|
destroy() {
|
||||||
this.component.$destroy();
|
this.component.$destroy();
|
||||||
this.component = undefined;
|
this.component = undefined;
|
||||||
|
|||||||
@@ -721,7 +721,7 @@ export default {
|
|||||||
&& visibleActions.find(action => action.key === 'large.view');
|
&& visibleActions.find(action => action.key === 'large.view');
|
||||||
|
|
||||||
if (viewLargeAction && viewLargeAction.appliesTo(this.objectPath, this.currentView)) {
|
if (viewLargeAction && viewLargeAction.appliesTo(this.objectPath, this.currentView)) {
|
||||||
viewLargeAction.onItemClicked();
|
viewLargeAction.invoke(this.objectPath, this.currentView);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async initializeRelatedTelemetry() {
|
async initializeRelatedTelemetry() {
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ export default class ViewLargeAction {
|
|||||||
|
|
||||||
_expand(objectPath, view) {
|
_expand(objectPath, view) {
|
||||||
const element = this._getPreview(objectPath, view);
|
const element = this._getPreview(objectPath, view);
|
||||||
|
view.onPreviewModeChange?.({ isPreviewing: true });
|
||||||
|
|
||||||
this.overlay = this.openmct.overlays.overlay({
|
this.overlay = this.openmct.overlays.overlay({
|
||||||
element,
|
element,
|
||||||
@@ -67,6 +68,7 @@ export default class ViewLargeAction {
|
|||||||
this.preview.$destroy();
|
this.preview.$destroy();
|
||||||
this.preview = undefined;
|
this.preview = undefined;
|
||||||
delete this.preview;
|
delete this.preview;
|
||||||
|
view.onPreviewModeChange?.();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user