-
Notifications
You must be signed in to change notification settings - Fork 613
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CONSOLE-4269: add custom ConsolePlugin resource details page
- Loading branch information
Showing
23 changed files
with
595 additions
and
46 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
31 changes: 31 additions & 0 deletions
31
frontend/packages/console-app/src/components/console-operator/ConsolePluginBackendDetail.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,31 @@ | ||
import * as React from 'react'; | ||
import { DetailsItemComponentProps } from '@console/dynamic-plugin-sdk/src/extensions/details-item'; | ||
import { | ||
getGroupVersionKindForModel, | ||
ResourceLink, | ||
} from '@console/dynamic-plugin-sdk/src/lib-core'; | ||
import { ServiceModel } from '@console/internal/models'; | ||
import { ConsolePluginKind } from '@console/internal/module/k8s'; | ||
import { DASH } from '@console/shared/src/constants'; | ||
|
||
const ConsolePluginBackendDetail: React.FC<ConsolePluginBackendDetailProps> = ({ | ||
obj: { | ||
spec: { backend }, | ||
}, | ||
}) => | ||
// only Service is supported per the ConsolePlugin schema | ||
backend.type === ServiceModel.label ? ( | ||
<ResourceLink | ||
name={backend.service.name} | ||
namespace={backend.service.namespace} | ||
groupVersionKind={getGroupVersionKindForModel(ServiceModel)} | ||
/> | ||
) : ( | ||
<>{DASH}</> | ||
); | ||
|
||
type ConsolePluginBackendDetailProps = Omit<DetailsItemComponentProps, 'obj'> & { | ||
obj: ConsolePluginKind; | ||
}; | ||
|
||
export default ConsolePluginBackendDetail; |
28 changes: 28 additions & 0 deletions
28
...end/packages/console-app/src/components/console-operator/ConsolePluginCSPStatusDetail.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,28 @@ | ||
import * as React from 'react'; | ||
import { DetailsItemComponentProps } from '@console/dynamic-plugin-sdk/src/extensions/details-item'; | ||
import { isLoadedDynamicPluginInfo } from '@console/plugin-sdk/src'; | ||
import { usePluginStore } from '@console/plugin-sdk/src/api/usePluginStore'; | ||
import { DASH } from '@console/shared/src/constants'; | ||
import { ConsolePluginCSPStatus } from './ConsoleOperatorConfig'; | ||
|
||
const ConsolePluginCSPStatusDetail: React.FC<DetailsItemComponentProps> = ({ obj }) => { | ||
const pluginStore = usePluginStore(); | ||
const pluginName = React.useMemo(() => obj?.metadata?.name, [obj?.metadata?.name]); | ||
|
||
const pluginInfo = React.useMemo(() => pluginStore.findDynamicPluginInfo(pluginName), [ | ||
pluginStore, | ||
pluginName, | ||
]); | ||
|
||
return pluginInfo ? ( | ||
<ConsolePluginCSPStatus | ||
hasViolations={ | ||
isLoadedDynamicPluginInfo(pluginInfo) ? pluginInfo.hasCSPViolations ?? false : false | ||
} | ||
/> | ||
) : ( | ||
<>{DASH}</> | ||
); | ||
}; | ||
|
||
export default ConsolePluginCSPStatusDetail; |
Oops, something went wrong.