-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ref: DTCORE-2664 Signed-off-by: Florian Renaut <[email protected]>
- Loading branch information
Showing
15 changed files
with
228 additions
and
35 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
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
50 changes: 50 additions & 0 deletions
50
packages/manager/apps/pci-load-balancer/src/pages/detail/log/LoadBalancerLogsProvider.tsx
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,50 @@ | ||
import { LogProvider } from '@ovh-ux/manager-pci-common'; | ||
import { useMe } from '@ovh-ux/manager-react-components'; | ||
import { LOAD_BALANCER_LOGS_SERVICE_GUIDE_LINK } from '@/constants'; | ||
|
||
export interface KubeLogsProviderProps { | ||
loadBalancerId: string; | ||
projectId: string; | ||
region: string; | ||
} | ||
|
||
export function LoadBalancerLogsProvider({ | ||
children, | ||
loadBalancerId, | ||
projectId, | ||
region, | ||
}: React.PropsWithChildren<KubeLogsProviderProps>) { | ||
const ovhSubsidiary = useMe()?.me?.ovhSubsidiary; | ||
return ( | ||
<LogProvider | ||
logsApiURL={`/cloud/project/${projectId}/region/${region}/loadbalancing/loadbalancer/${loadBalancerId}/log`} | ||
logsKeys={[ | ||
'client_ip', | ||
'http_verb', | ||
'http_request', | ||
'http_version_num', | ||
'http_status_int', | ||
'bytes_uploaded_int', | ||
]} | ||
logsKind="haproxy" | ||
logsGuideURL={ | ||
LOAD_BALANCER_LOGS_SERVICE_GUIDE_LINK[ovhSubsidiary] || | ||
LOAD_BALANCER_LOGS_SERVICE_GUIDE_LINK.DEFAULT | ||
} | ||
logsTracking={ | ||
{ | ||
// @TODO wait for implementation | ||
// graylogWatch: '', | ||
// ldpDetails: '', | ||
// subscribe: '', | ||
// unsubscribe: '', | ||
// createAccount: '', | ||
// createDataStream: '', | ||
// transfer: '', | ||
} | ||
} | ||
> | ||
{children} | ||
</LogProvider> | ||
); | ||
} |
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
124 changes: 124 additions & 0 deletions
124
packages/manager/apps/pci-load-balancer/src/pages/detail/log/Streams.page.tsx
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,124 @@ | ||
import { useHref, useParams } from 'react-router-dom'; | ||
import { | ||
ODS_BUTTON_SIZE, | ||
ODS_BUTTON_VARIANT, | ||
ODS_ICON_NAME, | ||
ODS_ICON_SIZE, | ||
ODS_TEXT_LEVEL, | ||
ODS_TEXT_SIZE, | ||
} from '@ovhcloud/ods-components'; | ||
import { ODS_THEME_COLOR_INTENT } from '@ovhcloud/ods-common-theming'; | ||
import { | ||
OsdsButton, | ||
OsdsIcon, | ||
OsdsLink, | ||
OsdsText, | ||
} from '@ovhcloud/ods-components/react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { useContext, useState } from 'react'; | ||
import { | ||
Notifications, | ||
useNotifications, | ||
} from '@ovh-ux/manager-react-components'; | ||
import { ShellContext } from '@ovh-ux/manager-react-shell-client'; | ||
import { | ||
DbaasLogsAccountSelector, | ||
StreamsList, | ||
TDbaasLog, | ||
} from '@ovh-ux/manager-pci-common'; | ||
import { LoadBalancerLogsProvider } from './LoadBalancerLogsProvider'; | ||
|
||
export default function StreamsPage() { | ||
const { projectId, loadBalancerId, region } = useParams(); | ||
const { t } = useTranslation('logs'); | ||
const { t: tCommon } = useTranslation('pci-common'); | ||
const { navigation } = useContext(ShellContext).shell; | ||
const backHref = useHref('../logs'); | ||
const { clearNotifications } = useNotifications(); | ||
const [account, setAccount] = useState<TDbaasLog>(); | ||
|
||
const gotoAddDataStream = async () => | ||
navigation | ||
.getURL( | ||
'dedicated', | ||
`#/dbaas/logs/${account?.serviceName}/streams/add`, | ||
{}, | ||
) | ||
.then((url: string) => window.open(url, '_blank')); | ||
|
||
return ( | ||
<LoadBalancerLogsProvider | ||
loadBalancerId={loadBalancerId} | ||
projectId={projectId} | ||
region={region} | ||
> | ||
<Notifications /> | ||
<div className="mb-6"> | ||
<OsdsLink | ||
color={ODS_THEME_COLOR_INTENT.primary} | ||
href={backHref} | ||
onClick={() => { | ||
clearNotifications(); | ||
}} | ||
> | ||
<span slot="start"> | ||
<OsdsIcon | ||
className="mr-4" | ||
name={ODS_ICON_NAME.ARROW_LEFT} | ||
color={ODS_THEME_COLOR_INTENT.primary} | ||
size={ODS_ICON_SIZE.xxs} | ||
/> | ||
</span> | ||
{tCommon('common_back_button_back_to_previous_page')} | ||
</OsdsLink> | ||
</div> | ||
<OsdsText | ||
level={ODS_TEXT_LEVEL.heading} | ||
size={ODS_TEXT_SIZE._400} | ||
color={ODS_THEME_COLOR_INTENT.text} | ||
> | ||
{t('logs_list_title')} | ||
</OsdsText> | ||
<p> | ||
<OsdsText | ||
level={ODS_TEXT_LEVEL.body} | ||
size={ODS_TEXT_SIZE._400} | ||
color={ODS_THEME_COLOR_INTENT.text} | ||
> | ||
{t('octavia_load_balancer_data_streams_description_haproxy')} | ||
</OsdsText> | ||
</p> | ||
|
||
<OsdsButton | ||
className="mt-4" | ||
color={ODS_THEME_COLOR_INTENT.primary} | ||
size={ODS_BUTTON_SIZE.sm} | ||
variant={ODS_BUTTON_VARIANT.stroked} | ||
onClick={() => { | ||
gotoAddDataStream(); | ||
}} | ||
inline | ||
> | ||
<span slot="start"> | ||
<OsdsIcon | ||
name={ODS_ICON_NAME.ADD} | ||
size={ODS_ICON_SIZE.xxs} | ||
color={ODS_THEME_COLOR_INTENT.primary} | ||
/> | ||
</span> | ||
{t('logs_list_add_data_stream_button')} | ||
</OsdsButton> | ||
|
||
<DbaasLogsAccountSelector | ||
account={account} | ||
onAccountChange={setAccount} | ||
/> | ||
|
||
{account && ( | ||
<div className="mt-4"> | ||
<StreamsList account={account} serviceName={loadBalancerId} /> | ||
</div> | ||
)} | ||
</LoadBalancerLogsProvider> | ||
); | ||
} |
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