Skip to content

only change query option data not trigger http request #340

@fantaishao

Description

@fantaishao

In my project , I put some additional parameters in the query options.
These query options can be changed by the user .

After uploading a file successfully, I only change the query options and keep the image file uploaded just now , and then I want to save it. But the http request is not triggered.

     $scope.flowInitOptions = {
         target: 'api/upload/pic',
         query: function(flowFile, flowChunk) {
           return $scope.initParams;
         },
         forceChunkSize: true,
         singleFile: true,
         testChunks: false,
         uploadMethod: 'POST',
         headers: getHeaders(),
         generateUniqueIdentifier: UUID.generate,
         permanentErrors: [400, 404, 415, 500, 501,401]
       };
    $scope.save = function($file, $event, $flow, type) {
         $flow.opts.query = angular.copy($scope.initParams);
         $flow.opts.query.publishDate = $scope.formatTime(angular.copy($scope.initParams.publishDate),'YYYY-MM-DD','');
         $flow.opts.query.scanEndDate = $scope.formatTime(angular.copy($scope.initParams.scanEndDate),'YYYY-MM-DD','');
         $flow.opts.query.scanStartDate = $scope.formatTime(angular.copy($scope.initParams.scanStartDate),'YYYY-MM-DD','');
         $flow.opts.query.articleClassifyId = angular.copy($scope.initParams.articleClassify.id);
         $flow.opts.query.classifyFlag = angular.copy($scope.initParams.classifyFlagTmp)?1:0;
         $flow.opts.query.scanType = angular.copy($scope.initParams.scanTypeTmp)?1:0;
         $flow.opts.query.useWebLib = angular.copy($scope.initParams.useWebLibTmp)?1:0;
         if(type == 'retry') {
           $flow.files[0].retry();
         }else {
           $flow.upload();
         }
       };
<div class="add-img-library add-work-library" ng-controller="AddImgLibraryController"
   flow-init="flowInitOptions"
   flow-file-added="!!{png:1,gif:1,jpg:1,jpeg:1}[$file.getExtension()];someHandlerMethod($file, $event, $flow)"
   flow-file-success="saveSuccess( $file, $message, $flow )"
   flow-complete="infoComplete( $file, $message, $flow )"
   flow-file-error="saveError( $file, $message, $flow )">
</div>

is there a cleaner way, I can trigger the http request right when I only change the query option,but don't change the text file or img file?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions