mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2026-09-22 16:00:51 +00:00
feat: add node selection reports (#12871)
* feat: add node selection reports * Merge dev-v2 and resolve PR conflicts --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
co-authored by
copilot-swe-agent[bot]
parent
b9dff99d63
commit
462a3bbc83
@@ -57,8 +57,10 @@ type SSHConfUpdate struct {
|
||||
}
|
||||
type SearchSSHLog struct {
|
||||
PageInfo
|
||||
Info string `json:"info"`
|
||||
Status string `json:"Status" validate:"required,oneof=Success Failed All"`
|
||||
Info string `json:"info"`
|
||||
Status string `json:"Status" validate:"required,oneof=Success Failed All"`
|
||||
StartTime time.Time `json:"startTime"`
|
||||
EndTime time.Time `json:"endTime"`
|
||||
}
|
||||
|
||||
type SSHHistory struct {
|
||||
|
||||
@@ -599,7 +599,18 @@ func (u *SSHService) LoadLog(ctx *gin.Context, req dto.SearchSSHLog) (int64, []d
|
||||
nyc, _ := time.LoadLocation(common.LoadTimeZoneByCmd())
|
||||
itemFailed, itemTotal := 0, 0
|
||||
for _, file := range fileList {
|
||||
dataItem, successCount, failedCount := loadSSHData(ctx, file.Name, req.Status, filter, showCountFrom, showCountTo, file.Year, nyc)
|
||||
dataItem, successCount, failedCount := loadSSHData(
|
||||
ctx,
|
||||
file.Name,
|
||||
req.Status,
|
||||
filter,
|
||||
req.StartTime,
|
||||
req.EndTime,
|
||||
showCountFrom,
|
||||
showCountTo,
|
||||
file.Year,
|
||||
nyc,
|
||||
)
|
||||
itemFailed += failedCount
|
||||
itemTotal += successCount + failedCount
|
||||
showCountFrom = showCountFrom - (successCount + failedCount)
|
||||
@@ -1118,7 +1129,13 @@ type sshParsedLog struct {
|
||||
Index int
|
||||
}
|
||||
|
||||
func loadSSHData(ctx *gin.Context, filePath, status, filter string, showCountFrom, showCountTo, currentYear int, nyc *time.Location) ([]dto.SSHHistory, int, int) {
|
||||
func loadSSHData(
|
||||
ctx *gin.Context,
|
||||
filePath, status, filter string,
|
||||
startTime, endTime time.Time,
|
||||
showCountFrom, showCountTo, currentYear int,
|
||||
nyc *time.Location,
|
||||
) ([]dto.SSHHistory, int, int) {
|
||||
var (
|
||||
datas []dto.SSHHistory
|
||||
successCount int
|
||||
@@ -1138,9 +1155,12 @@ func loadSSHData(ctx *gin.Context, filePath, status, filter string, showCountFro
|
||||
if !matchSSHLogStatus(status, itemData.Status) || !checkIsStandard(itemData) {
|
||||
continue
|
||||
}
|
||||
itemData.Date = loadDate(currentYear, itemData.DateStr, nyc)
|
||||
if !isSSHLogWithinTimeRange(itemData.Date, startTime, endTime) {
|
||||
continue
|
||||
}
|
||||
if successCount+failedCount >= showCountFrom && (showCountTo == -1 || successCount+failedCount < showCountTo) {
|
||||
itemData.Area, _ = geo.GetIPLocation(getLoc, itemData.Address, common.GetLang(ctx))
|
||||
itemData.Date = loadDate(currentYear, itemData.DateStr, nyc)
|
||||
datas = append(datas, itemData)
|
||||
}
|
||||
if itemData.Status == constant.StatusSuccess {
|
||||
@@ -1152,6 +1172,13 @@ func loadSSHData(ctx *gin.Context, filePath, status, filter string, showCountFro
|
||||
return datas, successCount, failedCount
|
||||
}
|
||||
|
||||
func isSSHLogWithinTimeRange(itemTime, startTime, endTime time.Time) bool {
|
||||
if startTime.IsZero() || endTime.IsZero() {
|
||||
return true
|
||||
}
|
||||
return itemTime.After(startTime) && itemTime.Before(endTime)
|
||||
}
|
||||
|
||||
func collectSSHLogItems(lines []string, filter, status string) []sshParsedLog {
|
||||
var items []sshParsedLog
|
||||
auxiliaryIndex := make(map[string]int)
|
||||
|
||||
@@ -33,8 +33,10 @@ type SearchOpLogWithPage struct {
|
||||
|
||||
type SearchLgLogWithPage struct {
|
||||
PageInfo
|
||||
Info string `json:"info"`
|
||||
Status string `json:"status"`
|
||||
Info string `json:"info"`
|
||||
Status string `json:"status"`
|
||||
StartTime time.Time `json:"startTime"`
|
||||
EndTime time.Time `json:"endTime"`
|
||||
}
|
||||
|
||||
type LoginLog struct {
|
||||
|
||||
@@ -2,6 +2,7 @@ package repo
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/1Panel-dev/1Panel/core/constant"
|
||||
"github.com/1Panel-dev/1Panel/core/global"
|
||||
@@ -73,6 +74,13 @@ func WithByStatus(status string) global.DBOption {
|
||||
return g.Where("status = ?", status)
|
||||
}
|
||||
}
|
||||
|
||||
func WithByCreatedAt(startTime, endTime time.Time) global.DBOption {
|
||||
return func(g *gorm.DB) *gorm.DB {
|
||||
return g.Where("created_at > ? AND created_at < ?", startTime, endTime)
|
||||
}
|
||||
}
|
||||
|
||||
func WithByNode(node string) global.DBOption {
|
||||
return func(g *gorm.DB) *gorm.DB {
|
||||
return g.Where("node = ?", node)
|
||||
|
||||
@@ -53,6 +53,9 @@ func (u *LogService) PageLoginLog(ctx *gin.Context, req dto.SearchLgLogWithPage)
|
||||
if len(req.Status) != 0 {
|
||||
options = append(options, repo.WithByStatus(req.Status))
|
||||
}
|
||||
if !req.StartTime.IsZero() && !req.EndTime.IsZero() {
|
||||
options = append(options, repo.WithByCreatedAt(req.StartTime, req.EndTime))
|
||||
}
|
||||
total, ops, err := logRepo.PageLoginLog(
|
||||
req.Page,
|
||||
req.PageSize,
|
||||
|
||||
@@ -113,15 +113,6 @@ func (u *SettingService) GetSettingInfo() (*dto.SettingInfo, error) {
|
||||
return &info, err
|
||||
}
|
||||
|
||||
func defaultOpsReportSavePath() string {
|
||||
return path.Join(global.CONF.Base.InstallDir, constant.OpsReportDefaultSaveSubDir)
|
||||
}
|
||||
|
||||
func isValidOpsReportThreshold(value string) bool {
|
||||
threshold, err := strconv.Atoi(strings.TrimSpace(value))
|
||||
return err == nil && threshold >= 1 && threshold <= 100
|
||||
}
|
||||
|
||||
func (u *SettingService) GetSettingBaseInfo() (*dto.SettingBaseInfo, error) {
|
||||
setting, err := settingRepo.List()
|
||||
if err != nil {
|
||||
|
||||
@@ -83,12 +83,10 @@ require (
|
||||
github.com/ncruces/go-strftime v1.0.0 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.3.0 // indirect
|
||||
github.com/philhofer/fwd v1.2.0 // indirect
|
||||
github.com/phpdave11/gofpdi v1.0.14-0.20211212211723-1f10f9844311 // indirect
|
||||
github.com/quic-go/qpack v0.6.0 // indirect
|
||||
github.com/quic-go/quic-go v0.59.0 // indirect
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
||||
github.com/sagikazarmark/locafero v0.12.0 // indirect
|
||||
github.com/signintech/gopdf v0.36.1
|
||||
github.com/spf13/afero v1.15.0 // indirect
|
||||
github.com/spf13/cast v1.10.0 // indirect
|
||||
github.com/spf13/pflag v1.0.10 // indirect
|
||||
|
||||
@@ -145,9 +145,6 @@ github.com/pelletier/go-toml/v2 v2.3.0 h1:k59bC/lIZREW0/iVaQR8nDHxVq8OVlIzYCOJf4
|
||||
github.com/pelletier/go-toml/v2 v2.3.0/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
|
||||
github.com/philhofer/fwd v1.2.0 h1:e6DnBTl7vGY+Gz322/ASL4Gyp1FspeMvx1RNDoToZuM=
|
||||
github.com/philhofer/fwd v1.2.0/go.mod h1:RqIHx9QI14HlwKwm98g9Re5prTQ6LdeRQn+gXJFxsJM=
|
||||
github.com/phpdave11/gofpdi v1.0.14-0.20211212211723-1f10f9844311 h1:zyWXQ6vu27ETMpYsEMAsisQ+GqJ4e1TPvSNfdOPF0no=
|
||||
github.com/phpdave11/gofpdi v1.0.14-0.20211212211723-1f10f9844311/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/sftp v1.13.10 h1:+5FbKNTe5Z9aspU88DPIKJ9z2KZoaGCu6Sr6kKR/5mU=
|
||||
@@ -167,8 +164,6 @@ github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncj
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/sagikazarmark/locafero v0.12.0 h1:/NQhBAkUb4+fH1jivKHWusDYFjMOOKU88eegjfxfHb4=
|
||||
github.com/sagikazarmark/locafero v0.12.0/go.mod h1:sZh36u/YSZ918v0Io+U9ogLYQJ9tLLBmM4eneO6WwsI=
|
||||
github.com/signintech/gopdf v0.36.1 h1:cGpvEKvvqCV+ZXB9R2SQoWgouW91JpwsgoQEhLxIdp0=
|
||||
github.com/signintech/gopdf v0.36.1/go.mod h1:d23eO35GpEliSrF22eJ4bsM3wVeQJTjXTHq5x5qGKjA=
|
||||
github.com/sirupsen/logrus v1.9.4 h1:TsZE7l11zFCLZnZ+teH4Umoq5BhEIfIzfRDZ1Uzql2w=
|
||||
github.com/sirupsen/logrus v1.9.4/go.mod h1:ftWc9WdOfJ0a92nsE2jF5u5ZwH8Bv2zdeOC42RjbV2g=
|
||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e h1:MRM5ITcdelLK2j1vwZ3Je0FKVCfqOLp5zO6trqMLYs0=
|
||||
|
||||
@@ -195,8 +195,8 @@ export namespace Cronjob {
|
||||
}
|
||||
export interface SearchRecord extends ReqPage {
|
||||
cronjobID: number;
|
||||
startTime: Date;
|
||||
endTime: Date;
|
||||
startTime: string | Date;
|
||||
endTime: string | Date;
|
||||
status: string;
|
||||
}
|
||||
export interface Record {
|
||||
|
||||
@@ -201,6 +201,8 @@ export namespace Host {
|
||||
export interface searchSSHLog extends ReqPage {
|
||||
info: string;
|
||||
status: string;
|
||||
startTime?: string | Date;
|
||||
endTime?: string | Date;
|
||||
}
|
||||
export interface analysisSSHLog extends ReqPage {
|
||||
orderBy: string;
|
||||
|
||||
@@ -22,10 +22,13 @@ export namespace Log {
|
||||
source: string;
|
||||
status: string;
|
||||
operation: string;
|
||||
node?: string;
|
||||
}
|
||||
export interface SearchLgLog extends ReqPage {
|
||||
info: string;
|
||||
status: string;
|
||||
startTime?: string | Date;
|
||||
endTime?: string | Date;
|
||||
}
|
||||
export interface LoginLogs {
|
||||
ip: string;
|
||||
|
||||
@@ -2,8 +2,13 @@ import http from '@/api';
|
||||
import { ResPage } from '@/api/interface';
|
||||
import { Alert } from '../interface/alert';
|
||||
import { deepCopy } from '@/utils/misc';
|
||||
export const SearchAlerts = (req: Alert.AlertSearch) => {
|
||||
return http.post<ResPage<Alert.AlertInfo>>(`/alert/search`, req);
|
||||
export const SearchAlerts = (req: Alert.AlertSearch, currentNode?: string) => {
|
||||
return http.post<ResPage<Alert.AlertInfo>>(
|
||||
`/alert/search`,
|
||||
req,
|
||||
undefined,
|
||||
currentNode ? { CurrentNode: currentNode } : undefined,
|
||||
);
|
||||
};
|
||||
|
||||
export const CreateAlert = (req: Alert.AlertCreateReq) => {
|
||||
@@ -27,8 +32,13 @@ export const ListDisks = () => {
|
||||
return http.get<Alert.DisksDTO[]>(`/alert/disks/list`);
|
||||
};
|
||||
|
||||
export const SearchAlertLogs = (req: Alert.AlertLogSearch) => {
|
||||
return http.post<ResPage<Alert.AlertLog>>(`/alert/logs/search`, req);
|
||||
export const SearchAlertLogs = (req: Alert.AlertLogSearch, currentNode?: string) => {
|
||||
return http.post<ResPage<Alert.AlertLog>>(
|
||||
`/alert/logs/search`,
|
||||
req,
|
||||
undefined,
|
||||
currentNode ? { CurrentNode: currentNode } : undefined,
|
||||
);
|
||||
};
|
||||
|
||||
export const CleanAlertLogs = () => {
|
||||
@@ -43,8 +53,13 @@ export const ListCronJob = (req: Alert.CronJobReq) => {
|
||||
return http.post<Alert.CronJobDTO[]>(`/alert/cronjob/list`, req);
|
||||
};
|
||||
|
||||
export const ListAlertConfigs = () => {
|
||||
return http.post<Alert.AlertConfigInfo[]>(`/alert/config/info`);
|
||||
export const ListAlertConfigs = (currentNode?: string) => {
|
||||
return http.post<Alert.AlertConfigInfo[]>(
|
||||
`/alert/config/info`,
|
||||
{},
|
||||
undefined,
|
||||
currentNode ? { CurrentNode: currentNode } : undefined,
|
||||
);
|
||||
};
|
||||
|
||||
export const DeleteAlertConfig = (req: Alert.DelReq) => {
|
||||
|
||||
@@ -3,8 +3,13 @@ import { ResPage, SearchWithPage } from '../interface';
|
||||
import { Container } from '../interface/container';
|
||||
import { TimeoutEnum } from '@/enums/http-enum';
|
||||
|
||||
export const searchContainer = (params: Container.ContainerSearch) => {
|
||||
return http.post<ResPage<Container.ContainerInfo>>(`/containers/search`, params, TimeoutEnum.T_40S);
|
||||
export const searchContainer = (params: Container.ContainerSearch, currentNode?: string) => {
|
||||
return http.post<ResPage<Container.ContainerInfo>>(
|
||||
`/containers/search`,
|
||||
params,
|
||||
TimeoutEnum.T_40S,
|
||||
currentNode ? { CurrentNode: currentNode } : undefined,
|
||||
);
|
||||
};
|
||||
export const listContainer = () => {
|
||||
return http.post<Array<Container.ContainerOption>>(`/containers/list`, {});
|
||||
@@ -39,8 +44,12 @@ export const downloadContainerFile = (params: { containerID: string; path: strin
|
||||
timeout: TimeoutEnum.T_40S,
|
||||
});
|
||||
};
|
||||
export const loadContainerStatus = () => {
|
||||
return http.get<Container.ContainerStatus>(`/containers/status`);
|
||||
export const loadContainerStatus = (currentNode?: string) => {
|
||||
return http.get<Container.ContainerStatus>(
|
||||
`/containers/status`,
|
||||
{},
|
||||
currentNode ? { headers: { CurrentNode: currentNode } } : {},
|
||||
);
|
||||
};
|
||||
export const loadResourceLimit = () => {
|
||||
return http.get<Container.ResourceLimit>(`/containers/limit`);
|
||||
@@ -72,8 +81,13 @@ export const cleanContainerLog = (containerName: string, operateNode?: string) =
|
||||
const params = operateNode ? `?operateNode=${operateNode}` : '';
|
||||
return http.post(`/containers/clean/log${params}`, { name: containerName }, TimeoutEnum.T_60S);
|
||||
};
|
||||
export const containerItemStats = (containerID: string) => {
|
||||
return http.post<Container.ContainerItemStats>(`/containers/item/stats`, { name: containerID }, TimeoutEnum.T_60S);
|
||||
export const containerItemStats = (containerID: string, currentNode?: string) => {
|
||||
return http.post<Container.ContainerItemStats>(
|
||||
`/containers/item/stats`,
|
||||
{ name: containerID },
|
||||
TimeoutEnum.T_60S,
|
||||
currentNode ? { CurrentNode: currentNode } : undefined,
|
||||
);
|
||||
};
|
||||
export const containerListStats = () => {
|
||||
return http.get<Array<Container.ContainerListStats>>(`/containers/list/stats`);
|
||||
|
||||
@@ -47,8 +47,13 @@ export const deleteCronjob = (params: Cronjob.CronjobDelete) => {
|
||||
return http.post(`/cronjobs/del`, params);
|
||||
};
|
||||
|
||||
export const searchRecords = (params: Cronjob.SearchRecord, timeout?: TimeoutEnum) => {
|
||||
return http.post<ResPage<Cronjob.Record>>(`cronjobs/search/records`, params, timeout);
|
||||
export const searchRecords = (params: Cronjob.SearchRecord, timeout?: TimeoutEnum, currentNode?: string) => {
|
||||
return http.post<ResPage<Cronjob.Record>>(
|
||||
`cronjobs/search/records`,
|
||||
params,
|
||||
timeout,
|
||||
currentNode ? { CurrentNode: currentNode } : undefined,
|
||||
);
|
||||
};
|
||||
|
||||
export const stopCronjob = (id: number) => {
|
||||
|
||||
@@ -21,12 +21,20 @@ export const changeLauncherStatus = (key: string, val: string) => {
|
||||
return http.post(`/dashboard/app/launcher/show`, { key: key, value: val });
|
||||
};
|
||||
|
||||
export const loadBaseInfo = (ioOption: string, netOption: string) => {
|
||||
return http.get<Dashboard.BaseInfo>(`/dashboard/base/${ioOption}/${netOption}`);
|
||||
export const loadBaseInfo = (ioOption: string, netOption: string, currentNode?: string) => {
|
||||
return http.get<Dashboard.BaseInfo>(
|
||||
`/dashboard/base/${ioOption}/${netOption}`,
|
||||
{},
|
||||
currentNode ? { headers: { CurrentNode: currentNode } } : {},
|
||||
);
|
||||
};
|
||||
|
||||
export const loadCurrentInfo = (ioOption: string, netOption: string) => {
|
||||
return http.get<Dashboard.CurrentInfo>(`/dashboard/current/${ioOption}/${netOption}`);
|
||||
export const loadCurrentInfo = (ioOption: string, netOption: string, currentNode?: string) => {
|
||||
return http.get<Dashboard.CurrentInfo>(
|
||||
`/dashboard/current/${ioOption}/${netOption}`,
|
||||
{},
|
||||
currentNode ? { headers: { CurrentNode: currentNode } } : {},
|
||||
);
|
||||
};
|
||||
|
||||
export const loadTopCPU = () => {
|
||||
|
||||
@@ -68,8 +68,13 @@ export const stopDeCompressFile = (taskID: string) => {
|
||||
return http.post('files/decompress/stop', { taskID } as File.FileDeCompressStopReq);
|
||||
};
|
||||
|
||||
export const getFileContent = (params: File.ReqFile) => {
|
||||
return http.post<File.File>('files/content', params);
|
||||
export const getFileContent = (params: File.ReqFile, currentNode?: string) => {
|
||||
return http.post<File.File>(
|
||||
`files/content`,
|
||||
params,
|
||||
TimeoutEnum.T_3M,
|
||||
currentNode ? { CurrentNode: currentNode } : undefined,
|
||||
);
|
||||
};
|
||||
|
||||
export const getPreviewContent = (params: File.PreviewContentReq) => {
|
||||
|
||||
@@ -62,28 +62,50 @@ export const operateFilterChain = (name: string, op: string) => {
|
||||
};
|
||||
|
||||
// monitors
|
||||
export const loadMonitor = (param: Host.MonitorSearch) => {
|
||||
return http.post<Array<Host.MonitorData>>(`/hosts/monitor/search`, param);
|
||||
export const loadMonitor = (param: Host.MonitorSearch, currentNode?: string) => {
|
||||
return http.post<Array<Host.MonitorData>>(
|
||||
`/hosts/monitor/search`,
|
||||
param,
|
||||
TimeoutEnum.T_60S,
|
||||
currentNode ? { CurrentNode: currentNode } : undefined,
|
||||
);
|
||||
};
|
||||
export const getNetworkOptions = () => {
|
||||
return http.get<Array<string>>(`/hosts/monitor/netoptions`);
|
||||
export const getNetworkOptions = (currentNode?: string) => {
|
||||
return http.get<Array<string>>(
|
||||
`/hosts/monitor/netoptions`,
|
||||
{},
|
||||
currentNode ? { headers: { CurrentNode: currentNode } } : {},
|
||||
);
|
||||
};
|
||||
export const getIOOptions = () => {
|
||||
return http.get<Array<string>>(`/hosts/monitor/iooptions`);
|
||||
export const getIOOptions = (currentNode?: string) => {
|
||||
return http.get<Array<string>>(
|
||||
`/hosts/monitor/iooptions`,
|
||||
{},
|
||||
currentNode ? { headers: { CurrentNode: currentNode } } : {},
|
||||
);
|
||||
};
|
||||
export const cleanMonitors = () => {
|
||||
return http.post(`/hosts/monitor/clean`, {});
|
||||
};
|
||||
export const loadMonitorSetting = () => {
|
||||
return http.get<Host.MonitorSetting>(`/hosts/monitor/setting`, {});
|
||||
export const loadMonitorSetting = (currentNode?: string) => {
|
||||
return http.get<Host.MonitorSetting>(
|
||||
`/hosts/monitor/setting`,
|
||||
{},
|
||||
currentNode ? { headers: { CurrentNode: currentNode } } : {},
|
||||
);
|
||||
};
|
||||
export const updateMonitorSetting = (key: string, value: string) => {
|
||||
return http.post(`/hosts/monitor/setting/update`, { key: key, value: value });
|
||||
};
|
||||
|
||||
// ssh
|
||||
export const getSSHInfo = () => {
|
||||
return http.post<Host.SSHInfo>(`/hosts/ssh/search`);
|
||||
export const getSSHInfo = (currentNode?: string) => {
|
||||
return http.post<Host.SSHInfo>(
|
||||
`/hosts/ssh/search`,
|
||||
{},
|
||||
undefined,
|
||||
currentNode ? { CurrentNode: currentNode } : undefined,
|
||||
);
|
||||
};
|
||||
export const operateSSH = (operation: string) => {
|
||||
return http.post(`/hosts/ssh/operate`, { operation: operation }, TimeoutEnum.T_40S);
|
||||
@@ -116,8 +138,13 @@ export const deleteCert = (ids: Array<number>, forceDelete: boolean) => {
|
||||
export const syncCert = () => {
|
||||
return http.post(`/hosts/ssh/cert/sync`);
|
||||
};
|
||||
export const loadSSHLogs = (params: Host.searchSSHLog) => {
|
||||
return http.post<ResPage<Host.sshHistory>>(`/hosts/ssh/log`, params);
|
||||
export const loadSSHLogs = (params: Host.searchSSHLog, currentNode?: string) => {
|
||||
return http.post<ResPage<Host.sshHistory>>(
|
||||
`/hosts/ssh/log`,
|
||||
params,
|
||||
undefined,
|
||||
currentNode ? { CurrentNode: currentNode } : undefined,
|
||||
);
|
||||
};
|
||||
export const exportSSHLogs = (params: Host.searchSSHLog) => {
|
||||
return http.post<string>(`/hosts/ssh/log/export`, params, TimeoutEnum.T_40S);
|
||||
|
||||
@@ -7,8 +7,13 @@ export const getOperationLogs = (info: Log.SearchOpLog) => {
|
||||
return http.post<ResPage<Log.OperationLog>>(`/core/logs/operation`, info);
|
||||
};
|
||||
|
||||
export const getLoginLogs = (info: Log.SearchLgLog) => {
|
||||
return http.post<ResPage<Log.LoginLogs>>(`/core/logs/login`, info);
|
||||
export const getLoginLogs = (info: Log.SearchLgLog, currentNode?: string) => {
|
||||
return http.post<ResPage<Log.LoginLogs>>(
|
||||
`/core/logs/login`,
|
||||
info,
|
||||
undefined,
|
||||
currentNode ? { CurrentNode: currentNode } : undefined,
|
||||
);
|
||||
};
|
||||
|
||||
export const getSystemFiles = (node?: string) => {
|
||||
|
||||
@@ -110,8 +110,13 @@ export const updateAcmeAccount = (req: Website.AcmeAccountUpdate) => {
|
||||
return http.post<Website.AcmeAccount>(`/websites/acme/update`, req, TimeoutEnum.T_10M);
|
||||
};
|
||||
|
||||
export const searchSSL = (req: ReqPage) => {
|
||||
return http.post<ResPage<Website.SSLDTO>>(`/websites/ssl/search`, req);
|
||||
export const searchSSL = (req: ReqPage, currentNode?: string) => {
|
||||
return http.post<ResPage<Website.SSLDTO>>(
|
||||
`/websites/ssl/search`,
|
||||
req,
|
||||
TimeoutEnum.T_40S,
|
||||
currentNode ? { CurrentNode: currentNode } : undefined,
|
||||
);
|
||||
};
|
||||
|
||||
export const listSSL = (req: Website.SSLReq) => {
|
||||
|
||||
@@ -3976,6 +3976,9 @@ const message = {
|
||||
setting: 'Settings',
|
||||
page: {
|
||||
enterprise: 'Enterprise',
|
||||
reportNode: 'Report Node',
|
||||
selectReportNode: 'Select report node',
|
||||
currentNode: 'Current',
|
||||
scoreMeta: '{0} points deducted · {1} risks',
|
||||
hostAddress: 'Host Address',
|
||||
panelVersion: 'Panel Version',
|
||||
@@ -4202,7 +4205,7 @@ const message = {
|
||||
alertFailedLogs: 'Failed Alert Logs',
|
||||
alertPendingLogs: 'Pending Sync Logs',
|
||||
alertPending: 'Pending Sync',
|
||||
alertTaskTypeStats: 'Alert Type Statistics',
|
||||
alertTaskStats: 'Alert Task Statistics',
|
||||
alertTaskType: 'Alert Type',
|
||||
alertLogStatusStats: 'Alert Execution Status',
|
||||
alertHealthNormal: 'Normal',
|
||||
|
||||
@@ -4034,6 +4034,9 @@ const message = {
|
||||
setting: 'Configuración',
|
||||
page: {
|
||||
enterprise: 'Enterprise',
|
||||
reportNode: 'Report Node',
|
||||
selectReportNode: 'Select report node',
|
||||
currentNode: 'Current',
|
||||
scoreMeta: '{0} points deducted · {1} risks',
|
||||
hostAddress: 'Host Address',
|
||||
panelVersion: 'Panel Version',
|
||||
@@ -4250,7 +4253,7 @@ const message = {
|
||||
alertFailedLogs: 'Failed Alert Logs',
|
||||
alertPendingLogs: 'Pending Sync Logs',
|
||||
alertPending: 'Pending Sync',
|
||||
alertTaskTypeStats: 'Alert Type Statistics',
|
||||
alertTaskStats: 'Alert Task Statistics',
|
||||
alertTaskType: 'Alert Type',
|
||||
alertLogStatusStats: 'Alert Execution Status',
|
||||
alertHealthNormal: 'Normal',
|
||||
|
||||
@@ -4016,6 +4016,9 @@ const message = {
|
||||
setting: '設定',
|
||||
page: {
|
||||
enterprise: 'Enterprise',
|
||||
reportNode: 'Report Node',
|
||||
selectReportNode: 'Select report node',
|
||||
currentNode: 'Current',
|
||||
scoreMeta: '{0} points deducted · {1} risks',
|
||||
hostAddress: 'Host Address',
|
||||
panelVersion: 'Panel Version',
|
||||
@@ -4232,7 +4235,7 @@ const message = {
|
||||
alertFailedLogs: 'Failed Alert Logs',
|
||||
alertPendingLogs: 'Pending Sync Logs',
|
||||
alertPending: 'Pending Sync',
|
||||
alertTaskTypeStats: 'Alert Type Statistics',
|
||||
alertTaskStats: 'Alert Task Statistics',
|
||||
alertTaskType: 'Alert Type',
|
||||
alertLogStatusStats: 'Alert Execution Status',
|
||||
alertHealthNormal: 'Normal',
|
||||
|
||||
@@ -3928,6 +3928,9 @@ const message = {
|
||||
setting: '설정',
|
||||
page: {
|
||||
enterprise: 'Enterprise',
|
||||
reportNode: 'Report Node',
|
||||
selectReportNode: 'Select report node',
|
||||
currentNode: 'Current',
|
||||
scoreMeta: '{0} points deducted · {1} risks',
|
||||
hostAddress: 'Host Address',
|
||||
panelVersion: 'Panel Version',
|
||||
@@ -4144,7 +4147,7 @@ const message = {
|
||||
alertFailedLogs: 'Failed Alert Logs',
|
||||
alertPendingLogs: 'Pending Sync Logs',
|
||||
alertPending: 'Pending Sync',
|
||||
alertTaskTypeStats: 'Alert Type Statistics',
|
||||
alertTaskStats: 'Alert Task Statistics',
|
||||
alertTaskType: 'Alert Type',
|
||||
alertLogStatusStats: 'Alert Execution Status',
|
||||
alertHealthNormal: 'Normal',
|
||||
|
||||
@@ -4071,6 +4071,9 @@ const message = {
|
||||
setting: 'Tetapan',
|
||||
page: {
|
||||
enterprise: 'Enterprise',
|
||||
reportNode: 'Report Node',
|
||||
selectReportNode: 'Select report node',
|
||||
currentNode: 'Current',
|
||||
scoreMeta: '{0} points deducted · {1} risks',
|
||||
hostAddress: 'Host Address',
|
||||
panelVersion: 'Panel Version',
|
||||
@@ -4287,7 +4290,7 @@ const message = {
|
||||
alertFailedLogs: 'Failed Alert Logs',
|
||||
alertPendingLogs: 'Pending Sync Logs',
|
||||
alertPending: 'Pending Sync',
|
||||
alertTaskTypeStats: 'Alert Type Statistics',
|
||||
alertTaskStats: 'Alert Task Statistics',
|
||||
alertTaskType: 'Alert Type',
|
||||
alertLogStatusStats: 'Alert Execution Status',
|
||||
alertHealthNormal: 'Normal',
|
||||
|
||||
@@ -4210,6 +4210,9 @@ const message = {
|
||||
setting: 'Configurações',
|
||||
page: {
|
||||
enterprise: 'Enterprise',
|
||||
reportNode: 'Report Node',
|
||||
selectReportNode: 'Select report node',
|
||||
currentNode: 'Current',
|
||||
scoreMeta: '{0} points deducted · {1} risks',
|
||||
hostAddress: 'Host Address',
|
||||
panelVersion: 'Panel Version',
|
||||
@@ -4426,7 +4429,7 @@ const message = {
|
||||
alertFailedLogs: 'Failed Alert Logs',
|
||||
alertPendingLogs: 'Pending Sync Logs',
|
||||
alertPending: 'Pending Sync',
|
||||
alertTaskTypeStats: 'Alert Type Statistics',
|
||||
alertTaskStats: 'Alert Task Statistics',
|
||||
alertTaskType: 'Alert Type',
|
||||
alertLogStatusStats: 'Alert Execution Status',
|
||||
alertHealthNormal: 'Normal',
|
||||
|
||||
@@ -4062,6 +4062,9 @@ const message = {
|
||||
setting: 'Настройки',
|
||||
page: {
|
||||
enterprise: 'Enterprise',
|
||||
reportNode: 'Report Node',
|
||||
selectReportNode: 'Select report node',
|
||||
currentNode: 'Current',
|
||||
scoreMeta: '{0} points deducted · {1} risks',
|
||||
hostAddress: 'Host Address',
|
||||
panelVersion: 'Panel Version',
|
||||
@@ -4278,7 +4281,7 @@ const message = {
|
||||
alertFailedLogs: 'Failed Alert Logs',
|
||||
alertPendingLogs: 'Pending Sync Logs',
|
||||
alertPending: 'Pending Sync',
|
||||
alertTaskTypeStats: 'Alert Type Statistics',
|
||||
alertTaskStats: 'Alert Task Statistics',
|
||||
alertTaskType: 'Alert Type',
|
||||
alertLogStatusStats: 'Alert Execution Status',
|
||||
alertHealthNormal: 'Normal',
|
||||
|
||||
@@ -4063,6 +4063,9 @@ const message = {
|
||||
setting: 'Ayarlar',
|
||||
page: {
|
||||
enterprise: 'Enterprise',
|
||||
reportNode: 'Report Node',
|
||||
selectReportNode: 'Select report node',
|
||||
currentNode: 'Current',
|
||||
scoreMeta: '{0} points deducted · {1} risks',
|
||||
hostAddress: 'Host Address',
|
||||
panelVersion: 'Panel Version',
|
||||
@@ -4279,7 +4282,7 @@ const message = {
|
||||
alertFailedLogs: 'Failed Alert Logs',
|
||||
alertPendingLogs: 'Pending Sync Logs',
|
||||
alertPending: 'Pending Sync',
|
||||
alertTaskTypeStats: 'Alert Type Statistics',
|
||||
alertTaskStats: 'Alert Task Statistics',
|
||||
alertTaskType: 'Alert Type',
|
||||
alertLogStatusStats: 'Alert Execution Status',
|
||||
alertHealthNormal: 'Normal',
|
||||
|
||||
@@ -3702,6 +3702,9 @@ const message = {
|
||||
setting: '設置',
|
||||
page: {
|
||||
enterprise: '企業版',
|
||||
reportNode: '報表節點',
|
||||
selectReportNode: '選擇報表節點',
|
||||
currentNode: '當前節點',
|
||||
scoreMeta: '扣分 {0} 分 · 風險 {1} 項',
|
||||
hostAddress: '主機地址',
|
||||
panelVersion: '面板版本',
|
||||
@@ -3913,7 +3916,7 @@ const message = {
|
||||
alertFailedLogs: '失敗告警日誌',
|
||||
alertPendingLogs: '待同步日誌',
|
||||
alertPending: '待同步',
|
||||
alertTaskTypeStats: '告警類型統計',
|
||||
alertTaskStats: '告警任務統計',
|
||||
alertTaskType: '告警類型',
|
||||
alertLogStatusStats: '告警執行狀態',
|
||||
alertHealthNormal: '正常',
|
||||
|
||||
@@ -4290,6 +4290,9 @@ const message = {
|
||||
setting: '设置',
|
||||
page: {
|
||||
enterprise: '企业版',
|
||||
reportNode: '报表节点',
|
||||
selectReportNode: '选择报表节点',
|
||||
currentNode: '当前节点',
|
||||
scoreMeta: '扣分 {0} 分 · 风险 {1} 项',
|
||||
hostAddress: '主机地址',
|
||||
panelVersion: '面板版本',
|
||||
@@ -4511,7 +4514,7 @@ const message = {
|
||||
alertFailedLogs: '失败告警日志',
|
||||
alertPendingLogs: '待同步日志',
|
||||
alertPending: '待同步',
|
||||
alertTaskTypeStats: '告警类型统计',
|
||||
alertTaskStats: '告警任务统计',
|
||||
alertTaskType: '告警类型',
|
||||
alertLogStatusStats: '告警执行状态',
|
||||
alertHealthNormal: '正常',
|
||||
|
||||
@@ -100,6 +100,22 @@ export function dateFormatSimpleWithSecond(dataStr: any) {
|
||||
return `${String(y)}-${String(m)}-${String(d)} ${String(h)}:${String(minute)}:${String(second)}`;
|
||||
}
|
||||
|
||||
export function dateFormatRFC3339(dataStr: any) {
|
||||
const date = new Date(dataStr);
|
||||
const y = date.getFullYear();
|
||||
const m = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const d = String(date.getDate()).padStart(2, '0');
|
||||
const h = String(date.getHours()).padStart(2, '0');
|
||||
const minute = String(date.getMinutes()).padStart(2, '0');
|
||||
const second = String(date.getSeconds()).padStart(2, '0');
|
||||
const offset = -date.getTimezoneOffset();
|
||||
const sign = offset >= 0 ? '+' : '-';
|
||||
const absOffset = Math.abs(offset);
|
||||
const offsetHour = String(Math.floor(absOffset / 60)).padStart(2, '0');
|
||||
const offsetMinute = String(absOffset % 60).padStart(2, '0');
|
||||
return `${y}-${m}-${d}T${h}:${minute}:${second}${sign}${offsetHour}:${offsetMinute}`;
|
||||
}
|
||||
|
||||
export function dateFormatForName(dataStr: any) {
|
||||
const date = new Date(dataStr);
|
||||
const y = date.getFullYear();
|
||||
|
||||
Reference in New Issue
Block a user