Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "Open Dashboard" button to Immersive Editor #3769

Merged
merged 7 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions frontend/src/pages/instance/Editor/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
</div>
<ff-tabs :tabs="navigation" class="tabs" />
<div class="side-actions">
<DashboardLink v-if="instance.settings?.dashboard2UI" :instance="instance" />
<DropdownMenu v-if="hasPermission('project:change-status')" buttonClass="ff-btn ff-btn--primary" :options="actionsDropdownOptions">Actions</DropdownMenu>
<a :href="instance.url">
<ExternalLinkIcon class="ff-btn--icon" />
Expand Down Expand Up @@ -73,6 +74,7 @@ import FfPage from '../../../layouts/Page.vue'
import instanceMixin from '../../../mixins/Instance.js'
import FfTabs from '../../../ui-components/components/tabs/Tabs.vue'
import ConfirmInstanceDeleteDialog from '../Settings/dialogs/ConfirmInstanceDeleteDialog.vue'
import DashboardLink from '../components/DashboardLink.vue'

import EditorWrapper from './components/EditorWrapper.vue'
import DrawerTrigger from './components/drawer/DrawerTrigger.vue'
Expand All @@ -82,6 +84,7 @@ import ResizeBar from './components/drawer/ResizeBar.vue'
export default {
name: 'InstanceEditor',
components: {
DashboardLink,
MiddleCloseButton,
DrawerTrigger,
FfTabs,
Expand Down Expand Up @@ -269,13 +272,10 @@ export default {
.side-actions {
display: flex;
justify-content: flex-end;
gap: 10px;
align-items: center;
color: $ff-grey-500;

.ff-btn--icon {
margin-left: 10px;
}

.close-drawer {
&:hover {
cursor: pointer;
Expand Down
65 changes: 64 additions & 1 deletion test/e2e/frontend/cypress/tests/instances/editor.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ describe('FlowForge - Instance editor', () => {
const instance = response.body.projects.find(
(project) => project.name === 'instance-1-1'
)
instance.name = 'qweqwe'
cstns marked this conversation as resolved.
Show resolved Hide resolved
cy.visit(`/instance/${instance.id}/editor`)
})

Expand Down Expand Up @@ -136,4 +135,68 @@ describe('FlowForge - Instance editor', () => {
cy.get('@tabs-wrapper').get('.logo').click()
cy.get('[data-el="page-name"]').contains('instance-1-1')
})

describe('The Immersive editor', () => {
it('doesn\'t display the dashboard button if there isn\'t a configured dashboard', () => {
cy.intercept(
'GET',
'/api/*/projects/*',
(req) => req.reply(res => {
res.body = { ...res.body, ...{ meta: { versions: { launcher: '2.3.1' } } } }
return res
})).as('getProjects')

cy.login('bob', 'bbPassword')
cy.home()

cy.request('GET', '/api/v1/user/teams')
.then((response) => {
const team = response.body.teams.find(
(team) => team.name === 'ATeam'
)
return cy.request('GET', `/api/v1/teams/${team.id}/projects`)
})
.then((response) => {
const instance = response.body.projects.find(
(project) => project.name === 'instance-1-1'
)
cy.visit(`/instance/${instance.id}/editor`)
})

cy.get('[data-el="tabs-drawer"]').within(() => {
cy.get('[data-action="open-dashboard"]').should('not.exist')
})
})

it('displays the dashboard button if there\'s a configured dashboard available', () => {
cy.intercept(
'GET',
'/api/*/projects/*',
(req) => req.reply(res => {
res.body = { ...res.body, ...{ meta: { versions: { launcher: '2.3.1' } }, settings: { dashboard2UI: '/dashboard' } } }
return res
})).as('getProjects')

cy.login('bob', 'bbPassword')
cy.home()

cy.request('GET', '/api/v1/user/teams')
.then((response) => {
const team = response.body.teams.find(
(team) => team.name === 'ATeam'
)
return cy.request('GET', `/api/v1/teams/${team.id}/projects`)
})
.then((response) => {
const instance = response.body.projects.find(
(project) => project.name === 'instance-1-1'
)
cy.visit(`/instance/${instance.id}/editor`)
})

cy.get('[data-el="tabs-drawer"]').within(() => {
cy.get('[data-action="open-dashboard"]').should('exist')
})
})
})
})
Loading