Some minor changes on the sites view

This commit is contained in:
Melon 2023-11-13 20:19:52 +00:00
parent 8c32bce49e
commit 57d4366472
Signed by: melon
GPG Key ID: 6C9D970C50D26A25
2 changed files with 20 additions and 7 deletions

View File

@ -91,15 +91,21 @@
</thead> </thead>
<tbody class="invert-rows"> <tbody class="invert-rows">
{#each tableKeys as key (key)} {#each tableKeys as key (key)}
{@const site = $sitesTable[key]}
{@const domain = site.domain.replace(/[^0-9a-z-]/gi, "-")}
<tr> <tr>
<td><a href="https://{$sitesTable[key].domain}" target="_blank">{$sitesTable[key].domain}</a></td> <td><a href="https://{site.domain}" target="_blank">{site.domain}</a></td>
<td class="branch-cell"> <td class="branch-cell">
{#each $sitesTable[key].branches as branch} {#each site.branches as branch}
<div>{branch}</div> {#if branch == ""}
<div><button on:click={() => deleteBranch($sitesTable[key], branch)}>Delete Branch</button></div> <div><a href="https://{domain}_main.sites.1f349.com" target="_blank" class="main-or-master">main or master</a></div>
{:else}
<div><a href="https://{domain}_{branch}.sites.1f349.com" target="_blank">{branch}</a></div>
{/if}
<div><button on:click={() => deleteBranch(site, branch)}>Delete Branch</button></div>
{/each} {/each}
</td> </td>
<td><button on:click={() => resetSiteSecret($sitesTable[key])}>Reset Secret</button></td> <td><button on:click={() => resetSiteSecret(site)}>Reset Secret</button></td>
</tr> </tr>
{/each} {/each}
</tbody> </tbody>
@ -117,5 +123,12 @@
.branch-cell { .branch-cell {
display: grid; display: grid;
grid-template-columns: repeat(2, auto); grid-template-columns: repeat(2, auto);
width: fit-content;
gap: 8px;
}
.main-or-master {
color: lightgreen;
} }
</style> </style>

View File

@ -173,13 +173,13 @@ func apiServer(verify mjwt.Verifier) {
for i := 0; i < 20; i++ { for i := 0; i < 20; i++ {
m = append(m, map[string]any{ m = append(m, map[string]any{
"domain": uuid.NewString() + ".example.com", "domain": uuid.NewString() + ".example.com",
"branches": []string{"@", "@beta"}, "branches": []string{"", "beta"},
}) })
} }
for i := 0; i < 20; i++ { for i := 0; i < 20; i++ {
m = append(m, map[string]any{ m = append(m, map[string]any{
"domain": uuid.NewString() + ".example.org", "domain": uuid.NewString() + ".example.org",
"branches": []string{"@", "@alpha"}, "branches": []string{"", "alpha"},
}) })
} }
json.NewEncoder(rw).Encode(m) json.NewEncoder(rw).Encode(m)