Skip to content

Commit

Permalink
New setting to visualize images fetch requests separated from data logs
Browse files Browse the repository at this point in the history
  • Loading branch information
marc0l92 committed May 30, 2023
1 parent 4bbbd7b commit c5230c6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/client/jiraClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ async function preFetchImage(account: IJiraIssueAccountSettings, url: string): P
let response: RequestUrlResponse
try {
response = await requestUrl(options)
SettingsData.logRequestsResponses && console.info('JiraIssue:FetchImage:', { request: options, response })
SettingsData.logImagesFetch && console.info('JiraIssue:FetchImage:', { request: options, response })
} catch (errorResponse) {
SettingsData.logRequestsResponses && console.warn('JiraIssue:FetchImage:', { request: options, response: errorResponse })
SettingsData.logImagesFetch && console.warn('JiraIssue:FetchImage:', { request: options, response: errorResponse })
response = errorResponse
}

Expand Down
1 change: 1 addition & 0 deletions src/interfaces/settingsInterfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export interface IJiraIssueSettings {
inlineIssuePrefix: string
searchColumns: ISearchColumn[]
logRequestsResponses: boolean
logImagesFetch: boolean
showColorBand: boolean

// Legacy credentials
Expand Down
12 changes: 11 additions & 1 deletion src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const DEFAULT_SETTINGS: IJiraIssueSettings = {
{ type: ESearchColumnsTypes.STATUS, compact: false },
],
logRequestsResponses: false,
logImagesFetch: false,
}

export const DEFAULT_ACCOUNT: IJiraIssueAccountSettings = {
Expand Down Expand Up @@ -593,14 +594,23 @@ export class JiraIssueSettingTab extends PluginSettingTab {

containerEl.createEl('h3', { text: 'Troubleshooting' })
new Setting(containerEl)
.setName('Log Request and Responses')
.setName('Log data request and responses')
.setDesc('Log in the console (CTRL+Shift+I) all the API requests and responses performed by the plugin.')
.addToggle(toggle => toggle
.setValue(SettingsData.logRequestsResponses)
.onChange(async value => {
SettingsData.logRequestsResponses = value
await this.saveSettings()
}))
new Setting(containerEl)
.setName('Log images requests and responses')
.setDesc('Log in the console (CTRL+Shift+I) all the images fetch requests and responses performed by the plugin.')
.addToggle(toggle => toggle
.setValue(SettingsData.logImagesFetch)
.onChange(async value => {
SettingsData.logImagesFetch = value
await this.saveSettings()
}))
}

createNewEmptyAccount() {
Expand Down

0 comments on commit c5230c6

Please sign in to comment.