feat: Add workflow sharing functionality and permissions (#4370)

* feat(editor): extract credentials view into reusable layout components for workflows view

* feat(editor): add workflow card and start work on empty state

* feat: add hoverable card and finish workflows empty state

* fix: undo workflows response interface changes

* chore: fix linting issues.

* fix: remove enterprise sharing env schema

* fix(editor): fix workflows resource view when sharing is enabled

* fix: change owner tag design and order

* feat: add personalization survey on workflows page

* fix: update component snapshots

* feat: refactored workflow card to use workflow-activator properly

* fix: fix workflow activator and proptypes

* fix: hide owner tag for workflow card until sharing is available

* fix: fixed ownedBy and sharedWith appearing for workflows list

* feat: update tags component design

* refactor: change resource filter select to n8n-user-select

* fix: made telemetry messages reusable

* chore: remove unused import

* refactor: fix component name casing

* refactor: use Vue.set to make workflow property reactive

* feat: add support for clicking on tags for filtering

* chore: fix tags linting issues

* fix: fix resources list layout when title words are very long

* refactor: add active and inactive status text to workflow activator

* fix: fix credentials and workflows sorting when name contains leading whitespace

* fix: remove wrongfully added style tag

* feat: add translations and storybook examples for truncated tags

* fix: remove enterprise sharing env from schema

* refactor: fix workflows module and workflows field store naming conflict

* feat: add workflow share button and open dummy modal

* feat: add workflow sharing modal (in progress)

* feat: add message when sharing disabled

* feat: add sharing messages based on flags

* feat: add workflow sharing api integration and readonly state handling

* fix: change how foreign credentials are handled

* refactor: migrate newly added workflow sharing store methods to pinia

* fix: update foreign credentials handler and add executable prop to node-settings

* fix: fix credentials display issue caused by addCredentials override

* fix: fix various issues when sharing from empty state

* fix: update node duplication credentials

* fix: revert defautl values for sharing env

* feat: hide share button behind feature flag

* chore: add env variable for sharing feature (testing only)

* fix: change enterprise-edition component casing
This commit is contained in:
Alex Grozav
2022-11-15 14:25:04 +02:00
committed by GitHub
parent d1ffc58aa4
commit 898c25fd7e
27 changed files with 567 additions and 97 deletions

View File

@@ -91,6 +91,7 @@
:nodeType="activeNodeType"
:isReadOnly="readOnly || hasForeignCredential"
:blockUI="blockUi && showTriggerPanel"
:executable="!readOnly || hasForeignCredential"
@valueChanged="valueChanged"
@execute="onNodeExecute"
@stopExecution="onStopExecution"
@@ -136,6 +137,7 @@ import InputPanel from './InputPanel.vue';
import TriggerPanel from './TriggerPanel.vue';
import {
BASE_NODE_SURVEY_URL,
EnterpriseEditionFeature,
START_NODE_TYPE,
STICKY_NODE_TYPE,
} from '@/constants';
@@ -147,6 +149,7 @@ import { useWorkflowsStore } from '@/stores/workflows';
import { useNDVStore } from '@/stores/ndv';
import { useNodeTypesStore } from '@/stores/nodeTypes';
import { useUIStore } from '@/stores/ui';
import {useSettingsStore} from "@/stores/settings";
export default mixins(
externalHooks,
@@ -188,7 +191,6 @@ export default mixins(
pinDataDiscoveryTooltipVisible: false,
avgInputRowHeight: 0,
avgOutputRowHeight: 0,
hasForeignCredential: false,
};
},
mounted() {
@@ -206,6 +208,7 @@ export default mixins(
useNDVStore,
useUIStore,
useWorkflowsStore,
useSettingsStore,
),
sessionId(): string {
return this.ndvStore.sessionId;
@@ -365,6 +368,21 @@ export default mixins(
blockUi(): boolean {
return this.isWorkflowRunning || this.isExecutionWaitingForWebhook;
},
hasForeignCredential(): boolean {
const credentials = (this.activeNode || {}).credentials;
const foreignCredentials = this.credentialsStore.foreignCredentialsById;
let hasForeignCredential = false;
if (credentials && this.settingsStore.isEnterpriseFeatureEnabled(EnterpriseEditionFeature.WorkflowSharing)) {
Object.values(credentials).forEach((credential) => {
if (credential.id && foreignCredentials[credential.id] && !foreignCredentials[credential.id].currentUserHasAccess) {
hasForeignCredential = true;
}
});
}
return hasForeignCredential;
},
},
watch: {
activeNode(node: INodeUi | null) {
@@ -384,8 +402,6 @@ export default mixins(
nodeSubtitle: this.getNodeSubtitle(node, this.activeNodeType, this.getCurrentWorkflow()),
});
this.checkForeignCredentials();
setTimeout(() => {
if (this.activeNode) {
const outgoingConnections = this.workflowsStore.outgoingConnectionsByNodeName(
@@ -631,12 +647,6 @@ export default mixins(
input_node_type: this.inputNode ? this.inputNode.type : '',
});
},
checkForeignCredentials() {
if(this.activeNode){
const issues = this.getNodeCredentialIssues(this.activeNode);
this.hasForeignCredential = !!issues?.credentials?.foreign;
}
},
onStopExecution(){
this.$emit('stopExecution');
},