-
-
+
@@ -17,10 +17,10 @@
mdi-information-outline
-
+
+
-
+
+ mdi-close
+ Reset
+
+
+
+
+ mdi-plus
+
+ New table
+
- {{ id || localId ? 'Update' : 'Create' }}
- Template
+ {{ id || localId ? 'Update in' :'Submit to' }} NocoDB
@@ -422,8 +428,6 @@
@click="counter++"
/>
-
-
@@ -556,11 +560,17 @@ export default {
LinkToAnotherRecord: 'blue lighten-5',
Rollup: 'pink lighten-5',
Lookup: 'green lighten-5'
- },
- counter: 0
+ }
}),
computed: {
-
+ counter: {
+ get() {
+ return this.$store.state.templateC
+ },
+ set(c) {
+ this.$store.commit('mutTemplateC', c)
+ }
+ },
updateFilename() {
return this.url && this.url.split('/').pop()
},
@@ -828,7 +838,7 @@ export default {
this.copyJSON()
break
case 's':
- await this.submitTemplate()
+ await this.saveTemplate()
break
case 'arrowup':
this.expansionPanel = this.expansionPanel ? --this.expansionPanel : this.project.tables.length - 1
@@ -862,18 +872,14 @@ export default {
this.$toast.info('Please fill all the required column!').goAway(5000)
return
}
-
- this.$clipboard(JSON.stringify(this.projectTemplate, null, 2))
-
- // const el = document.createElement('textarea')
- // el.value = JSON.stringify(this.projectTemplate, null, 2)
- // debugger
- // el.setAttribute('readonly', '')
- // el.style = { position: 'absolute', left: '-9999px' }
- // document.body.appendChild(el)
- // el.select()
- // document.execCommand('copy')
- // document.body.removeChild(el)
+ const el = document.createElement('textarea')
+ el.addEventListener('focusin', e => e.stopPropagation())
+ el.value = JSON.stringify(this.projectTemplate, null, 2)
+ el.style = { position: 'absolute', left: '-9999px' }
+ document.body.appendChild(el)
+ el.select()
+ document.execCommand('copy')
+ document.body.removeChild(el)
this.$toast.success('Successfully copied JSON data to clipboard!').goAway(3000)
return true
},
@@ -1025,12 +1031,14 @@ export default {
if (this.id || this.localId) {
await this.$axios.put(`${process.env.NC_API_URL}/api/v1/nc/templates/${this.id || this.localId}`, this.projectTemplate, {
params: {
- token: this.token
+ token: this.$store.state.template
}
})
this.$toast.success('Template updated successfully').goAway(3000)
- } else if (!this.token) {
- if (!this.copyJSON()) { return }
+ } else if (!this.$store.state.template) {
+ if (!this.copyJSON()) {
+ return
+ }
this.$toast.info('Initiating Github for template').goAway(3000)
const res = await this.$axios.post(`${process.env.NC_API_URL}/api/v1/projectTemplateCreate`, this.projectTemplate)
@@ -1040,7 +1048,7 @@ export default {
} else {
const res = await this.$axios.post(`${process.env.NC_API_URL}/api/v1/nc/templates`, this.projectTemplate, {
params: {
- token: this.token
+ token: this.$store.state.template
}
})
this.localId = res.data.id
diff --git a/packages/nc-gui/components/templates/gradientGenerator.vue b/packages/nc-gui/components/templates/gradientGenerator.vue
index b57088ac2f..ecaf4abbb6 100644
--- a/packages/nc-gui/components/templates/gradientGenerator.vue
+++ b/packages/nc-gui/components/templates/gradientGenerator.vue
@@ -7,8 +7,9 @@
>
Click to change gradient
-
-
+
+
+
@@ -24,7 +25,8 @@ export default {
computed: {
color1: {
get() {
- return this.value && this.value.split(',')[1]
+ const val = this.value && this.value.split(',')[1].trim()
+ return val
},
set(v) {
const gradient = 'linear-gradient(' + this.angle + 'deg, ' + v + ', ' + this.color2 + ')'
@@ -33,7 +35,7 @@ export default {
},
color2: {
get() {
- return this.value && this.value.split(',')[2].slice(0, -1)
+ return this.value && this.value.split(',')[2].slice(0, -1).trim()
},
set(v) {
const gradient = 'linear-gradient(' + this.angle + 'deg, ' + this.color1 + ', ' + v + ')'
diff --git a/packages/nc-gui/components/templates/list.vue b/packages/nc-gui/components/templates/list.vue
index aaf94c26dc..8d819c9828 100644
--- a/packages/nc-gui/components/templates/list.vue
+++ b/packages/nc-gui/components/templates/list.vue
@@ -25,11 +25,11 @@
md="6"
lg="4"
xl="3"
- @click="openTemplate(template.id)"
>