This repository has been archived by the owner on Sep 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #400 from OBDDimal/issue-223-detecting-feature
Issue 223 detecting feature problems via the FeatureIDE Service
- Loading branch information
Showing
9 changed files
with
142 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Command } from '@/classes/Commands/Command'; | ||
|
||
export class ReloadCommand extends Command { | ||
|
||
execute() { | ||
} | ||
|
||
undo() { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
frontendVue3/src/services/FeatureModel/colorsFromService.service.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { jsonToXML } from '@/services/xmlTranspiler.service'; | ||
import axios, { CancelToken } from 'axios'; | ||
import { NODE_CORE_COLOR, NODE_DEAD_COLOR, NODE_FALSEOP_COLOR } from '@/classes/constants'; | ||
import { useAppStore } from '@/store/app'; | ||
|
||
export async function getColorsFromService(featureModel, d3Data) { | ||
try { | ||
const source = CancelToken.source(); | ||
const timeout = setTimeout(() => { | ||
source.cancel(); | ||
// Timeout Logic | ||
}, 450); | ||
const content = new TextEncoder().encode(jsonToXML(featureModel)); | ||
let response = await axios.post(`${import.meta.env.VITE_APP_DOMAIN_FEATUREIDESERVICE}stats`, { | ||
name: featureModel.id + ".xml", | ||
content: Array.from(content) | ||
}, {cancelToken: source.token}); | ||
clearTimeout(timeout); | ||
let deadFeatures = response.data.deadFeatures; | ||
let falseOptionalFeatures = response.data.falseOptionalFeatures; | ||
let coreFeatures = response.data.coreFeatures; | ||
|
||
if (coreFeatures.length > 0) { | ||
d3Data.root.descendants().filter(node => coreFeatures.includes(node.data.name)).forEach(node => node.data.setColor(NODE_CORE_COLOR)); | ||
} | ||
if (falseOptionalFeatures.length > 0) { | ||
d3Data.root.descendants().filter(node => falseOptionalFeatures.includes(node.data.name)).forEach(node => node.data.setColor(NODE_FALSEOP_COLOR)); | ||
} | ||
if (deadFeatures.length > 0) { | ||
d3Data.root.descendants().filter(node => deadFeatures.includes(node.data.name)).forEach(node => node.data.setColor(NODE_DEAD_COLOR)); | ||
} | ||
return true; | ||
} catch (e) { | ||
const appStore = useAppStore() | ||
appStore.updateSnackbar( | ||
'Could not detect any special cases, because Service is down.', | ||
'error', | ||
3000, | ||
true) | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters