Skip to content

Commit

Permalink
Fix Save & Add error on ability modal
Browse files Browse the repository at this point in the history
  • Loading branch information
argaudreau committed Aug 8, 2022
1 parent afa3a81 commit e8fdc79
Showing 1 changed file with 110 additions and 109 deletions.
219 changes: 110 additions & 109 deletions templates/adversaries.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,126 +66,127 @@ <h3 x-text="selectedProfileName" class="pointer tooltip has-tooltip-arrow" data-
</div>
</form>
<div>
<div class="row is-4 buttons m-0 is-flex">
<button class="button is-small level-item" @click="selectedAbilityId = ''; showAbilityChoiceModal = true;">
<div class="is-flex m-0">
<button class="button is-small mr-2" @click="selectedAbilityId = ''; showAbilityChoiceModal = true;">
<span class="icon"><em class="fas fa-plus"></em></span>
<span>Add Ability</span>
</button>
<button class="button is-primary is-small level-item" @click="showAddAdversaryModal = true">
<button class="button is-primary is-small mr-2" @click="showAddAdversaryModal = true">
<span class="icon"><em class="fas fa-plus"></em></span>
<span>Add Adversary</span>
</button>
<button type="button" class="button is-small is-expanded auto-complete" @click="showFactBreakdownModal = true">
<span class="icon"><em class="fas fa-unlock-alt"></em></span>
<span>Fact Breakdown</span>
</button>
<div class="vr is-expanded auto-complete"></div>
<span>Objective: <b x-text="getObjectiveName()"></b>&nbsp;&nbsp;&nbsp;</span>
<button type="button" class="button is-small" @click="showObjectiveModal = true">Change</button>
<div class="vr"></div>
<button type="button" class="button is-small" @click="exportProfile()">
<span class="icon"><em class="fas fa-file-export"></em></span>
<span>Export</span>
</button>
<button type="button" class="button is-success is-small" x-bind:disabled="!unsavedChanges" @click="saveProfile()">Save Profile</button>
<button type="button" class="button is-danger is-outlined is-small" @click="deleteProfile()">Delete Profile</button>
</div>
<button type="button" class="button is-small mr-2" @click="showFactBreakdownModal = true">
<span class="icon"><em class="fas fa-unlock-alt"></em></span>
<span>Fact Breakdown</span>
</button>
<div class="vr"></div>
<span>Objective: <b x-text="getObjectiveName()"></b>&nbsp;&nbsp;&nbsp;</span>
<button type="button" class="button is-small mr-2" @click="showObjectiveModal = true">Change</button>
<div class="vr"></div>
<button type="button" class="button is-small mr-2" @click="exportProfile()">
<span class="icon"><em class="fas fa-file-export"></em></span>
<span>Export</span>
</button>
<button type="button" class="button is-success is-small mr-2" x-bind:disabled="!unsavedChanges" @click="saveProfile()">Save Profile</button>
<button type="button" class="button is-danger is-outlined is-small mr-2" @click="deleteProfile()">Delete Profile</button>
</div>

<div class="tactic-breakdown pt-4 pb-4" @click="isTacticBreakdownActive = !isTacticBreakdownActive" title="Click to expand/collapse">
<template x-for="tactic in getTacticBreakdown" :key="tactic[0]">
<span class="tactic-item has-tooltip-bottom" :class="{ 'active': isTacticBreakdownActive }" x-bind:style="`width: ${tactic[1]}%; background-color: ${hashStringToColor(tactic[0])};`" x-text="`${tactic[0]} ${tactic[1]}%`"></span>
</template>
</div>
<div class="tactic-breakdown pt-4 pb-4" @click="isTacticBreakdownActive = !isTacticBreakdownActive" title="Click to expand/collapse">
<template x-for="tactic in getTacticBreakdown" :key="tactic[0]">
<span class="tactic-item has-tooltip-bottom" :class="{ 'active': isTacticBreakdownActive }" x-bind:style="`width: ${tactic[1]}%; background-color: ${hashStringToColor(tactic[0])};`" x-text="`${tactic[0]} ${tactic[1]}%`"></span>
</template>
</div>

