Improve deprecation warning and output. (#258)

Signed-off-by: Jerome Luckenbach <github@luckenba.ch>
pull/259/head
Jerome Luckenbach 2021-04-07 22:02:08 +02:00 committed by GitHub
parent a6964e958c
commit a6939ae847
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 9 deletions

View File

@ -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)

View File

@ -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()
}
}
@ -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
@ -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()
}
}
}