Skip to content

Improve deprecation warning and output. #258

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Refactor configuration entries (#247)
- Remove 3rd Party references and rename console setting (#247)
- Replace deprecated http library (#247)
- Add update notice prepared for loing term usage (#250)
- Add update notice prepared for loing term usage (#250, #258)
- Remove Changelog from .vscodeignore for better marketplace presentation (#253)
- Dependency update (#254)

Expand Down
23 changes: 15 additions & 8 deletions client/src/Utils/ConfigManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,15 @@ Please take a look at the current extension settings\nand update to the new conf
this.deprecationWarningShown = false
this.updateConfig()

if(this.hasDeprecatedParameters()){
let deprecatedParameters = this.hasDeprecatedParameters()

if (deprecatedParameters) {
if (Array.isArray(deprecatedParameters)) {
deprecatedParameters.forEach((parameter) => {
utils.appendToOutput(`Usage of deprecated config => openhab.${parameter} <= detected.`)
})
}

this.showDeprecationWarning()
}
}
Expand Down Expand Up @@ -102,7 +110,7 @@ Please take a look at the current extension settings\nand update to the new conf

// Output a warning with a "Dismiss" button to prevent warning from showing too often
if(returnValue !== null){
utils.appendToOutput(`Usage of deprecated config ${parameter} detected.`)
utils.appendToOutput(`Usage of deprecated config => openhab.${parameter} <= detected.`)
}

return returnValue
Expand Down Expand Up @@ -252,14 +260,13 @@ Please take a look at the current extension settings\nand update to the new conf
private async showDeprecationWarning() {
if(!this.deprecationWarningShown){
this.deprecationWarningShown = true
// const migrateStandardValues = 'Migrate minimal config directly!'
const showOutput = 'Show Output'

// let result = await vscode.window.showWarningMessage(ConfigManager.DEPRECATION_WARNING_MESSAGE, { modal: true }, migrateStandardValues)
vscode.window.showWarningMessage(ConfigManager.DEPRECATION_WARNING_MESSAGE)
let result = await vscode.window.showWarningMessage(ConfigManager.DEPRECATION_WARNING_MESSAGE, showOutput)

// // Action based on user input
// if(result == migrateStandardValues)
// ConfigManager.migrateDeprecatedParameters()
// Action based on user input
if(result == showOutput)
utils.getOutputChannel().show()
}
}
}