Skip to content
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
4 changes: 4 additions & 0 deletions server/web/src/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
--np-bg-soft: #0f1626;
--np-panel-bg: rgba(15, 22, 38, 0.82);
--np-panel-bg-strong: rgba(17, 24, 40, 0.94);
--np-sticky-bg: #0d1422;
--np-sticky-bg-hover: #121c2e;
--np-bg-hover: rgba(76, 141, 255, 0.09);
--np-border: #26314a;
--np-border-soft: rgba(148, 163, 184, 0.13);
Expand Down Expand Up @@ -55,6 +57,8 @@
--np-bg-soft: #ffffff;
--np-panel-bg: rgba(255, 255, 255, 0.92);
--np-panel-bg-strong: #ffffff;
--np-sticky-bg: #ffffff;
--np-sticky-bg-hover: #f3f7ff;
--np-bg-hover: rgba(37, 99, 235, 0.06);
--np-border: #d7e0ee;
--np-border-soft: rgba(37, 99, 235, 0.1);
Expand Down
28 changes: 26 additions & 2 deletions server/web/src/views/Nodes.vue
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,13 @@ const clickable = (row, field, cls) => ({
onClick: () => openEdit(row, field),
});

// Keep the real width of every visible column instead of a fixed 1500px. A fixed
// scroll-x smaller than the sum squeezes columns and lets the sticky ops column
// sit on top of neighbouring text.
const tableScrollX = computed(() =>
ALL_COLUMNS.filter((c) => visibleKeys.value.includes(c.key)).reduce((sum, c) => sum + c.width, 0)
);

const tableColumns = computed(() =>
ALL_COLUMNS.filter((c) => visibleKeys.value.includes(c.key)).map((c) => {
const def = {
Expand Down Expand Up @@ -439,13 +446,13 @@ const cbRowClass = (row) => {
<section class="nodes-table np-panel">
<div class="nodes-table-head">
<span class="nodes-table-title">节点列表</span>
<span class="nodes-table-hint">点击「区域 / 分组 / 标签 / 备注」单元格可直接编辑</span>
<span class="nodes-table-hint">点击「区域 / 分组 / 标签 / 备注」单元格可直接编辑 · 表格可左右滑动</span>
</div>
<NDataTable
:columns="tableColumns"
:data="filtered"
:loading="loading"
:scroll-x="1500"
:scroll-x="tableScrollX"
:row-class-name="cbRowClass"
:bordered="false"
:single-line="false"
Expand Down Expand Up @@ -592,6 +599,23 @@ const cbRowClass = (row) => {
letter-spacing: 0.04em;
}
.nodes-table :deep(.n-data-table-td) { font-size: 12.5px; }
/* The ops column is sticky. Naive paints every td with the theme's tdColor;
ours is transparent for the glass panel, so the cells scrolling underneath
showed through the button cell. Give the sticky column its own opaque
surface (and a divider) so the buttons always win the overlap. */
.nodes-table :deep(.n-data-table-td--fixed-right) {
background: var(--np-sticky-bg) !important;
border-left: 1px solid var(--np-border-soft);
white-space: nowrap;
}
.nodes-table :deep(.n-data-table-th--fixed-right) {
background: var(--np-sticky-bg) !important;
border-left: 1px solid var(--np-border-soft);
z-index: 3;
}
.nodes-table :deep(.n-data-table-tr:hover .n-data-table-td--fixed-right) {
background: var(--np-sticky-bg-hover) !important;
}

.np-edit-head {
display: flex;
Expand Down
Loading