Skip to content

Commit

Permalink
Modify k8s object filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
yongsikgi committed Dec 24, 2021
1 parent 2e725d5 commit 5ca3bf2
Show file tree
Hide file tree
Showing 2 changed files with 154 additions and 5 deletions.
59 changes: 54 additions & 5 deletions frontend/src/hosts/containers/KubernetesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -238,14 +238,15 @@ class KubernetesPage extends PureComponent<Props, State> {
const saltMasterToken = addon.token
const pParam: SaltStack = {
kwarg: {
detail: true,
namespace: `${filterNamespace}`,
fieldselector: `spec.nodeName=${node}`,
labelselector:
!_.isEmpty(filterLabelKey) && !_.isEmpty(filterLabelValue)
? `${filterLabelKey}=${filterLabelValue}`
: '',
namespace: `${filterNamespace}`,

limit: filterLimit !== '' ? parseInt(filterLimit) : 100,
detail: true,
},
}

Expand All @@ -272,6 +273,7 @@ class KubernetesPage extends PureComponent<Props, State> {
filterNamespace,
filterLabelKey,
filterLabelValue,
filterLimit,
} = this.state
const addon = this.props.addons.find(addon => {
return addon.name === AddonType.salt
Expand All @@ -286,6 +288,7 @@ class KubernetesPage extends PureComponent<Props, State> {
!_.isEmpty(filterLabelKey) && !_.isEmpty(filterLabelValue)
? `${filterLabelKey}=${filterLabelValue}`
: '',
limit: filterLimit !== '' ? parseInt(filterLimit) : 100,
detail: true,
},
}
Expand Down Expand Up @@ -313,6 +316,7 @@ class KubernetesPage extends PureComponent<Props, State> {
filterNamespace,
filterLabelKey,
filterLabelValue,
filterLimit,
} = this.state
const addon = this.props.addons.find(addon => {
return addon.name === AddonType.salt
Expand All @@ -327,6 +331,7 @@ class KubernetesPage extends PureComponent<Props, State> {
!_.isEmpty(filterLabelKey) && !_.isEmpty(filterLabelValue)
? `${filterLabelKey}=${filterLabelValue}`
: '',
limit: filterLimit !== '' ? parseInt(filterLimit) : 100,
detail: true,
},
}
Expand Down Expand Up @@ -354,6 +359,7 @@ class KubernetesPage extends PureComponent<Props, State> {
filterNamespace,
filterLabelKey,
filterLabelValue,
filterLimit,
} = this.state
const addon = this.props.addons.find(addon => {
return addon.name === AddonType.salt
Expand All @@ -368,6 +374,7 @@ class KubernetesPage extends PureComponent<Props, State> {
!_.isEmpty(filterLabelKey) && !_.isEmpty(filterLabelValue)
? `${filterLabelKey}=${filterLabelValue}`
: '',
limit: filterLimit !== '' ? parseInt(filterLimit) : 100,
detail: true,
},
}
Expand Down Expand Up @@ -395,6 +402,7 @@ class KubernetesPage extends PureComponent<Props, State> {
filterNamespace,
filterLabelKey,
filterLabelValue,
filterLimit,
} = this.state
const addon = this.props.addons.find(addon => {
return addon.name === AddonType.salt
Expand All @@ -409,6 +417,7 @@ class KubernetesPage extends PureComponent<Props, State> {
!_.isEmpty(filterLabelKey) && !_.isEmpty(filterLabelValue)
? `${filterLabelKey}=${filterLabelValue}`
: '',
limit: filterLimit !== '' ? parseInt(filterLimit) : 100,
detail: true,
},
}
Expand Down Expand Up @@ -436,6 +445,7 @@ class KubernetesPage extends PureComponent<Props, State> {
filterNamespace,
filterLabelKey,
filterLabelValue,
filterLimit,
} = this.state
const addon = this.props.addons.find(addon => {
return addon.name === AddonType.salt
Expand All @@ -450,6 +460,7 @@ class KubernetesPage extends PureComponent<Props, State> {
!_.isEmpty(filterLabelKey) && !_.isEmpty(filterLabelValue)
? `${filterLabelKey}=${filterLabelValue}`
: '',
limit: filterLimit !== '' ? parseInt(filterLimit) : 100,
detail: true,
},
}
Expand Down Expand Up @@ -477,6 +488,7 @@ class KubernetesPage extends PureComponent<Props, State> {
filterNamespace,
filterLabelKey,
filterLabelValue,
filterLimit,
} = this.state
const addon = this.props.addons.find(addon => {
return addon.name === AddonType.salt
Expand All @@ -491,6 +503,7 @@ class KubernetesPage extends PureComponent<Props, State> {
!_.isEmpty(filterLabelKey) && !_.isEmpty(filterLabelValue)
? `${filterLabelKey}=${filterLabelValue}`
: '',
limit: filterLimit !== '' ? parseInt(filterLimit) : 100,
detail: true,
},
}
Expand Down Expand Up @@ -518,6 +531,7 @@ class KubernetesPage extends PureComponent<Props, State> {
filterNamespace,
filterLabelKey,
filterLabelValue,
filterLimit,
} = this.state
const addon = this.props.addons.find(addon => {
return addon.name === AddonType.salt
Expand All @@ -532,6 +546,7 @@ class KubernetesPage extends PureComponent<Props, State> {
!_.isEmpty(filterLabelKey) && !_.isEmpty(filterLabelValue)
? `${filterLabelKey}=${filterLabelValue}`
: '',
limit: filterLimit !== '' ? parseInt(filterLimit) : 100,
detail: true,
},
}
Expand Down Expand Up @@ -559,6 +574,7 @@ class KubernetesPage extends PureComponent<Props, State> {
filterNamespace,
filterLabelKey,
filterLabelValue,
filterLimit,
} = this.state
const addon = this.props.addons.find(addon => {
return addon.name === AddonType.salt
Expand All @@ -573,6 +589,7 @@ class KubernetesPage extends PureComponent<Props, State> {
!_.isEmpty(filterLabelKey) && !_.isEmpty(filterLabelValue)
? `${filterLabelKey}=${filterLabelValue}`
: '',
limit: filterLimit !== '' ? parseInt(filterLimit) : 100,
detail: true,
},
}
Expand Down Expand Up @@ -603,6 +620,7 @@ class KubernetesPage extends PureComponent<Props, State> {
filterNamespace,
filterLabelKey,
filterLabelValue,
filterLimit,
} = this.state
const addon = this.props.addons.find(addon => {
return addon.name === AddonType.salt
Expand All @@ -617,6 +635,7 @@ class KubernetesPage extends PureComponent<Props, State> {
!_.isEmpty(filterLabelKey) && !_.isEmpty(filterLabelValue)
? `${filterLabelKey}=${filterLabelValue}`
: '',
limit: filterLimit !== '' ? parseInt(filterLimit) : 100,
detail: true,
},
}
Expand Down Expand Up @@ -648,6 +667,7 @@ class KubernetesPage extends PureComponent<Props, State> {
filterNamespace,
filterLabelKey,
filterLabelValue,
filterLimit,
} = this.state
const addon = this.props.addons.find(addon => {
return addon.name === AddonType.salt
Expand All @@ -662,6 +682,7 @@ class KubernetesPage extends PureComponent<Props, State> {
!_.isEmpty(filterLabelKey) && !_.isEmpty(filterLabelValue)
? `${filterLabelKey}=${filterLabelValue}`
: '',
limit: filterLimit !== '' ? parseInt(filterLimit) : 100,
detail: true,
},
}
Expand Down Expand Up @@ -689,6 +710,7 @@ class KubernetesPage extends PureComponent<Props, State> {
filterNamespace,
filterLabelKey,
filterLabelValue,
filterLimit,
} = this.state
const addon = this.props.addons.find(addon => {
return addon.name === AddonType.salt
Expand All @@ -703,6 +725,7 @@ class KubernetesPage extends PureComponent<Props, State> {
!_.isEmpty(filterLabelKey) && !_.isEmpty(filterLabelValue)
? `${filterLabelKey}=${filterLabelValue}`
: '',
limit: filterLimit !== '' ? parseInt(filterLimit) : 100,
detail: true,
},
}
Expand Down Expand Up @@ -730,6 +753,7 @@ class KubernetesPage extends PureComponent<Props, State> {
filterNamespace,
filterLabelKey,
filterLabelValue,
filterLimit,
} = this.state
const addon = this.props.addons.find(addon => {
return addon.name === AddonType.salt
Expand All @@ -744,6 +768,7 @@ class KubernetesPage extends PureComponent<Props, State> {
!_.isEmpty(filterLabelKey) && !_.isEmpty(filterLabelValue)
? `${filterLabelKey}=${filterLabelValue}`
: '',
limit: filterLimit !== '' ? parseInt(filterLimit) : 100,
detail: true,
},
}
Expand All @@ -766,7 +791,12 @@ class KubernetesPage extends PureComponent<Props, State> {
}

public getClusterRoles = async () => {
const {selectMinion, filterLabelKey, filterLabelValue} = this.state
const {
selectMinion,
filterLabelKey,
filterLabelValue,
filterLimit,
} = this.state
const addon = this.props.addons.find(addon => {
return addon.name === AddonType.salt
})
Expand All @@ -779,6 +809,7 @@ class KubernetesPage extends PureComponent<Props, State> {
!_.isEmpty(filterLabelKey) && !_.isEmpty(filterLabelValue)
? `${filterLabelKey}=${filterLabelValue}`
: '',
limit: filterLimit !== '' ? parseInt(filterLimit) : 100,
detail: true,
},
}
Expand All @@ -801,7 +832,12 @@ class KubernetesPage extends PureComponent<Props, State> {
}

public getClusterRoleBindings = async () => {
const {selectMinion, filterLabelKey, filterLabelValue} = this.state
const {
selectMinion,
filterLabelKey,
filterLabelValue,
filterLimit,
} = this.state
const addon = this.props.addons.find(addon => {
return addon.name === AddonType.salt
})
Expand All @@ -814,6 +850,7 @@ class KubernetesPage extends PureComponent<Props, State> {
!_.isEmpty(filterLabelKey) && !_.isEmpty(filterLabelValue)
? `${filterLabelKey}=${filterLabelValue}`
: '',
limit: filterLimit !== '' ? parseInt(filterLimit) : 100,
detail: true,
},
}
Expand Down Expand Up @@ -841,6 +878,7 @@ class KubernetesPage extends PureComponent<Props, State> {
filterNamespace,
filterLabelKey,
filterLabelValue,
filterLimit,
} = this.state
const addon = this.props.addons.find(addon => {
return addon.name === AddonType.salt
Expand All @@ -855,6 +893,7 @@ class KubernetesPage extends PureComponent<Props, State> {
!_.isEmpty(filterLabelKey) && !_.isEmpty(filterLabelValue)
? `${filterLabelKey}=${filterLabelValue}`
: '',
limit: filterLimit !== '' ? parseInt(filterLimit) : 100,
detail: true,
},
}
Expand Down Expand Up @@ -882,6 +921,7 @@ class KubernetesPage extends PureComponent<Props, State> {
filterNamespace,
filterLabelKey,
filterLabelValue,
filterLimit,
} = this.state
const addon = this.props.addons.find(addon => {
return addon.name === AddonType.salt
Expand All @@ -896,6 +936,7 @@ class KubernetesPage extends PureComponent<Props, State> {
!_.isEmpty(filterLabelKey) && !_.isEmpty(filterLabelValue)
? `${filterLabelKey}=${filterLabelValue}`
: '',
limit: filterLimit !== '' ? parseInt(filterLimit) : 100,
detail: true,
},
}
Expand All @@ -918,7 +959,12 @@ class KubernetesPage extends PureComponent<Props, State> {
}

public getPersistentVolumes = async () => {
const {selectMinion, filterLabelKey, filterLabelValue} = this.state
const {
selectMinion,
filterLabelKey,
filterLabelValue,
filterLimit,
} = this.state
const addon = this.props.addons.find(addon => {
return addon.name === AddonType.salt
})
Expand All @@ -931,6 +977,7 @@ class KubernetesPage extends PureComponent<Props, State> {
!_.isEmpty(filterLabelKey) && !_.isEmpty(filterLabelValue)
? `${filterLabelKey}=${filterLabelValue}`
: '',
limit: filterLimit !== '' ? parseInt(filterLimit) : 100,
detail: true,
},
}
Expand Down Expand Up @@ -958,6 +1005,7 @@ class KubernetesPage extends PureComponent<Props, State> {
filterNamespace,
filterLabelKey,
filterLabelValue,
filterLimit,
} = this.state
const addon = this.props.addons.find(addon => {
return addon.name === AddonType.salt
Expand All @@ -972,6 +1020,7 @@ class KubernetesPage extends PureComponent<Props, State> {
!_.isEmpty(filterLabelKey) && !_.isEmpty(filterLabelValue)
? `${filterLabelKey}=${filterLabelValue}`
: '',
limit: filterLimit !== '' ? parseInt(filterLimit) : 100,
detail: true,
},
}
Expand Down
Loading

0 comments on commit 5ca3bf2

Please sign in to comment.