fix: Stop showing mapping hint after mapping (#5586)

* fix: Stop showing mapping hint after mapping

* fix: set value correctly

* chore: clean up mapping hint code
This commit is contained in:
Mutasem Aldmour
2023-03-01 14:02:34 +03:00
committed by GitHub
parent aa2beaa800
commit eac4275a7e
7 changed files with 13 additions and 46 deletions

View File

@@ -70,7 +70,6 @@
import { PropType } from 'vue';
import mixins from 'vue-typed-mixins';
import VueJsonPretty from 'vue-json-pretty';
import { LOCAL_STORAGE_MAPPING_FLAG } from '@/constants';
import { IDataObject, INodeExecutionData } from 'n8n-workflow';
import Draggable from '@/components/Draggable.vue';
import { executionDataToJson, isString, shorten } from '@/utils';
@@ -114,9 +113,6 @@ export default mixins(externalHooks).extend({
distanceFromActive: {
type: Number,
},
showMappingHint: {
type: Boolean,
},
runIndex: {
type: Number,
},
@@ -127,40 +123,15 @@ export default mixins(externalHooks).extend({
data() {
return {
selectedJsonPath: null as null | string,
mappingHintVisible: false,
showHintWithDelay: false,
draggingPath: null as null | string,
displayMode: 'json',
};
},
mounted() {
if (this.showMappingHint) {
this.mappingHintVisible = true;
setTimeout(() => {
this.mappingHintVisible = false;
}, 6000);
}
if (this.showMappingHint && this.showHint) {
setTimeout(() => {
this.showHintWithDelay = this.showHint;
this.$telemetry.track('User viewed JSON mapping tooltip', { type: 'param focus' });
}, 500);
}
},
computed: {
...mapStores(useNDVStore, useWorkflowsStore),
jsonData(): IDataObject[] {
return executionDataToJson(this.inputData);
},
showHint(): boolean {
return (
!this.draggingPath &&
((this.showMappingHint && this.mappingHintVisible) ||
window.localStorage.getItem(LOCAL_STORAGE_MAPPING_FLAG) !== 'true')
);
},
},
methods: {
getShortKey(el: HTMLElement): string {