<table x-show="selectedProfileAbilities.length" class="table is-striped is-fullwidth">
<thead>
<tr class="ability-row">
<th></th>
<th>Ordering</th>
<th>Name</th>
<th>Tactic</th>
<th>Technique</th>
<th>Executors</th>
<th>Requires</th>
<th>Unlocks</th>
<th>Payload</th>
<th>Cleanup</th>
<th></th>
</tr>
</thead>
<tbody>
<template x-for="(ability, index) of selectedProfileAbilities" :key="ability.ability_id">
<tr @click="selectAbility(ability.ability_id)" class="ability-row"
x-bind:class="{ 'orange-row': needsParser.indexOf(ability.name) > -1 ,
'row-hover': ability.ability_id === abilityTableDragHoverId && abilityTableDragHoverId != undefined,
'red-row-unclickable': undefinedAbilities.indexOf(ability.ability_id) > -1 }"
x-on:mouseenter="setAbilityHover(ability.ability_id)" x-on:mouseleave="clearAbilityHover()" x-on:dragenter="abilityTableDragHoverId = ability.ability_id">
<td class="has-text-centered drag" @click.stop draggable="true" x-on:dragstart="startAbilitySwap" x-on:dragover.prevent="swapAbilitiesHover" x-on:dragend="swapAbilities">&#9776;</td>
<td>
<div class="icon-text">
<span x-text="index + 1"></span>
<span class="icon has-text-danger" x-show="!ability.ability_id">
<em class="fas fa-ban"></em>
<table x-show="selectedProfileAbilities.length" class="table is-striped is-fullwidth">
<thead>
<tr class="ability-row">
<th></th>
<th>Ordering</th>
<th>Name</th>
<th>Tactic</th>
<th>Technique</th>
<th>Executors</th>
<th>Requires</th>
<th>Unlocks</th>
<th>Payload</th>
<th>Cleanup</th>
<th></th>
</tr>
</thead>
<tbody>
<template x-for="(ability, index) of selectedProfileAbilities">
<tr @click="selectAbility(ability.ability_id)" class="ability-row"
x-bind:class="{ 'orange-row': needsParser.indexOf(ability.name) > -1 ,
'row-hover': ability.ability_id === abilityTableDragHoverId && abilityTableDragHoverId != undefined,
'red-row-unclickable': undefinedAbilities.indexOf(ability.ability_id) > -1 }"
x-on:mouseenter="setAbilityHover(ability.ability_id)" x-on:mouseleave="clearAbilityHover()" x-on:dragenter="abilityTableDragHoverId = ability.ability_id">
<td class="has-text-centered drag" @click.stop draggable="true" x-on:dragstart="startAbilitySwap" x-on:dragover.prevent="swapAbilitiesHover" x-on:dragend="swapAbilities">&#9776;</td>
<td>
<div class="icon-text">
<span x-text="index + 1"></span>
<span class="icon has-text-danger" x-show="!ability.ability_id">
<em class="fas fa-ban"></em>
</span>
<span class="icon has-text-warning" x-show="needsParser.indexOf(ability.name) > -1">
<em class="fas fa-exclamation-triangle"></em>
</span>
</div>
</td>
<td x-text="ability.ability_id ? ability.name : 'Undefined Ability'"></td>
<template x-if="!ability.ability_id">
<td colspan="7" x-text="'ID - ' + abilityIDs[index]"></td>
</template>
<td x-show="undefinedAbilities.indexOf(ability.ability_id)">
<span x-text="ability.tactic" x-bind:style="`border-bottom: 1px ridge ${hashStringToColor(ability.tactic)}`"></span>
</td>
<td x-text="ability.technique_name" x-show="undefinedAbilities.indexOf(ability.ability_id)"></td>
<td x-show="undefinedAbilities.indexOf(ability.ability_id)">
<template x-for="platform of getExecutorDetail('platforms', ability)">
<span class="has-tooltip-arrow no-underline" x-bind:data-tooltip="platform">
<span class="icon is-small"><em class="fab" x-bind:class="if (platform.includes('windows')) return 'fa-windows'; else if (platform.includes('darwin')) return 'fa-apple'; else if (platform.includes('linux')) return 'fa-linux'"></em></span>
</span>
</template>
</td>
<td class="has-text-centered" x-show="undefinedAbilities.indexOf(ability.ability_id)" x-bind:class="{ 'unlock': onHoverUnlocks.indexOf(ability.ability_id) > -1 }">
<span class=" has-tooltip-arrow no-underline" x-show="getExecutorDetail('requirements', ability)" x-bind:data-tooltip="`This ability has requirements: (${abilityDependencies[ability.ability_id].requireTypes})`">
<span class="icon is-small"><em class="fas fa-lock"></em></span>
</span>
<span class="icon has-text-warning" x-show="needsParser.indexOf(ability.name) > -1">
<em class="fas fa-exclamation-triangle"></em>
</td>
<td class="has-text-centered" x-show="undefinedAbilities.indexOf(ability.ability_id)" x-bind:class="{ 'lock': onHoverLocks.indexOf(ability.ability_id) > -1 }">
<span class="has-tooltip-arrow no-underline" x-show="getExecutorDetail('parser', ability)" x-bind:data-tooltip="`This ability unlocks other abilities: (${abilityDependencies[ability.ability_id].enableTypes})`">
<span class="icon is-small"><em class="fas fa-key"></em></span>
</span>
</div>
</td>
<td x-text="ability.ability_id ? ability.name : 'Undefined Ability'"></td>
<template x-if="!ability.ability_id">
<td colspan="7" x-text="'ID - ' + abilityIDs[index]"></td>
</template>
<td x-show="undefinedAbilities.indexOf(ability.ability_id)">
<span x-text="ability.tactic" x-bind:style="`border-bottom: 1px ridge ${hashStringToColor(ability.tactic)}`"></span>
</td>
<td x-text="ability.technique_name" x-show="undefinedAbilities.indexOf(ability.ability_id)"></td>
<td x-show="undefinedAbilities.indexOf(ability.ability_id)">
<template x-for="platform of getExecutorDetail('platforms', ability)">
<span class="has-tooltip-arrow no-underline" x-bind:data-tooltip="platform">
<span class="icon is-small"><em class="fab" x-bind:class="if (platform.includes('windows')) return 'fa-windows'; else if (platform.includes('darwin')) return 'fa-apple'; else if (platform.includes('linux')) return 'fa-linux'"></em></span>
</td>
<td class="has-text-centered" x-show="undefinedAbilities.indexOf(ability.ability_id)">
<span class="has-tooltip-arrow no-underline" x-show="getExecutorDetail('payload', ability)" data-tooltip="This ability uses a payload">
<span class="icon is-small"><em class="fas fa-weight-hanging"></em></span>
</span>
</template>
</td>
<td class="has-text-centered" x-show="undefinedAbilities.indexOf(ability.ability_id)" x-bind:class="{ 'unlock': onHoverUnlocks.indexOf(ability.ability_id) > -1 }">
<span class=" has-tooltip-arrow no-underline" x-show="getExecutorDetail('requirements', ability)" x-bind:data-tooltip="`This ability has requirements: (${abilityDependencies[ability.ability_id].requireTypes})`">
<span class="icon is-small"><em class="fas fa-lock"></em></span>
</span>
</td>
<td class="has-text-centered" x-show="undefinedAbilities.indexOf(ability.ability_id)" x-bind:class="{ 'lock': onHoverLocks.indexOf(ability.ability_id) > -1 }">
<span class="has-tooltip-arrow no-underline" x-show="getExecutorDetail('parser', ability)" x-bind:data-tooltip="`This ability unlocks other abilities: (${abilityDependencies[ability.ability_id].enableTypes})`">
<span class="icon is-small"><em class="fas fa-key"></em></span>
</span>
</td>
<td class="has-text-centered" x-show="undefinedAbilities.indexOf(ability.ability_id)">
<span class="has-tooltip-arrow no-underline" x-show="getExecutorDetail('payload', ability)" data-tooltip="This ability uses a payload">
<span class="icon is-small"><em class="fas fa-weight-hanging"></em></span>
</span>
</td>
<td class="has-text-centered" x-show="undefinedAbilities.indexOf(ability.ability_id)">
<span class="has-tooltip-arrow no-underline" x-show="getExecutorDetail('cleanup', ability)" data-tooltip="This ability can clean itself up">
<span class="icon is-small"><em class="fas fa-trash"></em></span>
</span>
</td>
<td class="has-text-centered"><button class="delete is-danger" @click.stop="removeAbility(index)"></button></td>
</tr>
</template>
</tbody>
</table>
<div x-show="!selectedProfileAbilities.length" class="container has-text-centered">
<p>This profile has no abilities.</p>
</div>
<div class="icon-text" x-show="needsParser.length">
<span class="icon has-text-warning">
<em class="fas fa-exclamation-triangle"></em>
</span>
<span>One or more of the abilities have unmet requirements, which may result in a failed operation if ran sequentially.</span>
</div>
<div class="icon-text mt-2" x-show="undefinedAbilities.length">
<span class="icon has-text-danger">
<em class="fas fa-ban"></em>
</span>
<span>One or more of the referenced abilities are not defined.</span>
</td>
<td class="has-text-centered" x-show="undefinedAbilities.indexOf(ability.ability_id)">
<span class="has-tooltip-arrow no-underline" x-show="getExecutorDetail('cleanup', ability)" data-tooltip="This ability can clean itself up">
<span class="icon is-small"><em class="fas fa-trash"></em></span>
</span>
</td>
<td class="has-text-centered"><button class="delete is-danger" @click.stop="removeAbility(index)"></button></td>
</tr>
</template>
</tbody>
</table>
<div x-show="!selectedProfileAbilities.length" class="container has-text-centered">
<p>This profile has no abilities.</p>
</div>
<div class="icon-text" x-show="needsParser.length">
<span class="icon has-text-warning">
<em class="fas fa-exclamation-triangle"></em>
</span>
<span>One or more of the abilities have unmet requirements, which may result in a failed operation if ran sequentially.</span>
</div>
<div class="icon-text mt-2" x-show="undefinedAbilities.length">
<span class="icon has-text-danger">
<em class="fas fa-ban"></em>
</span>
<span>One or more of the referenced abilities are not defined.</span>
</div>
</div>
</div>
</template>
Expand Down

0 comments on commit e8fdc79

Please sign in to comment.