Merge pull request #1879 from automatisch/AUT-971

feat(monday): add create column action
This commit is contained in:
Ali BARIN
2025-02-05 17:54:49 +01:00
committed by GitHub
10 changed files with 153 additions and 14 deletions

View File

@@ -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,
});
},
});

View File

@@ -1,4 +1,5 @@
import createBoard from './create-board/index.js';
import createColumn from './create-column/index.js';
import createItem from './create-item/index.js';
export default [createBoard, createItem];
export default [createBoard, createColumn, createItem];

View File

@@ -13,6 +13,7 @@ export default {
boards {
id
name
type
}
}
`,
@@ -22,10 +23,12 @@ export default {
if (data.data.boards?.length) {
for (const board of data.data.boards) {
boards.data.push({
value: board.id,
name: board.name,
});
if (board.type === 'board') {
boards.data.push({
value: board.id,
name: board.name,
});
}
}
}

View File

@@ -1,3 +1,4 @@
import newBoards from './new-boards/index.js';
import newUsers from './new-users/index.js';
export default [newBoards];
export default [newBoards, newUsers];

View File

@@ -8,7 +8,7 @@ export default defineTrigger({
async run($) {
const body = {
query: 'query { boards { id, name } }',
query: 'query { boards { id, name, type } }',
};
const { data } = await $.http.post('/', body);
@@ -18,12 +18,14 @@ export default defineTrigger({
}
for (const board of data.data.boards) {
$.pushTriggerItem({
raw: board,
meta: {
internalId: board.id,
},
});
if (board.type === 'board') {
$.pushTriggerItem({
raw: board,
meta: {
internalId: board.id,
},
});
}
}
},
});

View 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,
},
});
}
},
});

View File

@@ -40,6 +40,7 @@ exports[`App model > list should have list of applications keys 1`] = `
"mattermost",
"miro",
"mistral-ai",
"monday",
"notion",
"ntfy",
"odoo",

View File

@@ -345,8 +345,8 @@ export default defineConfig({
collapsible: true,
collapsed: true,
items: [
{ text: 'Actions', link: '/apps/monday/actions' },
{ text: 'Triggers', link: '/apps/monday/triggers' },
{ text: 'Actions', link: '/apps/monday/actions' },
{ text: 'Connection', link: '/apps/monday/connection' },
],
},

View File

@@ -3,6 +3,8 @@ favicon: /favicons/monday.svg
items:
- name: Create board
desc: Creates a new board.
- name: Create column
desc: Creates a new column in a board.
- name: Create item
desc: Creates a new item in a board.
---

View File

@@ -3,6 +3,8 @@ favicon: /favicons/monday.svg
items:
- name: New board
desc: Triggers when a new board is created.
- name: New users
desc: Triggers when a new user joins your account.
---
<script setup>