Browse Source

Merge pull request #2438 from nocodb/fix/wh-trigger

fix: webhook triggers
pull/2454/head
Pranav C 2 years ago committed by GitHub
parent
commit
14e9f41da9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      packages/nc-gui/components/project/spreadsheet/components/EditableCell.vue
  2. 13
      packages/nc-gui/components/project/spreadsheet/components/editableCell/DurationCell.vue
  3. 3
      packages/nc-gui/components/project/spreadsheet/components/editableCell/TimePickerCell.vue
  4. 24
      packages/nc-gui/components/project/spreadsheet/mixins/cell.js

18
packages/nc-gui/components/project/spreadsheet/components/EditableCell.vue

@ -42,6 +42,7 @@
:is-form="isForm" :is-form="isForm"
:column="column" :column="column"
:is-locked="isLocked" :is-locked="isLocked"
v-on="parentListeners"
/> />
<boolean-cell <boolean-cell
@ -74,6 +75,7 @@
v-else-if="isTime" v-else-if="isTime"
v-model="localState" v-model="localState"
v-on="parentListeners" v-on="parentListeners"
@save="$emit('save')"
/> />
<date-time-picker-cell <date-time-picker-cell
@ -95,7 +97,6 @@
:is-form="isForm" :is-form="isForm"
:column="column" :column="column"
v-on="parentListeners" v-on="parentListeners"
@input="$emit('save')"
/> />
<json-editable-cell <json-editable-cell
@ -111,7 +112,6 @@
v-model="localState" v-model="localState"
:column="column" :column="column"
v-on="parentListeners" v-on="parentListeners"
@input="$emit('save')"
/> />
<set-list-cell <set-list-cell
v-else-if="isSet" v-else-if="isSet"
@ -210,10 +210,10 @@ export default {
if (val !== this.value) { if (val !== this.value) {
this.changed = true this.changed = true
this.$emit('input', val) this.$emit('input', val)
if (this.isAttachment || this.isBoolean || this.isRating || this.isTime || this.isDateTime || this.isDate || this.isDuration) { if (this.isAutoSaved) {
this.syncData()
} else if (!this.isCurrency && !this.isEnum && !this.isSet) {
this.syncDataDebounce(this) this.syncDataDebounce(this)
} else if (!this.isManualSaved) {
this.saveData()
} }
} }
} }
@ -241,7 +241,7 @@ export default {
// this.$refs.input.focus(); // this.$refs.input.focus();
}, },
beforeDestroy() { beforeDestroy() {
if (this.changed && !(this.isAttachment || this.isBoolean || this.isRating || this.isTime || this.isDateTime || this.isDuration)) { if (this.changed && this.isAutoSaved) {
this.changed = false this.changed = false
this.$emit('change') this.$emit('change')
} }
@ -253,6 +253,12 @@ export default {
this.changed = false this.changed = false
this.$emit('update') this.$emit('update')
} }
},
saveData() {
if (this.changed && !this.destroyed) {
this.changed = false
this.$emit('save')
}
} }
} }
} }

13
packages/nc-gui/components/project/spreadsheet/components/editableCell/DurationCell.vue

@ -7,6 +7,7 @@
@blur="onBlur" @blur="onBlur"
@keypress="checkDurationFormat($event)" @keypress="checkDurationFormat($event)"
@keydown.enter="isEdited && $emit('input', durationInMS)" @keydown.enter="isEdited && $emit('input', durationInMS)"
v-on="parentListeners"
> >
<div v-if="showWarningMessage == true" class="duration-warning"> <div v-if="showWarningMessage == true" class="duration-warning">
<!-- TODO: i18n --> <!-- TODO: i18n -->
@ -51,6 +52,18 @@ export default {
}, },
durationType() { durationType() {
return this.column?.meta?.duration || 0 return this.column?.meta?.duration || 0
},
parentListeners() {
const $listeners = {}
if (this.$listeners.blur) {
$listeners.blur = this.$listeners.blur
}
if (this.$listeners.focus) {
$listeners.focus = this.$listeners.focus
}
return $listeners
} }
}, },
mounted() { mounted() {

3
packages/nc-gui/components/project/spreadsheet/components/editableCell/TimePickerCell.vue

@ -5,7 +5,7 @@
</template> </template>
<div class="d-flex flex-column justify-center" @click.stop> <div class="d-flex flex-column justify-center" @click.stop>
<v-time-picker v-model="localState" v-on="parentListeners" /> <v-time-picker v-model="localState" v-on="parentListeners" />
<v-btn small color="primary" @click="$emit('update')"> <v-btn small color="primary" @click="$emit('save')">
<!-- Save --> <!-- Save -->
{{ $t('general.save') }} {{ $t('general.save') }}
</v-btn> </v-btn>
@ -15,7 +15,6 @@
<script> <script>
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { MysqlUi } from 'nocodb-sdk'
export default { export default {
name: 'TimePickerCell', name: 'TimePickerCell',

24
packages/nc-gui/components/project/spreadsheet/mixins/cell.js

@ -70,6 +70,30 @@ export default {
}, },
isDuration() { isDuration() {
return this.uiDatatype === UITypes.Duration return this.uiDatatype === UITypes.Duration
},
isAutoSaved() {
return [
UITypes.SingleLineText,
UITypes.LongText,
UITypes.PhoneNumber,
UITypes.Email,
UITypes.URL,
UITypes.Number,
UITypes.Decimal,
UITypes.Percent,
UITypes.Count,
UITypes.AutoNumber,
UITypes.SpecificDBType,
UITypes.Geometry
].includes(this.uiDatatype)
},
isManualSaved() {
return [
UITypes.Currency,
UITypes.Year,
UITypes.Time,
UITypes.Duration
].includes(this.uiDatatype)
} }
} }
} }

Loading…
Cancel
Save