Skip to content

Commit

Permalink
fix: Fix cluster api
Browse files Browse the repository at this point in the history
  • Loading branch information
leoliu committed Jun 23, 2020
1 parent 4cf4df4 commit 7909879
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/actions/resource.edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* along with KubeSphere Console. If not, see <https://www.gnu.org/licenses/>.
*/

import { toJS } from 'mobx'
import { Modal } from 'components/Base'
import EditBasicInfoModal from 'components/Modals/EditBasicInfo'
import EditYamlModal from 'components/Modals/EditYaml'
Expand All @@ -30,7 +31,7 @@ export default {
success && success()
})
},
detail: detail._originData || detail,
detail: toJS(detail._originData || detail),
modal: EditBasicInfoModal,
store,
...props,
Expand Down
2 changes: 1 addition & 1 deletion src/actions/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export default {
})
},
modal: EditServiceModal,
detail: detail._originData,
detail: toJS(detail._originData),
type: detail.type,
store,
...props,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

import React from 'react'
import { toJS } from 'mobx'
import { observer } from 'mobx-react'
import { get } from 'lodash'
import { RadioButton, RadioGroup } from '@pitrix/lego-ui'
Expand Down Expand Up @@ -71,7 +72,7 @@ export default class WorkloadSelect extends React.Component {

render() {
const { type, selectItem } = this.state
const { data, total, page, isLoading } = this.store.list
const { data, total, page, isLoading } = toJS(this.store.list)

return (
<div>
Expand Down
7 changes: 3 additions & 4 deletions src/stores/cluster/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ export default class ClusterStore extends Base {
getAgentUrl = ({ cluster }) =>
`kapis/cluster.kubesphere.io/v1alpha1/clusters/${cluster}/agent/deployment`

getDetailUrl = (params = {}) =>
`${this.getResourceUrl(params)}/${params.name}`

@action
async fetchList({ cluster, workspace, namespace, more, ...params } = {}) {
this.list.isLoading = true
Expand Down Expand Up @@ -104,7 +101,9 @@ export default class ClusterStore extends Base {
if (!globals.app.isMultiCluster) {
detail = this.mapper(cloneDeep(DEFAULT_CLUSTER))
} else {
const result = await request.get(this.getDetailUrl(params))
const result = await request.get(
`${this.getResourceUrl(params)}/${params.name}`
)
detail = { ...params, ...this.mapper(result) }
}

Expand Down

0 comments on commit 7909879

Please sign in to comment.