Skip to content
Open
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
28 changes: 3 additions & 25 deletions dashboards/src/context/DatasourceStoreProvider.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,7 @@ describe('DatasourceStoreProvider::useListDatasourceSelectItems', () => {
{
editLink: undefined,
group: `Default Datasource Plugin for ${FAKE_PLUGIN_NAME}`,
items: [
{
name: 'Default (localDatasourceA from dashboard)',
selector: {
kind: FAKE_PLUGIN_NAME,
},
},
],
items: [],
},
{
editLink: undefined,
Expand Down Expand Up @@ -297,15 +290,7 @@ describe('DatasourceStoreProvider::useListDatasourceSelectItems', () => {
{
editLink: undefined,
group: `Default Datasource Plugin for ${FAKE_PLUGIN_NAME}`,
items: [
{
// This is the default datasource because first of the list
name: 'Default (datasourceA from project)',
selector: {
kind: FAKE_PLUGIN_NAME,
},
},
],
items: [],
},
{
editLink: '/projects/perses/datasources',
Expand Down Expand Up @@ -458,14 +443,7 @@ describe('DatasourceStoreProvider::useListDatasourceSelectItems', () => {
{
editLink: undefined,
group: `Default Datasource Plugin for ${FAKE_PLUGIN_NAME}`,
items: [
{
name: 'Default (localDatasourceA from dashboard)',
selector: {
kind: FAKE_PLUGIN_NAME,
},
},
],
items: [],
},
{
editLink: undefined,
Expand Down
2 changes: 1 addition & 1 deletion dashboards/src/context/DatasourceStoreProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ function buildDatasourceSelectItemGroups(pluginDisplayName: string): {
usedNames.add(selectorName);

const isExplicitDefault = !isOverridden && spec.default && !explicitDefaultAdded;
if (results[0] && (isFirst || isExplicitDefault)) {
if (results[0] && isExplicitDefault) {
// If we haven't added a default yet and this is a default, add default option to the beginning of the results
results[0].items = [
{
Expand Down