Merge "Add support for reuse configuration in OTA generator." am: 097e8c0a15 am: 4976675e9a am: 023d8bfa44

Original change: https://android-review.googlesource.com/c/platform/development/+/1802616

Change-Id: I1020f5807de22c5f5dad72e4633f7c4d0360160f
This commit is contained in:
Treehugger Robot
2021-08-19 21:32:54 +00:00
committed by Automerger Merge Worker
8 changed files with 170 additions and 52 deletions

View File

@@ -2,7 +2,7 @@
<form @submit.prevent="sendForm">
<FileList
v-model="incrementalSources"
:disabled="!otaConfig.isIncremental"
:disabled="!checkIncremental"
label="Source files"
/>
<v-divider />
@@ -14,7 +14,6 @@
<OTAOptions
:targetDetails="targetDetails"
:targetBuilds="targetBuilds"
@update:otaConfig="otaConfig=$event"
/>
<v-divider class="my-5" />
<v-btn
@@ -29,7 +28,6 @@
<script>
import OTAOptions from '@/components/OTAOptions.vue'
import FileList from '@/components/FileList.vue'
import { OTAConfiguration } from '@/services/JobSubmission.js'
export default {
components: {
@@ -44,25 +42,30 @@ export default {
},
data() {
return {
incrementalSources: [],
targetBuilds: [],
otaConfig: new OTAConfiguration(),
}
},
computed: {
checkIncremental() {
return this.otaConfig.isIncremental
return this.$store.state.otaConfig.isIncremental
},
incrementalSources: {
get() {
return this.$store.state.sourceBuilds
},
watch: {
checkIncremental: {
handler: function () {
this.$emit('update:isIncremental', this.checkIncremental)
set(target) {
this.$store.commit('SET_SOURCES', target)
}
},
targetBuilds: {
get() {
return this.$store.state.targetBuilds
},
set(target) {
this.$store.commit('SET_TARGETS', target)
}
}
},
created() {
this.$emit('update:isIncremental', this.checkIncremental)
this.$emit('update:handler', this.addIncrementalSources, this.addTargetBuilds)
},
methods: {
@@ -71,10 +74,12 @@ export default {
*/
async sendForm() {
try {
let response_messages = await this.otaConfig.sendForms(
let response_messages = await this.$store.state.otaConfig.sendForms(
this.targetBuilds, this.incrementalSources)
alert(response_messages.join('\n'))
this.otaConfig.reset()
this.$store.state.otaConfig.reset()
this.$store.commit('SET_TARGETS', [])
this.$store.commit('SET_SOURCES', [])
} catch (err) {
alert(
'Job cannot be started properly for the following reasons: ' + err

View File

@@ -9,7 +9,6 @@
<OTAOptions
:targetDetails="targetDetails"
:targetBuilds="targetBuilds"
@update:otaConfig="otaConfig=$event"
/>
<v-divider class="my-5" />
<v-btn
@@ -24,7 +23,6 @@
<script>
import OTAOptions from '@/components/OTAOptions.vue'
import FileList from '@/components/FileList.vue'
import { OTAConfiguration } from '@/services/JobSubmission.js'
export default {
components: {
@@ -39,12 +37,33 @@ export default {
},
data() {
return {
targetBuilds: [],
otaConfig: new OTAConfiguration(),
}
},
computed: {
checkIncremental() {
return this.$store.state.otaConfig.isIncremental
},
targetBuilds: {
get() {
return this.$store.state.targetBuilds
},
set(target) {
this.$store.commit('SET_TARGETS', target)
}
}
},
watch: {
checkIncremental: {
handler() {
// The isIncremental flag has to be set false all the time
this.$store.commit('SET_ISINCREMENTAL', false)
this.$store.commit('SET_SOURCES', [])
}
}
},
created() {
this.$emit('update:isIncremental', false)
this.$store.commit('SET_ISINCREMENTAL', false)
this.$store.commit('SET_SOURCES', [])
this.$emit('update:handler', this.addIncrementalSources, this.addTargetBuilds)
},
methods: {
@@ -59,10 +78,11 @@ export default {
return
}
try {
let response_messages = await this.otaConfig
let response_messages = await this.$store.state.otaConfig
.sendChainForms(this.targetBuilds)
alert(response_messages.join('\n'))
this.otaConfig.reset()
this.$store.state.otaConfig.reset()
this.$store.commit('SET_TARGETS', [])
} catch (err) {
alert(
'Job cannot be started properly for the following reasons: ' + err

View File

@@ -15,10 +15,12 @@
<div v-if="otaConfig.isPartial">
<v-divider />
<h3>Select Partitions</h3>
<div v-if="targetDetails.length!==0">
<PartialCheckbox
v-model="otaConfig.partial"
:labels="updatablePartitions"
/>
</div>
<v-divider />
</div>
<v-btn
@@ -51,7 +53,7 @@
import BaseInput from '@/components/BaseInput.vue'
import BaseCheckbox from '@/components/BaseCheckbox.vue'
import PartialCheckbox from '@/components/PartialCheckbox.vue'
import { OTAConfiguration, OTABasicFlags, OTAExtraFlags } from '@/services/JobSubmission.js'
import { OTABasicFlags, OTAExtraFlags } from '@/services/JobSubmission.js'
export default {
components: {
@@ -71,7 +73,7 @@ export default {
},
data () {
return {
otaConfig: new OTAConfiguration(),
otaConfig: null,
moreOptions: false,
basicFlags: OTABasicFlags,
extraFlags: OTAExtraFlags
@@ -93,14 +95,29 @@ export default {
)
return target[0].partitions
},
checkIncremental() {
return this.$store.state.otaConfig.isIncremental
}
},
watch: {
otaConfig: {
handler () {
this.$emit('update:otaConfig', this.otaConfig)
this.$store.commit('SET_CONFIG', this.otaConfig)
},
deep: true
},
checkIncremental: {
handler () {
// In chain OTA, this option will be set outside this components
console.log('changed')
this.otaConfig.isIncremental = this.checkIncremental
}
}
},
created() {
// This option only need to be synced once because this will not be
// modified outside this components
this.otaConfig = this.$store.state.otaConfig
}
}
</script>

View File

@@ -64,10 +64,20 @@ export default {
}
},
mounted() {
// Set the default value to be true once mounted
// Set the default value to be true once mounted if nothing has been selected
if (this.modelValue.length === 0) {
for (let key of this.labels) {
this.partitionSelected.set(key, true)
}
} else {
for (let key of this.labels) {
this.partitionSelected.set(key, false)
}
for (let key of this.modelValue) {
this.partitionSelected.set(key, true)
}
}
this.$emit('update:modelValue', this.modelValue)
},
methods: {
updateSelected(newSelect) {

View File

@@ -1,7 +1,7 @@
<template>
<form @submit.prevent="sendForm">
<FileSelect
v-if="otaConfig.isIncremental"
v-if="checkIncremental"
v-model="incrementalSource"
label="Select the source file"
:options="targetDetails"
@@ -14,7 +14,6 @@
<OTAOptions
:targetDetails="targetDetails"
:targetBuilds="[targetBuild]"
@update:otaConfig="otaConfig=$event"
/>
<v-divider class="my-5" />
<v-btn
@@ -29,7 +28,6 @@
<script>
import OTAOptions from '@/components/OTAOptions.vue'
import FileSelect from '@/components/FileSelect.vue'
import { OTAConfiguration } from '@/services/JobSubmission.js'
export default {
components: {
@@ -44,25 +42,30 @@ export default {
},
data() {
return {
incrementalSource: '',
targetBuild: '',
otaConfig: new OTAConfiguration(),
}
},
computed: {
checkIncremental() {
return this.otaConfig.isIncremental
return this.$store.state.otaConfig.isIncremental
},
incrementalSource: {
get() {
return this.$store.state.sourceBuilds[0]
},
watch: {
checkIncremental: {
handler: function () {
this.$emit('update:isIncremental', this.checkIncremental)
set(target) {
this.$store.commit('SET_SOURCE', target)
}
},
targetBuild: {
get() {
return this.$store.state.targetBuilds[0]
},
set(target) {
this.$store.commit('SET_TARGET', target)
}
}
},
created() {
this.$emit('update:isIncremental', this.checkIncremental)
this.$emit('update:handler', this.setIncrementalSource, this.setTargetBuild)
},
methods: {
@@ -71,10 +74,12 @@ export default {
*/
async sendForm() {
try {
let response_message = await this.otaConfig.sendForm(
let response_message = await this.$store.state.otaConfig.sendForm(
this.targetBuild, this.incrementalSource)
alert(response_message)
this.otaConfig.reset()
this.$store.state.otaConfig.reset()
this.$store.commit('SET_TARGETS', [])
this.$store.commit('SET_SOURCES', [])
} catch (err) {
alert(
'Job cannot be started properly for the following reasons: ' + err

View File

@@ -1,8 +1,55 @@
import { createStore } from 'vuex'
import { OTAConfiguration, OTAExtraFlags } from '@/services/JobSubmission.js'
export default createStore({
state: {},
mutations: {},
state: {
otaConfig: new OTAConfiguration(),
targetBuilds: [],
sourceBuilds: []
},
mutations: {
REUSE_CONFIG(state, config) {
state.otaConfig.verbose = config.verbose
state.otaConfig.isIncremental = config.isIncremental
state.otaConfig.partial = config.partial
state.otaConfig.isPartial = config.isPartial
state.targetBuilds = [config.target]
if (config.isIncremental)
state.sourceBuilds = [config.incremental]
const extra =
config.extra.split('--')
.filter((s) => s!=='')
.map((s) => s.trimRight())
extra.forEach( (key) => {
if (OTAExtraFlags.filter((flags) => flags.key == key)) {
state.otaConfig[key] = true
} else {
state.extra += key
}
})
},
SET_CONFIG(state, config) {
state.otaConfig = config
},
RESET_CONFIG(state) {
state.otaConfig = new OTAConfiguration()
},
SET_TARGET(state, target) {
state.targetBuilds = [target]
},
SET_SOURCE(state, target) {
state.sourceBuilds = [target]
},
SET_TARGETS(state, targets) {
state.targetBuilds = targets
},
SET_SOURCES(state, targets) {
state.sourceBuilds = targets
},
SET_ISINCREMENTAL(state, isIncremental) {
state.otaConfig.isIncremental = isIncremental
}
},
actions: {},
modules: {}
})

View File

@@ -17,7 +17,6 @@
:is="currentTab"
class="tab-component"
:targetDetails="targetDetails"
@update:isIncremental="isIncremental = $event"
@update:handler="setHandler"
/>
</v-col>
@@ -30,7 +29,7 @@
<!-- the key-binding refresh has to be used to reload the methods-->
<BuildLibrary
:refresh="refresh"
:isIncremental="isIncremental"
:isIncremental="checkIncremental"
@update:incrementalSource="addIncrementalSource"
@update:targetBuild="addTargetBuild"
@update:targetDetails="targetDetails = $event"
@@ -55,7 +54,6 @@ export default {
data() {
return {
targetDetails: [],
isIncremental: false,
currentTab: 'SingleOTAOptions',
refresh: false,
tabs: [
@@ -65,6 +63,11 @@ export default {
],
}
},
computed: {
checkIncremental() {
return this.$store.state.otaConfig.isIncremental
},
},
methods: {
setHandler(addIncrementalSource, addTargetBuild) {
this.refresh = true,

View File

@@ -5,6 +5,14 @@
:job="job"
:build-detail="true"
/>
<router-link :to="{name: 'Create'}">
<v-btn
block
@click="updateConfig()"
>
Reuse this configuration.
</v-btn>
</router-link>
<v-divider class="my-5" />
<div>
<h3>STDERR</h3>
@@ -95,6 +103,9 @@ export default {
if (this.job.status == 'Running') {
setTimeout(this.updateStatus, 1000)
}
},
updateConfig() {
this.$store.commit("REUSE_CONFIG", this.job)
}
},
}