go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/milo/ui/src/bisection/tools/info_display.ts (about)

     1  // Copyright 2023 The LUCI Authors.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  import {
    16    AnalysisStatus,
    17    RerunStatus,
    18  } from '@/proto/go.chromium.org/luci/bisection/proto/v1/common.pb';
    19  
    20  export function displayRerunStatus(rerunStatus: RerunStatus): string {
    21    switch (rerunStatus) {
    22      case RerunStatus.PASSED:
    23        return 'Passed';
    24      case RerunStatus.FAILED:
    25        return 'Failed';
    26      case RerunStatus.IN_PROGRESS:
    27        return 'In Progress';
    28      case RerunStatus.INFRA_FAILED:
    29        return 'Infra failed';
    30      case RerunStatus.CANCELED:
    31        return 'Canceled';
    32    }
    33    return 'Unknown';
    34  }
    35  
    36  export function displayStatus(status: AnalysisStatus): string {
    37    switch (status) {
    38      case AnalysisStatus.CREATED:
    39        return 'Created';
    40      case AnalysisStatus.RUNNING:
    41        return 'Running';
    42      case AnalysisStatus.FOUND:
    43        return 'Culprit found';
    44      case AnalysisStatus.NOTFOUND:
    45        return 'Suspect not found';
    46      case AnalysisStatus.SUSPECTFOUND:
    47        return 'Suspect found';
    48      case AnalysisStatus.ERROR:
    49        return 'Error';
    50    }
    51    return 'Unknown';
    52  }