return getJSON('/api/projects/provisioned', data);
}
-export function getGhosts(data: RequestData): Promise<any> {
- return getJSON('/api/projects/ghosts', data);
-}
-
export function deleteComponents(projects: string[], organization: string): Promise<void> {
return post('/api/projects/bulk_delete', { projects: projects.join(), organization });
}
import CreateProjectForm from './CreateProjectForm';
import ListFooter from '../../components/controls/ListFooter';
import { PAGE_SIZE, Type, Project } from './utils';
-import { getComponents, getProvisioned, getGhosts } from '../../api/components';
+import { getComponents, getProvisioned } from '../../api/components';
import { Organization } from '../../app/types';
import { translate } from '../../helpers/l10n';
case Type.Provisioned:
this.requestProvisioned();
break;
- case Type.Ghosts:
- this.requestGhosts();
- break;
}
};
- requestGhosts = () => {
- const data = this.getFilters();
- getGhosts(data).then(r => {
- if (this.mounted) {
- let projects: Project[] = r.projects.map((project: any) => ({
- ...project,
- id: project.uuid,
- qualifier: 'TRK'
- }));
- if (this.state.page > 1) {
- projects = [...this.state.projects, ...projects];
- }
- this.setState({ ready: true, projects, selection: [], total: r.total });
- }
- });
- };
-
requestProvisioned = () => {
const data = this.getFilters();
getProvisioned(data).then(r => {
getTypeOptions = () => [
{ value: Type.All, label: 'All' },
- { value: Type.Provisioned, label: 'Provisioned' },
- { value: Type.Ghosts, label: 'Ghosts' }
+ { value: Type.Provisioned, label: 'Provisioned' }
];
getQualifierOptions = () => {
return <Checkbox checked={checked} thirdState={thirdState} onCheck={this.onCheck} />;
};
- renderGhostsDescription = () => {
- if (this.props.type !== Type.Ghosts || !this.props.ready) {
- return null;
- }
- return (
- <div className="spacer-top alert alert-info">
- {translate('bulk_deletion.ghosts.description')}
- </div>
- );
- };
-
renderQualifierFilter = () => {
const options = this.getQualifierOptions();
if (options.length < 2) {
</tr>
</tbody>
</table>
- {this.renderGhostsDescription()}
{this.state.bulkApplyTemplateModal &&
<BulkApplyTemplateModal
jest.mock('../../../api/components', () => ({
getComponents: jest.fn(),
- getProvisioned: jest.fn(() => Promise.resolve({ paging: { total: 0 }, projects: [] })),
- getGhosts: jest.fn(() => Promise.resolve({ projects: [], total: 0 }))
+ getProvisioned: jest.fn(() => Promise.resolve({ paging: { total: 0 }, projects: [] }))
}));
import * as React from 'react';
const getComponents = require('../../../api/components').getComponents as jest.Mock<any>;
const getProvisioned = require('../../../api/components').getProvisioned as jest.Mock<any>;
-const getGhosts = require('../../../api/components').getGhosts as jest.Mock<any>;
const organization = { key: 'org', name: 'org', projectVisibility: 'public' };
.mockImplementation(() => Promise.resolve({ paging: { total: 0 }, components: [] }))
.mockClear();
getProvisioned.mockClear();
- getGhosts.mockClear();
});
it('fetches all projects on mount', () => {
const wrapper = mountRender();
wrapper.find('Search').prop<Function>('onTypeChanged')(Type.Provisioned);
expect(getProvisioned).lastCalledWith(defaultSearchParameters);
- wrapper.find('Search').prop<Function>('onTypeChanged')(Type.Ghosts);
- expect(getGhosts).lastCalledWith(defaultSearchParameters);
});
it('changes qualifier and resets type', () => {
"label": "Provisioned",
"value": "PROVISIONED",
},
- Object {
- "label": "Ghosts",
- "value": "GHOSTS",
- },
]
}
value="ALL"
"label": "Provisioned",
"value": "PROVISIONED",
},
- Object {
- "label": "Ghosts",
- "value": "GHOSTS",
- },
]
}
value="ALL"
export enum Type {
All = 'ALL',
- Provisioned = 'PROVISIONED',
- Ghosts = 'GHOSTS'
+ Provisioned = 'PROVISIONED'
}
export interface Project {
bulk_deletion.deletion_manager.deletion_completed=Component deletion completed.
bulk_deletion.deletion_manager.however_failures_occurred=However, some failures occurred.
bulk_deletion.started_since_x=Started {0} ago
-bulk_deletion.ghosts=Ghosts
-bulk_deletion.ghosts.description=A ghost is the result of constantly failed attempts to analyse a project. In such a case, the project is not linked to any successful analysis, and therefore cannot be displayed in SonarQube. When the user authentication is forced, leaving a ghost can even prevent further analyses of the corresponding project.
-bulk_deletion.no_ghosts=There is currently no ghost.
-bulk_deletion.following_ghosts_can_be_deleted=The following ghosts can be safely deleted:
-bulk_deletion.delete_all_ghosts=Delete all ghosts
#------------------------------------------------------------------------------