Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
3073746
Add ACE features, fixed from newAce
GregRRoss Apr 18, 2024
6d4aac8
Reduced line length for ACE script for linter
GregRRoss Apr 18, 2024
41844d9
Shorten Vue Template line length for Linter
GregRRoss Apr 18, 2024
8bfdc44
Vue Template Linter Fixes
GregRRoss Apr 18, 2024
8c9be40
Vue Template Linter Indent and Trailing Space Remove
GregRRoss Apr 18, 2024
a09dd5e
Vue Template Linter Indent and Trailing Space Remove
GregRRoss Apr 18, 2024
9c2f152
Vue Template Linter Indent and Trailing Space Remove
GregRRoss Apr 18, 2024
276ba0f
Vue Template Linter Indent and Paren Space
GregRRoss Apr 18, 2024
36c01a2
Linter: Remove multiline strings, fix foreach iterator
GregRRoss Apr 18, 2024
553a787
Fix Linter issues Greenhouse.vue
GregRRoss Apr 18, 2024
135b8b7
Fix Linter space after ; missing, Greenhouse.vue
GregRRoss Apr 18, 2024
15c2d18
Fix linter issues configurationVue (For loop fix)
GregRRoss Apr 18, 2024
4a0e048
Fix linter issues configurationVue let->const
GregRRoss Apr 18, 2024
6015b44
Linter: change == to ===
GregRRoss Apr 18, 2024
267dbfb
Linter: change != to !==
GregRRoss Apr 18, 2024
29f655f
Linter: remove for-each loop for currencyType, classType
GregRRoss Apr 18, 2024
2a0a7b9
Linter: Remove for-each agentsInClass()
GregRRoss Apr 18, 2024
b172fde
Linter: Remove for-each getLocalStorageAgents()
GregRRoss Apr 18, 2024
61922ae
linter: Empty block in if statement -> Console.log
GregRRoss Apr 18, 2024
87204a9
Linter: Remove unused variable + refactor section
GregRRoss Apr 18, 2024
b083068
Improve Comment
GregRRoss Apr 19, 2024
db53c0b
linter: Remove for-each in generateCurrencyList()
GregRRoss Apr 19, 2024
b0e4615
linter: Remove for-each in name change functions
GregRRoss Apr 19, 2024
6c9079f
linter: whitespace and let->const
GregRRoss Apr 19, 2024
02fadbf
remove for-each getLocalStorageCurrencies()
GregRRoss Apr 19, 2024
f456810
linter: removePropQuotes, spacing, ;
GregRRoss Apr 19, 2024
c41b963
linter: destructuring variable name the fixed
GregRRoss Apr 19, 2024
826932b
linter: eliminate destructuring warning
GregRRoss Apr 19, 2024
28d1a37
linter: Stop assigning to function parameter
GregRRoss Apr 19, 2024
f097988
linter: Adjust Whitespace
GregRRoss Apr 19, 2024
f4a7df1
linter: isNaN -> Number.isNaN
GregRRoss Apr 19, 2024
5798938
linter: indentation
GregRRoss Apr 19, 2024
6b8b1cf
Fixed bug caused by incorrectly replacing for-each loop for currencies
GregRRoss Apr 19, 2024
cbc7ee3
Fix line length linter errors
GregRRoss May 11, 2024
50894a3
Add computed selectedAgent() to reduce line length
GregRRoss May 11, 2024
c5cde3a
Fix linter errors in new selectedAgent()
GregRRoss May 11, 2024
c2f2b0e
Linter fix: Remove unused v-for index
GregRRoss May 11, 2024
c2eaa67
Linter fix: add key to v-for
GregRRoss May 11, 2024
7581d82
Improve comments
GregRRoss May 11, 2024
735c9b9
Improve comments
GregRRoss Jun 7, 2024
4399d6b
Add comments
GregRRoss Jun 7, 2024
d66764c
Add instructions for Agent Editor
GregRRoss Jun 10, 2024
96bf858
Fixed Spacing for Linter
GregRRoss Jun 10, 2024
30a0dad
Fixed Spacing for Linter
GregRRoss Jun 10, 2024
8d30163
Merge branch 'master' into ace_branch
GregRRoss Jun 10, 2024
d5b0c8b
Refactor exportJSON() to remove repeated code
GregRRoss Jun 24, 2024
17dffcd
Merge branch 'master' into ace_branch
GregRRoss Jun 24, 2024
ed39f1c
Improve ACE UI with Nesting / Blank Entry Fix
GregRRoss Jul 1, 2024
3d979cb
Merge remote-tracking branch 'refs/remotes/origin/ace_branch' into ac…
GregRRoss Jul 1, 2024
c02d22b
Prepare for Refactor/combine type change functions
GregRRoss Jul 1, 2024
8f30100
Improve ACE UI: Outline new items, wording
GregRRoss Jul 1, 2024
c16f11f
Improve UI for Deprives
GregRRoss Jul 1, 2024
2fce7c5
Make style more similar to elsewhere (not done)
GregRRoss Jul 11, 2024
20c9af6
Add comments clarifying purpose of ConfigurationMenu.vue
GregRRoss Jul 12, 2024
20ff0e7
Improve comment
GregRRoss Jul 12, 2024
691930d
Add SimulationConfiguration support component for Custom non-plant ag…
GregRRoss Jul 19, 2024
dba1a25
Fix linter issues
GregRRoss Jul 22, 2024
1e5d547
Fix linter issues
GregRRoss Jul 22, 2024
d0dc12f
Homogenize styling, add reference
GregRRoss Jul 22, 2024
be68ff8
Add exported custom agent&currency view / deleter
GregRRoss Aug 19, 2024
22f79b5
Make visual appearance consistent for mode title
GregRRoss Aug 19, 2024
246bcfd
Revert to simplified quantity selector, focus on functionality
GregRRoss Aug 30, 2024
69f7536
Merging the updated master into this branch
GregRRoss May 9, 2025
c9f70a4
Resolve merge conflict to updated master
GregRRoss May 9, 2025
296e92f
Solve merge conflict to update branch to master
GregRRoss May 9, 2025
b568e32
Solve merge conflict to update branch to master
GregRRoss May 9, 2025
61e8c76
Unceomment ACE button (caused by merge?)
GregRRoss May 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,373 changes: 1,373 additions & 0 deletions src/components/ace/ACE.vue

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/components/ace/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {default as ACE} from './ACE.vue'
7 changes: 7 additions & 0 deletions src/components/configuration/ConfigurationMenu.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<!--
ConfigurationMenu.vue relates to the pop up menu modal accessible by pressing the hamburger
(3 horizontal line) button that appears in the upper right corner of the screen on the top bar
when in Simulation Configuration, which is reached after choosing 'Mars' or
'Biosphere 2' from the "Main Menu" modal menu. See base\BaseConfiguration.vue for the layout of the
Simulation Configuration itself.
-->
<template>
<BaseMenu>
<template #menu-title>
Expand Down
175 changes: 175 additions & 0 deletions src/components/configuration/CustomAgents.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
<!-- This component establishes the user interface for configuring the quantity of custom agents that
have been defined in local storage that should be present in the actual simulation -->

