From f37ad5fd560c408422b118c6573cd2f7c98cdac5 Mon Sep 17 00:00:00 2001 From: Tosone Date: Wed, 29 Nov 2023 19:14:04 +0800 Subject: [PATCH] :sparkles: Remove repository visibility field --- pkg/dal/dao/artifact_test.go | 6 +- pkg/dal/dao/repository.go | 3 - pkg/dal/dao/repository_test.go | 4 +- pkg/dal/dao/tag_test.go | 2 +- .../migrations/mysql/0001_initialize.up.sql | 1 - .../postgresql/0001_initialize.up.sql | 1 - .../migrations/sqlite3/0001_initialize.up.sql | 1 - pkg/dal/models/repository.go | 10 +-- pkg/dal/query/repositories.gen.go | 6 +- .../artifacts/artifacts_delete_test.go | 2 +- pkg/handlers/artifacts/artifacts_get_test.go | 2 +- pkg/handlers/artifacts/artifacts_list_test.go | 2 +- .../distribution/base/repository_list_test.go | 2 +- .../distribution/base/tags_list_test.go | 2 +- .../manifest/manifest_delete_test.go | 2 +- .../manifest/manifest_head_test.go | 2 +- .../distribution/manifest/manifest_put.go | 5 +- .../manifest/manifest_put_test.go | 2 +- .../repositories/repositories_create.go | 1 - pkg/handlers/repositories/repositories_get.go | 1 - .../repositories/repositories_list.go | 1 - web/package.json | 10 +-- web/src/interfaces/index.ts | 1 - web/src/pages/Repository/index.tsx | 41 --------- web/yarn.lock | 89 +++++++++---------- 25 files changed, 65 insertions(+), 134 deletions(-) diff --git a/pkg/dal/dao/artifact_test.go b/pkg/dal/dao/artifact_test.go index 830c4dd1..82d02957 100644 --- a/pkg/dal/dao/artifact_test.go +++ b/pkg/dal/dao/artifact_test.go @@ -78,7 +78,7 @@ func TestArtifactServiceAssociateArtifact(t *testing.T) { assert.NoError(t, err) repositoryService := repositoryServiceFactory.New(tx) - repositoryObj = &models.Repository{Name: "test/busybox", NamespaceID: namespaceObj.ID, Visibility: enums.VisibilityPrivate} + repositoryObj = &models.Repository{Name: "test/busybox", NamespaceID: namespaceObj.ID} err = repositoryService.Create(ctx, repositoryObj, dao.AutoCreateNamespace{UserID: userObj.ID}) assert.NoError(t, err) return nil @@ -148,7 +148,7 @@ func TestArtifactService(t *testing.T) { assert.NoError(t, err) repositoryService := repositoryServiceFactory.New(tx) - repositoryObj := &models.Repository{Name: "test/busybox", NamespaceID: namespaceObj.ID, Visibility: enums.VisibilityPrivate} + repositoryObj := &models.Repository{Name: "test/busybox", NamespaceID: namespaceObj.ID} err = repositoryService.Create(ctx, repositoryObj, dao.AutoCreateNamespace{UserID: userObj.ID}) assert.NoError(t, err) @@ -275,7 +275,7 @@ func TestArtifactService(t *testing.T) { assert.NoError(t, err) repositoryService := repositoryServiceFactory.New(tx) - repositoryObj := &models.Repository{Name: "test1/busybox", NamespaceID: namespaceObj.ID, Visibility: enums.VisibilityPrivate} + repositoryObj := &models.Repository{Name: "test1/busybox", NamespaceID: namespaceObj.ID} err = repositoryService.Create(ctx, repositoryObj, dao.AutoCreateNamespace{UserID: userObj.ID}) assert.NoError(t, err) diff --git a/pkg/dal/dao/repository.go b/pkg/dal/dao/repository.go index 157b3254..34a674ed 100644 --- a/pkg/dal/dao/repository.go +++ b/pkg/dal/dao/repository.go @@ -141,9 +141,6 @@ func (s *repositoryService) Create(ctx context.Context, repositoryObj *models.Re if !errors.Is(err, gorm.ErrRecordNotFound) { return err } - if !repositoryObj.Visibility.IsValid() { - repositoryObj.Visibility = namespaceObj.Visibility - } err = s.tx.Repository.WithContext(ctx).Create(repositoryObj) if err != nil { return err diff --git a/pkg/dal/dao/repository_test.go b/pkg/dal/dao/repository_test.go index e6cf987c..b6c7d946 100644 --- a/pkg/dal/dao/repository_test.go +++ b/pkg/dal/dao/repository_test.go @@ -76,14 +76,14 @@ func TestRepositoryService(t *testing.T) { assert.NoError(t, err) repositoryService := repositoryServiceFactory.New(tx) - repositoryObj := &models.Repository{Name: "test/busybox", NamespaceID: namespaceObj.ID, Visibility: enums.VisibilityPrivate} + repositoryObj := &models.Repository{Name: "test/busybox", NamespaceID: namespaceObj.ID} err = repositoryService.Create(ctx, repositoryObj, dao.AutoCreateNamespace{UserID: userObj.ID}) assert.NoError(t, err) namespaceObj1 := &models.Namespace{Name: "test1", Visibility: enums.VisibilityPrivate} err = namespaceService.Create(ctx, namespaceObj1) assert.NoError(t, err) - err = repositoryService.Create(ctx, &models.Repository{Name: "test1/busybox", Visibility: enums.VisibilityPrivate}, dao.AutoCreateNamespace{UserID: userObj.ID}) + err = repositoryService.Create(ctx, &models.Repository{Name: "test1/busybox"}, dao.AutoCreateNamespace{UserID: userObj.ID}) assert.NoError(t, err) count1, err := repositoryService.CountRepository(ctx, namespaceObj.ID, nil) diff --git a/pkg/dal/dao/tag_test.go b/pkg/dal/dao/tag_test.go index d1c3ef2d..b8c6f60f 100644 --- a/pkg/dal/dao/tag_test.go +++ b/pkg/dal/dao/tag_test.go @@ -77,7 +77,7 @@ func TestTagService(t *testing.T) { assert.NoError(t, err) repositoryService := repositoryServiceFactory.New(tx) - repositoryObj := &models.Repository{Name: "test/busybox", NamespaceID: namespaceObj.ID, Visibility: enums.VisibilityPrivate} + repositoryObj := &models.Repository{Name: "test/busybox", NamespaceID: namespaceObj.ID} err = repositoryService.Create(ctx, repositoryObj, dao.AutoCreateNamespace{UserID: userObj.ID}) assert.NoError(t, err) diff --git a/pkg/dal/migrations/mysql/0001_initialize.up.sql b/pkg/dal/migrations/mysql/0001_initialize.up.sql index 6bc53119..1d023f09 100644 --- a/pkg/dal/migrations/mysql/0001_initialize.up.sql +++ b/pkg/dal/migrations/mysql/0001_initialize.up.sql @@ -166,7 +166,6 @@ CREATE TABLE IF NOT EXISTS `repositories` ( `name` varchar(64) NOT NULL, `description` varchar(255), `overview` BLOB, - `visibility` ENUM ('public', 'private') NOT NULL DEFAULT 'private', `size_limit` bigint NOT NULL DEFAULT 0, `size` bigint NOT NULL DEFAULT 0, `tag_limit` bigint NOT NULL DEFAULT 0, diff --git a/pkg/dal/migrations/postgresql/0001_initialize.up.sql b/pkg/dal/migrations/postgresql/0001_initialize.up.sql index 7108d776..0cdd5c4e 100644 --- a/pkg/dal/migrations/postgresql/0001_initialize.up.sql +++ b/pkg/dal/migrations/postgresql/0001_initialize.up.sql @@ -247,7 +247,6 @@ CREATE TABLE IF NOT EXISTS "repositories" ( "name" varchar(64) NOT NULL, "description" varchar(255), "overview" bytea, - "visibility" visibility NOT NULL DEFAULT 'private', "size_limit" bigint NOT NULL DEFAULT 0, "size" bigint NOT NULL DEFAULT 0, "tag_limit" bigint NOT NULL DEFAULT 0, diff --git a/pkg/dal/migrations/sqlite3/0001_initialize.up.sql b/pkg/dal/migrations/sqlite3/0001_initialize.up.sql index 24b3867f..8b94985b 100644 --- a/pkg/dal/migrations/sqlite3/0001_initialize.up.sql +++ b/pkg/dal/migrations/sqlite3/0001_initialize.up.sql @@ -196,7 +196,6 @@ CREATE TABLE IF NOT EXISTS `repositories` ( `name` varchar(64) NOT NULL, `description` varchar(255), `overview` BLOB, - `visibility` text CHECK (`visibility` IN ('public', 'private')) NOT NULL DEFAULT 'private', `size_limit` integer NOT NULL DEFAULT 0, `size` integer NOT NULL DEFAULT 0, `tag_limit` integer NOT NULL DEFAULT 0, diff --git a/pkg/dal/models/repository.go b/pkg/dal/models/repository.go index 6ee4f47f..876c5e74 100644 --- a/pkg/dal/models/repository.go +++ b/pkg/dal/models/repository.go @@ -18,7 +18,6 @@ import ( "gorm.io/gorm" "gorm.io/plugin/soft_delete" - "github.com/go-sigma/sigma/pkg/types/enums" "github.com/go-sigma/sigma/pkg/xerrors" ) @@ -33,11 +32,10 @@ type Repository struct { Name string Description *string Overview []byte - Visibility enums.Visibility `gorm:"default:public"` - TagLimit int64 `gorm:"default:0"` - TagCount int64 `gorm:"default:0"` - SizeLimit int64 `gorm:"default:0"` - Size int64 `gorm:"default:0"` + TagLimit int64 `gorm:"default:0"` + TagCount int64 `gorm:"default:0"` + SizeLimit int64 `gorm:"default:0"` + Size int64 `gorm:"default:0"` Namespace Namespace Builder *Builder diff --git a/pkg/dal/query/repositories.gen.go b/pkg/dal/query/repositories.gen.go index 15afad2c..618cc4f0 100644 --- a/pkg/dal/query/repositories.gen.go +++ b/pkg/dal/query/repositories.gen.go @@ -35,7 +35,6 @@ func newRepository(db *gorm.DB, opts ...gen.DOOption) repository { _repository.Name = field.NewString(tableName, "name") _repository.Description = field.NewString(tableName, "description") _repository.Overview = field.NewBytes(tableName, "overview") - _repository.Visibility = field.NewField(tableName, "visibility") _repository.TagLimit = field.NewInt64(tableName, "tag_limit") _repository.TagCount = field.NewInt64(tableName, "tag_count") _repository.SizeLimit = field.NewInt64(tableName, "size_limit") @@ -90,7 +89,6 @@ type repository struct { Name field.String Description field.String Overview field.Bytes - Visibility field.Field TagLimit field.Int64 TagCount field.Int64 SizeLimit field.Int64 @@ -122,7 +120,6 @@ func (r *repository) updateTableName(table string) *repository { r.Name = field.NewString(table, "name") r.Description = field.NewString(table, "description") r.Overview = field.NewBytes(table, "overview") - r.Visibility = field.NewField(table, "visibility") r.TagLimit = field.NewInt64(table, "tag_limit") r.TagCount = field.NewInt64(table, "tag_count") r.SizeLimit = field.NewInt64(table, "size_limit") @@ -153,7 +150,7 @@ func (r *repository) GetFieldByName(fieldName string) (field.OrderExpr, bool) { } func (r *repository) fillFieldMap() { - r.fieldMap = make(map[string]field.Expr, 15) + r.fieldMap = make(map[string]field.Expr, 14) r.fieldMap["created_at"] = r.CreatedAt r.fieldMap["updated_at"] = r.UpdatedAt r.fieldMap["deleted_at"] = r.DeletedAt @@ -162,7 +159,6 @@ func (r *repository) fillFieldMap() { r.fieldMap["name"] = r.Name r.fieldMap["description"] = r.Description r.fieldMap["overview"] = r.Overview - r.fieldMap["visibility"] = r.Visibility r.fieldMap["tag_limit"] = r.TagLimit r.fieldMap["tag_count"] = r.TagCount r.fieldMap["size_limit"] = r.SizeLimit diff --git a/pkg/handlers/artifacts/artifacts_delete_test.go b/pkg/handlers/artifacts/artifacts_delete_test.go index 65658b8b..4a6e4c38 100644 --- a/pkg/handlers/artifacts/artifacts_delete_test.go +++ b/pkg/handlers/artifacts/artifacts_delete_test.go @@ -78,7 +78,7 @@ func TestDeleteArtifact(t *testing.T) { log.Info().Interface("namespace", namespaceObj).Msg("namespace created") repositoryServiceFactory := dao.NewRepositoryServiceFactory() repositoryService := repositoryServiceFactory.New(tx) - repositoryObj := &models.Repository{Name: repositoryName, NamespaceID: namespaceObj.ID, Visibility: enums.VisibilityPrivate} + repositoryObj := &models.Repository{Name: repositoryName, NamespaceID: namespaceObj.ID} err = repositoryService.Create(ctx, repositoryObj, dao.AutoCreateNamespace{UserID: userObj.ID}) assert.NoError(t, err) artifactServiceFactory := dao.NewArtifactServiceFactory() diff --git a/pkg/handlers/artifacts/artifacts_get_test.go b/pkg/handlers/artifacts/artifacts_get_test.go index 888e6eaf..7772fb32 100644 --- a/pkg/handlers/artifacts/artifacts_get_test.go +++ b/pkg/handlers/artifacts/artifacts_get_test.go @@ -79,7 +79,7 @@ func TestGetArtifact(t *testing.T) { log.Info().Interface("namespace", namespaceObj).Msg("namespace created") repositoryServiceFactory := dao.NewRepositoryServiceFactory() repositoryService := repositoryServiceFactory.New(tx) - repositoryObj := &models.Repository{Name: namespaceName + "/" + repositoryName, NamespaceID: namespaceObj.ID, Visibility: enums.VisibilityPrivate} + repositoryObj := &models.Repository{Name: namespaceName + "/" + repositoryName, NamespaceID: namespaceObj.ID} err = repositoryService.Create(ctx, repositoryObj, dao.AutoCreateNamespace{UserID: userObj.ID}) assert.NoError(t, err) artifactServiceFactory := dao.NewArtifactServiceFactory() diff --git a/pkg/handlers/artifacts/artifacts_list_test.go b/pkg/handlers/artifacts/artifacts_list_test.go index 8a557880..8925e317 100644 --- a/pkg/handlers/artifacts/artifacts_list_test.go +++ b/pkg/handlers/artifacts/artifacts_list_test.go @@ -81,7 +81,7 @@ func TestListArtifact(t *testing.T) { log.Info().Interface("namespace", namespaceObj).Msg("namespace created") repositoryServiceFactory := dao.NewRepositoryServiceFactory() repositoryService := repositoryServiceFactory.New(tx) - repositoryObj := &models.Repository{Name: namespaceName + "/" + repositoryName, NamespaceID: namespaceObj.ID, Visibility: enums.VisibilityPrivate} + repositoryObj := &models.Repository{Name: namespaceName + "/" + repositoryName, NamespaceID: namespaceObj.ID} err = repositoryService.Create(ctx, repositoryObj, dao.AutoCreateNamespace{UserID: userObj.ID}) assert.NoError(t, err) artifactServiceFactory := dao.NewArtifactServiceFactory() diff --git a/pkg/handlers/distribution/base/repository_list_test.go b/pkg/handlers/distribution/base/repository_list_test.go index 43244685..7d22540e 100644 --- a/pkg/handlers/distribution/base/repository_list_test.go +++ b/pkg/handlers/distribution/base/repository_list_test.go @@ -54,7 +54,7 @@ func TestListRepositories(t *testing.T) { assert.NoError(t, dao.NewUserServiceFactory().New().Create(ctx, userObj)) namespaceObj := &models.Namespace{Name: namespaceName, Visibility: enums.VisibilityPrivate} assert.NoError(t, dao.NewNamespaceServiceFactory().New().Create(ctx, namespaceObj)) - repositoryObj := &models.Repository{Name: repositoryName, NamespaceID: namespaceObj.ID, Visibility: enums.VisibilityPrivate} + repositoryObj := &models.Repository{Name: repositoryName, NamespaceID: namespaceObj.ID} assert.NoError(t, dao.NewRepositoryServiceFactory().New().Create(ctx, repositoryObj, dao.AutoCreateNamespace{UserID: userObj.ID})) artifactObj := &models.Artifact{RepositoryID: repositoryObj.ID, Digest: "sha256:1234567890", Size: 1234, ContentType: "application/octet-stream", Raw: []byte("test"), PushedAt: time.Now()} assert.NoError(t, dao.NewArtifactServiceFactory().New().Create(ctx, artifactObj)) diff --git a/pkg/handlers/distribution/base/tags_list_test.go b/pkg/handlers/distribution/base/tags_list_test.go index cf4418b8..f2c57876 100644 --- a/pkg/handlers/distribution/base/tags_list_test.go +++ b/pkg/handlers/distribution/base/tags_list_test.go @@ -56,7 +56,7 @@ func TestListTags(t *testing.T) { assert.NoError(t, dao.NewNamespaceServiceFactory().New().Create(ctx, namespaceObj)) _, err := dao.NewNamespaceMemberServiceFactory().New().AddNamespaceMember(ctx, userObj.ID, ptr.To(namespaceObj), enums.NamespaceRoleAdmin) assert.NoError(t, err) - repositoryObj := &models.Repository{Name: repositoryName, NamespaceID: namespaceObj.ID, Visibility: enums.VisibilityPrivate} + repositoryObj := &models.Repository{Name: repositoryName, NamespaceID: namespaceObj.ID} assert.NoError(t, dao.NewRepositoryServiceFactory().New().Create(ctx, repositoryObj, dao.AutoCreateNamespace{UserID: userObj.ID})) artifactObj := &models.Artifact{RepositoryID: repositoryObj.ID, Digest: "sha256:1234567890", Size: 1234, ContentType: "application/octet-stream", Raw: []byte("test"), PushedAt: time.Now()} assert.NoError(t, dao.NewArtifactServiceFactory().New().Create(ctx, artifactObj)) diff --git a/pkg/handlers/distribution/manifest/manifest_delete_test.go b/pkg/handlers/distribution/manifest/manifest_delete_test.go index aa9ac67d..29d193cf 100644 --- a/pkg/handlers/distribution/manifest/manifest_delete_test.go +++ b/pkg/handlers/distribution/manifest/manifest_delete_test.go @@ -60,7 +60,7 @@ func TestDeleteManifest(t *testing.T) { namespaceObj := &models.Namespace{Name: namespaceName, Visibility: enums.VisibilityPrivate} assert.NoError(t, dao.NewNamespaceServiceFactory().New().Create(ctx, namespaceObj)) - repositoryObj := &models.Repository{NamespaceID: namespaceObj.ID, Name: repositoryName, Visibility: enums.VisibilityPrivate} + repositoryObj := &models.Repository{NamespaceID: namespaceObj.ID, Name: repositoryName} assert.NoError(t, dao.NewRepositoryServiceFactory().New().Create(ctx, repositoryObj, dao.AutoCreateNamespace{UserID: userObj.ID})) artifactObj := &models.Artifact{RepositoryID: repositoryObj.ID, Digest: digestName, Size: 123, ContentType: "application/vnd.oci.image.manifest.v1+json", Raw: []byte(`{"schemaVersion":2,"config":{"mediaType":"application/vnd.cncf.helm.config.v1+json","digest":"sha256:a61fd63bebd559934a60e30d1e7b832a136ac6bae3a11ca97ade20bfb3645796","size":800},"layers":[{"mediaType":"application/vnd.cncf.helm.chart.content.v1.tar+gzip","digest":"sha256:e45dd3e880e94bdb52cc88d6b4e0fbaec6876856f39a1a89f76e64d0739c2904","size":37869}],"annotations":{"category":"Infrastructure","licenses":"Apache-2.0","org.opencontainers.image.authors":"VMware, Inc.","org.opencontainers.image.description":"NGINX Open Source is a web server that can be also used as a reverse proxy, load balancer, and HTTP cache. Recommended for high-demanding sites due to its ability to provide faster content.","org.opencontainers.image.source":"https://github.com/bitnami/charts/tree/main/bitnami/nginx","org.opencontainers.image.title":"nginx","org.opencontainers.image.url":"https://bitnami.com","org.opencontainers.image.version":"15.0.2"}}`)} diff --git a/pkg/handlers/distribution/manifest/manifest_head_test.go b/pkg/handlers/distribution/manifest/manifest_head_test.go index 4b2f4193..cc8356db 100644 --- a/pkg/handlers/distribution/manifest/manifest_head_test.go +++ b/pkg/handlers/distribution/manifest/manifest_head_test.go @@ -127,7 +127,7 @@ func TestHeadManifest(t *testing.T) { assert.NoError(t, dao.NewUserServiceFactory().New().Create(ctx, userObj)) namespaceObj := &models.Namespace{Name: namespaceName, Visibility: enums.VisibilityPrivate} assert.NoError(t, dao.NewNamespaceServiceFactory().New().Create(ctx, namespaceObj)) - repositoryObj := &models.Repository{NamespaceID: namespaceObj.ID, Name: repositoryName, Visibility: enums.VisibilityPrivate} + repositoryObj := &models.Repository{NamespaceID: namespaceObj.ID, Name: repositoryName} assert.NoError(t, dao.NewRepositoryServiceFactory().New().Create(ctx, repositoryObj, dao.AutoCreateNamespace{UserID: userObj.ID})) artifactObj := &models.Artifact{RepositoryID: repositoryObj.ID, Digest: digestName, Size: 123, ContentType: "application/vnd.oci.image.manifest.v1+json", Raw: []byte(`{"schemaVersion":2,"config":{"mediaType":"application/vnd.cncf.helm.config.v1+json","digest":"sha256:a61fd63bebd559934a60e30d1e7b832a136ac6bae3a11ca97ade20bfb3645796","size":800},"layers":[{"mediaType":"application/vnd.cncf.helm.chart.content.v1.tar+gzip","digest":"sha256:e45dd3e880e94bdb52cc88d6b4e0fbaec6876856f39a1a89f76e64d0739c2904","size":37869}],"annotations":{"category":"Infrastructure","licenses":"Apache-2.0","org.opencontainers.image.authors":"VMware, Inc.","org.opencontainers.image.description":"NGINX Open Source is a web server that can be also used as a reverse proxy, load balancer, and HTTP cache. Recommended for high-demanding sites due to its ability to provide faster content.","org.opencontainers.image.source":"https://github.com/bitnami/charts/tree/main/bitnami/nginx","org.opencontainers.image.title":"nginx","org.opencontainers.image.url":"https://bitnami.com","org.opencontainers.image.version":"15.0.2"}}`)} assert.NoError(t, dao.NewArtifactServiceFactory().New().Create(ctx, artifactObj)) diff --git a/pkg/handlers/distribution/manifest/manifest_put.go b/pkg/handlers/distribution/manifest/manifest_put.go index 1a37df04..95f4d846 100644 --- a/pkg/handlers/distribution/manifest/manifest_put.go +++ b/pkg/handlers/distribution/manifest/manifest_put.go @@ -113,10 +113,7 @@ func (h *handler) PutManifest(c echo.Context) error { refs := h.parseRef(ref) repositoryService := h.repositoryServiceFactory.New() - repositoryObj := &models.Repository{ - Name: repository, - Visibility: enums.VisibilityPrivate, - } + repositoryObj := &models.Repository{Name: repository} err = repositoryService.Create(ctx, repositoryObj, dao.AutoCreateNamespace{ AutoCreate: h.config.Namespace.AutoCreate, Visibility: h.config.Namespace.Visibility, diff --git a/pkg/handlers/distribution/manifest/manifest_put_test.go b/pkg/handlers/distribution/manifest/manifest_put_test.go index 46f2819c..bfec47ff 100644 --- a/pkg/handlers/distribution/manifest/manifest_put_test.go +++ b/pkg/handlers/distribution/manifest/manifest_put_test.go @@ -104,7 +104,7 @@ func TestPutManifest(t *testing.T) { namespaceObj := &models.Namespace{Name: namespaceName, Visibility: enums.VisibilityPrivate} assert.NoError(t, dao.NewNamespaceServiceFactory().New().Create(ctx, namespaceObj)) - repositoryObj := &models.Repository{NamespaceID: namespaceObj.ID, Name: repositoryName, Visibility: enums.VisibilityPrivate} + repositoryObj := &models.Repository{NamespaceID: namespaceObj.ID, Name: repositoryName} assert.NoError(t, dao.NewRepositoryServiceFactory().New().Create(ctx, repositoryObj, dao.AutoCreateNamespace{AutoCreate: false, Visibility: enums.VisibilityPrivate, UserID: userObj.ID})) blobService := dao.NewBlobServiceFactory().New() diff --git a/pkg/handlers/repositories/repositories_create.go b/pkg/handlers/repositories/repositories_create.go index 2ef09cb2..24a01323 100644 --- a/pkg/handlers/repositories/repositories_create.go +++ b/pkg/handlers/repositories/repositories_create.go @@ -90,7 +90,6 @@ func (h *handler) CreateRepository(c echo.Context) error { Name: req.Name, Description: req.Description, Overview: []byte(ptr.To(req.Overview)), - Visibility: ptr.To(req.Visibility), TagLimit: ptr.To(req.TagLimit), SizeLimit: ptr.To(req.SizeLimit), } diff --git a/pkg/handlers/repositories/repositories_get.go b/pkg/handlers/repositories/repositories_get.go index e159c5f2..c2c8cf1e 100644 --- a/pkg/handlers/repositories/repositories_get.go +++ b/pkg/handlers/repositories/repositories_get.go @@ -138,7 +138,6 @@ func (h *handler) GetRepository(c echo.Context) error { Name: repositoryObj.Name, Description: repositoryObj.Description, Overview: ptr.Of(string(repositoryObj.Overview)), - Visibility: repositoryObj.Visibility, SizeLimit: ptr.Of(repositoryObj.SizeLimit), Size: ptr.Of(repositoryObj.Size), TagCount: repositoryObj.TagCount, diff --git a/pkg/handlers/repositories/repositories_list.go b/pkg/handlers/repositories/repositories_list.go index 13c22b91..d76d352a 100644 --- a/pkg/handlers/repositories/repositories_list.go +++ b/pkg/handlers/repositories/repositories_list.go @@ -112,7 +112,6 @@ func (h *handler) ListRepositories(c echo.Context) error { Name: repository.Name, Description: repository.Description, Overview: ptr.Of(string(repository.Overview)), - Visibility: repository.Visibility, SizeLimit: ptr.Of(repository.SizeLimit), Size: ptr.Of(repository.Size), TagCount: repository.TagCount, diff --git a/web/package.json b/web/package.json index 0d61f34c..5f79d288 100644 --- a/web/package.json +++ b/web/package.json @@ -30,19 +30,19 @@ "monaco-editor": "^0.44.0", "react": "^18.2.0", "react-dom": "^18.2.0", - "react-helmet-async": "^1.3.0", + "react-helmet-async": "^2.0.1", "react-hot-toast": "^2.4.1", "react-icons": "^4.12.0", "react-router-dom": "^6.20.0", "react-toastify": "^9.1.3", - "react-use": "^17.4.0", + "react-use": "^17.4.1", "xterm": "^5.3.0", "xterm-addon-attach": "^0.9.0", "xterm-addon-fit": "^0.8.0" }, "devDependencies": { - "@types/node": "^20.9.5", - "@types/react": "^18.2.38", + "@types/node": "^20.10.0", + "@types/react": "^18.2.39", "@types/react-dom": "^18.2.17", "@vitejs/plugin-react-swc": "^3.5.0", "autoprefixer": "^10.4.16", @@ -51,7 +51,7 @@ "postcss": "^8.4.31", "tailwindcss": "^3.3.5", "typescript": "^5.3.2", - "vite": "^5.0.2" + "vite": "^5.0.3" }, "packageManager": "yarn@4.0.2" } diff --git a/web/src/interfaces/index.ts b/web/src/interfaces/index.ts index 44183266..903e3b42 100644 --- a/web/src/interfaces/index.ts +++ b/web/src/interfaces/index.ts @@ -89,7 +89,6 @@ export interface IRepositoryItem { name: string; description: string; overview: string; - visibility: string; tag_count: number; tag_limit: number; size_limit: number; diff --git a/web/src/pages/Repository/index.tsx b/web/src/pages/Repository/index.tsx index 2fcbac4e..bbb49966 100644 --- a/web/src/pages/Repository/index.tsx +++ b/web/src/pages/Repository/index.tsx @@ -80,7 +80,6 @@ export default function ({ localServer }: { localServer: string }) { break; } }, [sizeLimit, sizeLimitUnit]); - const [repositoryVisibility, setRepositoryVisibility] = useState("private"); const [createRepositoryModal, setCreateRepositoryModal] = useState(false); const createRepository = () => { @@ -94,12 +93,10 @@ export default function ({ localServer }: { localServer: string }) { description: descriptionText, size_limit: realSizeLimit, tag_limit: tagCountLimit, - visibility: repositoryVisibility, } as IRepositoryItem, {}).then(response => { if (response.status === 201) { setRepositoryText(""); setDescriptionText(""); - setRepositoryVisibility("private") setTagCountLimit(0); setSizeLimit(0); setRefresh({}); @@ -280,9 +277,6 @@ export default function ({ localServer }: { localServer: string }) { setSortName("tag_count"); }} /> - - Visibility - { resetOrder(); @@ -420,21 +414,6 @@ export default function ({ localServer }: { localServer: string }) { ) }

- -
- -
@@ -575,7 +554,6 @@ function TableItem({ localServer, index, namespace, repository, setRefresh }: { break; } }, [sizeLimit, sizeLimitUnit]); - const [repositoryVisibility, setRepositoryVisibility] = useState("private"); const [updateRepositoryModal, setUpdateRepositoryModal] = useState(false); const updateRepository = () => { @@ -588,7 +566,6 @@ function TableItem({ localServer, index, namespace, repository, setRefresh }: { description: descriptionText, size_limit: realSizeLimit, tag_limit: tagCountLimit, - visibility: repositoryVisibility, } as IRepositoryItem, {}).then(response => { if (response.status === 204) { setRefresh({}); @@ -636,9 +613,6 @@ function TableItem({ localServer, index, namespace, repository, setRefresh }: { - - {repository.visibility} - {dayjs.utc(repository.created_at).tz(dayjs.tz.guess()).format("YYYY-MM-DD HH:mm:ss")} @@ -792,21 +766,6 @@ function TableItem({ localServer, index, namespace, repository, setRefresh }: { ) }

- -
- -
diff --git a/web/yarn.lock b/web/yarn.lock index e125a7dc..6200185b 100644 --- a/web/yarn.lock +++ b/web/yarn.lock @@ -12,7 +12,7 @@ __metadata: languageName: node linkType: hard -"@babel/runtime@npm:^7.1.2, @babel/runtime@npm:^7.12.5": +"@babel/runtime@npm:^7.1.2": version: 7.23.4 resolution: "@babel/runtime@npm:7.23.4" dependencies: @@ -695,7 +695,7 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:^20.9.5": +"@types/node@npm:^20.10.0": version: 20.10.0 resolution: "@types/node@npm:20.10.0" dependencies: @@ -727,7 +727,7 @@ __metadata: languageName: node linkType: hard -"@types/react@npm:*, @types/react@npm:^18.2.38": +"@types/react@npm:*": version: 18.2.38 resolution: "@types/react@npm:18.2.38" dependencies: @@ -738,6 +738,17 @@ __metadata: languageName: node linkType: hard +"@types/react@npm:^18.2.39": + version: 18.2.39 + resolution: "@types/react@npm:18.2.39" + dependencies: + "@types/prop-types": "npm:*" + "@types/scheduler": "npm:*" + csstype: "npm:^3.0.2" + checksum: e91a5419d7615ab4fcaa7cb3ad2bd372093676e86c082748ab36ac394d3ed560070482d092a5488f74d6b1d913369e4dabf6eb287debed4d70cd3eb7dc135542 + languageName: node + linkType: hard + "@types/scheduler@npm:*": version: 0.16.8 resolution: "@types/scheduler@npm:0.16.8" @@ -2791,7 +2802,7 @@ __metadata: languageName: node linkType: hard -"loose-envify@npm:^1.0.0, loose-envify@npm:^1.1.0, loose-envify@npm:^1.4.0": +"loose-envify@npm:^1.0.0, loose-envify@npm:^1.1.0": version: 1.4.0 resolution: "loose-envify@npm:1.4.0" dependencies: @@ -3632,9 +3643,9 @@ __metadata: languageName: node linkType: hard -"nano-css@npm:^5.3.1": - version: 5.6.0 - resolution: "nano-css@npm:5.6.0" +"nano-css@npm:^5.6.1": + version: 5.6.1 + resolution: "nano-css@npm:5.6.1" dependencies: "@jridgewell/sourcemap-codec": "npm:^1.4.15" css-tree: "npm:^1.1.2" @@ -3647,7 +3658,7 @@ __metadata: peerDependencies: react: "*" react-dom: "*" - checksum: 0d18e73520970f9e348792d07e419f6d6406655ff1b12a7bfed98654970b46258ec7bb3df44047160f36215a639421ecc0e7566d522a70b7ace766bff4812228 + checksum: 7328c973852d2471bd154c61d21392a3d6357f276a7a090b8a179fb06d71ba58c987b04c0bd80efebd87aa4f433428a25e37820e65484b3c4c44b84339b99d87 languageName: node linkType: hard @@ -3728,7 +3739,7 @@ __metadata: languageName: node linkType: hard -"object-assign@npm:^4, object-assign@npm:^4.0.1, object-assign@npm:^4.1.1": +"object-assign@npm:^4, object-assign@npm:^4.0.1": version: 4.1.1 resolution: "object-assign@npm:4.1.1" checksum: 1f4df9945120325d041ccf7b86f31e8bcc14e73d29171e37a7903050e96b81323784ec59f93f102ec635bcf6fa8034ba3ea0a8c7e69fa202b87ae3b6cec5a414 @@ -4316,17 +4327,6 @@ __metadata: languageName: node linkType: hard -"prop-types@npm:^15.7.2": - version: 15.8.1 - resolution: "prop-types@npm:15.8.1" - dependencies: - loose-envify: "npm:^1.4.0" - object-assign: "npm:^4.1.1" - react-is: "npm:^16.13.1" - checksum: 59ece7ca2fb9838031d73a48d4becb9a7cc1ed10e610517c7d8f19a1e02fa47f7c27d557d8a5702bec3cfeccddc853579832b43f449e54635803f277b1c78077 - languageName: node - linkType: hard - "property-information@npm:^6.0.0": version: 6.4.0 resolution: "property-information@npm:6.4.0" @@ -4410,26 +4410,24 @@ __metadata: languageName: node linkType: hard -"react-fast-compare@npm:^3.2.0": +"react-fast-compare@npm:^3.2.2": version: 3.2.2 resolution: "react-fast-compare@npm:3.2.2" checksum: 0bbd2f3eb41ab2ff7380daaa55105db698d965c396df73e6874831dbafec8c4b5b08ba36ff09df01526caa3c61595247e3269558c284e37646241cba2b90a367 languageName: node linkType: hard -"react-helmet-async@npm:^1.3.0": - version: 1.3.0 - resolution: "react-helmet-async@npm:1.3.0" +"react-helmet-async@npm:^2.0.1": + version: 2.0.1 + resolution: "react-helmet-async@npm:2.0.1" dependencies: - "@babel/runtime": "npm:^7.12.5" invariant: "npm:^2.2.4" - prop-types: "npm:^15.7.2" - react-fast-compare: "npm:^3.2.0" + react-fast-compare: "npm:^3.2.2" shallowequal: "npm:^1.1.0" peerDependencies: react: ^16.6.0 || ^17.0.0 || ^18.0.0 react-dom: ^16.6.0 || ^17.0.0 || ^18.0.0 - checksum: 8f3e6d26beff61d2ed18f7b41561df3e4d83a7582914c7196aa65158c7f3cce939276547d7a0b8987952d9d44131406df74efba02d1f8fa8a3940b49e6ced70b + checksum: f1fec97ae4d8d37fc040446adc473c26422b32fa9c73efa5ac6cb234090d1b51b33c603fefa6ec21332b3277f544235d56f2567c65afe1d349fc784fd3d99cd7 languageName: node linkType: hard @@ -4454,13 +4452,6 @@ __metadata: languageName: node linkType: hard -"react-is@npm:^16.13.1": - version: 16.13.1 - resolution: "react-is@npm:16.13.1" - checksum: 33977da7a5f1a287936a0c85639fec6ca74f4f15ef1e59a6bc20338fc73dc69555381e211f7a3529b8150a1f71e4225525b41b60b52965bda53ce7d47377ada1 - languageName: node - linkType: hard - "react-router-dom@npm:^6.20.0": version: 6.20.0 resolution: "react-router-dom@npm:6.20.0" @@ -4507,9 +4498,9 @@ __metadata: languageName: node linkType: hard -"react-use@npm:^17.4.0": - version: 17.4.0 - resolution: "react-use@npm:17.4.0" +"react-use@npm:^17.4.1": + version: 17.4.1 + resolution: "react-use@npm:17.4.1" dependencies: "@types/js-cookie": "npm:^2.2.6" "@xobotyi/scrollbar-width": "npm:^1.9.5" @@ -4517,7 +4508,7 @@ __metadata: fast-deep-equal: "npm:^3.1.3" fast-shallow-equal: "npm:^1.0.0" js-cookie: "npm:^2.2.1" - nano-css: "npm:^5.3.1" + nano-css: "npm:^5.6.1" react-universal-interface: "npm:^0.6.2" resize-observer-polyfill: "npm:^1.5.1" screenfull: "npm:^5.1.0" @@ -4528,7 +4519,7 @@ __metadata: peerDependencies: react: ^16.8.0 || ^17.0.0 || ^18.0.0 react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 - checksum: 9f9a56a5dbeb707186d470882a17d22e4d0845e7d77b576f4f23f07e7bc60600c7ca14bef33d62d0607f0a7ce18b465807cc9a120bdb75486985afc57d45da19 + checksum: 5d71ece2140be93ae5f391a3affca40f8618432d22b8beb1380e82cab730f028b8596497e9af653d346ac88be7e21d3a6476b9dbf00a60c6acf119a089a481ce languageName: node linkType: hard @@ -4940,8 +4931,8 @@ __metadata: "@tailwindcss/forms": "npm:^0.5.7" "@tailwindcss/line-clamp": "npm:^0.4.4" "@tailwindcss/typography": "npm:^0.5.10" - "@types/node": "npm:^20.9.5" - "@types/react": "npm:^18.2.38" + "@types/node": "npm:^20.10.0" + "@types/react": "npm:^18.2.39" "@types/react-dom": "npm:^18.2.17" "@vitejs/plugin-react-swc": "npm:^3.5.0" autoprefixer: "npm:^10.4.16" @@ -4960,15 +4951,15 @@ __metadata: postcss: "npm:^8.4.31" react: "npm:^18.2.0" react-dom: "npm:^18.2.0" - react-helmet-async: "npm:^1.3.0" + react-helmet-async: "npm:^2.0.1" react-hot-toast: "npm:^2.4.1" react-icons: "npm:^4.12.0" react-router-dom: "npm:^6.20.0" react-toastify: "npm:^9.1.3" - react-use: "npm:^17.4.0" + react-use: "npm:^17.4.1" tailwindcss: "npm:^3.3.5" typescript: "npm:^5.3.2" - vite: "npm:^5.0.2" + vite: "npm:^5.0.3" xterm: "npm:^5.3.0" xterm-addon-attach: "npm:^0.9.0" xterm-addon-fit: "npm:^0.8.0" @@ -5579,9 +5570,9 @@ __metadata: languageName: node linkType: hard -"vite@npm:^5.0.2": - version: 5.0.2 - resolution: "vite@npm:5.0.2" +"vite@npm:^5.0.3": + version: 5.0.3 + resolution: "vite@npm:5.0.3" dependencies: esbuild: "npm:^0.19.3" fsevents: "npm:~2.3.3" @@ -5615,7 +5606,7 @@ __metadata: optional: true bin: vite: bin/vite.js - checksum: e596706cd3775e2300552364844b07024b5455eac03c822d681416dd981439176c397714c4ae91576d3641f812032488bd0e7ebdda50a7e776457a1a05c80db3 + checksum: 3864b73586feb66abdc10e9fb21521a1c4ead9513a0b126cad3d59672e62687844ac60c087f61da82423ac3724b6254e0729c35d03840619b2a7d4a0a5cc0bff languageName: node linkType: hard