feat: store thumbnails in project mounts with legacy fallback
- Add thumbnail upload, lookup, deletion, and scratch-fetch helpers - Distinguish missing mounts from other listing failures
This commit is contained in:
1 parent
483a1a278b
commit
6aec03fb3d
16 files changed
+846
-126
No files matched your search
@@ -68,7 +68,7 @@
|
|||||||
type="checkbox"
|
type="checkbox"
|
||||||
checked={layoutState.wide}
|
checked={layoutState.wide}
|
||||||
onchange={(event) => layoutState.setWide(event.currentTarget.checked)}
|
onchange={(event) => layoutState.setWide(event.currentTarget.checked)}
|
||||||
class="size-4 rounded border-border accent-primary"
|
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
<div class="sc-form-actions">
|
<div class="sc-form-actions">
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@gabriel20xx/web-ui": minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Remove the `PageHeader` title card. `AppShell` no longer renders a per-page title/description card, and its `showPageHeader` and `pageHeaderActions` props are gone, as are the `PageHeader` export and the `.sc-page-header` styles. Buttons or status pills that lived in the title card now belong in a card inside the page content.
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
"@gabriel20xx/web-ui": minor
|
|
||||||
---
|
|
||||||
|
|
||||||
`UserManagement` accepts an optional `projects` prop (`KnownProject[]`): when present, each account gets a per-project login-access picker (checkboxes in the edit row, a summary in the read-only row) and `onUpdate` receives a `projects: string[]` field. Only AuthGuard's own admin UI passes this prop today; every other consumer is unaffected.
|
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@gabriel20xx/web-ui": minor
|
||||||
|
---
|
||||||
|
|
||||||
|
`UserManagement` accepts an optional `roles` prop (`KnownRole[]`) in place of the `projects` prop it replaces: when present, each account gets a role picker (checkboxes in the add and edit rows, the role names in the read-only row), and `onCreate`/`onUpdate` receive a `roleIds: number[]` field. An account's projects now come from its roles, so per-account project checkboxes are gone. `ManagedUser` carries `roleIds` instead of `projects`. Only AuthGuard's own admin UI passes this prop today; every other consumer is unaffected.
|
||||||
Regular → Executable
File mode changed.
+1
-1
@@ -54,7 +54,7 @@ These are the complete Svelte component exports from `packages/web-ui/src/lib/in
|
|||||||
| `StatusDialog` | Detailed service health/readiness status modal with refresh support. |
|
| `StatusDialog` | Detailed service health/readiness status modal with refresh support. |
|
||||||
| `StatusWidget` | Header-friendly health/readiness indicator that polls `/healthz` and `/ready` and opens `StatusDialog`. |
|
| `StatusWidget` | Header-friendly health/readiness indicator that polls `/healthz` and `/ready` and opens `StatusDialog`. |
|
||||||
| `TotpSettings` | TOTP status, setup, enable, and disable controls. |
|
| `TotpSettings` | TOTP status, setup, enable, and disable controls. |
|
||||||
| `UserManagement` | Role-aware user administration with listing, creation, editing, deletion, project scopes, and pagination. |
|
| `UserManagement` | Role-aware user administration with listing, creation, editing, deletion, role assignment, and pagination. |
|
||||||
|
|
||||||
This inventory describes the public component API only; the package also exports notification helpers, primary-color helpers, and TypeScript types. When a public component is added, removed, renamed, or materially changes responsibility, update this table in the same change as `packages/web-ui/src/lib/index.ts`. Keep the table aligned with that barrel file, and do not add internal or generated components to it.
|
This inventory describes the public component API only; the package also exports notification helpers, primary-color helpers, and TypeScript types. When a public component is added, removed, renamed, or materially changes responsibility, update this table in the same change as `packages/web-ui/src/lib/index.ts`. Keep the table aligned with that barrel file, and do not add internal or generated components to it.
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -264,9 +265,19 @@ func (c *Client) ProxyMount(w http.ResponseWriter, r *http.Request, project, mou
|
|||||||
c.Proxy(w, r, path)
|
c.Proxy(w, r, path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ErrMountNotFound is returned by ListMountFiles when every CarrierNode
|
||||||
|
// instance that answered said the directory does not exist and none failed
|
||||||
|
// some other way. It is a definitive "not there", unlike an unreachable
|
||||||
|
// instance or an error response, where the directory may well exist but could
|
||||||
|
// not be checked - callers can use errors.Is to tell the two apart.
|
||||||
|
var ErrMountNotFound = errors.New("carriernode mount directory not found")
|
||||||
|
|
||||||
// ListMountFiles lists the direct children of a project/type mount directory.
|
// ListMountFiles lists the direct children of a project/type mount directory.
|
||||||
// An empty relative path lists the mount root. The CarrierNode endpoint
|
// An empty relative path lists the mount root. The CarrierNode endpoint
|
||||||
// returns both files and directories so callers can build directory browsers.
|
// returns both files and directories so callers can build directory browsers.
|
||||||
|
// When no instance can list the directory, the error wraps ErrMountNotFound
|
||||||
|
// only if every instance answered 404; any unreachable instance or other
|
||||||
|
// failure yields a plain error instead, since the directory may live there.
|
||||||
func (c *Client) ListMountFiles(ctx context.Context, project, mountType, relative string) ([]MountFileEntry, error) {
|
func (c *Client) ListMountFiles(ctx context.Context, project, mountType, relative string) ([]MountFileEntry, error) {
|
||||||
candidates := c.candidateBaseURLs(ctx)
|
candidates := c.candidateBaseURLs(ctx)
|
||||||
if len(candidates) == 0 {
|
if len(candidates) == 0 {
|
||||||
@@ -286,6 +297,7 @@ func (c *Client) ListMountFiles(ctx context.Context, project, mountType, relativ
|
|||||||
var entries []MountFileEntry
|
var entries []MountFileEntry
|
||||||
var lastErr error
|
var lastErr error
|
||||||
loaded := false
|
loaded := false
|
||||||
|
missing := false
|
||||||
for _, baseURL := range candidates {
|
for _, baseURL := range candidates {
|
||||||
request, err := c.newRequest(ctx, baseURL, http.MethodGet, path, nil)
|
request, err := c.newRequest(ctx, baseURL, http.MethodGet, path, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -297,6 +309,11 @@ func (c *Client) ListMountFiles(ctx context.Context, project, mountType, relativ
|
|||||||
lastErr = err
|
lastErr = err
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if response.StatusCode == http.StatusNotFound {
|
||||||
|
response.Body.Close()
|
||||||
|
missing = true
|
||||||
|
continue
|
||||||
|
}
|
||||||
if response.StatusCode != http.StatusOK {
|
if response.StatusCode != http.StatusOK {
|
||||||
response.Body.Close()
|
response.Body.Close()
|
||||||
lastErr = fmt.Errorf("carriernode mount listing failed: %s", response.Status)
|
lastErr = fmt.Errorf("carriernode mount listing failed: %s", response.Status)
|
||||||
@@ -314,8 +331,13 @@ func (c *Client) ListMountFiles(ctx context.Context, project, mountType, relativ
|
|||||||
loaded = true
|
loaded = true
|
||||||
entries = append(entries, payload.Files...)
|
entries = append(entries, payload.Files...)
|
||||||
}
|
}
|
||||||
if !loaded && lastErr != nil {
|
if !loaded {
|
||||||
return nil, lastErr
|
if lastErr != nil {
|
||||||
|
return nil, lastErr
|
||||||
|
}
|
||||||
|
if missing {
|
||||||
|
return nil, ErrMountNotFound
|
||||||
|
}
|
||||||
}
|
}
|
||||||
unique := make([]MountFileEntry, 0, len(entries))
|
unique := make([]MountFileEntry, 0, len(entries))
|
||||||
seen := make(map[string]struct{}, len(entries))
|
seen := make(map[string]struct{}, len(entries))
|
||||||
@@ -421,6 +443,103 @@ func (c *Client) DeleteMountFile(ctx context.Context, project, mountType, relati
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ThumbnailMountType is the mount type ProjectConfigurator configures for a project's
|
||||||
|
// generated thumbnails. Each thumbnail is one "<id>.jpg" file under that mount.
|
||||||
|
const ThumbnailMountType = "thumbnails"
|
||||||
|
|
||||||
|
// thumbnailFile is the file name a thumbnail id is stored under. Ids are UUIDs that
|
||||||
|
// ContentScanner generates, so anything that could name a path outside the thumbnails
|
||||||
|
// directory is refused.
|
||||||
|
func thumbnailFile(id string) (string, error) {
|
||||||
|
if id == "" || id == "." || id == ".." || strings.ContainsAny(id, `/\`) {
|
||||||
|
return "", fmt.Errorf("invalid thumbnail id %q", id)
|
||||||
|
}
|
||||||
|
return id + ".jpg", nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// thumbnailPaths lists every CarrierNode path a thumbnail may live at, in lookup order: the
|
||||||
|
// project's thumbnails mount first, then CarrierNode's legacy thumbnail root. Thumbnails
|
||||||
|
// stored before the mount existed sit in the legacy root, and reads keep finding them there
|
||||||
|
// until they are regenerated or deleted.
|
||||||
|
func thumbnailPaths(project, id string) ([]string, error) {
|
||||||
|
file, err := thumbnailFile(id)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
var paths []string
|
||||||
|
if path := MountPath(project, ThumbnailMountType, file); path != "" {
|
||||||
|
paths = append(paths, path)
|
||||||
|
}
|
||||||
|
return append(paths, "/thumbnails/"+file), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// StoreThumbnail uploads a generated thumbnail into the project's thumbnails mount on the
|
||||||
|
// primary CarrierNode and returns its size in bytes. CarrierNode only accepts mount writes
|
||||||
|
// under its /mount volume, so the configured thumbnails path has to be there.
|
||||||
|
func (c *Client) StoreThumbnail(ctx context.Context, project, id, localPath string) (int64, error) {
|
||||||
|
file, err := thumbnailFile(id)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
info, err := os.Stat(localPath)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
if err := c.UploadMountFile(ctx, project, ThumbnailMountType, file, localPath); err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
return info.Size(), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteStoredThumbnail removes a thumbnail from the project's thumbnails mount and from the
|
||||||
|
// legacy root, since one stored before the mount existed may still be there. A thumbnail
|
||||||
|
// missing from both is already deleted.
|
||||||
|
func (c *Client) DeleteStoredThumbnail(ctx context.Context, project, id string) error {
|
||||||
|
file, err := thumbnailFile(id)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
mountErr := c.DeleteMountFile(ctx, project, ThumbnailMountType, file)
|
||||||
|
legacyErr := c.DeleteThumbnail(ctx, id)
|
||||||
|
return errors.Join(mountErr, legacyErr)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ProxyThumbnail streams a stored thumbnail to the original client, looking in the project's
|
||||||
|
// thumbnails mount and then the legacy root. It reports false without writing anything when
|
||||||
|
// neither holds the thumbnail, so the caller can fall back to another source.
|
||||||
|
func (c *Client) ProxyThumbnail(w http.ResponseWriter, r *http.Request, project, id string) bool {
|
||||||
|
paths, err := thumbnailPaths(project, id)
|
||||||
|
if err != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
for _, path := range paths {
|
||||||
|
if exists, _, _, probeErr := c.Probe(r.Context(), path); probeErr == nil && exists {
|
||||||
|
c.Proxy(w, r, path)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// FetchThumbnailToScratch downloads a stored thumbnail into an ephemeral local file, looking
|
||||||
|
// in the project's thumbnails mount and then the legacy root. Callers must invoke the returned
|
||||||
|
// cleanup once done.
|
||||||
|
func (c *Client) FetchThumbnailToScratch(ctx context.Context, project, id, suffix string) (string, func(), error) {
|
||||||
|
paths, err := thumbnailPaths(project, id)
|
||||||
|
if err != nil {
|
||||||
|
return "", nil, err
|
||||||
|
}
|
||||||
|
var lastErr error
|
||||||
|
for _, path := range paths {
|
||||||
|
scratch, cleanup, fetchErr := c.FetchToScratch(ctx, path, suffix)
|
||||||
|
if fetchErr == nil {
|
||||||
|
return scratch, cleanup, nil
|
||||||
|
}
|
||||||
|
lastErr = fetchErr
|
||||||
|
}
|
||||||
|
return "", nil, lastErr
|
||||||
|
}
|
||||||
|
|
||||||
// probeOne runs Probe's HEAD request against a single base URL.
|
// probeOne runs Probe's HEAD request against a single base URL.
|
||||||
func (c *Client) probeOne(ctx context.Context, baseURL, carrierNodePath string) (exists bool, size int64, modTime time.Time, err error) {
|
func (c *Client) probeOne(ctx context.Context, baseURL, carrierNodePath string) (exists bool, size int64, modTime time.Time, err error) {
|
||||||
request, err := c.newRequest(ctx, baseURL, http.MethodHead, carrierNodePath, nil)
|
request, err := c.newRequest(ctx, baseURL, http.MethodHead, carrierNodePath, nil)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package carriernodeclient
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"testing"
|
"testing"
|
||||||
@@ -194,3 +195,71 @@ func TestProxyForwardsLastInstanceErrorWhenNoneHaveTheFile(t *testing.T) {
|
|||||||
t.Fatalf("status = %d, want 404 forwarded from the last instance", rec.Code)
|
t.Fatalf("status = %d, want 404 forwarded from the last instance", rec.Code)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func mountListingServer(status int, body string) *httptest.Server {
|
||||||
|
return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
w.Header().Set("Content-Type", "application/json")
|
||||||
|
w.WriteHeader(status)
|
||||||
|
_, _ = w.Write([]byte(body))
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestListMountFilesReportsNotFoundWhenEveryInstanceMisses(t *testing.T) {
|
||||||
|
first := mountListingServer(http.StatusNotFound, `{"error":"mount directory not found"}`)
|
||||||
|
defer first.Close()
|
||||||
|
second := mountListingServer(http.StatusNotFound, `{"error":"mount directory not found"}`)
|
||||||
|
defer second.Close()
|
||||||
|
|
||||||
|
client := NewMulti("", func(ctx context.Context) []string { return []string{first.URL, second.URL} })
|
||||||
|
|
||||||
|
_, err := client.ListMountFiles(context.Background(), "autocode", "repos", "gone")
|
||||||
|
if !errors.Is(err, ErrMountNotFound) {
|
||||||
|
t.Fatalf("ListMountFiles error = %v, want ErrMountNotFound", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestListMountFilesDoesNotReportNotFoundWhenAnInstanceIsUnreachable(t *testing.T) {
|
||||||
|
missing := mountListingServer(http.StatusNotFound, `{"error":"mount directory not found"}`)
|
||||||
|
defer missing.Close()
|
||||||
|
down := httptest.NewServer(nil)
|
||||||
|
down.Close() // closed immediately so requests to it fail outright
|
||||||
|
|
||||||
|
client := NewMulti("", func(ctx context.Context) []string { return []string{missing.URL, down.URL} })
|
||||||
|
|
||||||
|
_, err := client.ListMountFiles(context.Background(), "autocode", "repos", "maybe-on-the-down-instance")
|
||||||
|
if err == nil {
|
||||||
|
t.Fatal("ListMountFiles succeeded, want an error")
|
||||||
|
}
|
||||||
|
if errors.Is(err, ErrMountNotFound) {
|
||||||
|
t.Fatalf("ListMountFiles error = %v, must not claim the directory is missing when an instance could not be checked", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestListMountFilesDoesNotReportNotFoundOnServerError(t *testing.T) {
|
||||||
|
broken := mountListingServer(http.StatusInternalServerError, `{"error":"boom"}`)
|
||||||
|
defer broken.Close()
|
||||||
|
|
||||||
|
client := NewMulti("", func(ctx context.Context) []string { return []string{broken.URL} })
|
||||||
|
|
||||||
|
_, err := client.ListMountFiles(context.Background(), "autocode", "repos", "")
|
||||||
|
if err == nil || errors.Is(err, ErrMountNotFound) {
|
||||||
|
t.Fatalf("ListMountFiles error = %v, want a non-ErrMountNotFound failure", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestListMountFilesUsesTheInstanceThatHasTheDirectory(t *testing.T) {
|
||||||
|
missing := mountListingServer(http.StatusNotFound, `{"error":"mount directory not found"}`)
|
||||||
|
defer missing.Close()
|
||||||
|
present := mountListingServer(http.StatusOK, `{"files":[{"name":"repo","path":"repo","directory":true}]}`)
|
||||||
|
defer present.Close()
|
||||||
|
|
||||||
|
client := NewMulti("", func(ctx context.Context) []string { return []string{missing.URL, present.URL} })
|
||||||
|
|
||||||
|
files, err := client.ListMountFiles(context.Background(), "autocode", "repos", "")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("ListMountFiles error: %v", err)
|
||||||
|
}
|
||||||
|
if len(files) != 1 || files[0].Name != "repo" || !files[0].Directory {
|
||||||
|
t.Fatalf("ListMountFiles = %+v, want the one directory from the instance that has it", files)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,183 @@
|
|||||||
|
package carriernodeclient
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"io"
|
||||||
|
"net/http"
|
||||||
|
"net/http/httptest"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"slices"
|
||||||
|
"strings"
|
||||||
|
"sync"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
const testThumbnailID = "3f1c2a9e-6b1d-4e8a-9f0e-2d7c5b4a1e00"
|
||||||
|
|
||||||
|
// recordingCarrierNode serves bodies at the paths it is given, accepts every write, and
|
||||||
|
// records each request so a test can see which CarrierNode paths were touched.
|
||||||
|
type recordingCarrierNode struct {
|
||||||
|
mu sync.Mutex
|
||||||
|
bodies map[string]string
|
||||||
|
requests []string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (n *recordingCarrierNode) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
|
n.mu.Lock()
|
||||||
|
n.requests = append(n.requests, r.Method+" "+r.URL.Path)
|
||||||
|
body, found := n.bodies[r.URL.Path]
|
||||||
|
n.mu.Unlock()
|
||||||
|
|
||||||
|
if r.Method == http.MethodPost || r.Method == http.MethodDelete {
|
||||||
|
w.WriteHeader(http.StatusOK)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !found {
|
||||||
|
w.WriteHeader(http.StatusNotFound)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
w.Header().Set("Content-Type", "image/jpeg")
|
||||||
|
w.WriteHeader(http.StatusOK)
|
||||||
|
if r.Method != http.MethodHead {
|
||||||
|
_, _ = io.WriteString(w, body)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (n *recordingCarrierNode) seen() []string {
|
||||||
|
n.mu.Lock()
|
||||||
|
defer n.mu.Unlock()
|
||||||
|
return append([]string(nil), n.requests...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func newThumbnailTestClient(t *testing.T, bodies map[string]string) (*Client, *recordingCarrierNode) {
|
||||||
|
t.Helper()
|
||||||
|
node := &recordingCarrierNode{bodies: bodies}
|
||||||
|
server := httptest.NewServer(node)
|
||||||
|
t.Cleanup(server.Close)
|
||||||
|
return New("", func(context.Context) string { return server.URL }), node
|
||||||
|
}
|
||||||
|
|
||||||
|
func thumbnailRequest() *http.Request {
|
||||||
|
return httptest.NewRequest(http.MethodGet, "/api/media/thumb", nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestStoreThumbnailWritesToProjectThumbnailsMount(t *testing.T) {
|
||||||
|
client, node := newThumbnailTestClient(t, nil)
|
||||||
|
local := filepath.Join(t.TempDir(), "thumb.jpg")
|
||||||
|
if err := os.WriteFile(local, []byte("jpeg bytes"), 0o600); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
size, err := client.StoreThumbnail(context.Background(), "ContentScanner", testThumbnailID, local)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("StoreThumbnail error: %v", err)
|
||||||
|
}
|
||||||
|
if size != int64(len("jpeg bytes")) {
|
||||||
|
t.Fatalf("StoreThumbnail size = %d, want %d", size, len("jpeg bytes"))
|
||||||
|
}
|
||||||
|
want := []string{"POST /api/mount/ContentScanner/thumbnails/" + testThumbnailID + ".jpg"}
|
||||||
|
if got := node.seen(); !slices.Equal(got, want) {
|
||||||
|
t.Fatalf("requests = %v, want %v", got, want)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestProxyThumbnailPrefersProjectMount(t *testing.T) {
|
||||||
|
mount := "/api/mount/MediaViewer/thumbnails/" + testThumbnailID + ".jpg"
|
||||||
|
legacy := "/thumbnails/" + testThumbnailID + ".jpg"
|
||||||
|
client, node := newThumbnailTestClient(t, map[string]string{mount: "from mount", legacy: "from legacy"})
|
||||||
|
|
||||||
|
rec := httptest.NewRecorder()
|
||||||
|
if !client.ProxyThumbnail(rec, thumbnailRequest(), "MediaViewer", testThumbnailID) {
|
||||||
|
t.Fatal("ProxyThumbnail missed although the mount holds the thumbnail")
|
||||||
|
}
|
||||||
|
if rec.Body.String() != "from mount" {
|
||||||
|
t.Fatalf("body = %q, want the mount copy", rec.Body.String())
|
||||||
|
}
|
||||||
|
for _, request := range node.seen() {
|
||||||
|
if !strings.Contains(request, "/api/mount/") {
|
||||||
|
t.Fatalf("legacy root was consulted although the mount had the thumbnail: %v", node.seen())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestProxyThumbnailFallsBackToLegacyRoot(t *testing.T) {
|
||||||
|
legacy := "/thumbnails/" + testThumbnailID + ".jpg"
|
||||||
|
client, _ := newThumbnailTestClient(t, map[string]string{legacy: "from legacy"})
|
||||||
|
|
||||||
|
rec := httptest.NewRecorder()
|
||||||
|
if !client.ProxyThumbnail(rec, thumbnailRequest(), "ContentScanner", testThumbnailID) {
|
||||||
|
t.Fatal("ProxyThumbnail missed although the legacy root holds the thumbnail")
|
||||||
|
}
|
||||||
|
if rec.Body.String() != "from legacy" {
|
||||||
|
t.Fatalf("body = %q, want the legacy copy", rec.Body.String())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestProxyThumbnailReportsMissingWithoutWriting(t *testing.T) {
|
||||||
|
client, _ := newThumbnailTestClient(t, nil)
|
||||||
|
|
||||||
|
rec := httptest.NewRecorder()
|
||||||
|
if client.ProxyThumbnail(rec, thumbnailRequest(), "ContentScanner", testThumbnailID) {
|
||||||
|
t.Fatal("ProxyThumbnail reported a hit for a thumbnail neither location holds")
|
||||||
|
}
|
||||||
|
if rec.Body.Len() != 0 {
|
||||||
|
t.Fatalf("ProxyThumbnail wrote %q on a miss; the caller needs a clean fallback", rec.Body.String())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestFetchThumbnailToScratchFallsBackToLegacyRoot(t *testing.T) {
|
||||||
|
legacy := "/thumbnails/" + testThumbnailID + ".jpg"
|
||||||
|
client, _ := newThumbnailTestClient(t, map[string]string{legacy: "from legacy"})
|
||||||
|
|
||||||
|
path, cleanup, err := client.FetchThumbnailToScratch(context.Background(), "ContentScanner", testThumbnailID, ".jpg")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("FetchThumbnailToScratch error: %v", err)
|
||||||
|
}
|
||||||
|
defer cleanup()
|
||||||
|
data, err := os.ReadFile(path)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if string(data) != "from legacy" {
|
||||||
|
t.Fatalf("scratch contents = %q, want the legacy copy", data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestDeleteStoredThumbnailRemovesMountAndLegacyCopies(t *testing.T) {
|
||||||
|
client, node := newThumbnailTestClient(t, nil)
|
||||||
|
|
||||||
|
if err := client.DeleteStoredThumbnail(context.Background(), "ContentScanner", testThumbnailID); err != nil {
|
||||||
|
t.Fatalf("DeleteStoredThumbnail error: %v", err)
|
||||||
|
}
|
||||||
|
want := []string{
|
||||||
|
"DELETE /api/mount/ContentScanner/thumbnails/" + testThumbnailID + ".jpg",
|
||||||
|
"DELETE /api/thumbnails/" + testThumbnailID,
|
||||||
|
}
|
||||||
|
if got := node.seen(); !slices.Equal(got, want) {
|
||||||
|
t.Fatalf("requests = %v, want %v", got, want)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestThumbnailIDsCannotEscapeTheThumbnailsDirectory(t *testing.T) {
|
||||||
|
client, node := newThumbnailTestClient(t, nil)
|
||||||
|
ctx := context.Background()
|
||||||
|
|
||||||
|
for _, id := range []string{"", ".", "..", "../secret", "nested/id"} {
|
||||||
|
if client.ProxyThumbnail(httptest.NewRecorder(), thumbnailRequest(), "ContentScanner", id) {
|
||||||
|
t.Errorf("ProxyThumbnail accepted id %q", id)
|
||||||
|
}
|
||||||
|
if _, _, err := client.FetchThumbnailToScratch(ctx, "ContentScanner", id, ".jpg"); err == nil {
|
||||||
|
t.Errorf("FetchThumbnailToScratch accepted id %q", id)
|
||||||
|
}
|
||||||
|
if _, err := client.StoreThumbnail(ctx, "ContentScanner", id, filepath.Join(t.TempDir(), "x.jpg")); err == nil {
|
||||||
|
t.Errorf("StoreThumbnail accepted id %q", id)
|
||||||
|
}
|
||||||
|
if err := client.DeleteStoredThumbnail(ctx, "ContentScanner", id); err == nil {
|
||||||
|
t.Errorf("DeleteStoredThumbnail accepted id %q", id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if got := node.seen(); len(got) != 0 {
|
||||||
|
t.Fatalf("invalid thumbnail ids reached CarrierNode: %v", got)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -198,9 +198,7 @@ func (c *Core) thumbnailMediaIdentifier(w http.ResponseWriter, r *http.Request,
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !strings.Contains(id, string(filepath.Separator)) && !strings.Contains(id, "/") {
|
if !strings.Contains(id, string(filepath.Separator)) && !strings.Contains(id, "/") {
|
||||||
thumbnailPath := "/thumbnails/" + id + ".jpg"
|
if c.carrierNode.ProxyThumbnail(w, r, c.serviceName, id) {
|
||||||
if exists, _, _, err := c.carrierNode.Probe(r.Context(), thumbnailPath); err == nil && exists {
|
|
||||||
c.carrierNode.Proxy(w, r, thumbnailPath)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -212,8 +210,11 @@ func (c *Core) thumbnailMediaIdentifier(w http.ResponseWriter, r *http.Request,
|
|||||||
WHERE m.media_key=$1 OR CAST(m.id AS TEXT)=$1
|
WHERE m.media_key=$1 OR CAST(m.id AS TEXT)=$1
|
||||||
ORDER BY t.created_at DESC
|
ORDER BY t.created_at DESC
|
||||||
LIMIT 1`, id).Scan(&thumbnailID); err == nil && SafeRelative(thumbnailID) {
|
LIMIT 1`, id).Scan(&thumbnailID); err == nil && SafeRelative(thumbnailID) {
|
||||||
c.carrierNode.Proxy(w, r, "/thumbnails/"+thumbnailID+".jpg")
|
// A row whose file CarrierNode no longer has falls through to the original image below,
|
||||||
return
|
// rather than proxying CarrierNode's 404.
|
||||||
|
if c.carrierNode.ProxyThumbnail(w, r, c.serviceName, thumbnailID) {
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
record, err := c.findMedia(r.Context(), id)
|
record, err := c.findMedia(r.Context(), id)
|
||||||
if err != nil || !isImagePath(record.FilePath) {
|
if err != nil || !isImagePath(record.FilePath) {
|
||||||
|
|||||||
@@ -1,42 +1,42 @@
|
|||||||
{
|
{
|
||||||
"name": "@gabriel20xx/web-ui",
|
"name": "@gabriel20xx/web-ui",
|
||||||
"version": "0.1.1",
|
"version": "0.1.1",
|
||||||
"description": "Shared Svelte UI, layout, authentication, and account components for Gabriel20xx web projects.",
|
"description": "Shared Svelte UI, layout, authentication, and account components for Gabriel20xx web projects.",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"files": [
|
"files": [
|
||||||
"src",
|
"src",
|
||||||
"README.md"
|
"README.md"
|
||||||
],
|
],
|
||||||
"sideEffects": [
|
"sideEffects": [
|
||||||
"**/*.css"
|
"**/*.css"
|
||||||
],
|
],
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"svelte": "^5.0.0"
|
"svelte": "^5.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@lucide/svelte": "1.28.0"
|
"@lucide/svelte": "1.28.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@sveltejs/package": "^2.5.0",
|
"@sveltejs/package": "^2.5.0",
|
||||||
"@sveltejs/vite-plugin-svelte": "^6.0.0",
|
"@sveltejs/vite-plugin-svelte": "^6.0.0",
|
||||||
"svelte": "^5.0.0",
|
"svelte": "^5.0.0",
|
||||||
"svelte-check": "^4.0.0",
|
"svelte-check": "^4.0.0",
|
||||||
"typescript": "^5.0.0"
|
"typescript": "^5.0.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"check": "svelte-check --tsconfig ./tsconfig.json",
|
"check": "svelte-check --tsconfig ./tsconfig.json",
|
||||||
"package": "svelte-package"
|
"package": "svelte-package"
|
||||||
},
|
},
|
||||||
"svelte": "./src/index.ts",
|
"svelte": "./src/index.ts",
|
||||||
"types": "./src/index.ts",
|
"types": "./src/index.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./src/index.ts",
|
"types": "./src/index.ts",
|
||||||
"svelte": "./src/index.ts",
|
"svelte": "./src/index.ts",
|
||||||
"import": "./src/index.ts"
|
"import": "./src/index.ts"
|
||||||
},
|
},
|
||||||
"./styles.css": "./src/lib/styles.css",
|
"./styles.css": "./src/lib/styles.css",
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type {
|
import type {
|
||||||
KnownProject,
|
KnownRole,
|
||||||
ManagedUser,
|
ManagedUser,
|
||||||
UserCreateInput,
|
UserCreateInput,
|
||||||
UserCreateRequest,
|
UserCreateRequest,
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
onDelete,
|
onDelete,
|
||||||
onList,
|
onList,
|
||||||
onUpdate,
|
onUpdate,
|
||||||
projects
|
roles
|
||||||
}: {
|
}: {
|
||||||
currentRole?: UserRole;
|
currentRole?: UserRole;
|
||||||
currentUserId?: UserId;
|
currentUserId?: UserId;
|
||||||
@@ -30,14 +30,13 @@
|
|||||||
onList?: UserListRequest;
|
onList?: UserListRequest;
|
||||||
onUpdate?: UserUpdateRequest;
|
onUpdate?: UserUpdateRequest;
|
||||||
/**
|
/**
|
||||||
* Every project an account can be restricted to logging into
|
* The custom roles an account can be placed in (AuthGuard's role-based
|
||||||
* (AuthGuard's project-scope feature). Only AuthGuard's own admin UI
|
* project access: a role decides which projects its members may log into).
|
||||||
* passes this - every other project's UserManagement usage (proxying to
|
* Only AuthGuard's own admin UI passes this - every other project's
|
||||||
* AuthGuard's admin/users endpoints without knowing about registered
|
* UserManagement usage omits it, and the whole role section of this
|
||||||
* projects) omits it, and the whole project-access section of this
|
|
||||||
* component simply doesn't render.
|
* component simply doesn't render.
|
||||||
*/
|
*/
|
||||||
projects?: KnownProject[];
|
roles?: KnownRole[];
|
||||||
} = $props();
|
} = $props();
|
||||||
|
|
||||||
let users = $state<ManagedUser[]>([]);
|
let users = $state<ManagedUser[]>([]);
|
||||||
@@ -113,28 +112,26 @@
|
|||||||
function startEditing(user: ManagedUser): void {
|
function startEditing(user: ManagedUser): void {
|
||||||
editingId = user.id;
|
editingId = user.id;
|
||||||
editUser = { username: user.username, email: user.email, role: roleForForm(user.role) };
|
editUser = { username: user.username, email: user.email, role: roleForForm(user.role) };
|
||||||
if (projects && projects.length > 0) editUser.projects = [...(user.projects ?? [])];
|
if (roles && roles.length > 0) editUser.roleIds = [...(user.roleIds ?? [])];
|
||||||
error = '';
|
error = '';
|
||||||
notice = '';
|
notice = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleEditProject(key: string, checked: boolean): void {
|
function toggleEditRole(id: number, checked: boolean): void {
|
||||||
const current = editUser.projects ?? [];
|
const current = editUser.roleIds ?? [];
|
||||||
editUser.projects = checked ? [...current, key] : current.filter((project) => project !== key);
|
editUser.roleIds = checked ? [...current, id] : current.filter((roleId) => roleId !== id);
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleNewProject(key: string, checked: boolean): void {
|
function toggleNewRole(id: number, checked: boolean): void {
|
||||||
const current = newUser.projects ?? [];
|
const current = newUser.roleIds ?? [];
|
||||||
newUser.projects = checked ? [...current, key] : current.filter((project) => project !== key);
|
newUser.roleIds = checked ? [...current, id] : current.filter((roleId) => roleId !== id);
|
||||||
}
|
}
|
||||||
|
|
||||||
function projectLabel(key: string): string {
|
// Names the roles an account is in, in the order the roles are listed. An account in none of
|
||||||
return projects?.find((project) => project.key === key)?.label ?? key;
|
// them keeps every project.
|
||||||
}
|
function roleSummary(user: ManagedUser): string {
|
||||||
|
const names = (roles ?? []).filter((role) => (user.roleIds ?? []).includes(role.id)).map((role) => role.name);
|
||||||
function projectSummary(user: ManagedUser): string {
|
return names.length > 0 ? names.join(', ') : 'All projects';
|
||||||
if (!user.projects || user.projects.length === 0) return 'All projects';
|
|
||||||
return user.projects.map(projectLabel).join(', ');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function stopEditing(): void {
|
function stopEditing(): void {
|
||||||
@@ -203,17 +200,17 @@
|
|||||||
{#if canAssignAdmin}<option value="admin">Admin</option>{/if}
|
{#if canAssignAdmin}<option value="admin">Admin</option>{/if}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
{#if projects && projects.length > 0}
|
{#if roles && roles.length > 0}
|
||||||
<fieldset class="sc-user-projects">
|
<fieldset class="sc-user-roles">
|
||||||
<legend>Projects (none checked = all projects)</legend>
|
<legend>Roles (none checked = all projects)</legend>
|
||||||
{#each projects as project (project.key)}
|
{#each roles as role (role.id)}
|
||||||
<label class="sc-user-project-option">
|
<label class="sc-user-role-option">
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
checked={(newUser.projects ?? []).includes(project.key)}
|
checked={(newUser.roleIds ?? []).includes(role.id)}
|
||||||
onchange={(event) => toggleNewProject(project.key, event.currentTarget.checked)}
|
onchange={(event) => toggleNewRole(role.id, event.currentTarget.checked)}
|
||||||
/>
|
/>
|
||||||
{project.label}
|
{role.name}
|
||||||
</label>
|
</label>
|
||||||
{/each}
|
{/each}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
@@ -241,17 +238,17 @@
|
|||||||
{#if canAssignAdmin}<option value="admin">Admin</option>{/if}
|
{#if canAssignAdmin}<option value="admin">Admin</option>{/if}
|
||||||
{#if user.role === 'superadmin'}<option value="superadmin">Superadmin</option>{/if}
|
{#if user.role === 'superadmin'}<option value="superadmin">Superadmin</option>{/if}
|
||||||
</select>
|
</select>
|
||||||
{#if projects && projects.length > 0}
|
{#if roles && roles.length > 0}
|
||||||
<fieldset class="sc-user-projects">
|
<fieldset class="sc-user-roles">
|
||||||
<legend>Projects (none checked = all projects)</legend>
|
<legend>Roles (none checked = all projects)</legend>
|
||||||
{#each projects as project (project.key)}
|
{#each roles as role (role.id)}
|
||||||
<label class="sc-user-project-option">
|
<label class="sc-user-role-option">
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
checked={(editUser.projects ?? []).includes(project.key)}
|
checked={(editUser.roleIds ?? []).includes(role.id)}
|
||||||
onchange={(event) => toggleEditProject(project.key, event.currentTarget.checked)}
|
onchange={(event) => toggleEditRole(role.id, event.currentTarget.checked)}
|
||||||
/>
|
/>
|
||||||
{project.label}
|
{role.name}
|
||||||
</label>
|
</label>
|
||||||
{/each}
|
{/each}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
@@ -263,8 +260,8 @@
|
|||||||
<div><strong>{user.username}</strong><span>{user.email}</span></div>
|
<div><strong>{user.username}</strong><span>{user.email}</span></div>
|
||||||
<span class="sc-user-role">{user.role}</span>
|
<span class="sc-user-role">{user.role}</span>
|
||||||
<span class="sc-muted sc-user-last-login" title="Last login">{formatLastLogin(user.lastLoginAt)}</span>
|
<span class="sc-muted sc-user-last-login" title="Last login">{formatLastLogin(user.lastLoginAt)}</span>
|
||||||
{#if projects && projects.length > 0}
|
{#if roles && roles.length > 0}
|
||||||
<span class="sc-muted sc-user-projects-summary" title="Project access">{projectSummary(user)}</span>
|
<span class="sc-muted sc-user-roles-summary" title="Roles">{roleSummary(user)}</span>
|
||||||
{/if}
|
{/if}
|
||||||
<div class="sc-user-actions">
|
<div class="sc-user-actions">
|
||||||
<Button disabled={saving} size="sm" type="button" variant="secondary" onclick={() => startEditing(user)}>Edit</Button>
|
<Button disabled={saving} size="sm" type="button" variant="secondary" onclick={() => startEditing(user)}>Edit</Button>
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ export type {
|
|||||||
AuthSetupInput,
|
AuthSetupInput,
|
||||||
ContentSnippet,
|
ContentSnippet,
|
||||||
KnownProject,
|
KnownProject,
|
||||||
|
KnownRole,
|
||||||
NavItem,
|
NavItem,
|
||||||
ProfileUpdateInput,
|
ProfileUpdateInput,
|
||||||
ManagedUser,
|
ManagedUser,
|
||||||
|
|||||||
@@ -703,6 +703,27 @@ html[data-wide-layout='true'] .sc-header {
|
|||||||
box-shadow: 0 0 0 3px color-mix(in srgb, var(--sc-ring) 22%, transparent);
|
box-shadow: 0 0 0 3px color-mix(in srgb, var(--sc-ring) 22%, transparent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Checkboxes and radios share one look across apps. The box takes each app's primary color,
|
||||||
|
so it follows that app's light and dark theme. Sizes match the legacy shared sheet. The rule
|
||||||
|
sits in the base layer so Tailwind utilities (size-*, accent-*) still override it per element. */
|
||||||
|
@layer base {
|
||||||
|
input[type='checkbox'],
|
||||||
|
input[type='radio'] {
|
||||||
|
accent-color: var(--sc-primary);
|
||||||
|
width: 1.05rem;
|
||||||
|
height: 1.05rem;
|
||||||
|
flex: 0 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type='checkbox'] {
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type='radio'] {
|
||||||
|
border-radius: 9999px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.sc-form-actions,
|
.sc-form-actions,
|
||||||
.sc-dialog-footer {
|
.sc-dialog-footer {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -809,7 +830,7 @@ html[data-wide-layout='true'] .sc-header {
|
|||||||
gap: 0.4rem;
|
gap: 0.4rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sc-user-projects-summary {
|
.sc-user-roles-summary {
|
||||||
max-width: 12rem;
|
max-width: 12rem;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
font-size: 0.8rem;
|
font-size: 0.8rem;
|
||||||
@@ -817,7 +838,7 @@ html[data-wide-layout='true'] .sc-header {
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sc-user-projects {
|
.sc-user-roles {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex: 1 1 100%;
|
flex: 1 1 100%;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
@@ -828,14 +849,14 @@ html[data-wide-layout='true'] .sc-header {
|
|||||||
border-radius: 0.5rem;
|
border-radius: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sc-user-projects legend {
|
.sc-user-roles legend {
|
||||||
flex-basis: 100%;
|
flex-basis: 100%;
|
||||||
margin-bottom: 0.3rem;
|
margin-bottom: 0.3rem;
|
||||||
color: var(--sc-muted-fg);
|
color: var(--sc-muted-fg);
|
||||||
font-size: 0.8rem;
|
font-size: 0.8rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sc-user-project-option {
|
.sc-user-role-option {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.35rem;
|
gap: 0.35rem;
|
||||||
@@ -1037,9 +1058,11 @@ html[data-wide-layout='true'] .sc-header {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.sc-notification {
|
.sc-notification {
|
||||||
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
gap: 0.625rem;
|
gap: 0.625rem;
|
||||||
|
min-width: 0;
|
||||||
padding: 0.875rem 1rem;
|
padding: 0.875rem 1rem;
|
||||||
color: var(--sc-fg);
|
color: var(--sc-fg);
|
||||||
background: var(--sc-surface-raised);
|
background: var(--sc-surface-raised);
|
||||||
@@ -1047,8 +1070,6 @@ html[data-wide-layout='true'] .sc-header {
|
|||||||
border-radius: var(--sc-radius-md);
|
border-radius: var(--sc-radius-md);
|
||||||
box-shadow: var(--sc-shadow-lg);
|
box-shadow: var(--sc-shadow-lg);
|
||||||
pointer-events: auto;
|
pointer-events: auto;
|
||||||
position: relative;
|
|
||||||
min-width: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.sc-notification + .sc-notification {
|
.sc-notification + .sc-notification {
|
||||||
@@ -1060,7 +1081,6 @@ html[data-wide-layout='true'] .sc-header {
|
|||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.sc-notification-icon {
|
.sc-notification-icon {
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
margin-top: 0.125rem;
|
margin-top: 0.125rem;
|
||||||
@@ -1085,10 +1105,10 @@ html[data-wide-layout='true'] .sc-header {
|
|||||||
|
|
||||||
.sc-notification-message {
|
.sc-notification-message {
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
|
min-width: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 0.875rem;
|
font-size: 0.875rem;
|
||||||
line-height: 1.45;
|
line-height: 1.45;
|
||||||
min-width: 0;
|
|
||||||
overflow-wrap: anywhere;
|
overflow-wrap: anywhere;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -59,20 +59,26 @@ export interface ManagedUser {
|
|||||||
/** Null/undefined means the account has never completed a login. */
|
/** Null/undefined means the account has never completed a login. */
|
||||||
lastLoginAt?: string | null;
|
lastLoginAt?: string | null;
|
||||||
/**
|
/**
|
||||||
* Project keys this account is restricted to logging into (AuthGuard's
|
* Ids of the custom roles this account belongs to. Those roles decide which
|
||||||
* project-scope feature); an empty array (never undefined, when the
|
* projects the account may log into (AuthGuard's role-based project access);
|
||||||
* backend supports this feature at all) means unrestricted. Undefined on
|
* an empty array means no custom role, which keeps every project open.
|
||||||
* a backend that doesn't report it at all.
|
* Undefined on a backend that doesn't report roles at all.
|
||||||
*/
|
*/
|
||||||
projects?: string[];
|
roleIds?: number[];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** One project an administrator may restrict a user's login access to - see UserManagement's `projects` prop. */
|
/** One registered project an administrator can pick from. */
|
||||||
export interface KnownProject {
|
export interface KnownProject {
|
||||||
key: string;
|
key: string;
|
||||||
label: string;
|
label: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** One custom role an administrator may assign to a user - see UserManagement's `roles` prop. */
|
||||||
|
export interface KnownRole {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* username/email are plain (never undefined) so <input> bindings stay simple
|
* username/email are plain (never undefined) so <input> bindings stay simple
|
||||||
* -- an empty string, not an absent key, is how this form represents "not
|
* -- an empty string, not an absent key, is how this form represents "not
|
||||||
@@ -86,11 +92,11 @@ export interface UserCreateInput {
|
|||||||
password: string;
|
password: string;
|
||||||
role?: UserRole;
|
role?: UserRole;
|
||||||
/**
|
/**
|
||||||
* Project keys this new account is restricted to. An empty array means
|
* Ids of the custom roles this new account belongs to. An empty array means
|
||||||
* unrestricted; omitted when the host application does not expose project
|
* no custom role (every project); omitted when the host application does not
|
||||||
* scoping.
|
* expose roles.
|
||||||
*/
|
*/
|
||||||
projects?: string[];
|
roleIds?: number[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface UserUpdateInput {
|
export interface UserUpdateInput {
|
||||||
@@ -99,11 +105,11 @@ export interface UserUpdateInput {
|
|||||||
password?: string;
|
password?: string;
|
||||||
role?: UserRole;
|
role?: UserRole;
|
||||||
/**
|
/**
|
||||||
* Replaces the account's full project-access list when present (an empty
|
* Replaces the account's full set of custom roles when present (an empty
|
||||||
* array clears any restriction); omitted (undefined) leaves it untouched.
|
* array removes it from every role); omitted (undefined) leaves them
|
||||||
* Only ever set when UserManagement was given a `projects` prop.
|
* untouched. Only ever set when UserManagement was given a `roles` prop.
|
||||||
*/
|
*/
|
||||||
projects?: string[];
|
roleIds?: number[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserListRequest = () => ManagedUser[] | Promise<ManagedUser[]>;
|
export type UserListRequest = () => ManagedUser[] | Promise<ManagedUser[]>;
|
||||||
|
|||||||
+329
-10
@@ -203,8 +203,10 @@ html[data-wide-layout='true'] .sc-header {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* The About item falls back to an <a> when no onAbout handler is wired, unlike the other
|
/* The About item falls back to an <a> when no onAbout handler is wired, unlike the other
|
||||||
button-based items - without this, the browser's default a:visited color (higher specificity
|
button-based items - without this, the browser's default a:link/a:visited color (higher
|
||||||
than the class color above) makes it drift from the other dropdown items' color once clicked. */
|
specificity than the class color above) makes it drift from the other dropdown items' color,
|
||||||
|
both before and after it's been clicked. */
|
||||||
|
.sc-profile-menu-item:link,
|
||||||
.sc-profile-menu-item:visited {
|
.sc-profile-menu-item:visited {
|
||||||
color: var(--sc-muted-fg);
|
color: var(--sc-muted-fg);
|
||||||
}
|
}
|
||||||
@@ -279,6 +281,12 @@ html[data-wide-layout='true'] .sc-header {
|
|||||||
font-weight: 650;
|
font-weight: 650;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sc-badge[data-variant="primary"] {
|
||||||
|
color: var(--sc-primary-fg);
|
||||||
|
background: var(--sc-primary);
|
||||||
|
border-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
.sc-badge[data-variant="success"] {
|
.sc-badge[data-variant="success"] {
|
||||||
color: var(--sc-success-fg);
|
color: var(--sc-success-fg);
|
||||||
background: var(--sc-success);
|
background: var(--sc-success);
|
||||||
@@ -302,7 +310,7 @@ html[data-wide-layout='true'] .sc-header {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
gap: 0.5rem;
|
gap: 0.5rem;
|
||||||
min-height: 2.5rem;
|
height: 2.5rem;
|
||||||
padding: 0.625rem 1rem;
|
padding: 0.625rem 1rem;
|
||||||
border: 1px solid transparent;
|
border: 1px solid transparent;
|
||||||
border-radius: var(--sc-radius-md);
|
border-radius: var(--sc-radius-md);
|
||||||
@@ -374,17 +382,207 @@ html[data-wide-layout='true'] .sc-header {
|
|||||||
background: var(--sc-danger-hover);
|
background: var(--sc-danger-hover);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sc-button-outline {
|
||||||
|
color: var(--sc-fg);
|
||||||
|
background: transparent;
|
||||||
|
border-color: var(--sc-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-button-outline:hover:not(:disabled) {
|
||||||
|
background: var(--sc-surface-hover);
|
||||||
|
}
|
||||||
|
|
||||||
.sc-button-sm {
|
.sc-button-sm {
|
||||||
min-height: 2rem;
|
height: 2.5rem;
|
||||||
padding: 0.45rem 0.75rem;
|
padding: 0.45rem 0.75rem;
|
||||||
font-size: 0.8125rem;
|
font-size: 0.8125rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sc-button-lg {
|
.sc-button-lg {
|
||||||
min-height: 2.875rem;
|
height: 2.5rem;
|
||||||
padding: 0.75rem 1.25rem;
|
padding: 0.75rem 1.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sc-button-icon {
|
||||||
|
height: 2.5rem;
|
||||||
|
width: 2.5rem;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-empty-state {
|
||||||
|
display: flex;
|
||||||
|
min-height: 10rem;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 0.75rem;
|
||||||
|
padding: 2rem 1.25rem;
|
||||||
|
text-align: center;
|
||||||
|
border: 1px dashed var(--sc-border);
|
||||||
|
border-radius: var(--sc-radius-lg);
|
||||||
|
background: color-mix(in srgb, var(--sc-surface) 50%, transparent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-empty-state-icon {
|
||||||
|
color: var(--sc-muted-fg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-empty-state-title {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--sc-fg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-empty-state-message {
|
||||||
|
margin: 0.25rem 0 0;
|
||||||
|
max-width: 24rem;
|
||||||
|
font-size: 0.8125rem;
|
||||||
|
color: var(--sc-muted-fg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-section-title {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-section-title h2 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
font-weight: 650;
|
||||||
|
color: var(--sc-fg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-section-title p {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-metric {
|
||||||
|
padding: 1rem;
|
||||||
|
border: 1px solid var(--sc-border);
|
||||||
|
border-radius: var(--sc-radius-lg);
|
||||||
|
background: var(--sc-surface);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-metric-label {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 0.6875rem;
|
||||||
|
font-weight: 650;
|
||||||
|
letter-spacing: 0.06em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
color: var(--sc-muted-fg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-metric-value {
|
||||||
|
margin: 0.5rem 0 0;
|
||||||
|
font-size: 1.5rem;
|
||||||
|
font-weight: 650;
|
||||||
|
letter-spacing: -0.01em;
|
||||||
|
color: var(--sc-fg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-metric-value[data-variant="primary"] {
|
||||||
|
color: var(--sc-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-metric-value[data-variant="success"] {
|
||||||
|
color: var(--sc-success);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-metric-value[data-variant="warning"] {
|
||||||
|
color: var(--sc-warning);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-metric-value[data-variant="danger"] {
|
||||||
|
color: var(--sc-danger);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-metric-detail {
|
||||||
|
margin: 0.25rem 0 0;
|
||||||
|
font-size: 0.8125rem;
|
||||||
|
color: var(--sc-muted-fg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-status-icon {
|
||||||
|
color: var(--sc-muted-fg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-status-summary[data-level="healthy"] .sc-status-icon,
|
||||||
|
.sc-status-summary[data-level="healthy"] .sc-status-summary-label {
|
||||||
|
color: var(--sc-success);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-status-summary[data-level="degraded"] .sc-status-icon,
|
||||||
|
.sc-status-summary[data-level="degraded"] .sc-status-summary-label {
|
||||||
|
color: var(--sc-warning);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-status-summary[data-level="offline"] .sc-status-icon,
|
||||||
|
.sc-status-summary[data-level="offline"] .sc-status-summary-label {
|
||||||
|
color: var(--sc-danger);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-status-spin {
|
||||||
|
animation: sc-spin 900ms linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes sc-spin {
|
||||||
|
to {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-status-summary {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.75rem;
|
||||||
|
margin-bottom: 1.25rem;
|
||||||
|
padding: 0.75rem;
|
||||||
|
border: 1px solid var(--sc-border);
|
||||||
|
border-radius: var(--sc-radius-md);
|
||||||
|
background: var(--sc-surface);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-status-summary-label {
|
||||||
|
font-weight: 650;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-status-summary-time {
|
||||||
|
margin-left: auto;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
color: var(--sc-muted-fg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-status-probes {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.5rem;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-status-probe {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 1rem;
|
||||||
|
padding: 0.5rem 0.75rem;
|
||||||
|
border: 1px solid var(--sc-border);
|
||||||
|
border-radius: var(--sc-radius-sm);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-status-probe span[data-ok="true"] {
|
||||||
|
color: var(--sc-success);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-status-probe span[data-ok="false"] {
|
||||||
|
color: var(--sc-danger);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-status-service {
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
.sc-button-full {
|
.sc-button-full {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
@@ -474,7 +672,6 @@ html[data-wide-layout='true'] .sc-header {
|
|||||||
.sc-select,
|
.sc-select,
|
||||||
.sc-textarea {
|
.sc-textarea {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-height: 2.6rem;
|
|
||||||
padding: 0.625rem 0.75rem;
|
padding: 0.625rem 0.75rem;
|
||||||
color: var(--sc-fg);
|
color: var(--sc-fg);
|
||||||
background: var(--sc-bg);
|
background: var(--sc-bg);
|
||||||
@@ -486,6 +683,11 @@ html[data-wide-layout='true'] .sc-header {
|
|||||||
box-shadow 140ms ease;
|
box-shadow 140ms ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sc-input,
|
||||||
|
.sc-select {
|
||||||
|
height: 2.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
.sc-textarea {
|
.sc-textarea {
|
||||||
min-height: 7rem;
|
min-height: 7rem;
|
||||||
resize: vertical;
|
resize: vertical;
|
||||||
@@ -597,12 +799,51 @@ html[data-wide-layout='true'] .sc-header {
|
|||||||
text-transform: capitalize;
|
text-transform: capitalize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sc-user-last-login {
|
||||||
|
flex-shrink: 0;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
.sc-user-actions {
|
.sc-user-actions {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
gap: 0.4rem;
|
gap: 0.4rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sc-user-roles-summary {
|
||||||
|
max-width: 12rem;
|
||||||
|
overflow: hidden;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-user-roles {
|
||||||
|
display: flex;
|
||||||
|
flex: 1 1 100%;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 0.5rem 1rem;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0.5rem 0.7rem;
|
||||||
|
border: 1px solid var(--sc-border);
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-user-roles legend {
|
||||||
|
flex-basis: 100%;
|
||||||
|
margin-bottom: 0.3rem;
|
||||||
|
color: var(--sc-muted-fg);
|
||||||
|
font-size: 0.8rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-user-role-option {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.35rem;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
}
|
||||||
|
|
||||||
.sc-user-edit-row {
|
.sc-user-edit-row {
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
@@ -628,6 +869,81 @@ html[data-wide-layout='true'] .sc-header {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sc-pagination {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 0.75rem;
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-pagination-page-size {
|
||||||
|
width: auto;
|
||||||
|
height: 2.5rem;
|
||||||
|
padding: 0.375rem 0.6rem;
|
||||||
|
color: var(--sc-fg);
|
||||||
|
background: var(--sc-bg);
|
||||||
|
border: 1px solid var(--sc-border);
|
||||||
|
border-radius: var(--sc-radius-sm);
|
||||||
|
font-size: 0.8rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-pagination-info {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--sc-muted-fg);
|
||||||
|
font-size: 0.8rem;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-pagination-controls {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.25rem;
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-pagination-button {
|
||||||
|
display: grid;
|
||||||
|
width: 2.5rem;
|
||||||
|
height: 2.5rem;
|
||||||
|
place-items: center;
|
||||||
|
color: var(--sc-muted-fg);
|
||||||
|
background: transparent;
|
||||||
|
border: 1px solid var(--sc-border);
|
||||||
|
border-radius: var(--sc-radius-sm);
|
||||||
|
cursor: pointer;
|
||||||
|
transition:
|
||||||
|
color 140ms ease,
|
||||||
|
background 140ms ease,
|
||||||
|
border-color 140ms ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-pagination-button:hover:not(:disabled) {
|
||||||
|
color: var(--sc-fg);
|
||||||
|
background: var(--sc-surface-hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-pagination-button:focus-visible {
|
||||||
|
outline: 3px solid color-mix(in srgb, var(--sc-ring) 45%, transparent);
|
||||||
|
outline-offset: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-pagination-button:disabled {
|
||||||
|
cursor: not-allowed;
|
||||||
|
opacity: 0.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 620px) {
|
||||||
|
.sc-pagination {
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc-pagination-controls {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.sc-auth-page {
|
.sc-auth-page {
|
||||||
display: grid;
|
display: grid;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
@@ -723,9 +1039,11 @@ html[data-wide-layout='true'] .sc-header {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.sc-notification {
|
.sc-notification {
|
||||||
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
gap: 0.625rem;
|
gap: 0.625rem;
|
||||||
|
min-width: 0;
|
||||||
padding: 0.875rem 1rem;
|
padding: 0.875rem 1rem;
|
||||||
color: var(--sc-fg);
|
color: var(--sc-fg);
|
||||||
background: var(--sc-surface-raised);
|
background: var(--sc-surface-raised);
|
||||||
@@ -733,8 +1051,6 @@ html[data-wide-layout='true'] .sc-header {
|
|||||||
border-radius: var(--sc-radius-md);
|
border-radius: var(--sc-radius-md);
|
||||||
box-shadow: var(--sc-shadow-lg);
|
box-shadow: var(--sc-shadow-lg);
|
||||||
pointer-events: auto;
|
pointer-events: auto;
|
||||||
position: relative;
|
|
||||||
min-width: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.sc-notification + .sc-notification {
|
.sc-notification + .sc-notification {
|
||||||
@@ -746,7 +1062,6 @@ html[data-wide-layout='true'] .sc-header {
|
|||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.sc-notification-icon {
|
.sc-notification-icon {
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
margin-top: 0.125rem;
|
margin-top: 0.125rem;
|
||||||
@@ -771,10 +1086,10 @@ html[data-wide-layout='true'] .sc-header {
|
|||||||
|
|
||||||
.sc-notification-message {
|
.sc-notification-message {
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
|
min-width: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 0.875rem;
|
font-size: 0.875rem;
|
||||||
line-height: 1.45;
|
line-height: 1.45;
|
||||||
min-width: 0;
|
|
||||||
overflow-wrap: anywhere;
|
overflow-wrap: anywhere;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -909,8 +1224,12 @@ html[data-wide-layout='true'] .sc-header {
|
|||||||
padding: 0.75rem 1rem;
|
padding: 0.75rem 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* top is pinned explicitly: with it unset, the button's static-position offset is
|
||||||
|
recomputed from the flex-wrap layout, which changes height once .sc-nav wraps onto
|
||||||
|
its own row on open - so the button visibly jumps vertically on click. */
|
||||||
.sc-mobile-menu-button {
|
.sc-mobile-menu-button {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
top: 0.75rem;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
display: grid;
|
display: grid;
|
||||||
order: 3;
|
order: 3;
|
||||||
|
|||||||
Reference in new issue
Block a user