Skip to content

Commit

Permalink
Merge pull request #1226 from leoendless/hotfix/logQueryExport
Browse files Browse the repository at this point in the history
fix: Fix log query export url
  • Loading branch information
ks-ci-bot authored Aug 28, 2020
2 parents ed2fe1c + 92e2162 commit 1117d54
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
3 changes: 2 additions & 1 deletion src/components/Cards/LogQuery/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,11 @@ class LogCollectionDetailContainers extends Component {
: this.state

const { containers: container, pods: pod } = this.store
const { namespaces: namespace } = this.store.pathParams
const { cluster, namespaces: namespace } = this.store.pathParams

const link = this.store.exportLinkFactory({
pod,
cluster,
namespace,
container,
start_time,
Expand Down
2 changes: 2 additions & 0 deletions src/components/Modals/LogSearch/Logging/Detail/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,10 @@ export default class DetailModal extends React.Component {
endTime: end_time,
namespaces,
} = this.logStore
const { cluster } = this.props.searchInputState

const link = this.logStore.exportLinkFactory({
cluster,
namespaces,
pods: pod,
containers: container,
Expand Down
10 changes: 1 addition & 9 deletions src/stores/logging/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,9 @@ export default class LoggingStore {
return 'kapis/logging.kubesphere.io/v1alpha2'
}

get apiPath() {
return this.clusterLogAPI
}

get clusterLogAPI() {
return 'kapis/tenant.kubesphere.io/v1alpha2/logs'
}

getApiPath(cluster) {
return cluster
? `kapis/klusters/${cluster}/tenant.kubesphere.io/v1alpha2/logs`
? `kapis/clusters/${cluster}/tenant.kubesphere.io/v1alpha2/logs`
: 'kapis/tenant.kubesphere.io/v1alpha2/logs'
}

Expand Down
5 changes: 3 additions & 2 deletions src/stores/logging/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { observable, action, computed } from 'mobx'
import { assign, get } from 'lodash'
import { stringify } from 'qs'
import stripAnsi from 'strip-ansi'
import { getClusterUrl } from 'utils'

import LoggingStore from './index'

Expand Down Expand Up @@ -119,8 +120,8 @@ export default class LoggingQuery extends LoggingStore {
}))
}

exportLinkFactory({ start_time, end_time, ...rest }) {
const api = this.clusterLogAPI
exportLinkFactory({ cluster, start_time, end_time, ...rest }) {
const api = getClusterUrl(this.getApiPath(cluster))

return `/${api}?${stringify({
sort: 'asc',
Expand Down

0 comments on commit 1117d54

Please sign in to comment.