Compare commits

...

4 Commits

Author SHA1 Message Date
Rıdvan Akca
2846dd2bdd feat(trello): add new cards trigger 2023-10-26 15:13:10 +03:00
QAComet
2fceaf2cf4 test: fix flakiness in GH connection test case (#1383) 2023-10-25 11:04:04 +02:00
Ömer Faruk Aydın
d82b50fcdb Merge pull request #1382 from automatisch/fix/delete-current-user
fix: Guard lowercase email for delete user operation
2023-10-25 01:17:52 +02:00
Faruk AYDIN
ab6e49bf4f fix: Guard lowercase email for delete user operation 2023-10-25 01:00:43 +02:00
13 changed files with 230 additions and 10 deletions

View File

@@ -0,0 +1,4 @@
import listBoardLists from './list-board-lists';
import listBoards from './list-boards';
export default [listBoardLists, listBoards];

View File

@@ -0,0 +1,33 @@
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
export default {
name: 'List board lists',
key: 'listBoardLists',
async run($: IGlobalVariable) {
const boards: {
data: IJSONObject[];
} = {
data: [],
};
const boardId = $.step.parameters.boardId;
if (!boardId) {
return { data: [] };
}
const { data } = await $.http.get(`/1/boards/${boardId}/lists`);
if (data) {
for (const list of data) {
boards.data.push({
value: list.id,
name: list.name,
});
}
}
return boards;
},
};

View File

@@ -0,0 +1,29 @@
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
export default {
name: 'List boards',
key: 'listBoards',
async run($: IGlobalVariable) {
const boards: {
data: IJSONObject[];
} = {
data: [],
};
const { data } = await $.http.get(`/1/members/me/boards`);
if (data) {
for (const board of data) {
boards.data.push({
value: board.id,
name: board.name,
});
}
} else {
return { data: [] };
}
return boards;
},
};

View File

@@ -1,6 +1,8 @@
import defineApp from '../../helpers/define-app'; import defineApp from '../../helpers/define-app';
import addAuthHeader from './common/add-auth-header'; import addAuthHeader from './common/add-auth-header';
import auth from './auth'; import auth from './auth';
import triggers from './triggers';
import dynamicData from './dynamic-data';
export default defineApp({ export default defineApp({
name: 'Trello', name: 'Trello',
@@ -13,4 +15,6 @@ export default defineApp({
primaryColor: '0079bf', primaryColor: '0079bf',
beforeRequest: [addAuthHeader], beforeRequest: [addAuthHeader],
auth, auth,
triggers,
dynamicData,
}); });

View File

@@ -0,0 +1,3 @@
import newCards from './new-cards';
export default [newCards];

View File

@@ -0,0 +1,123 @@
import defineTrigger from '../../../../helpers/define-trigger';
export default defineTrigger({
name: 'New cards',
key: 'newCards',
pollInterval: 15,
description: 'Triggers upon the addition of a new card.',
arguments: [
{
label: 'Board',
key: 'boardId',
type: 'dropdown' as const,
required: false,
description:
'Selecting a board initiates the trigger for newly added cards on that board.',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listBoards',
},
],
},
},
{
label: 'List',
key: 'listId',
type: 'dropdown' as const,
required: false,
dependsOn: ['parameters.boardId'],
description: 'Requires to opt for a board.',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listBoardLists',
},
{
name: 'parameters.boardId',
value: '{parameters.boardId}',
},
],
},
},
{
label: 'Filter',
key: 'filter',
type: 'dropdown' as const,
required: false,
description: 'Default is open.',
variables: true,
options: [
{
label: 'open',
value: 'open',
},
{
label: 'closed',
value: 'closed',
},
{
label: 'all',
value: 'all',
},
],
},
],
async run($) {
const { boardId, listId, filter } = $.step.parameters;
if (boardId && !listId) {
const cardFilter = filter || 'open';
const { data } = await $.http.get(
`/1/boards/${boardId}/cards/${cardFilter}`
);
if (data) {
for (const card of data) {
$.pushTriggerItem({
raw: card,
meta: {
internalId: card.id,
},
});
}
}
} else if (listId) {
const { data } = await $.http.get(`1/lists/${listId}/cards`);
if (data) {
for (const card of data) {
$.pushTriggerItem({
raw: card,
meta: {
internalId: card.id,
},
});
}
}
} else {
const { data } = await $.http.get(`/1/members/me/cards`);
if (data) {
for (const card of data) {
$.pushTriggerItem({
raw: card,
meta: {
internalId: card.id,
},
});
}
}
}
},
});

View File

