Skip to content

Commit

Permalink
1. Change lognhorn ico file.
Browse files Browse the repository at this point in the history
2. When the volume has been bound to PVC, the optation of create PVC is disabled.
3. Fix bug that backup does not load
4. Disable recovery when the latest backup field is empty

Signed-off-by: Siye Wang <siye@rancher.com>
  • Loading branch information
smallteeths authored and yasker committed May 2, 2020
1 parent 34cbbc3 commit c4d5f19
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 8 deletions.
Binary file modified public/favicon.ico
Binary file not shown.
7 changes: 4 additions & 3 deletions src/models/backup.js
Expand Up @@ -41,9 +41,10 @@ export default {
subscriptions: {
setup({ dispatch, history }) {
history.listen(() => {
let search = history.location.search ? queryString.parse(history.location.search) : {}

if (history.location.state || search.state) {
let search = history.location && history.location.search ? queryString.parse(history.location.search) : {}
// This code may cause confusion. React router does not pass parameters when right-clicking on Link,
// resulting in no request for the page, so an Undefined judgment is added.
if (history.location && (search.state || history.location.state || typeof (history.location.state) === 'undefined')) {
dispatch({
type: 'query',
payload: search,
Expand Down
2 changes: 1 addition & 1 deletion src/models/engineimage.js
Expand Up @@ -27,7 +27,7 @@ export default {
payload,
}, { call, put }) {
const data = yield call(query, parse(payload))
if (payload && payload.field && payload.keyword) {
if (payload && payload.field && payload.keyword && data.data) {
data.data = data.data.filter(item => item[payload.field] && item[payload.field].indexOf(payload.keyword.trim()) > -1)
}
if (data.data) {
Expand Down
2 changes: 1 addition & 1 deletion src/models/volume.js
Expand Up @@ -468,7 +468,7 @@ export default {
return { ...state, createPVAndPVCSingleVisible: false, pvNameDisabled: false, previousChecked: false, createPVAndPVCModalSingleKey: Math.random() }
},
hideCreatePVAndPVCModal(state) {
return { ...state, createPVAndPVCVisible: false, previousChecked: false, createPVAndPVCModalKey: Math.random() }
return { ...state, createPVAndPVCVisible: false, nameSpaceDisabled: false, previousChecked: false, createPVAndPVCModalKey: Math.random() }
},
hideCreatePVCAllModal(state) {
return { ...state, createPVCAllModalVisible: false, createPVCAllModalKey: Math.random() }
Expand Down
2 changes: 1 addition & 1 deletion src/routes/backup/BackupBulkActions.js
Expand Up @@ -17,7 +17,7 @@ function bulkActions({ selectedRows, restoreLatestBackup, showBulkCreateDisaster
}

const allActions = [
{ key: 'restoreLatestBackup', name: 'Restore Latest Backup', disabled() { return selectedRows.length === 0 } },
{ key: 'restoreLatestBackup', name: 'Restore Latest Backup', disabled() { return selectedRows.length === 0 || selectedRows.some(record => !record.lastBackupName) } },
{ key: 'bulkCreateDisasterRecoveryVolume', name: 'Create Disaster Recovery Volume', disabled() { return selectedRows.length === 0 || selectedRows.some(record => !record.lastBackupName) } },
]

Expand Down
2 changes: 1 addition & 1 deletion src/routes/backup/BackupVolumeList.js
Expand Up @@ -144,7 +144,7 @@ class List extends React.Component {
return (
<DropOption menuOptions={[
{ key: 'recovery', name: !record.lastBackupName ? 'No last backup' : 'Create Disaster Recovery Volume', disabled: !record.lastBackupName },
{ key: 'restoreLatestBackup', name: 'Restore Latest Backup' },
{ key: 'restoreLatestBackup', name: 'Restore Latest Backup', disabled: !record.lastBackupName },
{ key: 'deleteAll', name: 'Delete All Backups' },
]}
onMenuClick={e => this.handleMenuClick(record, e)}
Expand Down
3 changes: 2 additions & 1 deletion src/routes/volume/VolumeBulkActions.js
Expand Up @@ -60,6 +60,7 @@ function bulkActions({ selectedRows, engineImages, bulkDeleteVolume, showBulkEng
const hasDoingState = (exclusions = []) => selectedRows.some(item => (item.state.endsWith('ing') && !exclusions.includes(item.state)) || item.currentImage !== item.engineImage)
const isSnapshotDisabled = () => selectedRows.every(item => !item.actions || !item.actions.snapshotCreate)
const isHasStandy = () => selectedRows.some(item => item.standby)
const isHasPVC = () => selectedRows.some(item => item.kubernetesStatus && item.kubernetesStatus.pvStatus && item.kubernetesStatus.pvStatus === 'Bound')
// const isAttached = () => selectedRows.some(item => item.state === 'attached')
const isRestoring = () => selectedRows.some((selected) => {
if (selected.restoreStatus && selected.restoreStatus.length > 0) {
Expand All @@ -86,7 +87,7 @@ function bulkActions({ selectedRows, engineImages, bulkDeleteVolume, showBulkEng
{ key: 'upgrade', name: 'Upgrade Engine', disabled() { return selectedRows.length === 0 || !hasAction('engineUpgrade') || hasDoingState() || hasMoreOptions() || isRestoring() } },
{ key: 'expandVolume', name: 'Expand Volume', disabled() { return selectedRows.length === 0 || !hasAction('attach') } },
{ key: 'createSchedule', name: 'Update Schedule', disabled() { return selectedRows.length === 0 } },
{ key: 'createPVAndPVC', name: 'Create PV/PVC', disabled() { return selectedRows.length === 0 || isHasStandy() || isRestoring() } },
{ key: 'createPVAndPVC', name: 'Create PV/PVC', disabled() { return selectedRows.length === 0 || isHasStandy() || isRestoring() || isHasPVC() } },
{ key: 'bulkChangeVolume', name: 'Activate Disaster Recovery Volume', disabled() { return selectedRows.length === 0 || selectedRows.some((item) => !item.standby) } },
]

Expand Down

0 comments on commit c4d5f19

Please sign in to comment.