Search in sources :

Example 1 with IndexBaseRepoJob

use of com.searchcode.app.jobs.repository.IndexBaseRepoJob in project searchcode-server by boyter.

the class AdminRouteService method checkIndexStatus.

public String checkIndexStatus(Request request, Response response) {
    if (request.queryParams().contains("reponame")) {
        String reponame = request.queryParams("reponame");
        String reposLocation = Properties.getProperties().getProperty(Values.REPOSITORYLOCATION, Values.DEFAULTREPOSITORYLOCATION);
        IndexBaseRepoJob indexBaseRepoJob = new IndexFileRepoJob();
        RepoResult repoResult = Singleton.getRepo().getRepoByName(reponame);
        String indexStatus = Values.EMPTYSTRING;
        if (repoResult != null) {
            indexStatus = repoResult.getData().indexStatus;
        }
        if (indexBaseRepoJob.checkIndexSucess(reposLocation + "/" + reponame) || "success".equals(indexStatus)) {
            return "Indexed ✓";
        }
        if ("indexing".equals(indexStatus)) {
            return "Indexing...";
        }
    }
    return Values.EMPTYSTRING;
}
Also used : IndexFileRepoJob(com.searchcode.app.jobs.repository.IndexFileRepoJob) IndexBaseRepoJob(com.searchcode.app.jobs.repository.IndexBaseRepoJob) RepoResult(com.searchcode.app.model.RepoResult)

Aggregations

IndexBaseRepoJob (com.searchcode.app.jobs.repository.IndexBaseRepoJob)1 IndexFileRepoJob (com.searchcode.app.jobs.repository.IndexFileRepoJob)1 RepoResult (com.searchcode.app.model.RepoResult)1