@@ -275,7 +275,10 @@ class User extends Base {
async $beforeUpdate(opt: ModelOptions, queryContext: QueryContext) { async $beforeUpdate(opt: ModelOptions, queryContext: QueryContext) {
await super.$beforeUpdate(opt, queryContext); await super.$beforeUpdate(opt, queryContext);
this.email = this.email.toLowerCase(); if (this.email) {
this.email = this.email.toLowerCase();
}
await this.generateHash(); await this.generateHash();
} }

View File

@@ -377,7 +377,10 @@ export default defineConfig({
text: 'Trello', text: 'Trello',
collapsible: true, collapsible: true,
collapsed: true, collapsed: true,
items: [{ text: 'Connection', link: '/apps/trello/connection' }], items: [
{ text: 'Triggers', link: '/apps/trello/triggers' },
{ text: 'Connection', link: '/apps/trello/connection' },
],
}, },
{ {
text: 'Twilio', text: 'Twilio',

View File

@@ -0,0 +1,12 @@
---
favicon: /favicons/trello.svg
items:
- name: New cards
desc: Triggers upon the addition of a new card.
---
<script setup>
import CustomListing from '../../components/CustomListing.vue'
</script>
<CustomListing />

View File

@@ -39,6 +39,7 @@ The following integrations are currently supported by Automatisch.
- [Stripe](/apps/stripe/triggers) - [Stripe](/apps/stripe/triggers)
- [Telegram](/apps/telegram-bot/actions) - [Telegram](/apps/telegram-bot/actions)
- [Todoist](/apps/todoist/triggers) - [Todoist](/apps/todoist/triggers)
- [Trello](/apps/trello/triggers)
- [Twilio](/apps/twilio/triggers) - [Twilio](/apps/twilio/triggers)
- [Twitter](/apps/twitter/triggers) - [Twitter](/apps/twitter/triggers)
- [Typeform](/apps/typeform/triggers) - [Typeform](/apps/typeform/triggers)

View File

@@ -13,9 +13,9 @@ export class ApplicationsModal extends BasePage {
constructor (page) { constructor (page) {
super(page); super(page);
this.modal = page.getByTestId('add-app-connection-dialog'); this.modal = page.getByTestId('add-app-connection-dialog');
this.searchInput = page.getByTestId('search-for-app-text-field'); this.searchInput = this.modal.getByTestId('search-for-app-text-field');
this.appListItem = page.getByTestId('app-list-item'); this.appListItem = this.modal.getByTestId('app-list-item');
this.appLoader = page.getByTestId('search-for-app-loader'); this.appLoader = this.modal.getByTestId('search-for-app-loader');
} }
/** /**

View File

@@ -9,7 +9,7 @@ test('Github OAuth integration', async ({ page, applicationsPage }) => {
await page.waitForURL('/apps'); await page.waitForURL('/apps');
} }
const connectionModal = await applicationsPage.openAddConnectionModal(); const connectionModal = await applicationsPage.openAddConnectionModal();
expect(connectionModal.modal).toBeVisible(); await expect(connectionModal.modal).toBeVisible();
return await connectionModal.selectLink('github'); return await connectionModal.selectLink('github');
} }
); );
@@ -18,7 +18,7 @@ test('Github OAuth integration', async ({ page, applicationsPage }) => {
'Ensure the github connection modal is visible', 'Ensure the github connection modal is visible',
async () => { async () => {
const connectionModal = githubConnectionPage.addConnectionModal; const connectionModal = githubConnectionPage.addConnectionModal;
expect(connectionModal.modal).toBeVisible(); await expect(connectionModal.modal).toBeVisible();
return connectionModal; return connectionModal;
} }
); );
@@ -35,9 +35,9 @@ test('Github OAuth integration', async ({ page, applicationsPage }) => {
); );
await test.step('Ensure github popup is not a 404', async () => { await test.step('Ensure github popup is not a 404', async () => {
// expect(githubPopup).toBeVisible(); // await expect(githubPopup).toBeVisible();
const title = await githubPopup.title(); const title = await githubPopup.title();
expect(title).not.toMatch(/^Page not found/); await expect(title).not.toMatch(/^Page not found/);
}); });
/* Skip these in CI /* Skip these in CI

View File

@@ -74,7 +74,12 @@ export default function AddNewAppConnection(
}, []); }, []);
return ( return (
<Dialog open={true} onClose={onClose} maxWidth="sm" fullWidth> <Dialog
open={true}
onClose={onClose}
maxWidth="sm"
fullWidth
data-test="add-app-connection-dialog">
<DialogTitle>{formatMessage('apps.addNewAppConnection')}</DialogTitle> <DialogTitle>{formatMessage('apps.addNewAppConnection')}</DialogTitle>
<Box px={3}> <Box px={3}>