Skip to content
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

[Code] move RepoState to models #44976

Merged
merged 1 commit into from
Sep 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions x-pack/legacy/plugins/code/model/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,14 @@ export interface IndexWorkerProgress extends WorkerProgress {
// Index progress for commit indexing.
commitIndexProgress?: IndexProgress;
}

export enum RepoState {
CLONING,
DELETING,
INDEXING,
READY,
CLONE_ERROR,
DELETE_ERROR,
INDEX_ERROR,
UNKNOWN,
}
18 changes: 4 additions & 14 deletions x-pack/legacy/plugins/code/public/actions/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,16 @@
import { createAction } from 'redux-actions';

import {
RepositoryUri,
CloneProgress,
CloneWorkerProgress,
WorkerProgress,
Repository,
CloneProgress,
RepositoryUri,
RepoState,
WorkerProgress,
} from '../../model';
import { FetchFilePayload } from './file';
import { StatusReport } from '../../common/repo_file_status';

export enum RepoState {
CLONING,
DELETING,
INDEXING,
READY,
CLONE_ERROR,
DELETE_ERROR,
INDEX_ERROR,
UNKNOWN,
}

export interface RepoStatus {
uri: string;
progress: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ import React from 'react';
import { connect } from 'react-redux';
import { Link } from 'react-router-dom';
import { i18n } from '@kbn/i18n';
import { Repository, WorkerReservedProgress } from '../../../model';
import { Repository, RepoState, WorkerReservedProgress } from '../../../model';
import { deleteRepo, indexRepo, initRepoCommand } from '../../actions';
import { RepoState, RepoStatus } from '../../actions/status';
import { RepoStatus } from '../../actions/status';

const stateColor = {
[RepoState.CLONING]: 'secondary',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ import {
SearchScope,
WorkerReservedProgress,
Repository,
RepoState,
} from '../../../model';
import { CommitInfo, ReferenceInfo } from '../../../model/commit';
import { changeSearchScope, FetchFileResponse, RepoState, RepoStatus } from '../../actions';
import { changeSearchScope, FetchFileResponse, RepoStatus } from '../../actions';
import { MainRouteParams, PathTypes } from '../../common/types';
import { RootState } from '../../reducers';
import {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/code/public/reducers/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
WorkerReservedProgress,
IndexWorkerProgress,
CloneWorkerProgress,
RepoState,
} from '../../model';
import {
deleteRepoFinished,
Expand All @@ -26,7 +27,6 @@ import {
updateIndexProgress,
StatusSuccessPayload,
RepoStatus,
RepoState,
FetchRepoFileStatus,
} from '../actions';
import { StatusReport } from '../../common/repo_file_status';
Expand Down
3 changes: 1 addition & 2 deletions x-pack/legacy/plugins/code/public/sagas/project_status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
takeLatest,
} from 'redux-saga/effects';

import { Repository, RepositoryUri, WorkerReservedProgress } from '../../model';
import { Repository, RepositoryUri, WorkerReservedProgress, RepoState } from '../../model';
import * as ROUTES from '../components/routes';
import { allStatusSelector, repoUriSelector, routeSelector } from '../selectors';
import {
Expand All @@ -42,7 +42,6 @@ import {
pollRepoDeleteStatusStop,
pollRepoIndexStatusStop,
importRepoSuccess,
RepoState,
} from '../actions';
import {
cloneCompletedPattern,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ import { ClusterService, ClusterStateListener } from './cluster_service';
import { ClusterStateEvent } from './cluster_state_event';
import { ClusterMembershipService } from './cluster_membership_service';
import { CloneWorker } from '../../queue';
import { Repository, RepositoryUri } from '../../../model';
import { Repository, RepositoryUri, RepoState } from '../../../model';
import { Logger } from '../../log';
import { RepoState } from '../../../public/actions';

export class NodeRepositoriesService implements ClusterStateListener {
// visible for test
Expand Down