Skip to content

Commit

Permalink
Merge branch 'hotfix/20181102-03'
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsusek committed Nov 2, 2018
2 parents f8e95ef + b6afa23 commit fd0d9d6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/store/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -535,16 +535,16 @@ export default {
...getters.queryString
};

let dots = '';

for (let i = 0; i < state.path.split('/').length; i++) {
dots += '../';
}

if (forTest) {
// when run as part of a test, fix path since rule will be in server_data/tests/
config.import = '../../rules/BaseRule.config';
} else {
let dots = '';

for (let i = 1; i < state.path.split('/').length; i++) {
dots += '../';
}

config.import = `${dots}BaseRule.config`;
}

Expand Down
12 changes: 11 additions & 1 deletion src/store/configs.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,20 @@ export default {
let newConfig = cloneDeep(oldConfig);

// If there is a new path (i.e. in a subfolder), add that to the full pathname
newConfig.__praeco_full_path = `${newPath ? `${newPath}/` : ''}${newConfig.name}`;
newConfig.__praeco_full_path = `${newPath}${newConfig.name}`;

if (oldConfig.__praeco_full_path === newConfig.__praeco_full_path) return;

if (type === 'rules') {
let dots = '';

for (let i = 1; i < newConfig.__praeco_full_path.split('/').length; i++) {
dots += '../';
}

newConfig.import = `${dots}BaseRule.config`;
}

try {
// Create the config at the full path
let res = await dispatch('createConfig', { config: newConfig, type });
Expand Down

0 comments on commit fd0d9d6

Please sign in to comment.