Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
satellite/admin: Serve back-office static UI
Serve the front-end sources of the new back-office through the current satellite admin server under the path `/back-office`. The front-end is served in the same way than the current one, which is through an indicated directory path with a configuration parameter or embed in the binary when that configuration parameter is empty. The commit also slightly changes the test that checks serving these static assets for not targeting the empty file in the build folder. build folders must remain because of the embed directive. Change-Id: I3c5af6b75ec944722dbdc4c560d0e7d907a205b8
- Loading branch information
1 parent
48d7be7
commit 6555a68
Showing
12 changed files
with
133 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ node_modules | |
.DS_Store | ||
.idea | ||
package-lock.json | ||
dist | ||
/build/* | ||
!/build/.keep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (C) 2023 Storj Labs, Inc. | ||
// See LICENSE for copying information. | ||
|
||
//go:build !noembed | ||
// +build !noembed | ||
|
||
package backofficeui | ||
|
||
import ( | ||
"embed" | ||
"fmt" | ||
"io/fs" | ||
) | ||
|
||
//go:embed all:build/* | ||
var assets embed.FS | ||
|
||
// Assets contains either the built admin/back-office/ui or it is empty. | ||
var Assets = func() fs.FS { | ||
build, err := fs.Sub(assets, "build") | ||
if err != nil { | ||
panic(fmt.Errorf("invalid embedding: %w", err)) | ||
} | ||
return build | ||
}() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (C) 2023 Storj Labs, Inc. | ||
// See LICENSE for copying information. | ||
|
||
//go:build noembed | ||
// +build noembed | ||
|
||
package backofficeui | ||
|
||
import "io/fs" | ||
|
||
// Assets contains either the built admin/back-office/ui or it is empty. | ||
var Assets fs.FS = emptyFS{} | ||
|
||
// emptyFS implements an empty filesystem | ||
type emptyFS struct{} | ||
|
||
// Open implements fs.FS method. | ||
func (emptyFS) Open(name string) (fs.File, error) { return nil, fs.ErrNotExist } |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ node_modules | |
/.svelte-kit | ||
/package | ||
.env | ||
.env.* | ||
.env.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters