// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn . package iplibrary import ( "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" ) type UpdatePublicAction struct { actionutils.ParentAction } func (this *UpdatePublicAction) RunPost(params struct { ArtifactId int64 IsPublic bool }) { if params.IsPublic { defer this.CreateLogInfo(codes.IPLibraryArtifact_LogUseIPLibraryArtifact, params.ArtifactId) } else { defer this.CreateLogInfo(codes.IPLibraryArtifact_LogCancelIPLibraryArtifact, params.ArtifactId) } _, err := this.RPC().IPLibraryArtifactRPC().UpdateIPLibraryArtifactIsPublic(this.AdminContext(), &pb.UpdateIPLibraryArtifactIsPublicRequest{ IpLibraryArtifactId: params.ArtifactId, IsPublic: params.IsPublic, }) if err != nil { this.ErrorPage(err) return } this.Success() }