s: 'FILE_LINE',
...serializeQuery(query),
ps: 100,
+ organization: organization && organization.key,
facets,
...additional
};
- if (organization) {
- parameters.organization = organization.key;
- }
-
// only sorting by CREATION_DATE is allowed, so let's sort DESC
if (query.sort) {
Object.assign(parameters, { asc: 'false' });
onFacetToggle={this.handleFacetToggle}
onFilterChange={this.handleFilterChange}
openFacets={this.state.openFacets}
+ organization={this.props.organization}
query={query}
referencedComponents={this.state.referencedComponents}
referencedLanguages={this.state.referencedLanguages}
// @flow
import React from 'react';
import { sortBy, uniq, without } from 'lodash';
+import Avatar from '../../../components/ui/Avatar';
import FacetBox from './components/FacetBox';
import FacetHeader from './components/FacetHeader';
import FacetItem from './components/FacetItem';
import FacetItemsList from './components/FacetItemsList';
import FacetFooter from './components/FacetFooter';
import { searchAssignees } from '../utils';
-import type { ReferencedUser, Component } from '../utils';
-import Avatar from '../../../components/ui/Avatar';
import { translate } from '../../../helpers/l10n';
+import type { ReferencedUser, Component } from '../utils';
type Props = {|
assigned: boolean,
onChange: (changes: {}) => void,
onToggle: (property: string) => void,
open: boolean,
+ organization?: { key: string },
stats?: { [string]: number },
referencedUsers: { [string]: ReferencedUser }
|};
this.props.onChange({ assigned: true, assignees: [] });
};
- handleSearch = (query: string) => searchAssignees(query, this.props.component);
+ handleSearch = (query: string) => {
+ let organization = this.props.component && this.props.component.organization;
+ if (this.props.organization && !organization) {
+ organization = this.props.organization.key;
+ }
+ return searchAssignees(query, organization);
+ };
handleSelect = (assignee: string) => {
const { assignees } = this.props;
onChange: (changes: { [string]: Array<string> }) => void,
onToggle: (property: string) => void,
open: boolean,
+ organization?: { key: string },
stats?: { [string]: number },
referencedComponents: { [string]: ReferencedComponent },
projects: Array<string>
};
handleSearch = (query: string) => {
- const { component } = this.props;
-
- return component != null && ['VW', 'SVW'].includes(component.qualifier)
- ? getTree(component.key, { ps: 50, q: query, qualifiers: 'TRK' }).then(response =>
- response.components.map(component => ({
- label: component.name,
- organization: component.organization,
- value: component.refId
- }))
- )
- : searchProjects({
- ps: 50,
- filter: query ? `query = "${query}"` : ''
- }).then(response =>
- response.components.map(component => ({
- label: component.name,
- organization: component.organization,
- value: component.id
- }))
- );
+ const { component, organization } = this.props;
+ if (component != null && ['VW', 'SVW'].includes(component.qualifier)) {
+ return getTree(component.key, { ps: 50, q: query, qualifiers: 'TRK' }).then(response =>
+ response.components.map(component => ({
+ label: component.name,
+ organization: component.organization,
+ value: component.refId
+ }))
+ );
+ }
+
+ return searchProjects({
+ ps: 50,
+ filter: query ? `query = "${query}"` : '',
+ organization: organization && organization.key
+ }).then(response =>
+ response.components.map(component => ({
+ label: component.name,
+ organization: component.organization,
+ value: component.id
+ }))
+ );
};
handleSelect = (rule: string) => {
onFacetToggle: (property: string) => void,
onFilterChange: (changes: { [string]: Array<string> }) => void,
openFacets: { [string]: boolean },
+ organization?: { key: string },
query: Query,
referencedComponents: { [string]: ReferencedComponent },
referencedLanguages: { [string]: ReferencedLanguage },
rules={query.rules}
/>
<TagFacet
+ component={component}
facetMode={query.facetMode}
onChange={this.props.onFilterChange}
onToggle={this.props.onFacetToggle}
open={!!openFacets.tags}
+ organization={this.props.organization}
stats={facets.tags}
tags={query.tags}
/>
onChange={this.props.onFilterChange}
onToggle={this.props.onFacetToggle}
open={!!openFacets.projects}
+ organization={this.props.organization}
projects={query.projects}
referencedComponents={this.props.referencedComponents}
stats={facets.projects}
onChange={this.props.onFilterChange}
onToggle={this.props.onFacetToggle}
open={!!openFacets.assignees}
+ organization={this.props.organization}
assigned={query.assigned}
assignees={query.assignees}
referencedUsers={this.props.referencedUsers}
import FacetFooter from './components/FacetFooter';
import { searchIssueTags } from '../../../api/issues';
import { translate } from '../../../helpers/l10n';
+import type { Component } from '../utils';
type Props = {|
+ component?: Component,
facetMode: string,
onChange: (changes: { [string]: Array<string> }) => void,
onToggle: (property: string) => void,
open: boolean,
+ organization?: { key: string },
stats?: { [string]: number },
tags: Array<string>
|};
};
handleSearch = (query: string) => {
- return searchIssueTags({ ps: 50, q: query }).then(tags =>
+ let organization = this.props.component && this.props.component.organization;
+ if (this.props.organization && !organization) {
+ organization = this.props.organization.key;
+ }
+ return searchIssueTags({ organization, ps: 50, q: query }).then(tags =>
tags.map(tag => ({ label: tag, value: tag }))
);
};
| { isLoggedIn: false }
| { isLoggedIn: true, email?: string, login: string, name: string };
-export const searchAssignees = (query: string, component?: Component) => {
- return component
- ? searchMembers({ organization: component.organization, ps: 50, q: query }).then(response =>
+export const searchAssignees = (query: string, organization?: string) => {
+ return organization
+ ? searchMembers({ organization, ps: 50, q: query }).then(response =>
response.users.map(user => ({
avatar: user.avatar,
label: user.name,