chore: refactor submenu's right nav to accept list of buttons (#11102)

* submenu right-nav button refactor

* undo changes

* fix lint

* fix test

* update pr with suggested changes and test

* fix lint

* use enum to define btn style props

* add suggestions

* update savedquery buttons
This commit is contained in:
Phillip Kelley-Dotson
2020-10-01 15:05:49 -07:00
committed by GitHub
parent 2a906bc9d1
commit 07716ffd76
7 changed files with 106 additions and 65 deletions

View File

@@ -126,19 +126,22 @@ function DatabaseList({ addDangerToast, addSuccessToast }: DatabaseListProps) {
};
if (canCreate) {
menuData.primaryButton = {
name: (
<>
{' '}
<i className="fa fa-plus" /> {t('Database')}{' '}
</>
),
onClick: () => {
// Ensure modal will be opened in add mode
setCurrentDatabase(null);
setDatabaseModalOpen(true);
menuData.buttons = [
{
name: (
<>
{' '}
<i className="fa fa-plus" /> {t('Database')}{' '}
</>
),
buttonStyle: 'primary',
onClick: () => {
// Ensure modal will be opened in add mode
setCurrentDatabase(null);
setDatabaseModalOpen(true);
},
},
};
];
}
const initialSort = [{ id: 'changed_on_delta_humanized', desc: true }];