How to use the panel.locations.groupByFile function in panel

To help you get started, we’ve selected a few panel examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sourcegraph / sourcegraph / shared / src / panel / views / HierarchicalLocationsView.tsx View on Github external
const GROUPS: {
            name: string
            defaultSize: number
            key: (loc: Location) => string | undefined
        }[] = [
            {
                name: 'repo',
                defaultSize: 175,
                key: loc => parseRepoURI(loc.uri).repoName,
            },
        ]
        const groupByFile =
            this.props.settingsCascade.final &&
            !isErrorLike(this.props.settingsCascade.final) &&
            this.props.settingsCascade.final['panel.locations.groupByFile']
        if (groupByFile) {
            GROUPS.push({
                name: 'file',
                defaultSize: 200,
                key: loc => parseRepoURI(loc.uri).filePath,
            })
        }

        const { groups, selectedGroups, visibleLocations } = groupLocations(
            this.state.locationsOrError.results || [],
            this.state.selectedGroups || null,
            GROUPS.map(({ key }) => key),
            { uri: this.props.defaultGroup }
        )

        const groupsToDisplay = GROUPS.map(({ name, key, defaultSize }, i) => {