-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathApplicationNavPage.tsx
More file actions
110 lines (102 loc) · 2.86 KB
/
ApplicationNavPage.tsx
File metadata and controls
110 lines (102 loc) · 2.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import * as React from 'react';
import { useParams } from 'react-router-dom-v5-compat';
import { useApplicationActionsProvider } from '@gitops/hooks/useApplicationActionsProvider';
import { ApplicationKind, ApplicationModel } from '@gitops/models/ApplicationModel';
import { useGitOpsTranslation } from '@gitops/utils/hooks/useGitOpsTranslation';
import { HorizontalNav } from '@openshift-console/dynamic-plugin-sdk';
import { Bullseye, Spinner } from '@patternfly/react-core';
import { useFleetK8sWatchResource } from '@stolostron/multicluster-sdk';
import DetailsPageHeader from '../shared/DetailsPageHeader/DetailsPageHeader';
import EventsTab from '../shared/EventsTab/EventsTab';
import ResourceYAMLTab from '../shared/ResourceYAMLTab/ResourceYAMLTab';
import ApplicationDetailsTab from './ApplicationDetailsTab';
import ApplicationHistoryTab from './ApplicationHistoryTab';
import ApplicationResourcesTab from './ApplicationResourcesTab';
import ApplicationSourcesTab from './ApplicationSourcesTab';
import ApplicationSyncStatusTab from './ApplicationSyncStatusTab';
const ApplicationNavPage: React.FC = () => {
const { t } = useGitOpsTranslation();
const {
cluster,
name,
ns: namespace,
} = useParams<{
cluster?: string;
name: string;
ns: string;
}>();
const [application, loaded] = useFleetK8sWatchResource<ApplicationKind>({
groupVersionKind: {
group: 'argoproj.io',
kind: 'Application',
version: 'v1alpha1',
},
cluster,
name,
namespace,
});
const [actions] = useApplicationActionsProvider(application);
const pages = React.useMemo(
() => [
{
href: '',
name: t('Details'),
component: ApplicationDetailsTab,
},
{
href: 'yaml',
name: t('YAML'),
component: ResourceYAMLTab,
},
{
href: 'sources',
name: t('Sources'),
component: ApplicationSourcesTab,
},
{
href: 'resources',
name: t('Resources'),
component: ApplicationResourcesTab,
},
{
href: 'syncStatus',
name: t('Sync Status'),
component: ApplicationSyncStatusTab,
},
{
href: 'History',
name: t('History'),
component: ApplicationHistoryTab,
},
{
href: 'events',
name: t('Events'),
component: EventsTab,
},
],
[t],
);
return (
<>
<DetailsPageHeader
obj={application}
model={ApplicationModel}
namespace={namespace}
name={name}
actions={actions}
iconText="A"
iconTitle="Argo CD Application"
/>
{loaded ? (
<div>
<HorizontalNav pages={pages} resource={application} />
</div>
) : (
<Bullseye>
<Spinner size="xl" />
</Bullseye>
)}
</>
);
};
export default ApplicationNavPage;