summaryrefslogtreecommitdiffstats
path: root/templates/repo/settings
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2019-10-28 18:31:55 +0000
committerGitHub <noreply@github.com>2019-10-28 18:31:55 +0000
commit5e6a008fba9a85c9a5319d93c1e52e183211a342 (patch)
tree1da9197537ea37a338838b52e479697f44a046ea /templates/repo/settings
parentaf8957bc4ce78613fe03cb1abc6c961dd67ff344 (diff)
downloadgitea-5e6a008fba9a85c9a5319d93c1e52e183211a342.tar.gz
gitea-5e6a008fba9a85c9a5319d93c1e52e183211a342.zip
Add basic repository lfs management (#7199)
This PR adds basic repository LFS management UI including the ability to find all possible pointers within the repository. Locks are not managed at present but would be addable through some simple additions. * Add basic repository lfs management * add auto-associate function * Add functionality to find commits with this lfs file * Add link to find commits on the lfs file view * Adjust commit view to state the likely branch causing the commit * Only read Oid from database
Diffstat (limited to 'templates/repo/settings')
-rw-r--r--templates/repo/settings/lfs.tmpl62
-rw-r--r--templates/repo/settings/lfs_file.tmpl57
-rw-r--r--templates/repo/settings/lfs_file_find.tmpl52
-rw-r--r--templates/repo/settings/lfs_pointers.tmpl71
-rw-r--r--templates/repo/settings/navbar.tmpl5
5 files changed, 247 insertions, 0 deletions
diff --git a/templates/repo/settings/lfs.tmpl b/templates/repo/settings/lfs.tmpl
new file mode 100644
index 0000000000..e4480a8b97
--- /dev/null
+++ b/templates/repo/settings/lfs.tmpl
@@ -0,0 +1,62 @@
+{{template "base/head" .}}
+<div class="repository settings lfs">
+ {{template "repo/header" .}}
+ {{template "repo/settings/navbar" .}}
+ <div class="ui container">
+ {{template "base/alert" .}}
+ <h4 class="ui top attached header">
+ {{.i18n.Tr "repo.settings.lfs_filelist"}}
+ <div class="ui right">
+ <a class="ui blue tiny show-panel button" href="{{.Link}}/pointers">{{.i18n.Tr "repo.settings.lfs_findpointerfiles"}}</a>
+ </div>
+ </h4>
+ <table id="lfs-files-table" class="ui attached segment single line table">
+ <tbody>
+ {{range .LFSFiles}}
+ <tr>
+ <td>
+ <span class="text sha label">
+ <a href="{{$.Link}}/show/{{.Oid}}" title="{{.Oid}}" class="ui detail icon button brown truncate">
+ {{ShortSha .Oid}}
+ </a>
+ </span>
+ </td>
+ <td>{{FileSize .Size}}</td>
+ <td>{{TimeSince .CreatedUnix.AsTime $.Lang}}</td>
+ <td class="right aligned">
+ <a class="ui blue show-panel button" href="{{$.Link}}/find?oid={{.Oid}}&size={{.Size}}">{{$.i18n.Tr "repo.settings.lfs_findcommits"}}</a>
+ <button class="ui basic show-modal icon button" data-modal="#delete-{{.Oid}}">
+ <i class="octicon octicon-trashcan btn-octicon btn-octicon-danger poping up" data-content="{{$.i18n.Tr "repo.editor.delete_this_file"}}" data-position="bottom center" data-variation="tiny inverted"></i>
+ </button>
+ </td>
+ </tr>
+ {{else}}
+ <tr>
+ <td colspan="4">{{.i18n.Tr "repo.settings.lfs_no_lfs_files"}}</td>
+ </tr>
+ {{end}}
+ </tbody>
+ </table>
+ {{template "base/paginate" .}}
+ {{range .LFSFiles}}
+ <div class="ui basic modal" id="delete-{{.Oid}}">
+ <div class="ui icon header">
+ {{$.i18n.Tr "repo.settings.lfs_delete" .Oid}}
+ </div>
+ <div class="content center">
+ <p>
+ {{$.i18n.Tr "repo.settings.lfs_delete_warning"}}
+ </p>
+ <form class="ui form" action="{{$.Link}}/delete/{{.Oid}}" method="post">
+ {{$.CsrfTokenHtml}}
+ <div class="center actions">
+ <div class="ui basic cancel inverted button">{{$.i18n.Tr "settings.cancel"}}</div>
+ <button class="ui basic inverted yellow button">{{$.i18n.Tr "modal.yes"}}</button>
+ </div>
+ </form>
+ </div>
+ </div>
+ {{end}}
+ </div>
+</div>
+{{template "base/footer" .}}
diff --git a/templates/repo/settings/lfs_file.tmpl b/templates/repo/settings/lfs_file.tmpl
new file mode 100644
index 0000000000..6283548eaa
--- /dev/null
+++ b/templates/repo/settings/lfs_file.tmpl
@@ -0,0 +1,57 @@
+{{template "base/head" .}}
+<div class="repository settings lfs">
+ {{template "repo/header" .}}
+ {{template "repo/settings/navbar" .}}
+ <div class="ui container repository file list">
+ {{template "base/alert" .}}
+ <div class="tab-size-8 non-diff-file-content">
+ <h4 class="ui top attached header">
+ <a href="{{.LFSFilesLink}}">{{.i18n.Tr "repo.settings.lfs"}}</a> / <span class="truncate sha">{{.LFSFile.Oid}}</span>
+ <div class="ui right">
+ <a class="ui blue show-panel button" href="{{.LFSFilesLink}}/find?oid={{.LFSFile.Oid}}&size={{.LFSFile.Size}}">{{$.i18n.Tr "repo.settings.lfs_findcommits"}}</a>
+ </div>
+ </h4>
+ <div class="ui attached table unstackable segment">
+ <div class="file-view {{if .IsMarkup}}markdown{{else if .IsRenderedHTML}}plain-text{{else if .IsTextFile}}code-view{{end}} has-emoji">
+ {{if .IsMarkup}}
+ {{if .FileContent}}{{.FileContent | Safe}}{{end}}
+ {{else if .IsRenderedHTML}}
+ <pre>{{if .FileContent}}{{.FileContent | Str2html}}{{end}}</pre>
+ {{else if not .IsTextFile}}
+ <div class="view-raw ui center">
+ {{if .IsImageFile}}
+ <img src="{{EscapePound $.RawFileLink}}">
+ {{else if .IsVideoFile}}
+ <video controls src="{{EscapePound $.RawFileLink}}">
+ <strong>{{.i18n.Tr "repo.video_not_supported_in_browser"}}</strong>
+ </video>
+ {{else if .IsAudioFile}}
+ <audio controls src="{{EscapePound $.RawFileLink}}">
+ <strong>{{.i18n.Tr "repo.audio_not_supported_in_browser"}}</strong>
+ </audio>
+ {{else if .IsPDFFile}}
+ <iframe width="100%" height="600px" src="{{AppSubUrl}}/vendor/plugins/pdfjs/web/viewer.html?file={{EscapePound $.RawFileLink}}"></iframe>
+ {{else}}
+ <a href="{{EscapePound $.RawFileLink}}" rel="nofollow" class="btn btn-gray btn-radius">{{.i18n.Tr "repo.file_view_raw"}}</a>
+ {{end}}
+ </div>
+ {{else if .FileSize}}
+ <table>
+ <tbody>
+ <tr>
+ {{if .IsFileTooLarge}}
+ <td><strong>{{.i18n.Tr "repo.file_too_large"}}</strong></td>
+ {{else}}
+ <td class="lines-num">{{.LineNums}}</td>
+ <td class="lines-code"><pre><code class="{{.HighlightClass}}"><ol class="linenums">{{.FileContent}}</ol></code></pre></td>
+ {{end}}
+ </tr>
+ </tbody>
+ </table>
+ {{end}}
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
+{{template "base/footer" .}}
diff --git a/templates/repo/settings/lfs_file_find.tmpl b/templates/repo/settings/lfs_file_find.tmpl
new file mode 100644
index 0000000000..18db0215a5
--- /dev/null
+++ b/templates/repo/settings/lfs_file_find.tmpl
@@ -0,0 +1,52 @@
+{{template "base/head" .}}
+<div class="repository settings lfs">
+ {{template "repo/header" .}}
+ {{template "repo/settings/navbar" .}}
+ <div class="ui container repository file list">
+ {{template "base/alert" .}}
+ <div class="tab-size-8 non-diff-file-content">
+ <h4 class="ui top attached header">
+ <a href="{{.LFSFilesLink}}">{{.i18n.Tr "repo.settings.lfs"}}</a> / <span class="truncate sha">{{.Oid}}</span>
+ </h4>
+ <table id="lfs-files-find-table" class="ui attached segment single line table">
+ <tbody>
+ {{range .Results}}
+ <tr>
+ <td>
+ <span class="octicon octicon-file-text"></span>
+ <a href="{{EscapePound $.RepoLink}}/src/commit/{{.SHA}}/{{EscapePound .Name}}" title="{{.Name}}">{{.Name}}</a>
+ </td>
+ <td class="message has-emoji">
+ <span class="truncate">
+ <a href="{{$.RepoLink}}/commit/{{.SHA}}" title="{{.Summary}}">
+ {{.Summary}}
+ </a>
+ </span>
+ </td>
+ <td>
+ <span class="text grey"><i class="octicon octicon-git-branch"></i>{{.BranchName}}</span>
+ </td>
+ <td>
+ {{if .ParentHashes}}
+ {{$.i18n.Tr "repo.diff.parent"}}
+ {{range .ParentHashes}}
+ <a class="ui blue sha label" href="{{$.RepoLink}}/commit/{{.String}}">{{ShortSha .String}}</a>
+ {{end}}
+ {{end}}
+ <div class="mobile-only"></div>
+ {{$.i18n.Tr "repo.diff.commit"}}
+ <a class="ui blue sha label" href="{{$.RepoLink}}/commit/{{.SHA}}">{{ShortSha .SHA}}</a>
+ </td>
+ <td>{{TimeSince .When $.Lang}}</td>
+ </tr>
+ {{else}}
+ <tr>
+ <td colspan="5">{{.i18n.Tr "repo.settings.lfs_lfs_file_no_commits"}}</td>
+ </tr>
+ {{end}}
+ </tbody>
+ </table>
+ </div>
+ </div>
+</div>
+{{template "base/footer" .}}
diff --git a/templates/repo/settings/lfs_pointers.tmpl b/templates/repo/settings/lfs_pointers.tmpl
new file mode 100644
index 0000000000..1bd48de157
--- /dev/null
+++ b/templates/repo/settings/lfs_pointers.tmpl
@@ -0,0 +1,71 @@
+{{template "base/head" .}}
+<div class="repository settings lfs">
+ {{template "repo/header" .}}
+ {{template "repo/settings/navbar" .}}
+ <div class="ui container">
+ {{template "base/alert" .}}
+ <h4 class="ui top attached header">
+ {{.i18n.Tr "repo.settings.lfs_pointers.found" .NumPointers .NumAssociated .NumNotAssociated .NumNoExist }}
+ {{if gt .NumAssociatable 0}}
+ <div class="ui right">
+ <form class="ui form" method="post" action="{{$.Link}}/associate">
+ {{.CsrfTokenHtml}}
+ {{range .Pointers}}
+ {{if and (not .InRepo) .Exists .Accessible}}
+ <input type="hidden" name="oid" value="{{.Oid}} {{.Size}}"/>
+ {{end}}
+ {{end}}
+ <button class="ui green button">{{$.i18n.Tr "repo.settings.lfs_pointers.associateAccessible" $.NumAssociatable}}</button>
+ </form>
+ </div>
+ {{end}}
+ </h4>
+ <div class="ui attached segment">
+ <table id="lfs-files-table" class="ui fixed single line table">
+ <thead>
+ <tr>
+ <th class="three wide">{{.i18n.Tr "repo.settings.lfs_pointers.sha"}}</th>
+ <th class="four wide">{{.i18n.Tr "repo.settings.lfs_pointers.oid"}}</th>
+ <th class="three wide"></th>
+ <th class="two wide">{{.i18n.Tr "repo.settings.lfs_pointers.inRepo"}}</th>
+ <th class="two wide">{{.i18n.Tr "repo.settings.lfs_pointers.exists"}}</th>
+ <th class="two wide">{{.i18n.Tr "repo.settings.lfs_pointers.accessible"}}</th>
+ </tr>
+ </thead>
+ <tbody>
+ {{range .Pointers}}
+ <tr>
+ <td>
+ <span class="text sha label" title="{{.SHA}}">
+ <a href="{{$.RepoLink}}/raw/blob/{{.SHA}}" rel="nofollow" target="_blank" class="ui detail icon button truncate">
+ {{ShortSha .SHA}}
+ </a>
+ </span>
+ </td>
+ <td>
+ <span class="text sha label" title="{{.Oid}}">
+ {{if and .Exists .InRepo}}
+ <a href="{{$.LFSFilesLink}}/show/{{.Oid}}" rel="nofollow" target="_blank" class="ui text detail icon button brown truncate">
+ {{ShortSha .Oid}}
+ </a>
+ {{else}}
+ <span class="ui detail icon button brown disabled truncate">
+ {{ShortSha .Oid}}
+ </span>
+ {{end}}
+ </span>
+ </td>
+ <td>
+ <a class="ui blue show-panel button" href="{{$.LFSFilesLink}}/find?oid={{.Oid}}&size={{.Size}}&sha={{.SHA}}">{{$.i18n.Tr "repo.settings.lfs_findcommits"}}</a>
+ </td>
+ <td><i class="fa fa{{if .InRepo}}-check{{end}}-square-o"></i></td>
+ <td><i class="fa fa{{if .Exists}}-check{{end}}-square-o"></i></td>
+ <td><i class="fa fa{{if .Accessible}}-check{{end}}-square-o"></i></td>
+ </tr>
+ {{end}}
+ </tbody>
+ </table>
+ </div>
+ </div>
+</div>
+{{template "base/footer" .}}
diff --git a/templates/repo/settings/navbar.tmpl b/templates/repo/settings/navbar.tmpl
index 24082000e2..abd6e285dc 100644
--- a/templates/repo/settings/navbar.tmpl
+++ b/templates/repo/settings/navbar.tmpl
@@ -21,4 +21,9 @@
<a class="{{if .PageIsSettingsKeys}}active{{end}} item" href="{{.RepoLink}}/settings/keys">
{{.i18n.Tr "repo.settings.deploy_keys"}}
</a>
+ {{if .LFSStartServer}}
+ <a class="{{if .PageIsSettingsLFS}}active{{end}} item" href="{{.RepoLink}}/settings/lfs">
+ {{.i18n.Tr "repo.settings.lfs"}}
+ </a>
+ {{end}}
</div>