Fixed import/export server issues reported while testing.

This commit is contained in:
Akshay Joshi 2022-01-06 20:01:25 +05:30
parent 6528d086ba
commit 7cc76c7d2d
2 changed files with 12 additions and 7 deletions

View File

@ -107,8 +107,11 @@ def get_servers():
for server in servers:
children.append({'value': server.id, 'label': server.name})
all_servers.append(
{'value': group.name, 'label': group.name, 'children': children})
# Add server group only when some servers are there.
if len(children) > 0:
all_servers.append(
{'value': group.name, 'label': group.name,
'children': children})
return make_json_response(success=1, data=all_servers)

View File

@ -80,7 +80,7 @@ export default function ImportExportServers() {
Notify.alert(gettext('Export Servers'), gettext('The selected servers were exported successfully.'));
})
.catch((err) => {
Notify.alert(err.response.data.errormsg);
Notify.alert(gettext('Export Error'), err.response.data.errormsg);
});
} else if (selectionFormData.imp_exp == 'i') {
// Remove the random number added to create unique tree item,
@ -105,10 +105,10 @@ export default function ImportExportServers() {
Notify.alert(gettext('Import Servers'), msg);
})
.catch((err) => {
Notify.alert(err.response.data.errormsg);
Notify.alert(gettext('Import error'), err.response.data.errormsg);
});
}
Alertify.importExportWizardDialog().close();
};
@ -174,6 +174,7 @@ export default function ImportExportServers() {
api.get(get_servers_url)
.then(res => {
setLoaderText('');
setErrMsg('');
setServerData(res.data.data);
resolve();
})
@ -190,6 +191,7 @@ export default function ImportExportServers() {
api.post(load_servers_url, post_data)
.then(res => {
setLoaderText('');
setErrMsg('');
setServerData(res.data.data);
resolve();
})
@ -261,10 +263,10 @@ export default function ImportExportServers() {
</tbody>
</table>
</Paper>
{selectionFormData.imp_exp == 'i' &&
{selectionFormData.imp_exp == 'i' &&
<FormNote className={classes.noteContainer} text={gettext(noteText)}/> }
</WizardStep>
</Wizard>
</Box>
);
}
}