Skip to content

Fine tune push mirror UI #33866

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

Merged
merged 2 commits into from
Mar 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions templates/repo/settings/options.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,17 @@
{{range .PushMirrors}}
<tr>
<td class="tw-break-anywhere">{{.RemoteAddress}}</td>
<td>{{ctx.Locale.Tr "repo.settings.mirror_settings.direction.push"}}</td>
<td>{{if .LastUpdateUnix}}{{DateUtils.FullTime .LastUpdateUnix}}{{else}}{{ctx.Locale.Tr "never"}}{{end}} {{if .LastError}}<div class="ui red label" data-tooltip-content="{{.LastError}}">{{ctx.Locale.Tr "error"}}</div>{{end}}</td>
<td>{{ctx.Locale.Tr "repo.settings.mirror_settings.direction.push"}} ({{.Interval}})</td>
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't it make more sense to include the interval already in the translated string?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How to? See the screenshot, I do not see your point.

Copy link
Contributor Author

@wxiaoguang wxiaoguang Mar 13, 2025

Choose a reason for hiding this comment

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

And I think the current syntax is good for all languages, no need to make it more complex.

(If not good, it won't be late to add a new translation in a new PR)

Copy link
Member

Choose a reason for hiding this comment

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

I meant something like Push (every %v), but yes, we can postpone it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, actually Push (every %v) is not really translatable ..... here 2h3m is not a human language, it doesn't fit "every" in many cases. 🤣

<td>
<span class="flex-text-block">
{{if .LastUpdateUnix}}
{{DateUtils.FullTime .LastUpdateUnix}}
{{else}}
{{ctx.Locale.Tr "never"}}
{{end}}
{{if .LastError}}<span class="ui red label" data-tooltip-content="{{.LastError}}">{{ctx.Locale.Tr "error"}}</span>{{end}}
</span>
</td>
<td class="right aligned">
<button
class="ui tiny button show-modal"
Expand Down
50 changes: 23 additions & 27 deletions templates/repo/settings/push_mirror_sync_modal.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,27 @@
<div class="header">
{{ctx.Locale.Tr "repo.settings.mirror_settings.push_mirror.edit_sync_time"}}
</div>
<div class="content">
<form class="ui form ignore-dirty" method="post">
{{.CsrfTokenHtml}}
<input type="hidden" name="action" value="push-mirror-update">
<input type="hidden" name="push_mirror_id" id="push-mirror-edit-id">
<div class="field">
<label for="name">{{ctx.Locale.Tr "repo.settings.mirror_settings.mirrored_repository"}}</label>
<div class="ui small input">
<input id="push-mirror-edit-address" readonly>
Copy link
Member

Choose a reason for hiding this comment

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

This breaks changing the mirror URL.
At the moment (1.23.4), it is possible to change it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Are you sure? readonly, how to change the mirror URL?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

@delvh delvh Mar 13, 2025

Choose a reason for hiding this comment

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

Yep, you are right, I got completely bamboozled:
I saw the readonly in the code above, but didn't check in the actual textbox if I could edit it.
The textbox did not look disabled, so I assumed it could be edited…
I thought the readonly may have been removed with JS.
I didn't imagine in the slightest that we would have a read-only input instead of a span that does not differ at all from an editable input.

</div>
</div>
<div class="inline field">
<label for="push-mirror-edit-interval">{{ctx.Locale.Tr "repo.mirror_interval" .MinimumMirrorInterval}}</label>
<input id="push-mirror-edit-interval" name="push_mirror_interval" autofocus>
</div>
<div class="actions">
<button class="ui small basic cancel button">
{{svg "octicon-x"}}
{{ctx.Locale.Tr "cancel"}}
</button>
<button class="ui primary small approve button">
{{svg "fontawesome-save"}}
{{ctx.Locale.Tr "save"}}
</button>
</div>
</form>
</div>
<form class="content ui form ignore-dirty" method="post">
{{.CsrfTokenHtml}}
<input type="hidden" name="action" value="push-mirror-update">
<input type="hidden" name="push_mirror_id" id="push-mirror-edit-id">
<div class="field">
<label>{{ctx.Locale.Tr "repo.settings.mirror_settings.mirrored_repository"}}</label>
<span id="push-mirror-edit-address"></span>
</div>
<div class="field">
<label for="push-mirror-edit-interval">{{ctx.Locale.Tr "repo.mirror_interval" .MinimumMirrorInterval}}</label>
<input id="push-mirror-edit-interval" name="push_mirror_interval" class="tw-w-auto">
</div>
<div class="actions">
<button class="ui small basic cancel button">
{{svg "octicon-x"}}
{{ctx.Locale.Tr "cancel"}}
</button>
<button class="ui primary small approve button">
{{svg "fontawesome-save"}}
{{ctx.Locale.Tr "save"}}
</button>
</div>
</form>
</div>