mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
⚡ Display scopes alert box
This commit is contained in:
parent
04997c5184
commit
1efedfddf3
|
@ -72,6 +72,7 @@ import { showMessage } from '@/components/mixins/showMessage';
|
||||||
import { mapGetters } from "vuex";
|
import { mapGetters } from "vuex";
|
||||||
|
|
||||||
import mixins from 'vue-typed-mixins';
|
import mixins from 'vue-typed-mixins';
|
||||||
|
import { HTTP_REQUEST_NODE_TYPE } from '@/constants';
|
||||||
|
|
||||||
export default mixins(
|
export default mixins(
|
||||||
genericHelpers,
|
genericHelpers,
|
||||||
|
@ -106,6 +107,10 @@ export default mixins(
|
||||||
credentialTypesNodeDescription (): INodeCredentialDescription[] {
|
credentialTypesNodeDescription (): INodeCredentialDescription[] {
|
||||||
const node = this.node as INodeUi;
|
const node = this.node as INodeUi;
|
||||||
|
|
||||||
|
if (this.node.type === HTTP_REQUEST_NODE_TYPE && this.node.typeVersion === 2) {
|
||||||
|
this.$emit('newHttpRequestNodeCredentialType', this.node.parameters.nodeCredentialType);
|
||||||
|
}
|
||||||
|
|
||||||
const activeNodeType = this.$store.getters.nodeType(node.type, node.typeVersion) as INodeTypeDescription | null;
|
const activeNodeType = this.$store.getters.nodeType(node.type, node.typeVersion) as INodeTypeDescription | null;
|
||||||
if (activeNodeType && activeNodeType.credentials) {
|
if (activeNodeType && activeNodeType.credentials) {
|
||||||
return activeNodeType.credentials;
|
return activeNodeType.credentials;
|
||||||
|
|
|
@ -23,7 +23,25 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="node-parameters-wrapper" v-if="node && nodeValid">
|
<div class="node-parameters-wrapper" v-if="node && nodeValid">
|
||||||
<div v-show="openPanel === 'params'">
|
<div v-show="openPanel === 'params'">
|
||||||
<node-credentials :node="node" @credentialSelected="credentialSelected"></node-credentials>
|
<n8n-notice
|
||||||
|
v-if="isHttpRequestNodeV2 && scopes.length > 0"
|
||||||
|
:truncate="true"
|
||||||
|
:content="$locale.baseText(
|
||||||
|
'nodeSettings.scopes',
|
||||||
|
{
|
||||||
|
adjustToNumber: scopes.length,
|
||||||
|
interpolate: {
|
||||||
|
activeCredential,
|
||||||
|
scopes: scopes.join(' '),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
)"
|
||||||
|
/>
|
||||||
|
<node-credentials
|
||||||
|
:node="node"
|
||||||
|
@credentialSelected="credentialSelected"
|
||||||
|
@newHttpRequestNodeCredentialType="loadScopesNoticeData"
|
||||||
|
/>
|
||||||
<node-webhooks :node="node" :nodeType="nodeType" />
|
<node-webhooks :node="node" :nodeType="nodeType" />
|
||||||
<parameter-input-list :parameters="parametersNoneSetting" :hideDelete="true" :nodeValues="nodeValues" path="parameters" @valueChanged="valueChanged" />
|
<parameter-input-list :parameters="parametersNoneSetting" :hideDelete="true" :nodeValues="nodeValues" path="parameters" @valueChanged="valueChanged" />
|
||||||
<div v-if="parametersNoneSetting.length === 0" class="no-parameters">
|
<div v-if="parametersNoneSetting.length === 0" class="no-parameters">
|
||||||
|
@ -69,6 +87,8 @@ import { nodeHelpers } from '@/components/mixins/nodeHelpers';
|
||||||
|
|
||||||
import mixins from 'vue-typed-mixins';
|
import mixins from 'vue-typed-mixins';
|
||||||
import NodeExecuteButton from './NodeExecuteButton.vue';
|
import NodeExecuteButton from './NodeExecuteButton.vue';
|
||||||
|
import { mapGetters } from 'vuex';
|
||||||
|
import { HTTP_REQUEST_NODE_TYPE } from '@/constants';
|
||||||
|
|
||||||
export default mixins(
|
export default mixins(
|
||||||
externalHooks,
|
externalHooks,
|
||||||
|
@ -87,6 +107,10 @@ export default mixins(
|
||||||
NodeExecuteButton,
|
NodeExecuteButton,
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
...mapGetters('credentials', [ 'getCredentialTypeByName' ]),
|
||||||
|
isHttpRequestNodeV2(): boolean {
|
||||||
|
return this.node.type === HTTP_REQUEST_NODE_TYPE && this.node.typeVersion === 2;
|
||||||
|
},
|
||||||
nodeType (): INodeTypeDescription | null {
|
nodeType (): INodeTypeDescription | null {
|
||||||
if (this.node) {
|
if (this.node) {
|
||||||
return this.$store.getters.nodeType(this.node.type, this.node.typeVersion);
|
return this.$store.getters.nodeType(this.node.type, this.node.typeVersion);
|
||||||
|
@ -169,6 +193,8 @@ export default mixins(
|
||||||
notes: '',
|
notes: '',
|
||||||
parameters: {},
|
parameters: {},
|
||||||
} as INodeParameters,
|
} as INodeParameters,
|
||||||
|
activeCredential: '',
|
||||||
|
scopes: [] as string[],
|
||||||
|
|
||||||
nodeSettings: [
|
nodeSettings: [
|
||||||
{
|
{
|
||||||
|
@ -270,6 +296,21 @@ export default mixins(
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
async loadScopesNoticeData(activeCredentialType: string) {
|
||||||
|
if (!this.isHttpRequestNodeV2) return;
|
||||||
|
|
||||||
|
if (
|
||||||
|
!activeCredentialType ||
|
||||||
|
!activeCredentialType.endsWith('OAuth2Api')
|
||||||
|
) {
|
||||||
|
this.scopes = [];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.activeCredential = this.getCredentialTypeByName(activeCredentialType).displayName;
|
||||||
|
|
||||||
|
this.scopes = await this.restApi().getScopes(activeCredentialType);
|
||||||
|
},
|
||||||
onNodeExecute () {
|
onNodeExecute () {
|
||||||
this.$emit('execute');
|
this.$emit('execute');
|
||||||
},
|
},
|
||||||
|
|
|
@ -410,6 +410,7 @@
|
||||||
"nodeSettings.thisNodeDoesNotHaveAnyParameters": "This node does not have any parameters",
|
"nodeSettings.thisNodeDoesNotHaveAnyParameters": "This node does not have any parameters",
|
||||||
"nodeSettings.waitBetweenTries.description": "How long to wait between each attempt (in milliseconds)",
|
"nodeSettings.waitBetweenTries.description": "How long to wait between each attempt (in milliseconds)",
|
||||||
"nodeSettings.waitBetweenTries.displayName": "Wait Between Tries (ms)",
|
"nodeSettings.waitBetweenTries.displayName": "Wait Between Tries (ms)",
|
||||||
|
"nodeSettings.scopes": "Your <b>{activeCredential}</b> credential has access to the following scope:<br>{scopes} | Your <b>{activeCredential}</b> credential has access to the following scopes:<br>{scopes}",
|
||||||
"nodeView.addNode": "Add node",
|
"nodeView.addNode": "Add node",
|
||||||
"nodeView.addSticky": "Click to add sticky note",
|
"nodeView.addSticky": "Click to add sticky note",
|
||||||
"nodeView.confirmMessage.beforeRouteLeave.cancelButtonText": "Leave without saving",
|
"nodeView.confirmMessage.beforeRouteLeave.cancelButtonText": "Leave without saving",
|
||||||
|
|
Loading…
Reference in a new issue