Move table column selection out of feature flag to MPAC. (#1973)

This commit is contained in:
Laurent Nguyen 2024-09-19 07:18:03 +02:00 committed by GitHub
parent 9f1cc4cd5c
commit 42a1c6c319
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 22 deletions

View File

@ -38,6 +38,7 @@ import {
TextSortDescendingRegular, TextSortDescendingRegular,
} from "@fluentui/react-icons"; } from "@fluentui/react-icons";
import { NormalizedEventKey } from "Common/Constants"; import { NormalizedEventKey } from "Common/Constants";
import { Environment, getEnvironment } from "Common/EnvironmentUtility";
import { TableColumnSelectionPane } from "Explorer/Panes/TableColumnSelectionPane/TableColumnSelectionPane"; import { TableColumnSelectionPane } from "Explorer/Panes/TableColumnSelectionPane/TableColumnSelectionPane";
import { import {
ColumnSizesMap, ColumnSizesMap,
@ -50,7 +51,6 @@ import {
import { INITIAL_SELECTED_ROW_INDEX, useDocumentsTabStyles } from "Explorer/Tabs/DocumentsTabV2/DocumentsTabV2"; import { INITIAL_SELECTED_ROW_INDEX, useDocumentsTabStyles } from "Explorer/Tabs/DocumentsTabV2/DocumentsTabV2";
import { selectionHelper } from "Explorer/Tabs/DocumentsTabV2/SelectionHelper"; import { selectionHelper } from "Explorer/Tabs/DocumentsTabV2/SelectionHelper";
import { LayoutConstants } from "Explorer/Theme/ThemeUtil"; import { LayoutConstants } from "Explorer/Theme/ThemeUtil";
import { userContext } from "UserContext";
import { isEnvironmentCtrlPressed, isEnvironmentShiftPressed } from "Utils/KeyboardUtils"; import { isEnvironmentCtrlPressed, isEnvironmentShiftPressed } from "Utils/KeyboardUtils";
import { useSidePanel } from "hooks/useSidePanel"; import { useSidePanel } from "hooks/useSidePanel";
import React, { useCallback, useMemo } from "react"; import React, { useCallback, useMemo } from "react";
@ -228,7 +228,7 @@ export const DocumentsTableComponent: React.FC<IDocumentsTableComponentProps> =
<MenuItem key="refresh" icon={<ArrowClockwise16Regular />} onClick={onRefreshTable}> <MenuItem key="refresh" icon={<ArrowClockwise16Regular />} onClick={onRefreshTable}>
Refresh Refresh
</MenuItem> </MenuItem>
{userContext.features.enableDocumentsTableColumnSelection && ( {[Environment.Development, Environment.Mpac].includes(getEnvironment()) && (
<> <>
<MenuItem <MenuItem
icon={<TextSortAscendingRegular />} icon={<TextSortAscendingRegular />}
@ -260,24 +260,25 @@ export const DocumentsTableComponent: React.FC<IDocumentsTableComponentProps> =
> >
Resize with left/right arrow keys Resize with left/right arrow keys
</MenuItem> </MenuItem>
{userContext.features.enableDocumentsTableColumnSelection && !isColumnSelectionDisabled && ( {[Environment.Development, Environment.Mpac].includes(getEnvironment()) &&
<MenuItem !isColumnSelectionDisabled && (
key="remove" <MenuItem
icon={<DeleteRegular />} key="remove"
onClick={() => { icon={<DeleteRegular />}
// Remove column id from selectedColumnIds onClick={() => {
const index = selectedColumnIds.indexOf(column.id); // Remove column id from selectedColumnIds
if (index === -1) { const index = selectedColumnIds.indexOf(column.id);
return; if (index === -1) {
} return;
const newSelectedColumnIds = [...selectedColumnIds]; }
newSelectedColumnIds.splice(index, 1); const newSelectedColumnIds = [...selectedColumnIds];
onColumnSelectionChange(newSelectedColumnIds); newSelectedColumnIds.splice(index, 1);
}} onColumnSelectionChange(newSelectedColumnIds);
> }}
Remove column >
</MenuItem> Remove column
)} </MenuItem>
)}
</MenuList> </MenuList>
</MenuPopover> </MenuPopover>
</Menu> </Menu>

View File

@ -38,7 +38,6 @@ export type Features = {
readonly copilotChatFixedMonacoEditorHeight: boolean; readonly copilotChatFixedMonacoEditorHeight: boolean;
readonly enablePriorityBasedExecution: boolean; readonly enablePriorityBasedExecution: boolean;
readonly disableConnectionStringLogin: boolean; readonly disableConnectionStringLogin: boolean;
readonly enableDocumentsTableColumnSelection: boolean;
// can be set via both flight and feature flag // can be set via both flight and feature flag
autoscaleDefault: boolean; autoscaleDefault: boolean;
@ -109,7 +108,6 @@ export function extractFeatures(given = new URLSearchParams(window.location.sear
copilotChatFixedMonacoEditorHeight: "true" === get("copilotchatfixedmonacoeditorheight"), copilotChatFixedMonacoEditorHeight: "true" === get("copilotchatfixedmonacoeditorheight"),
enablePriorityBasedExecution: "true" === get("enableprioritybasedexecution"), enablePriorityBasedExecution: "true" === get("enableprioritybasedexecution"),
disableConnectionStringLogin: "true" === get("disableconnectionstringlogin"), disableConnectionStringLogin: "true" === get("disableconnectionstringlogin"),
enableDocumentsTableColumnSelection: "true" === get("enabledocumentstablecolumnselection"),
}; };
} }