<script>

import {useWizardStore} from '../../store/modules/WizardStore'

export default {
setup() {
const wizard = useWizardStore()
const {
setActiveRefEntry,
} = wizard
return {
setActiveRefEntry,
}
},
data() {
return {
customAgents: [], // List of all the possible custom agents
addedCustomAgents: [], // Objects holding name and quantity for each agent
// selectedName: 'Agent', // For first custom agent field
// selectedNames: [], // For addedCustomAgents fields
// customAgentAdd: false,
}
},
computed: {
/* Related to formatting like plant species
newAgentAddMode() {
if (this.addedCustomAgents.length<1 || this.customAgentAdd) {
this.selectedName='Agent'
return true
} else {
return false
}
}
*/
},
watch: {/*
selectedName() { // Related to formatting custom agents the way plant species are
if (this.selectedName!='Agent'){
this.addedCustomAgents.push({name: this.selectedName, quantity: 1}) // Add drop selected agent
this.selectedName='Agent'
this.customAgentAdd=false // Make the 'Agent' template disappear when drop selected
} else {
console.log(this.selectedName)
}
},
addedCustomAgents() {
this.selectedNames = []
for (let agent in Object.keys(this.addedCustomAgents)) {
this.selectedNames.push(this.addedCustomAgents[agent].name)
}
}, */
},
async created() {
try {
// Get currencies from local storage.
// this.getLocalStorageCurrencies()
this.getLocalStorageAgents()
} catch (error) {
console.log(error)
}
},
methods: {
getLocalStorageAgents() {
let localStorageAgents = localStorage.getItem('customAgents')
localStorageAgents = JSON.parse(localStorageAgents)
const localAgentNames = Object.keys(localStorageAgents)
if (typeof (localStorageAgents)==='object' && (localStorageAgents!==null)) {
console.log('Custom agents found in local storage:')
for (let index=0; index<localAgentNames.length; ++index) {
// It only adds an agent if it is NOT a plant. Custom plants appear in Plant Species already
if (localStorageAgents[localAgentNames[index]].agent_class==='plants') {
console.log('PLANT: ', localAgentNames[index])
} else {
console.log('NOT PLANT: ', localAgentNames[index])
this.customAgents.push(localAgentNames[index])
const agentObject = {name: localAgentNames[index], quantity: 0}
console.log(agentObject)
this.addedCustomAgents.push(agentObject)
}
}
} else {
console.log(' * No agents loaded from local storage *')
}
}, /*
addCustomAgent(name) { // Related to formatting custom agents the way plant species are
this.customAgentAdd = true // This makes the blank 'Agent' Field appear when you hit +
console.log(name, this.newAgentAddMode)
},
removeCustomAgent(name) {
console.log('REMOVE AGENT:', name)
},
updateCustomAgent(number) {
console.log('UPDATE TRIED', number)
},*/
},
}
</script>
<template>
<div v-if="customAgents.length>0">
<label class="input-wrapper">
<div class="input-title" @click="setActiveRefEntry('CustomAgents')"> <!-- Description @ Reference.vue -->
Custom Agents <fa-icon :icon="['fa-solid','circle-info']" />
</div>
<div class="input-description">Custom user defined agents other than plants.</div>
<!-- This commented code is to make the agent look like the plant config instead
but it has issues that would need to be resolved and may be unnecessary.
<div v-for="(item,index) in addedCustomAgents" :key="index" class="input-plant-wrapper">
<select v-model="selectedNames[index]" class="input-field-select">
<option value="" selected hidden>selectedNames[index]</option>
<option v-for="(name,k) in customAgents" :key="k" :value="name">{{customAgents[k]}}</option>
</select>
<label><input class="input-field-number" type="number" pattern="^\d+$"
placeholder="Quantity" @input="updateCustomAgent(index)"> units</label>
<fa-layers class="fa-2x plant-row-icon icon-add" @click="addCustomAgent(selectedNames[index])">
<fa-icon :icon="['fa-solid','circle-plus']" />
</fa-layers>
<fa-layers class="fa-2x plant-row-icon icon-trash" @click="removeCustomAgent(selectedNames[index])">
<fa-icon :icon="['fa-solid','trash']" mask="circle" transform="shrink-7" />
</fa-layers>
</div>
<div v-if="newAgentAddMode">
<div class="input-plant-wrapper">
<select v-model="selectedName" class="input-field-select">
<option value="Agent" selected hidden disabled>Agent</option>
<option v-for="(name,k) in customAgents" :key="k" :value="name">{{customAgents[k]}}</option>
</select>
<label><input class="input-field-number" type="number" pattern="^\d+$"
placeholder="Quantity" @input="updateCustomAgent(index)"> units</label>
<fa-layers class="fa-2x plant-row-icon icon-add" @click="addCustomAgent(selectedName)">
<fa-icon :icon="['fa-solid','circle-plus']" />
</fa-layers>
<fa-layers class="fa-2x plant-row-icon icon-trash" @click="removeCustomAgent(selectedName)">
<fa-icon :icon="['fa-solid','trash']" mask="circle" transform="shrink-7" />
</fa-layers>
</div>
</div>
-->
<div v-for="agent in addedCustomAgents" :key="agent.name">
<b>{{agent.name}}</b>, Quantity:
<input v-model="agent.quantity" type="number" style="width: 50px;">
</div>
</label>
</div>
</template>
<style lang="scss" scoped>
@import '../../sass/components/configuration-input';

