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"); }} /> -