mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-25 06:25:31 +00:00
Merge pull request 'templates: Be more forgiving about missing package metadata' (#3701) from algernon/forgejo:missing-metadata-makes-me-mumble-murky-messages into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3701 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
This commit is contained in:
commit
cf0e451ef4
|
@ -23,49 +23,53 @@
|
||||||
</snapshotRepository>
|
</snapshotRepository>
|
||||||
</distributionManagement></code></pre></div>
|
</distributionManagement></code></pre></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
{{if .PackageDescriptor.Metadata}}
|
||||||
<label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.maven.install"}}</label>
|
<div class="field">
|
||||||
<div class="markup"><pre class="code-block"><code><dependency>
|
<label>{{svg "octicon-code"}} {{ctx.Locale.Tr "packages.maven.install"}}</label>
|
||||||
|
<div class="markup"><pre class="code-block"><code><dependency>
|
||||||
<groupId>{{.PackageDescriptor.Metadata.GroupID}}</groupId>
|
<groupId>{{.PackageDescriptor.Metadata.GroupID}}</groupId>
|
||||||
<artifactId>{{.PackageDescriptor.Metadata.ArtifactID}}</artifactId>
|
<artifactId>{{.PackageDescriptor.Metadata.ArtifactID}}</artifactId>
|
||||||
<version>{{.PackageDescriptor.Version.Version}}</version>
|
<version>{{.PackageDescriptor.Version.Version}}</version>
|
||||||
</dependency></code></pre></div>
|
</dependency></code></pre></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.maven.install2"}}</label>
|
<label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.maven.install2"}}</label>
|
||||||
<div class="markup"><pre class="code-block"><code>mvn install</code></pre></div>
|
<div class="markup"><pre class="code-block"><code>mvn install</code></pre></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.maven.download"}}</label>
|
<label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.maven.download"}}</label>
|
||||||
<div class="markup"><pre class="code-block"><code>mvn dependency:get -DremoteRepositories=<origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/maven"></origin-url> -Dartifact={{.PackageDescriptor.Metadata.GroupID}}:{{.PackageDescriptor.Metadata.ArtifactID}}:{{.PackageDescriptor.Version.Version}}</code></pre></div>
|
<div class="markup"><pre class="code-block"><code>mvn dependency:get -DremoteRepositories=<origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/maven"></origin-url> -Dartifact={{.PackageDescriptor.Metadata.GroupID}}:{{.PackageDescriptor.Metadata.ArtifactID}}:{{.PackageDescriptor.Version.Version}}</code></pre></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label>{{ctx.Locale.Tr "packages.registry.documentation" "Maven" "https://forgejo.org/docs/latest/user/packages/maven/"}}</label>
|
<label>{{ctx.Locale.Tr "packages.registry.documentation" "Maven" "https://forgejo.org/docs/latest/user/packages/maven/"}}</label>
|
||||||
</div>
|
</div>
|
||||||
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{if .PackageDescriptor.Metadata.Description}}
|
{{if .PackageDescriptor.Metadata}}
|
||||||
<h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4>
|
{{if .PackageDescriptor.Metadata.Description}}
|
||||||
<div class="ui attached segment">
|
<h4 class="ui top attached header">{{ctx.Locale.Tr "packages.about"}}</h4>
|
||||||
{{.PackageDescriptor.Metadata.Description}}
|
<div class="ui attached segment">
|
||||||
</div>
|
{{.PackageDescriptor.Metadata.Description}}
|
||||||
{{end}}
|
|
||||||
|
|
||||||
{{if .PackageDescriptor.Metadata.Dependencies}}
|
|
||||||
<h4 class="ui top attached header">{{ctx.Locale.Tr "packages.dependencies"}}</h4>
|
|
||||||
<div class="ui attached segment">
|
|
||||||
<div class="ui list">
|
|
||||||
{{range .PackageDescriptor.Metadata.Dependencies}}
|
|
||||||
<div class="item">
|
|
||||||
<i class="icon">{{svg "octicon-package-dependencies" 16 ""}}</i>
|
|
||||||
<div class="content">
|
|
||||||
<div class="header">{{.GroupID}}:{{.ArtifactID}}</div>
|
|
||||||
<div class="description text small">{{.Version}}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{end}}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{{end}}
|
||||||
|
|
||||||
|
{{if .PackageDescriptor.Metadata.Dependencies}}
|
||||||
|
<h4 class="ui top attached header">{{ctx.Locale.Tr "packages.dependencies"}}</h4>
|
||||||
|
<div class="ui attached segment">
|
||||||
|
<div class="ui list">
|
||||||
|
{{range .PackageDescriptor.Metadata.Dependencies}}
|
||||||
|
<div class="item">
|
||||||
|
<i class="icon">{{svg "octicon-package-dependencies" 16 ""}}</i>
|
||||||
|
<div class="content">
|
||||||
|
<div class="header">{{.GroupID}}:{{.ArtifactID}}</div>
|
||||||
|
<div class="description text small">{{.Version}}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{{if eq .PackageDescriptor.Package.Type "maven"}}
|
{{if and (eq .PackageDescriptor.Package.Type "maven") .PackageDescriptor.Metadata}}
|
||||||
{{if .PackageDescriptor.Metadata.Name}}<div class="item">{{svg "octicon-note" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.Name}}</div>{{end}}
|
{{if .PackageDescriptor.Metadata.Name}}<div class="item">{{svg "octicon-note" 16 "tw-mr-2"}} {{.PackageDescriptor.Metadata.Name}}</div>{{end}}
|
||||||
{{if .PackageDescriptor.Metadata.ProjectURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.ProjectURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.project_site"}}</a></div>{{end}}
|
{{if .PackageDescriptor.Metadata.ProjectURL}}<div class="item">{{svg "octicon-link-external" 16 "tw-mr-2"}} <a href="{{.PackageDescriptor.Metadata.ProjectURL}}" target="_blank" rel="noopener noreferrer me">{{ctx.Locale.Tr "packages.details.project_site"}}</a></div>{{end}}
|
||||||
{{range .PackageDescriptor.Metadata.Licenses}}<div class="item" title="{{ctx.Locale.Tr "packages.details.license"}}">{{svg "octicon-law" 16 "tw-mr-2"}} {{.}}</div>{{end}}
|
{{range .PackageDescriptor.Metadata.Licenses}}<div class="item" title="{{ctx.Locale.Tr "packages.details.license"}}">{{svg "octicon-law" 16 "tw-mr-2"}} {{.}}</div>{{end}}
|
||||||
|
|
|
@ -241,4 +241,15 @@ func TestPackageMaven(t *testing.T) {
|
||||||
putFile(t, fmt.Sprintf("/%s/maven-metadata.xml", snapshotVersion), "test", http.StatusCreated)
|
putFile(t, fmt.Sprintf("/%s/maven-metadata.xml", snapshotVersion), "test", http.StatusCreated)
|
||||||
putFile(t, fmt.Sprintf("/%s/maven-metadata.xml", snapshotVersion), "test-overwrite", http.StatusCreated)
|
putFile(t, fmt.Sprintf("/%s/maven-metadata.xml", snapshotVersion), "test-overwrite", http.StatusCreated)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
t.Run("Partial upload", func(t *testing.T) {
|
||||||
|
defer tests.PrintCurrentTest(t)()
|
||||||
|
|
||||||
|
partialVersion := packageVersion + "-PARTIAL"
|
||||||
|
putFile(t, fmt.Sprintf("/%s/%s", partialVersion, filename), "test", http.StatusCreated)
|
||||||
|
pkgUIURL := fmt.Sprintf("/%s/-/packages/maven/%s-%s/%s", user.Name, groupID, artifactID, partialVersion)
|
||||||
|
req := NewRequest(t, "GET", pkgUIURL)
|
||||||
|
resp := MakeRequest(t, req, http.StatusOK)
|
||||||
|
assert.NotContains(t, resp.Body.String(), "Internal server error")
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue