Skip to content

Commit 4840567

Browse files
committed
Fix various js loading states
1 parent 2115147 commit 4840567

File tree

9 files changed

+18
-34
lines changed

9 files changed

+18
-34
lines changed

templates/admin/notice.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
</div>
5151
</div>
5252
<button class="ui small teal button" id="delete-selection" data-link="{{.Link}}/delete" data-redirect="?page={{.Page.Paginater.Current}}">
53-
{{ctx.Locale.Tr "admin.notices.delete_selected"}}
53+
<span class="text">{{ctx.Locale.Tr "admin.notices.delete_selected"}}</span>
5454
</button>
5555
</th>
5656
</tr>

templates/repo/graph.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
</div>
5151
</h2>
5252
<div class="ui dividing"></div>
53-
<div class="ui segment loading gt-hidden" id="loading-indicator"></div>
53+
<div class="is-loading tw-py-[120px]" id="loading-indicator"></div>
5454
{{template "repo/graph/svgcontainer" .}}
5555
{{template "repo/graph/commits" .}}
5656
</div>

templates/repo/settings/webhook/history.tmpl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
<div class="ui right">
77
<!-- the button is wrapped with a span because the tooltip doesn't show on hover if we put data-tooltip-content directly on the button -->
88
<span data-tooltip-content="{{if or $isNew .Webhook.IsActive}}{{ctx.Locale.Tr "repo.settings.webhook.test_delivery_desc"}}{{else}}{{ctx.Locale.Tr "repo.settings.webhook.test_delivery_desc_disabled"}}{{end}}">
9-
<button class="ui teal tiny button{{if not (or $isNew .Webhook.IsActive)}} disabled{{end}}" id="test-delivery" data-link="{{.Link}}/test" data-redirect="{{.Link}}">{{ctx.Locale.Tr "repo.settings.webhook.test_delivery"}}</button>
9+
<button class="ui teal tiny button{{if not (or $isNew .Webhook.IsActive)}} disabled{{end}}" id="test-delivery" data-link="{{.Link}}/test" data-redirect="{{.Link}}">
10+
<span class="text">{{ctx.Locale.Tr "repo.settings.webhook.test_delivery"}}</span>
11+
</button>
1012
</span>
1113
</div>
1214
{{end}}

web_src/css/base.css

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -709,16 +709,6 @@ img.ui.avatar,
709709
background: var(--color-active);
710710
}
711711

712-
.ui.loading.segment::before,
713-
.ui.loading.form::before {
714-
background: none;
715-
}
716-
717-
.ui.loading.form > *,
718-
.ui.loading.segment > * {
719-
opacity: 0.35;
720-
}
721-
722712
.ui.form .fields.error .field textarea,
723713
.ui.form .fields.error .field select,
724714
.ui.form .fields.error .field input:not([type]),
@@ -810,10 +800,6 @@ input:-webkit-autofill:active,
810800
opacity: var(--opacity-disabled);
811801
}
812802

813-
.ui.loading.loading.input > i.icon svg {
814-
visibility: hidden;
815-
}
816-
817803
.text.primary {
818804
color: var(--color-primary) !important;
819805
}

web_src/css/features/gitgraph.css

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@
44
min-height: 350px;
55
}
66

7-
#git-graph-container > .ui.segment.loading {
8-
border: 0;
9-
z-index: 1;
10-
min-height: 246px;
11-
}
12-
137
#git-graph-container h2 {
148
display: flex;
159
justify-content: space-between;

web_src/js/features/admin/common.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ export function initAdminCommon() {
208208
$('#delete-selection').on('click', async function (e) {
209209
e.preventDefault();
210210
const $this = $(this);
211-
$this.addClass('loading disabled');
211+
$this.addClass('is-loading disabled');
212212
const data = new FormData();
213213
$checkboxes.each(function () {
214214
if ($(this).checkbox('is checked')) {

web_src/js/features/comp/WebHookEditor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export function initCompWebHookEditor() {
3535

3636
// Test delivery
3737
document.getElementById('test-delivery')?.addEventListener('click', async function () {
38-
this.classList.add('loading', 'disabled');
38+
this.classList.add('is-loading', 'disabled');
3939
await POST(this.getAttribute('data-link'));
4040
setTimeout(() => {
4141
window.location.href = this.getAttribute('data-redirect');

web_src/js/features/repo-common.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,33 @@ import {hideElem, showElem} from '../utils/dom.js';
33
import {POST} from '../modules/fetch.js';
44

55
async function getArchive($target, url, first) {
6+
const dropdownBtn = $target[0].closest('.ui.dropdown.button');
7+
68
try {
9+
dropdownBtn.classList.add('is-loading');
710
const response = await POST(url);
811
if (response.status === 200) {
912
const data = await response.json();
1013
if (!data) {
1114
// XXX Shouldn't happen?
12-
$target.closest('.dropdown').children('i').removeClass('loading');
15+
dropdownBtn.classList.remove('is-loading');
1316
return;
1417
}
1518

1619
if (!data.complete) {
17-
$target.closest('.dropdown').children('i').addClass('loading');
1820
// Wait for only three quarters of a second initially, in case it's
1921
// quickly archived.
2022
setTimeout(() => {
2123
getArchive($target, url, false);
2224
}, first ? 750 : 2000);
2325
} else {
2426
// We don't need to continue checking.
25-
$target.closest('.dropdown').children('i').removeClass('loading');
27+
dropdownBtn.classList.remove('is-loading');
2628
window.location.href = url;
2729
}
2830
}
2931
} catch {
30-
$target.closest('.dropdown').children('i').removeClass('loading');
32+
dropdownBtn.classList.remove('is-loading');
3133
}
3234
}
3335

web_src/js/features/repo-issue.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ export function initRepoIssueTimeTracking() {
4343

4444
async function updateDeadline(deadlineString) {
4545
hideElem($('#deadline-err-invalid-date'));
46-
$('#deadline-loader').addClass('loading');
46+
$('#deadline-loader').addClass('is-loading');
4747

4848
let realDeadline = null;
4949
if (deadlineString !== '') {
5050
const newDate = Date.parse(deadlineString);
5151

5252
if (Number.isNaN(newDate)) {
53-
$('#deadline-loader').removeClass('loading');
53+
$('#deadline-loader').removeClass('is-loading');
5454
showElem($('#deadline-err-invalid-date'));
5555
return false;
5656
}
@@ -69,7 +69,7 @@ async function updateDeadline(deadlineString) {
6969
}
7070
} catch (error) {
7171
console.error(error);
72-
$('#deadline-loader').removeClass('loading');
72+
$('#deadline-loader').removeClass('is-loading');
7373
showElem($('#deadline-err-invalid-date'));
7474
}
7575
}
@@ -231,14 +231,14 @@ export function initRepoPullRequestUpdate() {
231231
e.preventDefault();
232232
const $this = $(this);
233233
const redirect = $this.data('redirect');
234-
$this.addClass('loading');
234+
$this.addClass('is-loading');
235235
let response;
236236
try {
237237
response = await POST($this.data('do'));
238238
} catch (error) {
239239
console.error(error);
240240
} finally {
241-
$this.removeClass('loading');
241+
$this.removeClass('is-loading');
242242
}
243243
let data;
244244
try {

0 commit comments

Comments
 (0)