mirror of
https://github.com/mryanb/obsidian-asana.git
synced 2026-07-22 05:38:24 +00:00
feat(settings): add toggle for showing archived projects
- Add showArchivedProjects setting to control visibility of archived projects - Update fetchAsanaProjects to respect the new setting - Default to hiding archived projects for backward compatibility
This commit is contained in:
parent
a8d0e4945d
commit
8144510153
2 changed files with 15 additions and 1 deletions
|
|
@ -46,7 +46,7 @@ export async function fetchAsanaProjects(
|
|||
|
||||
try {
|
||||
const response = await requestUrl({
|
||||
url: `${ASANA_API_BASE_URL}/workspaces/${workspaceGid}/projects?is_archived=false`,
|
||||
url: `${ASANA_API_BASE_URL}/workspaces/${workspaceGid}/projects${settings.showArchivedProjects ? '' : '?is_archived=false'}`,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ export interface AsanaPluginSettings {
|
|||
markTaskAsCompleted: boolean;
|
||||
pinnedProjects: string[];
|
||||
enableMarkdownLink: boolean;
|
||||
showArchivedProjects: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -19,6 +20,7 @@ export const DEFAULT_SETTINGS: AsanaPluginSettings = {
|
|||
markTaskAsCompleted: false,
|
||||
pinnedProjects: [],
|
||||
enableMarkdownLink: true,
|
||||
showArchivedProjects: false,
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -103,6 +105,18 @@ export class AsanaSettingTab extends PluginSettingTab {
|
|||
});
|
||||
});
|
||||
|
||||
// Toggle: Show Archived Projects
|
||||
new Setting(containerEl)
|
||||
.setName('Show archived projects')
|
||||
.setDesc('Include archived projects in the project selection modal.')
|
||||
.addToggle((toggle: ToggleComponent) => {
|
||||
toggle.setValue(this.plugin.settings.showArchivedProjects)
|
||||
.onChange(async (value: boolean) => {
|
||||
this.plugin.settings.showArchivedProjects = value;
|
||||
await this.plugin.saveSettings();
|
||||
});
|
||||
});
|
||||
|
||||
// Pinned Projects Input (Scalable TextArea)
|
||||
new Setting(containerEl)
|
||||
.setName('Pinned projects')
|
||||
|
|
|
|||
Loading…
Reference in a new issue