Align tracker footer actions and text with Mission settings
Device Core qualification / qualify (push) Successful in 6m28s
Device Core qualification / qualify (push) Successful in 6m28s
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { Button, FeatureSettingsWindow, Icon, IconButton, ResourceList, ResourceRow, Select, SettingsCard, StatusBadge, Switch, TextField, Window } from '@nodedc/ui-react';
|
||||
import { Button, FeatureSettingsWindow, Icon, IconButton, ResourceList, ResourceRow, Select, SettingsCard, StatusBadge, Switch, TextField, Window, WindowFooterActions } from '@nodedc/ui-react';
|
||||
import { trackerRequest, newIntent, operationName, stateName, operationTone, formatTime, type TrackerRef, type TrackerState, type Policy, type Operation } from './tracker';
|
||||
import { B2RequestError } from './api';
|
||||
import './b2.css';
|
||||
@@ -70,7 +70,7 @@ export function B2TrackerSettings({projectRef,device,initialSection='identity',o
|
||||
sections={[{id:'identity',label:'Устройство и проект'},{id:'connection',label:'Сервер и связь'},{id:'commands',label:'Команды'},{id:'firmware',label:'Прошивка'},...groupNames.map((group,index)=>({id:group,label:group,group:index===0?'Параметры профиля':undefined}))]}
|
||||
activeSection={section} onSectionChange={setSection} onClose={onClose}
|
||||
headerActions={<IconButton label="Обновить сведения о трекере" disabled={Boolean(busy)} loading={busy==='refresh'} onClick={()=>void run('refresh',async()=>{await refresh();})}><Icon name="refresh" /></IconButton>}
|
||||
footer={section!=='commands'&§ion!=='firmware'?<><Button disabled={disabled||!dirty||!data} loading={busy==='save'} onClick={()=>void run('save',async()=>{await save();})}>Сохранить настройки</Button><Button disabled={disabled||!data} onClick={()=>{profileIntent.current=null;setProfileName('');setProfileOpen(true);}}>Сохранить профиль</Button></>:undefined}>
|
||||
footer={section!=='commands'&§ion!=='firmware'?<WindowFooterActions><Button disabled={disabled||!dirty||!data} loading={busy==='save'} onClick={()=>void run('save',async()=>{await save();})}>Сохранить настройки</Button><Button disabled={disabled||!data} onClick={()=>{profileIntent.current=null;setProfileName('');setProfileOpen(true);}}>Сохранить профиль</Button></WindowFooterActions>:undefined}>
|
||||
<div className="b2-tracker-form" aria-busy={Boolean(busy)}>
|
||||
<StatusBadge tone={connected?'success':'neutral'}>{connected?'Передаёт данные на VPS':data?'Нет свежих данных':'Загрузка…'}</StatusBadge>
|
||||
{data&§ion!=='commands'&§ion!=='firmware'?<SettingsCard title="Настройки через VPS">
|
||||
@@ -112,7 +112,7 @@ export function B2TrackerSettings({projectRef,device,initialSection='identity',o
|
||||
</div>
|
||||
</FeatureSettingsWindow>
|
||||
{commandsOpen?<B2CommandWindow projectRef={projectRef} device={device} data={data} canCommand={canCommand} onClose={()=>setCommandsOpen(false)} onError={onError} />:null}
|
||||
<Window open={profileOpen} title="Сохранить профиль" size="sm" onClose={()=>setProfileOpen(false)} footer={<Button loading={busy==='profile'} disabled={Boolean(busy)||!profileName.trim()} onClick={()=>void run('profile',async()=>{profileIntent.current ||= {action:'profile-save',id:newIntent(),name:profileName,policy};try{await request(profileIntent.current);profileIntent.current=null;}catch(error){if(error instanceof B2RequestError&&error.rejected)profileIntent.current=null;throw error;}setProfileOpen(false);await refresh();})}>Сохранить профиль</Button>}><TextField label="Название профиля" disabled={Boolean(busy)||Boolean(profileIntent.current)} autoFocus value={profileName} onChange={event=>setProfileName(event.target.value)} /></Window>
|
||||
<Window open={profileOpen} title="Сохранить профиль" size="sm" onClose={()=>setProfileOpen(false)} footer={<WindowFooterActions><Button loading={busy==='profile'} disabled={Boolean(busy)||!profileName.trim()} onClick={()=>void run('profile',async()=>{profileIntent.current ||= {action:'profile-save',id:newIntent(),name:profileName,policy};try{await request(profileIntent.current);profileIntent.current=null;}catch(error){if(error instanceof B2RequestError&&error.rejected)profileIntent.current=null;throw error;}setProfileOpen(false);await refresh();})}>Сохранить профиль</Button></WindowFooterActions>}><TextField label="Название профиля" disabled={Boolean(busy)||Boolean(profileIntent.current)} autoFocus value={profileName} onChange={event=>setProfileName(event.target.value)} /></Window>
|
||||
</>;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
.b2-disclosure__body { display: grid; gap: var(--nodedc-space-3); padding: var(--nodedc-space-2) var(--nodedc-space-3) var(--nodedc-space-4); }
|
||||
.b2-section-heading { display: flex; align-items: center; justify-content: space-between; gap: var(--nodedc-space-3); font-size: var(--nodedc-font-size-sm); }
|
||||
|
||||
.b2-tracker-form { display: grid; min-width: 0; gap: 1rem; }
|
||||
.b2-tracker-form { display: grid; min-width: 0; gap: 1rem; font-size: var(--nodedc-font-size-sm); }
|
||||
.b2-tracker-facts { display: grid; grid-template-columns: minmax(8rem, 1fr) minmax(0, 2fr); gap: .65rem 1rem; margin: 0; font-size: var(--nodedc-font-size-sm); }
|
||||
.b2-tracker-facts dt { color: var(--nodedc-text-muted); }
|
||||
.b2-tracker-facts dd { margin: 0; overflow-wrap: anywhere; }
|
||||
|
||||
Reference in New Issue
Block a user