mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
feat(editor): Migrate pinData mixin to usePinnedData composable (no-changelog) (#8207)
## Summary Required as part of NodeView refactoring: - Migrates `pinData` mixin to `usePinnedData` composable. - Adds `useActiveNode` and `useNodeType` composables ## Related tickets and issues https://linear.app/n8n/issue/N8N-6355/pindata ## Review / Merge checklist - [x] PR title and summary are descriptive. **Remember, the title automatically goes into the changelog. Use `(no-changelog)` otherwise.** ([conventions](https://github.com/n8n-io/n8n/blob/master/.github/pull_request_title_conventions.md)) - [x] [Docs updated](https://github.com/n8n-io/n8n-docs) or follow-up ticket created. - [x] Tests included. > A bug is not considered fixed, unless a test is added to prevent it from happening again. > A feature is not complete without tests.
This commit is contained in:
@@ -33,20 +33,21 @@ import {
|
||||
import type { INodeUi } from '@/Interface';
|
||||
import type { INodeTypeDescription } from 'n8n-workflow';
|
||||
import { workflowRun } from '@/mixins/workflowRun';
|
||||
import { pinData } from '@/mixins/pinData';
|
||||
import { useWorkflowsStore } from '@/stores/workflows.store';
|
||||
import { useNDVStore } from '@/stores/ndv.store';
|
||||
import { useNodeTypesStore } from '@/stores/nodeTypes.store';
|
||||
import { useMessage } from '@/composables/useMessage';
|
||||
import { useToast } from '@/composables/useToast';
|
||||
import { useExternalHooks } from '@/composables/useExternalHooks';
|
||||
import { usePinnedData } from '@/composables/usePinnedData';
|
||||
|
||||
export default defineComponent({
|
||||
mixins: [workflowRun, pinData],
|
||||
mixins: [workflowRun],
|
||||
inheritAttrs: false,
|
||||
props: {
|
||||
nodeName: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
@@ -70,10 +71,14 @@ export default defineComponent({
|
||||
},
|
||||
},
|
||||
setup(props, ctx) {
|
||||
const workflowsStore = useWorkflowsStore();
|
||||
const node = workflowsStore.getNodeByName(props.nodeName);
|
||||
const pinnedData = usePinnedData(node);
|
||||
const externalHooks = useExternalHooks();
|
||||
|
||||
return {
|
||||
externalHooks,
|
||||
pinnedData,
|
||||
...useToast(),
|
||||
...useMessage(),
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
@@ -221,7 +226,7 @@ export default defineComponent({
|
||||
this.$emit('stopExecution');
|
||||
} else {
|
||||
let shouldUnpinAndExecute = false;
|
||||
if (this.hasPinData) {
|
||||
if (this.pinnedData.hasData.value) {
|
||||
const confirmResult = await this.confirm(
|
||||
this.$locale.baseText('ndv.pinData.unpinAndExecute.description'),
|
||||
this.$locale.baseText('ndv.pinData.unpinAndExecute.title'),
|
||||
@@ -233,11 +238,11 @@ export default defineComponent({
|
||||
shouldUnpinAndExecute = confirmResult === MODAL_CONFIRM;
|
||||
|
||||
if (shouldUnpinAndExecute && this.node) {
|
||||
this.unsetPinData(this.node, 'unpin-and-execute-modal');
|
||||
this.pinnedData.unsetData('unpin-and-execute-modal');
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.hasPinData || shouldUnpinAndExecute) {
|
||||
if (!this.pinnedData.hasData.value || shouldUnpinAndExecute) {
|
||||
const telemetryPayload = {
|
||||
node_type: this.nodeType ? this.nodeType.name : null,
|
||||
workflow_id: this.workflowsStore.workflowId,
|
||||
|
||||
Reference in New Issue
Block a user