Skip to content

Commit

Permalink
ui: remove $ internal from apps filter option
Browse files Browse the repository at this point in the history
Previously, we had the option `$ internal` on the list of
Apps on filters of both Statement and Transaction pages.
We're making a change to not return internal filters anymore,
so this commit remove that option from the filter, since
it will always results on a blank table.

Release note (ui change): Remove `$ internal` as one of the apps
option under the Statements and Transactions page filters.
  • Loading branch information
maryliag committed Jan 24, 2022
1 parent 72c5471 commit e83963b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,28 +61,25 @@ export const selectApps = createSelector(sqlStatsSelector, sqlStatsState => {
}

let sawBlank = false;
let sawInternal = false;
const apps: { [app: string]: boolean } = {};
sqlStatsState.data.statements.forEach(
(statement: ICollectedStatementStatistics) => {
if (
sqlStatsState.data.internal_app_name_prefix &&
statement.key.key_data.app.startsWith(
sqlStatsState.data.internal_app_name_prefix,
)
(sqlStatsState.data.internal_app_name_prefix &&
!statement.key.key_data.app.startsWith(
sqlStatsState.data.internal_app_name_prefix,
)) ||
sqlStatsState.data.internal_app_name_prefix == undefined
) {
sawInternal = true;
} else if (statement.key.key_data.app) {
apps[statement.key.key_data.app] = true;
} else {
sawBlank = true;
if (statement.key.key_data.app) {
apps[statement.key.key_data.app] = true;
} else {
sawBlank = true;
}
}
},
);
return []
.concat(sawInternal ? [sqlStatsState.data.internal_app_name_prefix] : [])
.concat(sawBlank ? ["(unset)"] : [])
.concat(Object.keys(apps));
return [].concat(sawBlank ? ["(unset)"] : []).concat(Object.keys(apps));
});

// selectDatabases returns the array of all databases with statement statistics present
Expand Down
3 changes: 1 addition & 2 deletions pkg/ui/workspaces/cluster-ui/src/transactionsPage/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,13 @@ export const getTrxAppFilterOptions = (
transactions: Transaction[],
prefix: string,
): string[] => {
const defaultAppFilters = [prefix];
const uniqueAppNames = new Set(
transactions
.filter(t => !t.stats_data.app.startsWith(prefix))
.map(t => (t.stats_data.app ? t.stats_data.app : "(unset)")),
);

return defaultAppFilters.concat(Array.from(uniqueAppNames));
return Array.from(uniqueAppNames);
};

export const collectStatementsText = (statements: Statement[]): string =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,28 +161,25 @@ export const selectApps = createSelector(
}

let sawBlank = false;
let sawInternal = false;
const apps: { [app: string]: boolean } = {};
state.data.statements.forEach(
(statement: ICollectedStatementStatistics) => {
if (
state.data.internal_app_name_prefix &&
statement.key.key_data.app.startsWith(
state.data.internal_app_name_prefix,
)
(state.data.internal_app_name_prefix &&
!statement.key.key_data.app.startsWith(
state.data.internal_app_name_prefix,
)) ||
state.data.internal_app_name_prefix == undefined
) {
sawInternal = true;
} else if (statement.key.key_data.app) {
apps[statement.key.key_data.app] = true;
} else {
sawBlank = true;
if (statement.key.key_data.app) {
apps[statement.key.key_data.app] = true;
} else {
sawBlank = true;
}
}
},
);
return []
.concat(sawInternal ? [state.data.internal_app_name_prefix] : [])
.concat(sawBlank ? ["(unset)"] : [])
.concat(Object.keys(apps));
return [].concat(sawBlank ? ["(unset)"] : []).concat(Object.keys(apps));
},
);

Expand Down

0 comments on commit e83963b

Please sign in to comment.