Skip to content

Commit

Permalink
fix: Fix log search api
Browse files Browse the repository at this point in the history
  • Loading branch information
leoliu committed Jun 8, 2020
1 parent 0f3c8da commit 4ecfb6d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
13 changes: 8 additions & 5 deletions src/components/Modals/LogSearch/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ export default class LogSearchModal extends React.Component {

@computed
get clustersOpts() {
return this.clusters.list.data.map(({ name }) => ({
value: name,
label: `${t('Cluster')}: ${name}`,
}))
return this.clusters.list.data
.filter(item => item.configz.logging)
.map(({ name }) => ({
value: name,
label: `${t('Cluster')}: ${name}`,
}))
}

initStepState() {
Expand Down Expand Up @@ -125,9 +127,10 @@ export default class LogSearchModal extends React.Component {
async componentDidMount() {
await this.clusters.fetchList({
limit: -1,
ascending: true,
})

this.searchInputState.setCluster(this.clusters.list.data[0].name)
this.searchInputState.setCluster(this.clustersOpts[0].value)
}

render() {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ export const isAppsPage = (path = location.pathname) =>
export const getClusterUrl = url => {
let requestURL = url

const reg = new RegExp(/\/(api|apis|kapis)\/(.*)\/(klusters\/[^/]*)\/(.*)/)
const reg = new RegExp(/\/(api|apis|kapis)\/(.*)\/?(klusters\/[^/]*)\/(.*)/)
const match = requestURL.match(reg)

if (match && match.length === 5) {
Expand Down
1 change: 1 addition & 0 deletions src/utils/object.mapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,7 @@ const ClusterMapper = item => {
return {
...getBaseInfo(item),
conditions,
configz: get(item, 'status.configz', {}),
provider: get(item, 'spec.provider'),
isHost:
get(
Expand Down

0 comments on commit 4ecfb6d

Please sign in to comment.