Replace preview icon with button

This commit is contained in:
Andrew Kingston 2022-07-22 12:04:20 +01:00
parent accaaed462
commit e5da58e1fb
2 changed files with 23 additions and 12 deletions

View File

@ -56,6 +56,10 @@
} }
} }
const previewApp = () => {
window.open(`/${application}`)
}
const viewApp = () => { const viewApp = () => {
analytics.captureEvent(Events.APP_VIEW_PUBLISHED, { analytics.captureEvent(Events.APP_VIEW_PUBLISHED, {
appId: selectedApp.appId, appId: selectedApp.appId,
@ -174,7 +178,10 @@
Are you sure you want to unpublish the app <b>{selectedApp?.name}</b>? Are you sure you want to unpublish the app <b>{selectedApp?.name}</b>?
</ConfirmDialog> </ConfirmDialog>
<DeployModal onOk={completePublish} /> <div class="buttons">
<Button on:click={previewApp} newStyles secondary>Preview</Button>
<DeployModal onOk={completePublish} />
</div>
<style> <style>
.publish-popover-actions :global([data-cy="publish-popover-action"]) { .publish-popover-actions :global([data-cy="publish-popover-action"]) {
@ -183,4 +190,11 @@
:global([data-cy="publish-popover-menu"]) { :global([data-cy="publish-popover-menu"]) {
padding: 10px; padding: 10px;
} }
.buttons {
display: flex;
flex-direction: row;
justify-content: flex-end;
align-items: center;
gap: var(--spacing-m);
}
</style> </style>

View File

@ -1,7 +1,14 @@
<script> <script>
import { store, automationStore } from "builderStore" import { store, automationStore } from "builderStore"
import { roles, flags } from "stores/backend" import { roles, flags } from "stores/backend"
import { Icon, Tabs, Tab, Heading, notifications } from "@budibase/bbui" import {
Icon,
Tabs,
Tab,
Heading,
notifications,
Button,
} from "@budibase/bbui"
import RevertModal from "components/deploy/RevertModal.svelte" import RevertModal from "components/deploy/RevertModal.svelte"
import VersionModal from "components/deploy/VersionModal.svelte" import VersionModal from "components/deploy/VersionModal.svelte"
import DeployNavigation from "components/deploy/DeployNavigation.svelte" import DeployNavigation from "components/deploy/DeployNavigation.svelte"
@ -23,10 +30,6 @@
$layout.children.find(layout => $isActive(layout.path))?.title ?? "data" $layout.children.find(layout => $isActive(layout.path))?.title ?? "data"
) )
const previewApp = () => {
window.open(`/${application}`)
}
async function getPackage() { async function getPackage() {
try { try {
store.actions.reset() store.actions.reset()
@ -110,12 +113,6 @@
<div class="toprightnav"> <div class="toprightnav">
<VersionModal /> <VersionModal />
<RevertModal /> <RevertModal />
<Icon
name="Visibility"
tooltip="Open app preview"
hoverable
on:click={previewApp}
/>
<DeployNavigation {application} /> <DeployNavigation {application} />
</div> </div>
</div> </div>