fix: CB-1746 nav tree selection

This commit is contained in:
Wroud
2022-03-16 20:09:11 +03:00
parent df11e87153
commit 6407e91b27
7 changed files with 23 additions and 23 deletions
@@ -65,7 +65,7 @@ export const NavigationNodeControl: NavTreeControlComponent = observer(function
|| !!navTreeResource.getException(node.id)
));
const connected = getComputed(() => node.objectFeatures.includes(EObjectFeature.dataSourceConnected));
const selected = getComputed(() => treeNodeContext.selected);
const selected = treeNodeContext.selected;
const [editing, setEditing] = useState(false);
@@ -54,7 +54,7 @@ export const TableItem = observer<Props>(function TableItem({
throw new Error('TableContext must be provided');
}
const selectionDisabled = getComputed(() => selectDisabled || (!!context.state.isItemSelectable && ((
const selectionDisabled = selectDisabled || getComputed(() => (!!context.state.isItemSelectable && ((
context.state.selectableItems.length > 0 && !context.state.selectableItems.includes(item)
) || !context.state.isItemSelectable(item))));
@@ -44,8 +44,8 @@ export const TreeNodeExpand = observer<Props>(function TreeNodeExpand({
throw new Error('Context not provided');
}
disabled = getComputed(() => context.externalExpanded || context.disabled || disabled);
leaf = getComputed(() => context.leaf || leaf);
disabled = getComputed(() => context.externalExpanded || context.disabled) || disabled;
leaf = context.leaf || leaf;
const loading = useStateDelay(getComputed(() => context.loading || context.processing), 300);
const expandable = getComputed(() => !loading && (!leaf || context.externalExpanded));
@@ -48,10 +48,10 @@ export const TreeNodeSelect = observer<Props>(function TreeNodeSelect({
throw new Error('Context not provided');
}
disabled = getComputed(() => context.disabled || disabled);
group = getComputed(() => group ?? context.group);
const loading = getComputed(() => loadIndicator && context.loading);
selected = getComputed(() => selected ?? context.selected);
disabled = disabled || context.disabled;
group = group ?? context.group;
const loading = loadIndicator && context.loading;
selected = selected ?? context.selected;
async function handleSelect() {
await onSelect?.();
@@ -72,7 +72,7 @@ export const UsersTable = observer<Props>(function UsersTable({ sub, param }) {
const controller = useController(UsersTableController);
const usersResource = useMapResource(UsersTable, UsersResource, CachedMapAllKey);
const isLocalProviderAvailable = controller.isLocalProviderAvailable;
const users = getComputed(() => usersResource.data
const users = usersResource.data
.filter<AdminUser>(filterUndefined)
.sort((a, b) => {
if (usersResource.resource.isNew(a.userId) === usersResource.resource.isNew(b.userId)) {
@@ -82,7 +82,7 @@ export const UsersTable = observer<Props>(function UsersTable({ sub, param }) {
return -1;
}
return 1;
}));
});
const create = param === 'create';
const keys = users.map(user => user.userId);
@@ -68,19 +68,19 @@ export const ConfigurationsList = observer<Props>(function ConfigurationsList({
)).flat()
);
const filteredConfigurations = getComputed(() => {
const sortedConfigurations = configurations
.slice()
.sort((a, b) => comparePublicAuthConfigurations(a.configuration, b.configuration)) || [];
const sortedConfigurations = configurations
.slice()
.sort((a, b) => comparePublicAuthConfigurations(a.configuration, b.configuration));
if (!search) {
return sortedConfigurations;
}
let filteredConfigurations: IProviderConfiguration[];
return sortedConfigurations.filter(({ configuration }) => {
const target = `${configuration.displayName}${configuration.description || ''}`;
return target.toUpperCase().includes(search.toUpperCase());
});
if (!search) {
filteredConfigurations = sortedConfigurations;
}
filteredConfigurations = sortedConfigurations.filter(({ configuration }) => {
const target = `${configuration.displayName}${configuration.description || ''}`;
return target.toUpperCase().includes(search.toUpperCase());
});
async function auth({ provider, configuration }: IProviderConfiguration) {
@@ -56,7 +56,7 @@ export const SqlResultTabs = observer<Props>(function SqlDataResult({ state, onT
const translate = useTranslate();
const sqlResultTabsService = useService(SqlResultTabsService);
const orderedTabs = getComputed(() => state.tabs
const orderedTabs = state.tabs
.slice()
.sort((tabA, tabB) => {
const resultTabA = state.resultTabs.find(tab => tab.tabId === tabA.id);
@@ -67,7 +67,7 @@ export const SqlResultTabs = observer<Props>(function SqlDataResult({ state, onT
}
return tabA.order - tabB.order;
}));
});
function handleSelect(tab: ITabData) {
sqlResultTabsService.selectResultTab(state, tab.tabId);