go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/config_service/internal/ui/pages/config_set.html (about)

     1  {{define "title"}}
     2  LUCI Config - Config Set: {{.ConfigSet.Name}}
     3  {{end}}
     4  
     5  {{define "head"}}
     6  <style type="text/css">
     7    .info-table-key {
     8      width: 1px;
     9      white-space: nowrap;
    10      border-right: 1px solid #cccccc;
    11    }
    12  </style>
    13  {{end}}
    14  
    15  {{define "scripts"}}
    16  <script type="text/javascript" src="/static/js/config_set.js"></script>
    17  {{end}}
    18  
    19  {{define "content"}}
    20  <main role="main" class="container">
    21    <div class="d-flex flex-row">
    22      <h2>
    23        {{.ConfigSet.Name}}
    24      </h2>
    25      <div>
    26        <a href="{{.ConfigSet.Url}}" title="View Source">
    27          <img src="/static/images/link.svg" alt="View Source" width="24" height="24">
    28        </a>
    29      </div>
    30      {{if .CanReimport}}
    31      <div class="ms-auto">
    32        <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#reimport-modal" onclick="reimport({{.ConfigSet.Name}})">Reimport</button>
    33      </div>
    34      {{end}}
    35    </div>
    36  
    37    {{$Status := AttemptStatus .ConfigSet.GetLastImportAttempt}}
    38    {{if eq $Status "success"}}
    39    <div class="alert alert-success" role="alert">
    40      <div class="d-flex align-items-center">
    41        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor"
    42          class="bi bi-check-circle-fill flex-shrink-0 me-2" viewBox="0 0 16 16" role="img" aria-label="Success:">
    43          <path
    44            d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zm-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z" />
    45        </svg>
    46        <h5 class="alert-heading">{{.ConfigSet.GetLastImportAttempt.GetMessage}}</h5>
    47      </div>
    48    </div>
    49    {{else if eq $Status "warning"}}
    50    <div class="alert alert-warning" role="alert">
    51      <div class="d-flex align-items-center">
    52        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor"
    53          class="bi bi bi-exclamation-circle-fill flex-shrink-0 me-2" viewBox="0 0 16 16" role="img"
    54          aria-label="Warning:">
    55          <path
    56            d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8 4a.905.905 0 0 0-.9.995l.35 3.507a.552.552 0 0 0 1.1 0l.35-3.507A.905.905 0 0 0 8 4zm.002 6a1 1 0 1 0 0 2 1 1 0 0 0 0-2z" />
    57        </svg>
    58        <h5 class="alert-heading">{{.ConfigSet.GetLastImportAttempt.GetMessage}}</h5>
    59      </div>
    60      {{if .ConfigSet.GetLastImportAttempt.GetValidationResult.GetMessages}}
    61      <hr>
    62      <p class="mb-0">Config validation warnings</p>
    63      {{range .ConfigSet.GetLastImportAttempt.GetValidationResult.GetMessages}}
    64      <p class="mb-0"> - in "{{.Path}}": {{.Text}}</p>
    65      {{end}}
    66      {{end}}
    67    </div>
    68    {{else if eq $Status "failed"}}
    69    <div class="alert alert-danger" role="alert">
    70      <div class="d-flex align-items-center">
    71        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor"
    72          class="bi bi bi-exclamation-circle-fill flex-shrink-0 me-2" viewBox="0 0 16 16" role="img" aria-label="Danger:">
    73          <path
    74            d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8 4a.905.905 0 0 0-.9.995l.35 3.507a.552.552 0 0 0 1.1 0l.35-3.507A.905.905 0 0 0 8 4zm.002 6a1 1 0 1 0 0 2 1 1 0 0 0 0-2z" />
    75        </svg>
    76        <h5 class="alert-heading">Failed to import <a href="{{.ConfigSet.GetLastImportAttempt.GetRevision.GetUrl}}">config revision {{.ConfigSet.GetLastImportAttempt.GetRevision.GetId}}</a>. Reason: {{.ConfigSet.GetLastImportAttempt.GetMessage}}</h5>
    77      </div>
    78      {{if .ConfigSet.GetLastImportAttempt.GetValidationResult.GetMessages}}
    79      <hr>
    80      <p class="mb-0">Has config validation failures:</p>
    81      {{range .ConfigSet.GetLastImportAttempt.GetValidationResult.GetMessages}}
    82      <p class="mb-0">  {{.Text}}</p>
    83      {{end}}
    84      {{end}}
    85    </div>
    86    {{end}}
    87  
    88    <div class="row">
    89      <div class="col-lg-6 border-end">
    90        <h4 class="mb-3">Info</h4>
    91        <table class="table table-striped table-lg">
    92          <tbody>
    93            <tr>
    94              <td class="info-table-key"><b>Revision</b></td>
    95              <td class="user-select-all">
    96                {{.ConfigSet.Revision.Id}}
    97                <a href="{{.ConfigSet.Revision.Url}}" title="View Source">
    98                  <img src="/static/images/link.svg" alt="View Source">
    99                </a>
   100              </td>
   101            </tr>
   102            <tr>
   103              <td class="info-table-key"><b>Commit Time</b></td>
   104              <td>{{.ConfigSet.Revision.Timestamp.AsTime}}</td>
   105            </tr>
   106            <tr>
   107              <td class="info-table-key"><b>Author</b></td>
   108              <td>{{.ConfigSet.Revision.AuthorEmail}}</td>
   109            </tr>
   110            <tr>
   111              <td class="info-table-key"><b>Committer</b></td>
   112              <td>{{.ConfigSet.Revision.CommitterEmail}}</td>
   113            </tr>
   114          </tbody>
   115        </table>
   116      </div>
   117      <div class="col-lg-6">
   118        <h4 class="mb-3">Files</h4>
   119        <ul class="list-group">
   120          {{range .ConfigSet.Configs}}
   121          <li class="list-group-item d-flex justify-content-between align-items-center">
   122            <div class="ms-2 me-auto">
   123              <div class="fw-bold">{{.Path}}</div>
   124              <ul class="list-unstyled">
   125                <li><small class="text-muted">SHA256: {{.ContentSha256}}</small></li>
   126                <li><small class="text-muted">Size: {{HumanizeBytes .Size}}</small></li>
   127              </ul>
   128            </div>
   129            <a href="{{.Url}}" title="View Source">
   130              <img src="/static/images/link.svg" alt="View Source">
   131            </a>
   132          </li>
   133          {{end}}
   134        </ul>
   135      </div>
   136    </div>
   137  
   138    <div class="modal fade" id="reimport-modal" tabindex="-1" aria-labelledby="reimport-modal-title" aria-hidden="true">
   139      <div class="modal-dialog">
   140        <div class="modal-content">
   141          <div class="modal-header">
   142            <h5 class="modal-title" id="reimport-modal-title">Reimport</h5>
   143            <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
   144          </div>
   145          <div class="modal-body" id="reimport-modal-body">
   146            <div class="spinner-border" role="status">
   147              <span class="visually-hidden">Reimporting...</span>
   148            </div>
   149          </div>
   150          <div class="modal-footer">
   151            <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
   152          </div>
   153        </div>
   154      </div>
   155    </div>
   156  </main>
   157  {{end}}