Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package registry: add description from UI #20628

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

simmstein
Copy link

@simmstein simmstein commented Aug 2, 2022

This PR fix #20604

  • The package has 2 new columns: description and readme
  • Settings contains 2 new fields dedicated to the description (plain text) and the readme (markdown)
  • Package page contains the description below the package name and the readme below the installation guide
  • The packages list show descriptions below each package title

@a1012112796 a1012112796 added the type/feature Completely new functionality. Can only be merged if feature freeze is not active. label Aug 2, 2022
@simmstein simmstein changed the title WIP: Package registry: add description from UI Package registry: add description from UI Aug 2, 2022
@KN4CK3R
Copy link
Member

KN4CK3R commented Aug 2, 2022

Some package types already contain a readme. (Pub (#20560), npm, PyPI)

All package types (except generic) have at minimum a description field which can be provided by the package. For your Docker case you can set the description with LABEL org.opencontainers.image.description=Your description of the image. So I don't think your description field is needed.

And keep in mind the readme may change from version to version. So it may be wrong to have the readme at the package level.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Aug 2, 2022
@simmstein
Copy link
Author

The built-in package description is mainly interesting when you use the package search system. The proposed description is supposed to describe the package inside gitea.
Like docker hub, the readme is a global description which does not depend of the shown version.
This proposal unifies the way to manage descriptions of all packages 📦

@lafriks lafriks added this to the 1.18.0 milestone Aug 6, 2022
@lunny lunny modified the milestones: 1.18.0, 1.19.0 Oct 19, 2022
@jolheiser jolheiser modified the milestones: 1.19.0, 1.20.0 Jan 31, 2023
@wxiaoguang
Copy link
Contributor

Could there be a conclusion from maintainers: go or no-go?

@wxiaoguang wxiaoguang added the issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail label May 10, 2023
@lafriks
Copy link
Member

lafriks commented May 10, 2023

Feature-wise I think it's good

@wxiaoguang
Copy link
Contributor

@KN4CK3R has your concern been addressed?

Copy link
Member

@techknowlogick techknowlogick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR! A few notes in terms of the code, although of course pending @KN4CK3R's feedback too.

@@ -130,6 +130,8 @@ type Package struct {
Name string `xorm:"NOT NULL"`
LowerName string `xorm:"UNIQUE(s) INDEX NOT NULL"`
SemverCompatible bool `xorm:"NOT NULL DEFAULT false"`
Description string `xorm:"VARCHAR(255)"`
Readme string `xorm:"LONGBLOB"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe TEXT is more suitable for this column, as xorm should translate it into the appropriate type for each database

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LONGTEXT (for MySQL)

@@ -0,0 +1,31 @@
import $ from 'jquery';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linting rules should prevent the addition of new jQuery code, could you utilize vanilla JS instead?

Cc: @silverwind who has more insight into linting

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no linting for it, I don't think it's possible for the linter to distinguish old and new code. But yes, new code should prefer not to use jQuery, we want to eventually remove it.

@@ -0,0 +1,18 @@
// Copyright 2022 The Gitea Authors. All rights reserved.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you move this migration into a versioned directory?
Also, could you update the copyright heading to match the new format?

Comment on lines +2827 to +2833
settings.descriptions.success = Les descriptifs ont été mises à jour
settings.descriptions.error = Échec de la mise à jour des descriptifs
settings.descriptions = Descriptifs
settings.description.description = Description
settings.readme.description = Readme
settings.descriptions.button = Mettre à jour les descriptifs
readme = Readme
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be overridden by the CI again

@@ -130,6 +130,8 @@ type Package struct {
Name string `xorm:"NOT NULL"`
LowerName string `xorm:"UNIQUE(s) INDEX NOT NULL"`
SemverCompatible bool `xorm:"NOT NULL DEFAULT false"`
Description string `xorm:"VARCHAR(255)"`
Readme string `xorm:"LONGBLOB"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not LONGTEXT?

models/migrations/v224.go Outdated Show resolved Hide resolved
@@ -414,7 +414,7 @@ var migrations = []Migration{
// v222 -> v223
NewMigration("Drop old CredentialID column", v1_17.DropOldCredentialIDColumn),
// v223 -> v224
NewMigration("Rename CredentialIDBytes column to CredentialID", v1_17.RenameCredentialIDBytes),
NewMigration("Rename CredentialIDBytes column to CredentialID", renameCredentialIDBytes),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is absolutely outdated by now as @techknowlogick mentioned in https://github.com/go-gitea/gitea/pull/20628/files#r1194390383

@@ -22,6 +22,8 @@
</div>
</div>

{{template "package/content/readme" .}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few more registries have been merged in the mean time.
Those should get this call too.

Comment on lines +6 to +8
const $tabMenu = $form.find('.tabular.menu');
$tabMenu.find('.item').tab();
$tabMenu.find(`.item[data-tab="${$tabMenu.data('preview')}"]`).on('click', function () {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This selector looks really fragile.
Please create a specific class instead and query for that class.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's just the old code, after the "editor" refactoring, no such code is needed.

Actually, this PR has been stale for too long time, I guess the author might have lost interest on it?

If it is still stale and inactive, it needs the maintainers who have writer permission to help.

routers/web/user/package.go Outdated Show resolved Hide resolved
@KN4CK3R
Copy link
Member

KN4CK3R commented May 21, 2023

@KN4CK3R has your concern been addressed?

I'm still not sure if we should have the readme part because some packages already provide a readme and then there would be two readmes shown.

We could store the provided readme in the new readme field, but the provided readme may be version dependend. I don't know if thats really a problem. It may be needed to set/update the readme and description fields from the package metadata (which may again be version dependend).

Github simply shows the README.md file if the package is linked to a (git) repository (similar to the profile readme feature).

@wxiaoguang
Copy link
Contributor

wxiaoguang commented May 21, 2023

Then maybe it (this PR's proposal) needs some real cases for why a separate (non-package) README is needed, to see whether the separate README would be widely used and really needed.

@lunny
Copy link
Member

lunny commented May 22, 2023

Maybe it's like repository which has both description and README.md?

@simmstein
Copy link
Author

As I said the built-in package description is mainly interesting when you use the package search system. The proposed description is supposed to describe the package inside gitea.
Like docker hub, the readme is a global description which does not depend of the shown version.
This proposal unifies the way to manage descriptions of all packages package: a description shown in list, a readme/bigger description wrote in markdown to get more information (eg: overview of https://hub.docker.com/_/ubuntu).

Co-authored-by: delvh <dev.lh@web.de>
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label May 22, 2023
Co-authored-by: delvh <dev.lh@web.de>
@delvh delvh removed this from the 1.20.0 milestone Jun 4, 2023
@ravensorb
Copy link

Would it make sense to consider using the OCI annotation for docmentation -- org.opencontainers.image.documentation then it could be condition (display if the field is provided, don't if it is not)

ref: https://github.com/opencontainers/image-spec/blob/main/annotations.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. topic/packages type/feature Completely new functionality. Can only be merged if feature freeze is not active.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Package registry: add description from UI