feat(ui): detect errors in export-import using simple `ERROR:` regex heuristic
MODIFY
manager/ui/war/plugins/api-manager/html/admin/admin-export.html
manager/ui/war/plugins/api-manager/html/admin/admin-export.html
</div>
</div>
- <div style="float: left; width: 100%;" ng-show="importStatus == 'imported'">
- <span apiman-i18n-key="data-import-completed-msg">Data import completed. Please check the response below for details:</span>
- <pre style="width: 100%; max-height: 300px; margin-top: 15px; overflow: auto">{{ importResult }}</pre>
+ <div style="float: left; width: 100%;" ng-show="importStatus == 'imported' || importStatus == 'error' ">
+ <div class="alert alert-danger" ng-show="importStatus == 'error'" apiman-i18n-key="data-import-failed-msg">
+ <span class="pficon pficon-error-circle-o"></span>
+ Import failed. Please check the response below for error messages:
</div>
-
- <div style="float: left; width: 100%;" ng-show="importStatus == 'error'">
+ <div class="alert alert-info" ng-show="importStatus == 'imported'" apiman-i18n-key="data-import-completed-msg">
+ <span class="pficon pficon-info"></span>
+ Data import completed. Please check the response below for details:
+ </div>
+ <pre style="width: 100%; max-height: 300px; margin-top: 15px; overflow: auto">{{ importResult }}</pre>
</div>
</div>

MODIFY
manager/ui/war/plugins/api-manager/ts/admin/admin-export.ts
manager/ui/war/plugins/api-manager/ts/admin/admin-export.ts
@@ -39,6 +39,13 @@ _module.controller("Apiman.AdminExportImportController",
Logger.info('Import file successfully uploaded (and imported?).');
$scope.importResult = response.data;
$scope.importStatus = 'imported';
+ if (response.data.search(/^ERROR:/gm) === -1) {
+ Logger.info("ok")
+ $scope.importStatus = 'imported';
+ } else {
+ Logger.error("Looks like import had errors :-(");
+ $scope.importStatus = 'error';
+ }
}, function (error) {
$scope.importError = error;
$scope.importStatus = 'error';

feat(ui): detect errors in export-import using simple `ERROR:` regex heuristic