Skip to content

Commit

Permalink
tidy up of edit threat model view
Browse files Browse the repository at this point in the history
  • Loading branch information
jon gadsden committed Sep 23, 2022
1 parent 4e7f35e commit 27b4494
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
4 changes: 0 additions & 4 deletions td.vue/src/store/modules/threatmodel.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ const actions = {
},
[THREATMODEL_SAVE]: async ({ dispatch, rootState, state }) => {
try {
// TODO: This ONLY works if the backend provider is GitHub
// We need a separate code flow for localSession
// localSession needs to handle both a "download" type feature as well as saving to disk in electron

if (getProviderType(rootState.provider.selected) !== providerTypes.local) {
await threatmodelApi.updateAsync(
rootState.repo.selected,
Expand Down
22 changes: 11 additions & 11 deletions td.vue/src/views/ThreatModelEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ import { mapState } from 'vuex';
import { getProviderType } from '@/service/provider/providers.js';
import TdFormButton from '@/components/FormButton.vue';
import { THREATMODEL_CONTRIBUTORS_UPDATED, THREATMODEL_RESTORE, THREATMODEL_SAVE } from '@/store/actions/threatmodel.js';
import { tc } from '@/i18n/index.js';
export default {
name: 'ThreatModelEdit',
Expand Down Expand Up @@ -223,7 +222,7 @@ export default {
evt.preventDefault();
let newDiagram = {
name: '',
title: tc('threatmodel.diagram.stride.diagramTitle'),
title: this.$t('threatmodel.diagram.stride.diagramTitle'),
diagramType: 'STRIDE',
thumbnail: './public/content/images/thumbnail.stride.jpg',
version: this.version
Expand All @@ -235,27 +234,28 @@ export default {
switch (type) {
case 'CIA':
this.model.detail.diagrams[idx].thumbnail = './public/content/images/thumbnail.cia.jpg';
title = tc('threatmodel.diagram.cia.diagramTitle');
title = this.$t('threatmodel.diagram.cia.diagramTitle');
break;
case 'LINDDUN':
this.model.detail.diagrams[idx].thumbnail = './public/content/images/thumbnail.linddun.jpg';
title = tc('threatmodel.diagram.linddun.diagramTitle');
title = this.$t('threatmodel.diagram.linddun.diagramTitle');
break;
case 'STRIDE':
this.model.detail.diagrams[idx].thumbnail = './public/content/images/thumbnail.stride.jpg';
title = tc('threatmodel.diagram.stride.diagramTitle');
title = this.$t('threatmodel.diagram.stride.diagramTitle');
break;
default:
this.model.detail.diagrams[idx].thumbnail = './public/content/images/thumbnail.jpg';
title = tc('threatmodel.diagram.generic.diagramTitle');
type = tc('threatmodel.diagram.generic.select');
title = this.$t('threatmodel.diagram.generic.diagramTitle');
type = this.$t('threatmodel.diagram.generic.select');
break;
}
this.model.detail.diagrams[idx].diagramType = type;
if (this.model.detail.diagrams[idx].title === tc('threatmodel.diagram.cia.diagramTitle')
|| this.model.detail.diagrams[idx].title === tc('threatmodel.diagram.linddun.diagramTitle')
|| this.model.detail.diagrams[idx].title === tc('threatmodel.diagram.stride.diagramTitle')
|| this.model.detail.diagrams[idx].title === tc('threatmodel.diagram.generic.diagramTitle')
// if the diagram title is still generic, then change it to the new generic title
if (this.model.detail.diagrams[idx].title === this.$t('threatmodel.diagram.cia.diagramTitle')
|| this.model.detail.diagrams[idx].title === this.$t('threatmodel.diagram.linddun.diagramTitle')
|| this.model.detail.diagrams[idx].title === this.$t('threatmodel.diagram.stride.diagramTitle')
|| this.model.detail.diagrams[idx].title === this.$t('threatmodel.diagram.generic.diagramTitle')
) {
this.model.detail.diagrams[idx].title = title;
}
Expand Down

0 comments on commit 27b4494

Please sign in to comment.