diff --git a/client/web/reporter/src/components/Report/Datasources/Aggregate/index.vue b/client/web/reporter/src/components/Report/Datasources/Aggregate/index.vue
index 80ab95177..3914c703f 100644
--- a/client/web/reporter/src/components/Report/Datasources/Aggregate/index.vue
+++ b/client/web/reporter/src/components/Report/Datasources/Aggregate/index.vue
@@ -3,11 +3,13 @@
v-if="step.aggregate"
>
diff --git a/client/web/reporter/src/components/Report/Datasources/Join.vue b/client/web/reporter/src/components/Report/Datasources/Join.vue
index 75e47da2a..298fef0c4 100644
--- a/client/web/reporter/src/components/Report/Datasources/Join.vue
+++ b/client/web/reporter/src/components/Report/Datasources/Join.vue
@@ -5,11 +5,13 @@
@@ -103,14 +105,6 @@ export default {
extends: base,
- props: {
- datasources: {
- type: Array,
- required: false,
- default: () => [],
- },
- },
-
data () {
return {
localColumns: [],
diff --git a/client/web/reporter/src/components/Report/Datasources/Link.vue b/client/web/reporter/src/components/Report/Datasources/Link.vue
index ed3d88a61..85cbcfbd5 100644
--- a/client/web/reporter/src/components/Report/Datasources/Link.vue
+++ b/client/web/reporter/src/components/Report/Datasources/Link.vue
@@ -5,11 +5,13 @@
@@ -103,14 +105,6 @@ export default {
extends: base,
- props: {
- datasources: {
- type: Array,
- required: false,
- default: () => [],
- },
- },
-
data () {
return {
localColumns: [],
diff --git a/client/web/reporter/src/components/Report/Datasources/Load/index.vue b/client/web/reporter/src/components/Report/Datasources/Load/index.vue
index 40c46b0c1..e8f589b15 100644
--- a/client/web/reporter/src/components/Report/Datasources/Load/index.vue
+++ b/client/web/reporter/src/components/Report/Datasources/Load/index.vue
@@ -3,11 +3,13 @@
v-if="step.load"
>
diff --git a/client/web/reporter/src/components/Report/Datasources/base.vue b/client/web/reporter/src/components/Report/Datasources/base.vue
index c7eb7b12d..9a095f8ac 100644
--- a/client/web/reporter/src/components/Report/Datasources/base.vue
+++ b/client/web/reporter/src/components/Report/Datasources/base.vue
@@ -11,12 +11,32 @@ export default {
required: true,
default: () => ({}),
},
+
+ datasources: {
+ type: Array,
+ required: false,
+ default: () => [],
+ },
+
+ creating: {
+ type: Boolean,
+ default: true,
+ },
},
computed: {
kind () {
return Object.keys(this.step)
},
+
+ nameState () {
+ const name = this.step[this.kind].name
+ const isDuplicate = this.datasources.some(({ step }, index) => {
+ return index !== this.index && step[Object.keys(step)].name === name && name
+ })
+
+ return name.length > 0 && !isDuplicate ? null : false
+ },
},
}
diff --git a/client/web/reporter/src/views/Report/Builder.vue b/client/web/reporter/src/views/Report/Builder.vue
index 493a2699e..e01390a99 100644
--- a/client/web/reporter/src/views/Report/Builder.vue
+++ b/client/web/reporter/src/views/Report/Builder.vue
@@ -226,9 +226,10 @@
@@ -605,6 +607,16 @@ export default {
{ text: this.$t('builder:layout-options.vertical'), value: 'vertical' },
]
},
+
+ datasourceSaveDisabled () {
+ const uniqueDatasources = new Set()
+ const hasDuplicates = this.datasources.tempItems.some(({ step }) => {
+ const name = step[Object.keys(step)].name
+ return !name || uniqueDatasources.size === uniqueDatasources.add(name).size
+ })
+
+ return this.datasources.processing || hasDuplicates
+ },
},
watch: {
@@ -660,7 +672,7 @@ export default {
}
}
- return `${currentIndex}`
+ return `${this.$t('datasources:source')} ${currentIndex}`
},
openDatasourceSelector () {
@@ -670,7 +682,10 @@ export default {
openDatasourceConfigurator () {
this.datasources.showConfigurator = true
- this.datasources.tempItems = cloneDeep(this.reportDatasources)
+ this.datasources.tempItems = cloneDeep(this.reportDatasources).map(ds => {
+ ds.meta.creating = false
+ return ds
+ })
this.datasources.currentIndex = this.datasources.tempItems.length ? 0 : undefined
},
diff --git a/locale/en/corteza-webapp-reporter/datasources.yaml b/locale/en/corteza-webapp-reporter/datasources.yaml
index 33b6c5d47..4e0acc2a0 100644
--- a/locale/en/corteza-webapp-reporter/datasources.yaml
+++ b/locale/en/corteza-webapp-reporter/datasources.yaml
@@ -7,6 +7,7 @@ expression: Expression
group-by: Group by
label: Label
module: Module
+name-required: Name *
name: Name
namespace: Namespace
new:
diff --git a/locale/en/corteza-webapp-reporter/general.yaml b/locale/en/corteza-webapp-reporter/general.yaml
index 8f7a42c40..c963934b1 100644
--- a/locale/en/corteza-webapp-reporter/general.yaml
+++ b/locale/en/corteza-webapp-reporter/general.yaml
@@ -14,6 +14,7 @@ label:
or: Or
openLinkInNewTab: Open link in a new tab
save: Save
+ saveAndClose: Save and close
today: Today
urlPlaceholder: https://example.tld
default: Default