Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
describe('Enterprise builder element types', () => {
test('file input deactivation checks tolerate a missing workspace', () => {
const testApp = useNuxtApp()
const elementType = testApp.$registry.get('element', 'input_file')

expect(elementType.isDeactivatedReason({ workspace: undefined })).toBeNull()
expect(elementType.getDeactivatedClickModal({ workspace: undefined })).toBe(
null
)
})
})
21 changes: 5 additions & 16 deletions web-frontend/modules/automation/components/AutomationHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@
testRunEnabled
? $t('automationHeader.stopTestRun')
: $t('automationHeader.startTestRun')
}}</Button
>
}}
</Button>
<Button
data-highlight="automation-publish"
:loading="isPublishing"
Expand Down Expand Up @@ -159,21 +159,11 @@ export default defineComponent({
const store = useStore()
const app = useNuxtApp()
const isDev = inject('isDev')
const workflow = inject('workflow')

const debug = ref(false)
const isPublishing = ref(false)

const workflow = inject('workflow')

const selectedWorkflow = computed(() => {
if (!props.automation) return null
try {
return store.getters['automationWorkflow/getSelected']
} catch {
return null
}
})

const testRunDisabled = computed(() => {
if (!workflow.value?.graph) {
return true
Expand Down Expand Up @@ -207,12 +197,12 @@ export default defineComponent({
})

const publishedOn = computed(() => {
if (!selectedWorkflow.value?.published_on || isPublishing.value) {
if (!workflow.value?.published_on || isPublishing.value) {
return null
}

return moment
.utc(selectedWorkflow.value.published_on)
.utc(workflow.value.published_on)
.tz(getUserTimeZone())
.format('MMM D, YYYY HH:mm:ss')
})
Expand Down Expand Up @@ -313,7 +303,6 @@ export default defineComponent({
isPublishing,
isPaused,
isDisabled,
selectedWorkflow,
workflow,
activeSidePanel,
testRunDisabled,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,30 +34,21 @@ export default {
},
watch: {
'pageValue.workflow.id': {
handler() {
handler(newValue) {
this.loadData()
},
immediate: true,
},
},
unmounted() {
// Restore the current application to the selected application if any
this.$store.dispatch('userSourceUser/setCurrentApplication', {
application: this.$store.getters['application/getSelected'],
})
},
methods: {
async loadData() {
this.loading = true

try {
const automation = this.pageValue.automation
const workflow = await this.$store.dispatch(
'automationWorkflow/selectById',
{
automation,
workflowId: this.pageValue.workflow.id,
}
const workflow = this.$store.getters['automationWorkflow/getById'](
automation,
this.pageValue.workflow.id
)

const automationApplicationType = this.$registry.get(
Expand Down
4 changes: 1 addition & 3 deletions web-frontend/modules/automation/pages/automationWorkflow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,7 @@ if (error.value) {
// Computed properties from async data
const automation = computed(() => pageData.value?.automation ?? null)
const workspace = computed(() => pageData.value?.workspace ?? null)
const workflow = computed(
() => $store.getters['automationWorkflow/getSelected']
)
const workflow = computed(() => pageData.value?.workflow ?? null)

function onRouteChange(from) {
const currentAutomation = $store.getters['application/get'](
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ export default {
})
},
elementSelectedId(newValue) {
if (newValue) {
if (newValue && this.$refs.previewScaled) {
this.$refs.previewScaled.focus()
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ export default {
mode,
formulaComponent: ApplicationBuilderFormulaInput,
applicationContext: {
workspace: this.workspace,
builder: this.builder,
page: this.currentPage,
mode,
},
}
Expand Down Expand Up @@ -65,6 +67,7 @@ export default {
computed: {
applicationContext() {
return {
workspace: this.workspace,
builder: this.builder,
page: this.currentPage,
mode,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<Modal ref="modal" :full-screen="true" :close-button="false">
<Modal ref="modal" :full-screen="true" :close-button="false" keep-content>
<div v-if="loading" class="loading-absolute-center"></div>
<template v-else>
<TemplateHeader
Expand Down
36 changes: 36 additions & 0 deletions web-frontend/test/unit/core/components/templateModal.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { defineComponent } from 'vue'
import { shallowMount } from '@vue/test-utils'

import TemplateModal from '@baserow/modules/core/components/template/TemplateModal'

describe('TemplateModal', () => {
const mountComponent = () => {
return shallowMount(TemplateModal, {
propsData: {
workspace: {
id: 1,
},
},
global: {
stubs: {
Modal: defineComponent({
name: 'Modal',
props: ['keepContent', 'fullScreen', 'closeButton'],
template: '<div><slot /></div>',
}),
TemplateHeader: true,
TemplateCategories: true,
TemplatePreview: true,
},
},
})
}

it('keeps the root modal content mounted while closed', () => {
const wrapper = mountComponent()

expect(wrapper.findComponent({ name: 'Modal' }).props('keepContent')).toBe(
''
)
})
})
Loading