exportRuleset(event) {
this.rulesetService.exportRuleSet(event.data[0].ruleSetId).subscribe(
result => {
if (result.message != undefined && result.message == "ruleset does not contain any rules") {
let initialState = {
title: 'Export Ruleset',
btn2: 'OK',
body: 'Ruleset file does not contain any rules.',
enableBtn2: true
};
this.bsModalRef = this.bsModalService.show(GlobalModalComponent, Object.assign({ backdrop: true, ignoreBackdropClick: true, keyboard: false }, { initialState }));
}
if (result.message != undefined && result.message == "ruleset not associated with job") {
let initialState = {
title: 'Export Ruleset',
btn2: 'OK',
body: 'Ruleset not associated with job. Please update ruleset and then export',
enableBtn2: true
};
this.bsModalRef = this.bsModalService.show(GlobalModalComponent, Object.assign({ backdrop: true, ignoreBackdropClick: true, keyboard: false }, { initialState }));
}
if (result.message == undefined) {
var filename = result.rulelist[0].ruleset.ruleSetName;
const blob = new Blob([JSON.stringify(result)], { type: 'application/json' });
fileSaver.saveAs(blob, filename);
}
}
)
}