Skip to content

Commit

Permalink
Update reset request visibility if reset button is hidden (#322)
Browse files Browse the repository at this point in the history
* Hide reset request if reset button is hidden

* Hide reset payload if reset button is hidden

* Update version

---------

Co-authored-by: Mikhail Volkov <mikhail@volkovlabs.io>
  • Loading branch information
asimonok and mikhail-vl authored Jan 1, 2024
1 parent 88bceb3 commit 06bd1fe
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change Log

## 3.5.0 (IN PROGRESS)

### Features / Enhancements

- Add disable if code (#321)
- Update reset request visibility if reset button is hidden (#322)

## 3.4.0 (2023-12-14)

### Features / Enhancements
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,5 @@
"test:ci": "jest --maxWorkers 4 --coverage",
"upgrade": "npm upgrade --save"
},
"version": "3.4.0"
"version": "3.5.0"
}
11 changes: 8 additions & 3 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,8 @@ export const plugin = new PanelPlugin<PanelOptions>(FormPanel)
name: 'Data Source',
category: ['Reset Request'],
editor: DatasourceEditor,
showIf: (config) => config.resetAction.mode === ResetActionMode.DATASOURCE,
showIf: (config) =>
config.reset.variant !== ButtonVariant.HIDDEN && config.resetAction.mode === ResetActionMode.DATASOURCE,
})
.addCustomEditor({
id: 'resetAction.code',
Expand All @@ -625,7 +626,8 @@ export const plugin = new PanelPlugin<PanelOptions>(FormPanel)
language: CodeLanguage.JAVASCRIPT,
},
defaultValue: UPDATE_CODE_DEFAULT,
showIf: (config) => config.resetAction.mode === ResetActionMode.DATASOURCE,
showIf: (config) =>
config.reset.variant !== ButtonVariant.HIDDEN && config.resetAction.mode === ResetActionMode.DATASOURCE,
});

/**
Expand All @@ -642,7 +644,10 @@ export const plugin = new PanelPlugin<PanelOptions>(FormPanel)
language: CodeLanguage.JAVASCRIPT,
},
defaultValue: INITIAL_PAYLOAD_DEFAULT,
showIf: (config) => config.resetAction.mode === ResetActionMode.DATASOURCE && !!config.resetAction.datasource,
showIf: (config) =>
config.reset.variant !== ButtonVariant.HIDDEN &&
config.resetAction.mode === ResetActionMode.DATASOURCE &&
!!config.resetAction.datasource,
});

/**
Expand Down

0 comments on commit 06bd1fe

Please sign in to comment.