Skip to content

Commit

Permalink
fix(pipelineconfig): only cache stage/section state (#3587)
Browse files Browse the repository at this point in the history
  • Loading branch information
anotherchrisberry committed Apr 25, 2017
1 parent 6ad1517 commit 104f4df
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ module.exports = angular.module('spinnaker.core.pipeline.config.pipelineConfigur
$scope.viewState = configViewStateCache.get(buildCacheKey()) || {
section: 'triggers',
stageIndex: 0,
saving: false,
};

let setOriginal = (pipeline) => $scope.viewState.original = angular.toJson(pipeline);
Expand Down Expand Up @@ -349,14 +348,13 @@ module.exports = angular.module('spinnaker.core.pipeline.config.pipelineConfigur
};

function cacheViewState() {
var toCache = angular.copy($scope.viewState);
delete toCache.original;
const toCache = { section: $scope.viewState.section, stageIndex: $scope.viewState.stageIndex };
configViewStateCache.put(buildCacheKey(), toCache);
}

$scope.$watch('pipeline', markDirty, true);
$scope.$watch('viewState.original', markDirty);
$scope.$watch('viewState', cacheViewState, true);
$scope.$watchGroup(['viewState.section', 'viewState.stageIndex'], cacheViewState);

this.navigateTo({section: $scope.viewState.section, index: $scope.viewState.stageIndex});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class PipelineConfigService {
private API: Api,
private authenticationService: AuthenticationService,
viewStateCache: ViewStateCacheService) {
this.configViewStateCache = viewStateCache.createCache('pipelineConfig', { version: 1 });
this.configViewStateCache = viewStateCache.createCache('pipelineConfig', { version: 2 });
}

private buildViewStateCacheKey(applicationName: string, pipelineName: string): string {
Expand Down

0 comments on commit 104f4df

Please sign in to comment.