-
Notifications
You must be signed in to change notification settings - Fork 17
feat(Header): use cluster domain if cluster name is undefined #1271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
85ed1f6 to
fa7f73e
Compare
fa7f73e to
63d895c
Compare
|
|
||
| const normalizedClusterName = name ?? clusterName; | ||
|
|
||
| const {currentData: baseClusterInfo} = clusterApi.useGetClusterInfoQuery( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this query contain info form getClusterBaseInfo? Why do use both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, you're right. Will use it from getClusterBaseInfo if available!
ed36051 to
2a31967
Compare
9d17b33 to
244a2f5
Compare
| setDefaultClusterTab(state, action: PayloadAction<ClusterTab>) { | ||
| state.defaultClusterTab = action.payload; | ||
| }, | ||
| setClusterTitle: (state, action: PayloadAction<string>) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add only selector, something like this:
const createClusterInfoSelector = createSelector(
(clusterName?: string) => clusterName,
(clusterName) => clusterApi.endpoints.getClusterInfo.select(clusterName),
);
export const selectClusterInfo = createSelector(
(state: RootState) => state,
(_state: RootState, clusterName?: string) => createClusterInfoSelector(clusterName),
(state, selectGetTopic) => selectGetTopic(state).data,
);
export const selectClusterTitle = createSelector(
(_state: RootState, clusterName?: string) => clusterName,
(state: RootState, clusterName?: string) => selectClusterInfo(state, clusterName),
(clusterName, clusterInfo) => {
const {Name, Domain} = clusterInfo?.clusterData || {};
return Name || clusterName || normalizeDomain(Domain) || CLUSTER_DEFAULT_TITLE;
},
);
src/containers/Cluster/Cluster.tsx
Outdated
| }: ClusterProps) { | ||
| const container = React.useRef<HTMLDivElement>(null); | ||
|
|
||
| const clusterTitle = useTypedSelector(selectClusterTitle); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| const clusterTitle = useTypedSelector(selectClusterTitle); | |
| const clusterTitle = useTypedSelector((state) => selectClusterTitle(state, clusterName ?? undefined)); |
| export const selectClusterInfo = createSelector( | ||
| (state: RootState) => state, | ||
| (_state: RootState, clusterName?: string) => createClusterInfoSelector(clusterName), | ||
| (state, selectGetTopic) => selectGetTopic(state).data, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
selectGetTopic - please rename
cbe6182 to
76490d4
Compare
closes #1252
Stand
CI Results
Test Status:⚠️ FLAKY
📊 Full Report
Bundle Size: ✅
Current: 78.86 MB | Main: 78.86 MB
Diff: +0.00 MB (0.00%)
✅ Bundle size unchanged.
ℹ️ CI Information