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 mixins from 'vue-typed-mixins';
|
||||
import { HTTP_REQUEST_NODE_TYPE } from '@/constants';
|
||||
|
||||
export default mixins(
|
||||
genericHelpers,
|
||||
|
@ -106,6 +107,10 @@ export default mixins(
|
|||
credentialTypesNodeDescription (): INodeCredentialDescription[] {
|
||||
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;
|
||||
if (activeNodeType && activeNodeType.credentials) {
|
||||
return activeNodeType.credentials;
|
||||
|
|
|
@ -23,7 +23,25 @@
|
|||
</div>
|
||||
<div class="node-parameters-wrapper" v-if="node && nodeValid">
|
||||
<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" />
|
||||
<parameter-input-list :parameters="parametersNoneSetting" :hideDelete="true" :nodeValues="nodeValues" path="parameters" @valueChanged="valueChanged" />
|
||||
<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 NodeExecuteButton from './NodeExecuteButton.vue';
|
||||
import { mapGetters } from 'vuex';
|
||||
import { HTTP_REQUEST_NODE_TYPE } from '@/constants';
|
||||
|
||||
export default mixins(
|
||||
externalHooks,
|
||||
|
@ -87,6 +107,10 @@ export default mixins(
|
|||
NodeExecuteButton,
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('credentials', [ 'getCredentialTypeByName' ]),
|
||||
isHttpRequestNodeV2(): boolean {
|
||||
return this.node.type === HTTP_REQUEST_NODE_TYPE && this.node.typeVersion === 2;
|
||||
},
|
||||
nodeType (): INodeTypeDescription | null {
|
||||
if (this.node) {
|
||||
return this.$store.getters.nodeType(this.node.type, this.node.typeVersion);
|
||||
|
@ -169,6 +193,8 @@ export default mixins(
|
|||
notes: '',
|
||||
parameters: {},
|
||||
} as INodeParameters,
|
||||
activeCredential: '',
|
||||
scopes: [] as string[],
|
||||
|
||||
nodeSettings: [
|
||||
{
|
||||
|
@ -270,6 +296,21 @@ export default mixins(
|
|||
},
|
||||
},
|
||||
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 () {
|
||||
this.$emit('execute');
|
||||
},
|
||||
|
|
|
@ -410,6 +410,7 @@
|
|||
"nodeSettings.thisNodeDoesNotHaveAnyParameters": "This node does not have any parameters",
|
||||
"nodeSettings.waitBetweenTries.description": "How long to wait between each attempt (in milliseconds)",
|
||||
"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.addSticky": "Click to add sticky note",
|
||||
"nodeView.confirmMessage.beforeRouteLeave.cancelButtonText": "Leave without saving",
|
||||
|
|
Loading…
Reference in a new issue