Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 19m43s
113 lines
4.2 KiB
React
113 lines
4.2 KiB
React
import {
|
|
IconRefresh,
|
|
IconUpload,
|
|
IconDownload,
|
|
IconDeviceFloppy,
|
|
IconPlayerPlay,
|
|
IconBolt
|
|
} from '@tabler/icons-react';
|
|
|
|
function PageHeaderActions({
|
|
loading = false,
|
|
onPreview,
|
|
disablePreview = false,
|
|
onRefresh,
|
|
disableRefresh = false,
|
|
onImport,
|
|
onExport,
|
|
disableExport = false,
|
|
onClear,
|
|
disableClear = false,
|
|
onSave,
|
|
disableSave = false,
|
|
onHistory,
|
|
onOnlineUpdate,
|
|
onBackgroundUpdate,
|
|
}) {
|
|
return (
|
|
<div className="header-actions" role="toolbar" aria-label="Действия страницы">
|
|
<div className="btn-group">
|
|
{(onBackgroundUpdate || onOnlineUpdate) && (
|
|
<div className="btn-group">
|
|
{/* Дефолтное действие — фоновое обновление */}
|
|
<button
|
|
className="btn btn-outline-success"
|
|
type="button"
|
|
onClick={onBackgroundUpdate || onOnlineUpdate}
|
|
title="Фоновое обновление BGP (POST)"
|
|
>
|
|
<IconPlayerPlay className="me-1" /> Фоновое обновление
|
|
</button>
|
|
{(onBackgroundUpdate && onOnlineUpdate) && (
|
|
<>
|
|
<button className="btn btn-outline-success dropdown-toggle dropdown-toggle-split" type="button" data-bs-toggle="dropdown" data-bs-container="body" aria-expanded="false" aria-label="Другие варианты обновления"></button>
|
|
<div className="dropdown-menu">
|
|
<button className="dropdown-item" type="button" onClick={onBackgroundUpdate}>
|
|
<IconPlayerPlay className="me-1" /> Фоновое обновление
|
|
</button>
|
|
<button className="dropdown-item" type="button" onClick={onOnlineUpdate}>
|
|
<IconBolt className="me-1" /> Online-обновление
|
|
</button>
|
|
</div>
|
|
</>
|
|
)}
|
|
</div>
|
|
)}
|
|
</div>
|
|
<span className="vr d-none d-lg-inline" />
|
|
<div className="btn-group">
|
|
{onRefresh && (
|
|
<button className="btn btn-outline-secondary" type="button" onClick={onRefresh} disabled={disableRefresh} title="Обновить данные">
|
|
<IconRefresh className={loading ? 'spin me-1' : 'me-1'} /> Обновить
|
|
</button>
|
|
)}
|
|
{(onImport || onExport) && (
|
|
<div className="dropdown">
|
|
<button className="btn btn-outline-primary dropdown-toggle" type="button" data-bs-toggle="dropdown" data-bs-container="body" aria-expanded="false" title="Импорт/Экспорт">
|
|
<IconDownload className="me-1" /> Импорт/Экспорт
|
|
</button>
|
|
<div className="dropdown-menu">
|
|
{onImport && (
|
|
<button className="dropdown-item" type="button" onClick={onImport}>
|
|
<IconUpload className="me-1" /> Импорт
|
|
</button>
|
|
)}
|
|
{onExport && (
|
|
<button className="dropdown-item" type="button" onClick={onExport} disabled={disableExport}>
|
|
<IconDownload className="me-1" /> Экспорт
|
|
</button>
|
|
)}
|
|
</div>
|
|
</div>
|
|
)}
|
|
{onClear && (
|
|
<button className="btn btn-outline-secondary" type="button" onClick={onClear} disabled={disableClear} title="Очистить пустые/невалидные">
|
|
Очистить
|
|
</button>
|
|
)}
|
|
{onSave && (
|
|
<button className="btn btn-primary" type="button" onClick={onSave} disabled={disableSave} title="Сохранить">
|
|
{loading ? (
|
|
<>
|
|
<span className="spinner-border spinner-border-sm me-2" role="status"></span>
|
|
Сохранение...
|
|
</>
|
|
) : (
|
|
<>
|
|
<IconDeviceFloppy className="me-1" /> Сохранить
|
|
</>
|
|
)}
|
|
</button>
|
|
)}
|
|
{onHistory && (
|
|
<button className="btn btn-outline-secondary" type="button" onClick={onHistory} title="История версий">История</button>
|
|
)}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default PageHeaderActions;
|
|
|
|
|