-
Notifications
You must be signed in to change notification settings - Fork 596
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
Utility for adding a path to a sidebar group #5251
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -624,6 +624,44 @@ def _rename_paths(self, paths, new_paths): | |
for path, new_path in zip(paths, new_paths): | ||
self._rename_path(path, new_path) | ||
|
||
def _add_path_to_sidebar_group( | ||
self, | ||
path, | ||
sidebar_group, | ||
after_group=None, | ||
dataset=None, | ||
): | ||
if self.sidebar_groups is None: | ||
if dataset is None: | ||
return | ||
|
||
self.sidebar_groups = self.default_sidebar_groups(dataset) | ||
|
||
index_group = None | ||
for group in self.sidebar_groups: | ||
if group.name == sidebar_group: | ||
index_group = group | ||
else: | ||
if path in group.paths: | ||
group.paths.remove(path) | ||
|
||
if index_group is None: | ||
index_group = SidebarGroupDocument(name=sidebar_group) | ||
|
||
insert_after = None | ||
if after_group is not None: | ||
for i, group in enumerate(self.sidebar_groups): | ||
if group.name == after_group: | ||
insert_after = i | ||
|
||
if insert_after is None: | ||
self.sidebar_groups.append(index_group) | ||
else: | ||
self.sidebar_groups.insert(insert_after + 1, index_group) | ||
|
||
if path not in index_group.paths: | ||
index_group.paths.append(path) | ||
|
||
Comment on lines
+627
to
+664
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Based on the search results, I can now generate the final response: Direct manipulation of sidebar groups found in mutation.py The new utility method
🔗 Analysis chainVerify usage pattern in the codebase Let's ensure this new utility method is being used consistently across the codebase. 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Check for direct manipulation of sidebar_groups that should use this new utility.
# Test: Search for direct manipulation of sidebar_groups. Expect: No direct manipulation.
# Look for direct manipulation of sidebar_groups
rg -A 5 'sidebar_groups\s*=' --type py
# Look for path manipulation in sidebar groups
rg -A 5 'paths\.append|paths\.remove' --type py
Length of output: 18187 |
||
|
||
def _make_default_sidebar_groups(sample_collection): | ||
# Possible sidebar groups | ||
|
Unchanged files with check annotations Beta
clearUseKeyStores(panelId); | ||
trackEvent("close_panel", { panel: panelName }); | ||
}); | ||
}, []); | ||
Check warning on line 40 in app/packages/operators/src/CustomPanel.tsx
|
||
useEffect(() => { | ||
setLoading(count > 0); | ||
useEffect(() => { | ||
dimensions?.refresh(); | ||
}, []); | ||
return children; | ||
} |
unlisted: true, | ||
}); | ||
} | ||
useHooks(ctx: ExecutionContext): {} { | ||
return { updatePanelState: useUpdatePanelStatePartial() }; | ||
} | ||
async execute(ctx: ExecutionContext): Promise<void> { |
import { test as base } from "src/oss/fixtures"; | ||
Check failure on line 1 in e2e-pw/src/oss/specs/groups/dynamic-groups.spec.ts
|
||
import { GridPom } from "src/oss/poms/grid"; | ||
import { ModalPom } from "src/oss/poms/modal"; | ||
import { getUniqueDatasetNameWithPrefix } from "src/oss/utils"; |
} | ||
async openNthSample(n: number) { | ||
await this.getNthLooker(n).click({ position: { x: 10, y: 80 } }); | ||
Check failure on line 55 in e2e-pw/src/oss/poms/grid/index.ts
|
||
} | ||
async openFirstSample() { | ||
} | ||
async isEntryCountTextEqualTo(text: string) { | ||
return this.gridPom.page.waitForFunction( | ||
Check failure on line 149 in e2e-pw/src/oss/poms/grid/index.ts
|
||
(text_) => { | ||
return ( | ||
document.querySelector("[data-cy='entry-counts']").textContent === |
async verifySidebarEntryText(key: string, value: string) { | ||
const text = await this.modalSidebarPom.getSidebarEntryText(key); | ||
expect(text).toBe(value); | ||
Check failure on line 88 in e2e-pw/src/oss/poms/modal/modal-sidebar.ts
|
||
} | ||
async waitUntilSidebarEntryTextEquals(key: string, value: string) { |
) { | ||
const actualTitle = await this.modalPom.modalSamplePluginTitle; | ||
const expectedTitle = pinned ? `📌 ${title}` : title; | ||
expect(actualTitle).toBe(expectedTitle); | ||
Check failure on line 314 in e2e-pw/src/oss/poms/modal/index.ts
|
||
} | ||
} |
import { test as base } from "src/oss/fixtures"; | ||
Check failure on line 1 in e2e-pw/src/oss/specs/regression-tests/index-page.spec.ts
|
||
import { PagePom } from "src/oss/poms/page"; | ||
import { getUniqueDatasetNameWithPrefix } from "src/oss/utils"; | ||
await this.datasetSelector.openResults(); | ||
await this.datasetSelector.selectResult(dataset); | ||
} | ||
await this.page.waitForSelector( | ||
Check failure on line 37 in e2e-pw/src/oss/poms/page.ts
|
||
`[data-cy=${dataset ? "dataset" : "index"}-page]`, | ||
{ | ||
state: "visible", |
}); | ||
test("modal media field", async ({ grid, fiftyoneLoader, modal, page }) => { | ||
test.skip( | ||
true, | ||
"TODO: FIX ME. MODAL SCREENSHOT COMPARISON IS OFF BY ONE-PIXEL" | ||
); |
test("change date field visibility works", async ({ | ||
eventUtils, | ||
grid, | ||
page, | ||
sidebar, | ||
}) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add parameter validation and improve error handling
The method should validate the
path
parameter and provide a more informative error message whendataset
is required but not provided.📝 Committable suggestion