Merge pull request #1879 from automatisch/AUT-971
feat(monday): add create column action
This commit is contained in:
@@ -0,0 +1,98 @@
|
|||||||
|
import defineAction from '../../../../helpers/define-action.js';
|
||||||
|
|
||||||
|
export default defineAction({
|
||||||
|
name: 'Create column',
|
||||||
|
key: 'createColumn',
|
||||||
|
description: 'Creates a new column in a board.',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
label: 'Board',
|
||||||
|
key: 'boardId',
|
||||||
|
type: 'dropdown',
|
||||||
|
required: true,
|
||||||
|
description: '',
|
||||||
|
variables: true,
|
||||||
|
source: {
|
||||||
|
type: 'query',
|
||||||
|
name: 'getDynamicData',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: 'key',
|
||||||
|
value: 'listBoards',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Column Title',
|
||||||
|
key: 'columnTitle',
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
description: '',
|
||||||
|
variables: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Column Type',
|
||||||
|
key: 'columnType',
|
||||||
|
type: 'dropdown',
|
||||||
|
required: true,
|
||||||
|
description: '',
|
||||||
|
variables: true,
|
||||||
|
options: [
|
||||||
|
{ label: 'Button', value: 'button' },
|
||||||
|
{ label: 'Checkbox', value: 'checkbox' },
|
||||||
|
{ label: 'Color Picker', value: 'color_picker' },
|
||||||
|
{ label: 'Connect Boards', value: 'board_relation' },
|
||||||
|
{ label: 'Country', value: 'country' },
|
||||||
|
{ label: 'Creation Log', value: 'creation_log' },
|
||||||
|
{ label: 'Date', value: 'date' },
|
||||||
|
{ label: 'Dependency', value: 'dependency' },
|
||||||
|
{ label: 'Dropdown', value: 'dropdown' },
|
||||||
|
{ label: 'Email', value: 'email' },
|
||||||
|
{ label: 'Files', value: 'file' },
|
||||||
|
{ label: 'Formula', value: 'formula' },
|
||||||
|
{ label: 'Hour', value: 'hour' },
|
||||||
|
{ label: 'Item ID', value: 'item_id' },
|
||||||
|
{ label: 'Last Updated', value: 'last_updated' },
|
||||||
|
{ label: 'Link', value: 'link' },
|
||||||
|
{ label: 'Location', value: 'location' },
|
||||||
|
{ label: 'Long Text', value: 'long_text' },
|
||||||
|
{ label: 'Mirror', value: 'mirror' },
|
||||||
|
{ label: 'monday Doc', value: 'doc' },
|
||||||
|
{ label: 'Name', value: 'name' },
|
||||||
|
{ label: 'Numbers', value: 'numbers' },
|
||||||
|
{ label: 'People', value: 'people' },
|
||||||
|
{ label: 'Phone', value: 'phone' },
|
||||||
|
{ label: 'Rating', value: 'rating' },
|
||||||
|
{ label: 'Status', value: 'status' },
|
||||||
|
{ label: 'Tags', value: 'tags' },
|
||||||
|
{ label: 'Text', value: 'text' },
|
||||||
|
{ label: 'Timeline', value: 'timeline' },
|
||||||
|
{ label: 'Time Tracking', value: 'time_tracking' },
|
||||||
|
{ label: 'Vote', value: 'vote' },
|
||||||
|
{ label: 'Week', value: 'week' },
|
||||||
|
{ label: 'World Clock', value: 'world_clock' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
async run($) {
|
||||||
|
const { boardId, columnTitle, columnType } = $.step.parameters;
|
||||||
|
|
||||||
|
const body = {
|
||||||
|
query: `
|
||||||
|
mutation{
|
||||||
|
create_column (board_id: ${boardId}, title: "${columnTitle}", column_type: ${columnType}) {
|
||||||
|
id
|
||||||
|
title
|
||||||
|
}
|
||||||
|
}`,
|
||||||
|
};
|
||||||
|
|
||||||
|
const { data } = await $.http.post('/', body);
|
||||||
|
|
||||||
|
$.setActionItem({
|
||||||
|
raw: data,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import createBoard from './create-board/index.js';
|
import createBoard from './create-board/index.js';
|
||||||
|
import createColumn from './create-column/index.js';
|
||||||
import createItem from './create-item/index.js';
|
import createItem from './create-item/index.js';
|
||||||
|
|
||||||
export default [createBoard, createItem];
|
export default [createBoard, createColumn, createItem];
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ export default {
|
|||||||
boards {
|
boards {
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
|
type
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
@@ -22,10 +23,12 @@ export default {
|
|||||||
|
|
||||||
if (data.data.boards?.length) {
|
if (data.data.boards?.length) {
|
||||||
for (const board of data.data.boards) {
|
for (const board of data.data.boards) {
|
||||||
boards.data.push({
|
if (board.type === 'board') {
|
||||||
value: board.id,
|
boards.data.push({
|
||||||
name: board.name,
|
value: board.id,
|
||||||
});
|
name: board.name,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
import newBoards from './new-boards/index.js';
|
import newBoards from './new-boards/index.js';
|
||||||
|
import newUsers from './new-users/index.js';
|
||||||
|
|
||||||
export default [newBoards];
|
export default [newBoards, newUsers];
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export default defineTrigger({
|
|||||||
|
|
||||||
async run($) {
|
async run($) {
|
||||||
const body = {
|
const body = {
|
||||||
query: 'query { boards { id, name } }',
|
query: 'query { boards { id, name, type } }',
|
||||||
};
|
};
|
||||||
|
|
||||||
const { data } = await $.http.post('/', body);
|
const { data } = await $.http.post('/', body);
|
||||||
@@ -18,12 +18,14 @@ export default defineTrigger({
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const board of data.data.boards) {
|
for (const board of data.data.boards) {
|
||||||
$.pushTriggerItem({
|
if (board.type === 'board') {
|
||||||
raw: board,
|
$.pushTriggerItem({
|
||||||
meta: {
|
raw: board,
|
||||||
internalId: board.id,
|
meta: {
|
||||||
},
|
internalId: board.id,
|
||||||
});
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
29
packages/backend/src/apps/monday/triggers/new-users/index.js
Normal file
29
packages/backend/src/apps/monday/triggers/new-users/index.js
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import defineTrigger from '../../../../helpers/define-trigger.js';
|
||||||
|
|
||||||
|
export default defineTrigger({
|
||||||
|
name: 'New users',
|
||||||
|
key: 'newUsers',
|
||||||
|
pollInterval: 15,
|
||||||
|
description: 'Triggers when a new user joins your account.',
|
||||||
|
|
||||||
|
async run($) {
|
||||||
|
const body = {
|
||||||
|
query: 'query { users { id name } }',
|
||||||
|
};
|
||||||
|
|
||||||
|
const { data } = await $.http.post('/', body);
|
||||||
|
|
||||||
|
if (!data.data?.users?.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const user of data.data.users.reverse()) {
|
||||||
|
$.pushTriggerItem({
|
||||||
|
raw: user,
|
||||||
|
meta: {
|
||||||
|
internalId: user.id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
@@ -40,6 +40,7 @@ exports[`App model > list should have list of applications keys 1`] = `
|
|||||||
"mattermost",
|
"mattermost",
|
||||||
"miro",
|
"miro",
|
||||||
"mistral-ai",
|
"mistral-ai",
|
||||||
|
"monday",
|
||||||
"notion",
|
"notion",
|
||||||
"ntfy",
|
"ntfy",
|
||||||
"odoo",
|
"odoo",
|
||||||
|
|||||||
@@ -345,8 +345,8 @@ export default defineConfig({
|
|||||||
collapsible: true,
|
collapsible: true,
|
||||||
collapsed: true,
|
collapsed: true,
|
||||||
items: [
|
items: [
|
||||||
{ text: 'Actions', link: '/apps/monday/actions' },
|
|
||||||
{ text: 'Triggers', link: '/apps/monday/triggers' },
|
{ text: 'Triggers', link: '/apps/monday/triggers' },
|
||||||
|
{ text: 'Actions', link: '/apps/monday/actions' },
|
||||||
{ text: 'Connection', link: '/apps/monday/connection' },
|
{ text: 'Connection', link: '/apps/monday/connection' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ favicon: /favicons/monday.svg
|
|||||||
items:
|
items:
|
||||||
- name: Create board
|
- name: Create board
|
||||||
desc: Creates a new board.
|
desc: Creates a new board.
|
||||||
|
- name: Create column
|
||||||
|
desc: Creates a new column in a board.
|
||||||
- name: Create item
|
- name: Create item
|
||||||
desc: Creates a new item in a board.
|
desc: Creates a new item in a board.
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ favicon: /favicons/monday.svg
|
|||||||
items:
|
items:
|
||||||
- name: New board
|
- name: New board
|
||||||
desc: Triggers when a new board is created.
|
desc: Triggers when a new board is created.
|
||||||
|
- name: New users
|
||||||
|
desc: Triggers when a new user joins your account.
|
||||||
---
|
---
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
|||||||
Reference in New Issue
Block a user