forked from laysense/laysite
Check upstream versions and label article-driven components
This commit is contained in:
@@ -1,6 +1,28 @@
|
||||
'use strict';
|
||||
|
||||
jQuery(function ($) {
|
||||
const $updates = $('[data-about-updates]');
|
||||
const $check = $updates.find('[data-update-check]');
|
||||
const $updateStatus = $updates.find('[data-update-status]');
|
||||
$check.prop('hidden', false).on('click', function () {
|
||||
$check.prop('disabled', true);
|
||||
$updateStatus.text('正在查询上游仓库…');
|
||||
$.ajax({url: '/admin/about/update', dataType: 'json', timeout: 7500})
|
||||
.done(({current, latest, comparison}) => {
|
||||
if (comparison > 0) {
|
||||
$updateStatus.text('发现新版本 ' + latest + ',当前版本为 ' + current + '。');
|
||||
} else if (comparison < 0) {
|
||||
$updateStatus.text('当前版本 ' + current + ' 高于上游版本 ' + latest + '。');
|
||||
} else {
|
||||
$updateStatus.text('当前版本 ' + current + ' 已与上游仓库一致。');
|
||||
}
|
||||
})
|
||||
.fail(({status, responseJSON}) => {
|
||||
$updateStatus.text(status === 401 ? '登录已过期,请重新登录。' : (responseJSON?.message ?? '检查更新失败,请重试。'));
|
||||
})
|
||||
.always(() => $check.prop('disabled', false));
|
||||
});
|
||||
|
||||
const $metrics = $('[data-about-metrics]');
|
||||
if (!$metrics.length) return;
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
.admin-main { padding-block: clamp(1.65rem, 4vw, 3.25rem); }
|
||||
.admin-version { margin-block-start: auto; padding-block: 1rem; border-block-start: 1px solid var(--line); color: var(--muted); font-size: .875rem; }
|
||||
.settings-stack { display: grid; gap: .9rem; margin: 0; padding: 1rem; border: 1px solid var(--line); border-radius: .65rem; min-inline-size: 0; }
|
||||
.admin-about { max-inline-size: 52rem; }
|
||||
.admin-system-info dl { margin: 0; }
|
||||
.admin-system-info dl > div { display: grid; grid-template-columns: minmax(7.5rem, 1fr) 2fr; gap: .65rem 1rem; padding-block: .85rem; border-block-start: 1px solid var(--line); }
|
||||
.admin-system-info dt { color: var(--muted); }
|
||||
@@ -15,6 +14,7 @@
|
||||
.admin-system-info dd small { display: block; font-family: var(--sans); color: var(--muted); }
|
||||
.admin-system-info .admin-about-details { margin-block-start: .75rem; }
|
||||
.admin-system-info .field-note { margin-block: .5rem 0; }
|
||||
.admin-system-info [data-update-status]:empty { display: none; }
|
||||
.admin-about-details { background: var(--paper); }
|
||||
.admin-license-project { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .65rem 1rem; margin-bottom: 1rem; }
|
||||
.admin-license-project p { margin: .2rem 0 0; color: var(--muted); }
|
||||
@@ -263,6 +263,8 @@
|
||||
.studio-template-image:hover img, .studio-template-image:focus-visible img { transform: scale(1.07); }
|
||||
.studio-template-meta { display: flex; align-items: center; justify-content: space-between; gap: .3rem; padding: .3rem .38rem .3rem .55rem; font-size: .875rem; }
|
||||
.studio-template-meta .button { min-height: 33px; font-size: .8rem; flex: 0 0 auto; padding: .2rem .45rem; }
|
||||
.studio-component-label { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .35rem; min-inline-size: 0; }
|
||||
.studio-dynamic-badge { padding: .1rem .35rem; color: var(--accent-deep); background: var(--accent-light); border-radius: .35rem; font-size: .72rem; font-weight: 650; white-space: nowrap; }
|
||||
.studio-template-peek {
|
||||
position: fixed;
|
||||
z-index: 2;
|
||||
|
||||
@@ -1430,9 +1430,11 @@ jQuery(function ($) {
|
||||
const {key, fixed, version} = entry;
|
||||
const index = eligible.indexOf(entry);
|
||||
const $row = $('<li>', {'data-layer-key': key}).appendTo($layers);
|
||||
const $label = $('<div>').append($('<strong>', {
|
||||
const $label = $('<div>').appendTo($row);
|
||||
const $title = $('<div>', {class: 'studio-component-label'}).append($('<strong>', {
|
||||
'data-layer-title': '', text: plainText(entry.fields.title.node) || '未命名区块'
|
||||
})).appendTo($row);
|
||||
})).appendTo($label);
|
||||
if (entry.feed) $('<span>', {class: 'studio-dynamic-badge', text: '动态'}).appendTo($title);
|
||||
if (fixed || version === null) $label.append($('<small>').text(fixed ? '首屏目录' : '待保存'));
|
||||
const $actions = $('<div>', {class: 'actions studio-block-actions'}).appendTo($row);
|
||||
$actions.append(button('定位', 'jump'), button('上移', 'up', fixed || index === 0),
|
||||
|
||||
Reference in New Issue
Block a user