Skip to content

Commit

Permalink
fix: show all tasks on admin page
Browse files Browse the repository at this point in the history
  • Loading branch information
rutmanz committed Oct 29, 2024
1 parent 3226d0f commit 08e2d1e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
23 changes: 16 additions & 7 deletions src/slack/blocks/app_home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,24 @@ import { getTaskKeys } from '~tasks'
export async function getAppHome(user_id: string) {
const homeTab = HomeTab()
if (config.slack.users.devs.includes(user_id)) {
const tasks = getTaskKeys().map((key) => Bits.Option().text(key).value(key))
homeTab.blocks(
Blocks.Header().text('Dev Dashboard'),
Blocks.Section()
.text('Manual Tasks')
.accessory(
Elements.OverflowMenu()
.actionId(ActionIDs.RUN_TASK)
.options(getTaskKeys().map((key) => Bits.Option().text(key).value(key)))
),
)
for (let i = 0; i<Math.ceil(tasks.length/5); i++) {
console.log(tasks.slice(i*5,(i+1)*5))
homeTab.blocks(
Blocks.Section()
.text('Manual Tasks ('+i+")")
.accessory(
Elements.OverflowMenu()
.actionId(ActionIDs.RUN_TASK)
.options(tasks.slice(i*5,(i+1)*5))
),
)
}

homeTab.blocks(
Blocks.Actions().elements(
Elements.Button().text('Open Onboarding').actionId(ActionIDs.OPEN_ONBOARDING_MODAL),
Elements.Button().text('Send Pending Requests').actionId(ActionIDs.SEND_PENDING_REQUESTS),
Expand Down
8 changes: 4 additions & 4 deletions src/tasks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ export function scheduleTasks() {

// Slack is silly and can only handle 5 items in the overflow menu
scheduleCronTask(createTaskFunc(promptCheckinMessage), '0 19 * * FRI')
scheduleTask(updateSheet, 60 * 5, isProd, 0)
scheduleTask(syncSlackMembers, 60 * 60, isProd, 0) // can be run from the admin members page
scheduleTask(updateProfileCerts, 60 * 60 * 24, isProd, 5 * 60)
scheduleTask(updateProfileDepartments, 60 * 60 * 24, isProd, 10 * 60)
tasks["Sync Sheet"] = scheduleTask(updateSheet, 60 * 5, isProd, 0)
tasks["Sync Slack Members"] = scheduleTask(syncSlackMembers, 60 * 60, isProd, 0) // can be run from the admin members page
tasks["Update profile Certs"] = scheduleTask(updateProfileCerts, 60 * 60 * 24, isProd, 5 * 60)
tasks["Update Profile Departments"] = scheduleTask(updateProfileDepartments, 60 * 60 * 24, isProd, 10 * 60)
}

export async function runTask(key: string) {
Expand Down

0 comments on commit 08e2d1e

Please sign in to comment.