Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
151 changes: 151 additions & 0 deletions components/taiga/actions/create-issue/create-issue.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
import { parseObject } from "../../common/utils.mjs";
import taiga from "../../taiga.app.mjs";

export default {
key: "taiga-create-issue",
name: "Create Issue",
description: "Create a new issue in a Taiga project. [See the documentation](https://docs.taiga.io/api.html#issues-create)",
version: "0.0.1",
type: "action",
props: {
taiga,
projectId: {
propDefinition: [
taiga,
"projectId",
],
},
subject: {
propDefinition: [
taiga,
"issueSubject",
],
},
description: {
propDefinition: [
taiga,
"issueDescription",
],
optional: true,
},
priority: {
propDefinition: [
taiga,
"issuePriority",
({ projectId }) => ({
projectId,
}),
],
optional: true,
},
severity: {
propDefinition: [
taiga,
"issueSeverity",
({ projectId }) => ({
projectId,
}),
],
optional: true,
},
status: {
propDefinition: [
taiga,
"issueStatus",
({ projectId }) => ({
projectId,
}),
],
optional: true,
},
type: {
propDefinition: [
taiga,
"issueType",
({ projectId }) => ({
projectId,
}),
],
optional: true,
},
assignedTo: {
propDefinition: [
taiga,
"userId",
({ projectId }) => ({
projectId,
}),
],
label: "Assigned To",
description: "User to assign the issue to",
optional: true,
},
milestone: {
propDefinition: [
taiga,
"milestone",
({ projectId }) => ({
projectId,
}),
],
optional: true,
},
tags: {
propDefinition: [
taiga,
"tags",
],
optional: true,
},
blockedNote: {
propDefinition: [
taiga,
"issueBlockedNote",
],
optional: true,
},
isBlocked: {
propDefinition: [
taiga,
"isBlocked",
],
optional: true,
},
watchers: {
propDefinition: [
taiga,
"userId",
({ projectId }) => ({
projectId,
}),
],
type: "string[]",
label: "Watchers",
description: "Users to watch the issue",
optional: true,
},
},
async run({ $ }) {
const response = await this.taiga.createIssue({
$,
data: {
subject: this.subject,
description: this.description,
project: this.projectId,
priority: this.priority,
severity: this.severity,
status: this.status,
type: this.type,
assigned_to: this.assignedTo,
tags: parseObject(this.tags),
blocked_note: this.blockedNote,
is_blocked: this.isBlocked,
milestone: this.milestone,
watchers: parseObject(this.watchers),
},
});

$.export("$summary", `Created issue: ${response.id}`);
return response;
},
};
141 changes: 141 additions & 0 deletions components/taiga/actions/create-task/create-task.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
import { parseObject } from "../../common/utils.mjs";
import taiga from "../../taiga.app.mjs";

export default {
key: "taiga-create-task",
name: "Create Task",
description: "Create a new task in a Taiga project. [See the documentation](https://docs.taiga.io/api.html#tasks-create)",
version: "0.0.1",
type: "action",
props: {
taiga,
projectId: {
propDefinition: [
taiga,
"projectId",
],
},
subject: {
propDefinition: [
taiga,
"taskSubject",
],
},
description: {
propDefinition: [
taiga,
"taskDescription",
],
optional: true,
},
isBlocked: {
propDefinition: [
taiga,
"isBlocked",
],
description: "Whether the task is blocked",
optional: true,
},
milestone: {
propDefinition: [
taiga,
"milestone",
({ projectId }) => ({
projectId,
}),
],
optional: true,
},
status: {
propDefinition: [
taiga,
"taskStatus",
({ projectId }) => ({
projectId,
}),
],
optional: true,
},
assignedTo: {
propDefinition: [
taiga,
"userId",
({ projectId }) => ({
projectId,
}),
],
label: "Assigned To",
description: "User to assign the task to",
optional: true,
},
userStoryId: {
propDefinition: [
taiga,
"userStoryId",
({ projectId }) => ({
projectId,
}),
],
label: "User Story",
description: "User story to associate the task with",
optional: true,
},
usOrder: {
propDefinition: [
taiga,
"usOrder",
],
optional: true,
},
taskboardOrder: {
propDefinition: [
taiga,
"taskboardOrder",
],
optional: true,
},
tags: {
propDefinition: [
taiga,
"tags",
],
description: "Tags to associate with the task",
optional: true,
},
watchers: {
propDefinition: [
taiga,
"userId",
({ projectId }) => ({
projectId,
}),
],
type: "string[]",
label: "Watchers",
description: "Users to watch the task",
optional: true,
},
},
async run({ $ }) {
const response = await this.taiga.createTask({
$,
data: {
subject: this.subject,
description: this.description,
project: this.projectId,
status: this.status,
assigned_to: this.assignedTo,
user_story: this.userStoryId,
tags: parseObject(this.tags),
is_blocked: this.isBlocked,
milestone: this.milestone,
user_story_order: this.usOrder,
taskboard_order: this.taskboardOrder,
watchers: parseObject(this.watchers),
},
});

$.export("$summary", `Created task: ${response.id}`);
return response;
},
};
Loading
Loading