teragrep / ajs_01

User interface for Teragrep
Apache License 2.0
0 stars 0 forks source link

Restart interpreter handler does not block #175

Closed kortemik closed 2 months ago

kortemik commented 1 year ago

ID <278> Reporter <@StrongestNumber9>

It will run right past the error detection as it does not wait for the response

Finishing restart app.controller.js:94:20                     <--- finished
XHRPUThttp://iris-tg6.qa.teragrep.org:8080/api/interpreter/setting/restart/spark
[HTTP/1.1 401 Unauthorized 12ms]

Error  401   undefined app.controller.js:94:20            <---- but error message is here

In the current code

    $http.put(baseUrlSrv.getRestApiBase() + '/interpreter/setting/restart/' + interpreter.id, payload)
      .success(function(data, status, headers, config) {
        let index = _.findIndex($scope.interpreterSettings, {'id': interpreter.id});
        if(index >=0 ){
          $scope.interpreterSettings[index] = data.body;
          console.log('Status: success');
        }
        else {
          console.warn("Interpreter id was not found in the interpreter settings")
        }
      }).error(function(data, status, headers, config) {
      console.log('Error %o %o', status, data.message);           <----- error message here
      //this should be replaced with inner alert
      $scope.restartError = true;                              <---- sets restartError
      $scope.restartErrorMessage = 'Error restart interpreter: '+_.escape(data.message);
    });
    console.log('Finishing restart');                     <--- finished
    $scope.modalWorking = false;
    if(!$scope.restartError){                        <--- will basically always be false as code is reached too fast
      vm.close('restartInterpreterModal');
    }
kortemik commented 1 year ago

User <@StrongestNumber9> Date <[2022-11-16T07:41:15Z]>

That console.log('Error..') should also be console.error('...')

BVVLD commented 3 months ago

In version 8.0.0 code has all mentioned issues fixed. Please, confirm the status of the issue.