Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui: remove $ internal from apps filter option #75470

Merged
merged 1 commit into from
Jan 25, 2022
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -61,28 +61,27 @@ export const selectApps = createSelector(sqlStatsSelector, sqlStatsState => {
}

let sawBlank = false;
let sawInternal = false;
const apps: { [app: string]: boolean } = {};
sqlStatsState.data.statements.forEach(
(statement: ICollectedStatementStatistics) => {
if (
const isNotInternalApp =
sqlStatsState.data.internal_app_name_prefix &&
statement.key.key_data.app.startsWith(
!statement.key.key_data.app.startsWith(
sqlStatsState.data.internal_app_name_prefix,
)
);
if (
sqlStatsState.data.internal_app_name_prefix == undefined ||
isNotInternalApp
) {
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
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,27 @@ export const selectApps = createSelector(
}

let sawBlank = false;
let sawInternal = false;
const apps: { [app: string]: boolean } = {};
state.data.statements.forEach(
(statement: ICollectedStatementStatistics) => {
if (
const isNotInternalApp =
state.data.internal_app_name_prefix &&
statement.key.key_data.app.startsWith(
!statement.key.key_data.app.startsWith(
state.data.internal_app_name_prefix,
)
);
if (
state.data.internal_app_name_prefix == undefined ||
isNotInternalApp
) {
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