.input-plant-wrapper{
display:flex;
justify-content:flex-start;
align-items:center;
}

.input-field-select{
margin-right:24px;
}

.plant-row-icon{
&:first-of-type{
margin-left:auto;
}

margin-right:24px;
}

.crop-mgmt-description{
display: flex;
flex-direction: row;
align-items: center;
height: 2em;
}
</style>
37 changes: 25 additions & 12 deletions src/components/configuration/Greenhouse.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
/* This component establishes the user interface for configuring the greenhouse, including
the list of plants, when the user is in the 'Simulation Configuration' area prior to pressing
'Launch Simulation' button */
<template>
<div>
<label v-if="simLocation === 'mars'" class="input-wrapper">
<div class="input-title" @click="setActiveRefEntry('Greenhouse')">
Greenhouse <fa-icon :icon="['fa-solid','circle-info']" />
</div> <!-- On click make the value the active entry on the reference. Set the wiki as active.-->

<div class="input-description">Select the size of your greenouse. See <a class="reference-link" href="#" @click="activeReference = 'Graphs'">graph at right</a>.</div>
<div class="input-description">Select the size of your greenhouse. See <a class="reference-link" href="#" @click="activeReference = 'Graphs'">graph at right</a>.</div>
<select ref="greenhouse_type" v-model="greenhouse.type"
class="input-field-select" required @change="setGreenhouseHandler">
<option value="none" selected>None</option>
Expand Down Expand Up @@ -38,7 +41,7 @@
<fa-icon :icon="['fa-solid','circle-plus']" />
</fa-layers>
<fa-layers class="fa-2x plant-row-icon icon-trash" @click="removePlantSpecies(index)">
<!-- Deletes the object at the specicied key within the wizard store. -->
<!-- Deletes the object at the specified key within the wizard store. -->
<fa-icon :icon="['fa-solid','trash']" mask="circle" transform="shrink-7" />
</fa-layers>
</div>
Expand Down Expand Up @@ -81,10 +84,10 @@ export default {
data() {
return {
// Initialize the localized variables used for v-model
greenhouse: undefined,
plantSpecies: undefined,
plantValue: [],
plantFormatted: [],
greenhouse: undefined, // Used in the v-model for selection of greenhouse.type
plantSpecies: undefined, // Used in the v-model to specify sent plant data, including amount
plantValue: [], // This list corresponds to the values for the list of config plants
plantFormatted: [], // The formatted list of plants to display in the user drop down
plantMax: [], // the max m2 for each plant species to fit in the greenhouse
plant_selects: {}, // map index -> <select> for the plant type dropdown
plant_inputs: {}, // map index -> <input> for the plant amount
Expand Down Expand Up @@ -181,7 +184,7 @@ export default {
//const indexType = plantSpecies[index].type

let selectedValues = plantSpecies.splice(index,1)
return false;
return false
},

// This method should have returned a list of all plant values
Expand Down Expand Up @@ -231,16 +234,12 @@ export default {
// of similar route calls. Simply to reduce the callback hell look.
retrievePlantSpecies() {
axios.defaults.withCredentials = true

const params = {agent_class: 'plants'}

axios.get('/get_agent_types', {params}).then(response => {
if (response.status === 200) {
response.data.forEach(item => {
const {name} = item
this.plantValue.push(name)
// console.log(this.formatPlantName(name))
this.formatPlantName(name)
this.listPlant(name)
})
}
}).catch(error => {
Expand All @@ -249,6 +248,20 @@ export default {
console.log('Plant retrieval error')
}
})
// Get plants from local data
let customAgents = localStorage.getItem('customAgents')
if (customAgents == null) return
customAgents = JSON.parse(customAgents)
const agentNames = Object.keys(customAgents)
for (let index=0; index<agentNames.length; ++index) {
const name = (agentNames[index])
if (customAgents[name].agent_class === 'plants') this.listPlant(name)
}
},
listPlant(name) {
// Add the plant to the menu list
this.plantValue.push(name)
this.formatPlantName(name)
},
updateAndValidate() {
// validate and update greenhouse type
Expand Down
4 changes: 4 additions & 0 deletions src/components/configuration/Reference.vue
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ using v-for to populate all links with the title and the approriate value for th
<p>The battery holds a maximum of 10,000 kilowatt-hours (kWh).</p>
</ReferenceItem>

<ReferenceItem v-if="activeRefEntry === 'CustomAgents'" heading="Custom Agents">
<p>For custom agents that are not <a class="reference-link" href="#" @click="setActiveRefEntry('PlantSpecies')">plants</a>, you can specify the quantity here. This could be something like custom electronic devices that consume power. These are user defined agents created by the agent editor.</p>
</ReferenceItem>

<div v-if="activeRefEntry === 'Table'">
<div class="reference-item-title">Table of Contents</div>
<ul v-if="simLocation === 'mars'">
Expand Down
1 change: 1 addition & 0 deletions src/components/configuration/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ export {default as Reference} from './Reference.vue'
export {default as Graphs} from './Graphs.vue'
export {default as Presets} from './Presets.vue'
export {default as Layout} from './Layout.vue'
export {default as CustomAgents} from './CustomAgents.vue'
21 changes: 11 additions & 10 deletions src/components/entry/Menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
<button form="login-form" class="btn-normal btn-mars" @click="toConfiguration('mars')">MARS</button>
<button form="login-form" class="btn-normal btn-biosphere2" @click="toConfiguration('b2')">BIOSPHERE 2</button>
<button form="login-form" class="btn-normal" @click="uploadSimData">LOAD SIMULATION DATA</button>
<!-- <button :class="{'hidden': !showAgentEditor}" form="login-form" class="btn-normal"
@click="toAce">AGENT EDITOR</button> -->
<button :class="{'hidden': !showAgentEditor}" form="login-form" class="btn-normal"
@click="toAce">AGENT EDITOR</button>

<button :class="{'hidden': !showLiveMode}" form="login-form" class="btn-normal"
@click="toLiveDashboard">LIVE MODE</button>
<input id="simDataInputFile" ref="simDataInputFile" type="file"
Expand Down Expand Up @@ -59,7 +60,7 @@ export default {
},
data() {
return {
// showAgentEditor: false,
showAgentEditor: false,
showLiveMode: false,
}
},
Expand All @@ -76,9 +77,9 @@ export default {
this.$router.push('configuration')
},
// Send the user to the ACE Configuration Editor
// toAce() {
// this.$router.push('ace')
// },
toAce() {
this.$router.push('ace')
},
/** Routes the user to the live Dashboard. The minimum configuration required for any
* Dashboard instance to open without error is the min_step_num and a duration object
* composed of an 'amount' key-value pairing. Both of these values can be 0, but the
Expand Down Expand Up @@ -136,10 +137,10 @@ export default {
},
// Adapted from '../views/DashboardView.vue'
keyListener(e) {
// if (e.ctrlKey && e.key === 'a') {
// e.preventDefault() // prevent event from propagating to browser
// this.showAgentEditor = true
// }
if (e.ctrlKey && e.key === 'a') {
e.preventDefault() // prevent event from propagating to browser
this.showAgentEditor = true
}
if (e.ctrlKey && e.key === 'k') {
e.preventDefault() // prevent event from propagating to browser
this.surveyWasPrompted = true // do not prompt with survey in kiosk mode
Expand Down
6 changes: 2 additions & 4 deletions src/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,11 @@ export default createRouter({
},
],
},
/*
{
path: '/ace',
name: 'ace',
conponent: () => import('@/views/AceView.vue'),
name: 'ACE',
component: () => import('@/components/ace/ACE.vue'),
},
*/
{
path: '/configuration',
name: 'configuration',
Expand Down
Loading