Added Task breakdown to ProjectDetails

This commit is contained in:
Raven Scott 2022-01-24 23:41:22 +00:00
parent 0749dba48e
commit 1be59e5543

View File

@ -7,7 +7,8 @@ let boardList = []
let data
let desc
let columns = [];
let tasksInfo = []
let projectName
//Requiring our discord components and paginator
const { MessageEmbed, MessageButton } = require("discord.js");
const { Pagination } = require("pagination.djs");
@ -58,7 +59,7 @@ exports.run = async (client, interaction) => {
if (interaction.customId === 'select') {
(async () => {
await interaction.update({ content: 'Selection Detected.', components: [] });
await interaction.update({ content: '󠀠', components: [] });
console.log(interaction.values[0]);
var Request = http.get('https://board.grwh.work/jsonrpc.php').headers({ Accept: 'application/json', 'Content-Type': 'application/json' }).send({ "jsonrpc": "2.0", "method": "getBoard", "id": 0, "params": [interaction.values[0]] });
@ -81,19 +82,32 @@ exports.run = async (client, interaction) => {
desc = data.description
}
const pusherFunc = column => columns.push(column.title + " Position: " + column.nb_tasks + " tasks.\n");
const pusherFunc = column => columns.push(column.title + " " + column.nb_tasks + " tasks.\n");
data.columns.forEach(pusherFunc);
let dataTasks = response.body.result[0].columns
dataTasks.forEach(function(column) {
if (column.tasks != []){
column.tasks.forEach(function(task) {
// console.log(task)
//console.log (task.title + " in " + task.column_name + " for " + task.project_name)
if (task.is_active == 0) return
tasksInfo.push(task.title + " in " + task.column_name + "\n")
})}
});
console.log(tasksInfo)
const mainEmbed = new MessageEmbed()
.setColor('#0099ff')
.addFields(
{ name: 'Swimlane', value: data.name, inline: true },
{ name: 'Project ID', value: data.project_id, inline: true },
{ name: 'Description', value: desc },
{ name: 'Swimlane Description', value: desc },
{ name: 'Task Info', value: columns.join(" "), inline: true },
{ name: 'Open Task Breakdown', value: tasksInfo.join(" "), inline: false },
{ name: 'link', value: "https://" + process.env.ROOT_DOMAIN + "/board/" + data.project_id, inline: true })
.setTitle('Requested Details')
.setDescription("Position " + data.position)
.setDescription("Swimlane: " + data.name)
.setFooter(date.format(now, 'MM/DD/YYYY hh:mm:ss'));
(async () => {
@ -102,6 +116,7 @@ exports.run = async (client, interaction) => {
boardList = [];
columns = [];
desc = "";
tasksInfo = [];
})();
})
})();