mirror of
https://github.com/portainer/portainer.git
synced 2025-08-05 05:45:22 +02:00
feat(templates): allow managing git based templates [EE-2600] (#7855)
Co-authored-by: itsconquest <william.conquest@portainer.io> Co-authored-by: oscarzhou <oscar.zhou@portainer.io> Co-authored-by: Chaim Lev-Ari <chiptus@users.noreply.github.com>
This commit is contained in:
parent
30a2bb0495
commit
c650868fe9
32 changed files with 944 additions and 101 deletions
25
app/react/portainer/gitops/gitops.service.ts
Normal file
25
app/react/portainer/gitops/gitops.service.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
|
||||
interface PreviewPayload {
|
||||
repository: string;
|
||||
targetFile: string;
|
||||
reference?: string;
|
||||
username?: string;
|
||||
password?: string;
|
||||
tlsSkipVerify?: boolean;
|
||||
}
|
||||
|
||||
interface PreviewResponse {
|
||||
FileContent: string;
|
||||
}
|
||||
|
||||
export async function getFilePreview(payload: PreviewPayload) {
|
||||
try {
|
||||
const {
|
||||
data: { FileContent },
|
||||
} = await axios.post<PreviewResponse>('/gitops/repo/file/preview', payload);
|
||||
return FileContent;
|
||||
} catch (e) {
|
||||
throw parseAxiosError(e as Error, 'Unable to fetch file from git');
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@ interface SearchPayload {
|
|||
reference?: string;
|
||||
username?: string;
|
||||
password?: string;
|
||||
tlsSkipVerify?: boolean;
|
||||
}
|
||||
|
||||
export function useSearch(payload: SearchPayload, enabled: boolean) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue