2025-04-12 09:38:41 +00:00
|
|
|
|
2025-04-13 00:32:03 +00:00
|
|
|
import {TFile} from "obsidian";
|
2025-04-12 09:38:41 +00:00
|
|
|
import JiraPlugin from "../main";
|
2025-08-24 23:42:16 +00:00
|
|
|
import {IssueWorkLogModal} from "../modals";
|
2025-04-13 00:32:03 +00:00
|
|
|
import {addWorkLog} from "../api";
|
2025-04-12 09:38:41 +00:00
|
|
|
import {checkCommandCallback} from "../tools/check_command_callback";
|
2025-08-24 23:42:16 +00:00
|
|
|
import {useTranslations} from "../localization/translator";
|
|
|
|
|
|
|
|
|
|
const t = useTranslations("commands.add_worklog.manual").t;
|
2025-04-12 09:38:41 +00:00
|
|
|
|
|
|
|
|
export function registerUpdateWorkLogManuallyCommand(plugin: JiraPlugin): void {
|
|
|
|
|
plugin.addCommand({
|
|
|
|
|
id: "update-work-log-jira-manually",
|
2025-08-24 23:42:16 +00:00
|
|
|
name: t("name"),
|
2025-04-12 09:38:41 +00:00
|
|
|
checkCallback: (checking: boolean) => {
|
2025-04-13 00:32:03 +00:00
|
|
|
return checkCommandCallback(plugin, checking, processManualWorkLog, ["key"], ["key"]);
|
2025-04-12 09:38:41 +00:00
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-13 00:32:03 +00:00
|
|
|
async function processManualWorkLog(plugin: JiraPlugin, _: TFile, issueKey: string): Promise<void> {
|
2025-04-12 09:38:41 +00:00
|
|
|
|
2025-08-24 23:42:16 +00:00
|
|
|
new IssueWorkLogModal(plugin.app, async (timeSpent: string, startDate: string, comment: string) => {
|
2025-04-12 09:38:41 +00:00
|
|
|
await addWorkLog(plugin, issueKey, timeSpent, startDate, comment);
|
|
|
|
|
}).open();
|
|
|
|
|
}
|