Skip to content

Commit

Permalink
#118 - Changes from PR
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Giek committed Jan 19, 2025
1 parent 5f2963f commit d6031f2
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/main/environment/service/environment-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class EnvironmentService implements Initializable {
* Sets and saves all variables in the current collection.
* @param variables
*/
public setAndSaveAllVariables(variables: VariableObject[]) {
public setCollectionVariables(variables: VariableObject[]) {
this.currentCollection.variables = {};
variables.forEach((variable) => (this.currentCollection.variables[variable.key] = variable));
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/event/main-event-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { PersistenceService } from '../persistence/service/persistence-service';
import { TrufosObject } from 'shim/objects';
import { EnvironmentService } from 'main/environment/service/environment-service';
import './stream-events';
import { VariableObject } from '../../shim/variables';
import { VariableObject } from 'shim/variables';

const persistenceService = PersistenceService.instance;
const environmentService = EnvironmentService.instance;
Expand Down Expand Up @@ -102,8 +102,8 @@ export class MainEventService implements IEventService {
return environmentService.getVariable(key);
}

async setAndSaveAllVariables(variables: VariableObject[]) {
environmentService.setAndSaveAllVariables(variables);
async setCollectionVariables(variables: VariableObject[]) {
environmentService.setCollectionVariables(variables);
await persistenceService.saveCollection(environmentService.currentCollection);
}
}
2 changes: 1 addition & 1 deletion src/renderer/services/event/renderer-event-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const METHOD_NAMES = new Set<keyof IEventService>([
'deleteObject',
'getActiveEnvironmentVariables',
'getVariable',
'setAndSaveAllVariables',
'setCollectionVariables',
]);

const INSTANCE = {} as IEventService;
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/state/variableStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const useVariableStore = create<VariableState & VariableStateAction>()(
});
},
save: () => {
RendererEventService.instance.setAndSaveAllVariables(get().variables);
RendererEventService.instance.setCollectionVariables(get().variables);
set((state) => {
state.variables = [];
state.isOpen = false;
Expand Down
6 changes: 3 additions & 3 deletions src/shim/event-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ export interface IEventService {
getVariable(key: string): Promise<VariableObject>;

/**
* Set a variable.
* @param variables
* Set the collection variables.
* @param variables The variables of the Collection to set.
*/
setAndSaveAllVariables(variables: VariableObject[]): void;
setCollectionVariables(variables: VariableObject[]): void;
}

0 comments on commit d6031f2

Please sign in to comment.