forked from grafana/grafana
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:percona/grafana into PMM-12476-clus…
…ter-view-search
- Loading branch information
Showing
30 changed files
with
1,591 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
export const Messages = { | ||
dumps: { | ||
columns: { | ||
id: 'Id', | ||
status: 'Status', | ||
created: 'Created', | ||
startDate: 'Start Date', | ||
endDate: 'End Date', | ||
timeRange: 'Time Range', | ||
startTime: 'Start Time', | ||
endTime: 'End Time', | ||
serviceNames: 'Service Names', | ||
}, | ||
actions: { | ||
download: 'Download', | ||
sendToSupport: 'Send to Support', | ||
delete: 'Delete', | ||
viewLogs: 'View logs', | ||
deleteDumpMessage: 'Are you sure you want to delete this PMM dump?', | ||
deleteMultipleDumpsMessage: 'Are you sure you want to delete these PMM dumps?', | ||
selectServices: 'Select multiple datasets to bulk edit them.', | ||
addressRequired: 'Address is required.', | ||
nameRequired: 'Name is required.', | ||
passwordRequired: 'Password is required.', | ||
directoryRequired: 'Directory is required.', | ||
addressPlaceholder: 'sftp.percona.com', | ||
savingButton: 'Saving...', | ||
sendButton: 'Send', | ||
cancelButton: 'Cancel', | ||
}, | ||
emptyTable: 'No dumps available', | ||
createDataset: 'Create dataset', | ||
}, | ||
dumpLogs: { | ||
getLogsTitle: (name: string) => `Logs for ${name}`, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { CancelToken } from 'axios'; | ||
|
||
import { PmmDump, ExportDatasetProps } from 'app/percona/shared/core/reducers/pmmDump/pmmDump.types'; | ||
import { api } from 'app/percona/shared/helpers/api'; | ||
|
||
import { | ||
DumpLogs, | ||
DumpLogResponse, | ||
SendToSupportRequestBody, | ||
DeleteDump, | ||
PmmDumpResponse, | ||
ExportResponse, | ||
} from './PmmDump.types'; | ||
|
||
const BASE_URL = '/v1/management/dump/Dumps'; | ||
const link = document.createElement('a'); | ||
|
||
const delay = (ms: number): Promise<void> => { | ||
return new Promise((resolve) => setTimeout(resolve, ms)); | ||
}; | ||
|
||
export const PMMDumpService = { | ||
async getLogs(artifactId: string, offset: number, limit: number, token?: CancelToken): Promise<DumpLogs> { | ||
const { logs = [], end } = await api.post<DumpLogResponse, Object>( | ||
`${BASE_URL}/GetLogs`, | ||
{ | ||
dump_id: artifactId, | ||
offset, | ||
limit, | ||
}, | ||
false, | ||
token | ||
); | ||
return { | ||
logs: logs.map(({ chunk_id = 0, data, time }) => ({ id: chunk_id, data, time })), | ||
end, | ||
}; | ||
}, | ||
async list(): Promise<PmmDump[]> { | ||
const response = await api.post<PmmDumpResponse, void>(`${BASE_URL}/List`, undefined); | ||
return response.dumps || []; | ||
}, | ||
async delete(dumpIds: string[]) { | ||
await api.post<void, DeleteDump>(`${BASE_URL}/Delete`, { dump_ids: dumpIds }); | ||
}, | ||
async downloadAll(dumpIds: string[], index = 0): Promise<void> { | ||
for (let i = index; i < dumpIds.length; i++) { | ||
await this.download(dumpIds, i); | ||
} | ||
}, | ||
async download(dumpIds: string[], index: number): Promise<void> { | ||
return new Promise<void>(async (resolve) => { | ||
const dumpId = dumpIds[index]; | ||
|
||
link.setAttribute('href', `${window.location.origin}/dump/${dumpId}.tar.gz`); | ||
link.setAttribute('download', `${dumpId}.tar.gz`); | ||
document.body.appendChild(link); | ||
link.click(); | ||
document.body.removeChild(link); | ||
await delay(900); | ||
resolve(); | ||
}); | ||
}, | ||
async sendToSupport(body: SendToSupportRequestBody) { | ||
await api.post<void, DeleteDump>(`${BASE_URL}/Upload`, body, true); | ||
}, | ||
async trigger(body: ExportDatasetProps, token?: CancelToken): Promise<string> { | ||
const res = await api.post<ExportResponse, ExportDatasetProps>(`${BASE_URL}/Start`, body, false, token); | ||
return res.dump_id; | ||
}, | ||
}; |
Oops, something went wrong.