Merge "Add support for chain OTA generation." am: 4895d0a8b4 am: d5b6e875b0
Original change: https://android-review.googlesource.com/c/platform/development/+/1776605 Change-Id: I629768bbec7e0d9f7ae4ad47c697c70ab3ab89d1
This commit is contained in:
80
tools/otagui/src/components/ChainOTAOptions.vue
Normal file
80
tools/otagui/src/components/ChainOTAOptions.vue
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
<template>
|
||||||
|
<form @submit.prevent="sendForm">
|
||||||
|
<FileList
|
||||||
|
v-model="targetBuilds"
|
||||||
|
label="Target files"
|
||||||
|
:movable="true"
|
||||||
|
/>
|
||||||
|
<v-divider />
|
||||||
|
<OTAOptions
|
||||||
|
:targetDetails="targetDetails"
|
||||||
|
:targetBuilds="targetBuilds"
|
||||||
|
@update:otaConfig="otaConfig=$event"
|
||||||
|
/>
|
||||||
|
<v-divider class="my-5" />
|
||||||
|
<v-btn
|
||||||
|
block
|
||||||
|
type="submit"
|
||||||
|
>
|
||||||
|
Submit
|
||||||
|
</v-btn>
|
||||||
|
</form>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import OTAOptions from '@/components/OTAOptions.vue'
|
||||||
|
import FileList from '@/components/FileList.vue'
|
||||||
|
import { OTAConfiguration } from '@/services/JobSubmission.js'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
OTAOptions,
|
||||||
|
FileList,
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
targetDetails: {
|
||||||
|
type: Array,
|
||||||
|
default: () => [],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
targetBuilds: [],
|
||||||
|
otaConfig: new OTAConfiguration(),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.$emit('update:isIncremental', false)
|
||||||
|
this.$emit('update:handler', this.addIncrementalSources, this.addTargetBuilds)
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/**
|
||||||
|
* Send the configuration to the backend.
|
||||||
|
*/
|
||||||
|
async sendForm() {
|
||||||
|
if (this.targetBuilds.length<2) {
|
||||||
|
alert(
|
||||||
|
'At least two OTA packeges has to be given!'
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
let response_messages = await this.otaConfig
|
||||||
|
.sendChainForms(this.targetBuilds)
|
||||||
|
alert(response_messages.join('\n'))
|
||||||
|
this.otaConfig.reset()
|
||||||
|
} catch (err) {
|
||||||
|
alert(
|
||||||
|
'Job cannot be started properly for the following reasons: ' + err
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
addIncrementalSources (build) {},
|
||||||
|
addTargetBuilds (build) {
|
||||||
|
if (!this.targetBuilds.includes(build)) {
|
||||||
|
this.targetBuilds.push(build)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -14,13 +14,48 @@
|
|||||||
{{ build }}
|
{{ build }}
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
<v-btn
|
<v-row
|
||||||
class="my-2"
|
class="my-2"
|
||||||
|
>
|
||||||
|
<v-col
|
||||||
|
cols="12"
|
||||||
|
md="4"
|
||||||
|
>
|
||||||
|
<v-btn
|
||||||
:disabled="!selected"
|
:disabled="!selected"
|
||||||
|
block
|
||||||
@click="deleteSelected"
|
@click="deleteSelected"
|
||||||
>
|
>
|
||||||
Remove selected item
|
Remove selected item
|
||||||
</v-btn>
|
</v-btn>
|
||||||
|
</v-col>
|
||||||
|
<v-col
|
||||||
|
cols="12"
|
||||||
|
md="4"
|
||||||
|
>
|
||||||
|
<v-btn
|
||||||
|
v-if="movable"
|
||||||
|
:disabled="!selected"
|
||||||
|
block
|
||||||
|
@click="moveSelected(-1)"
|
||||||
|
>
|
||||||
|
🔼
|
||||||
|
</v-btn>
|
||||||
|
</v-col>
|
||||||
|
<v-col
|
||||||
|
cols="12"
|
||||||
|
md="4"
|
||||||
|
>
|
||||||
|
<v-btn
|
||||||
|
v-if="movable"
|
||||||
|
:disabled="!selected"
|
||||||
|
block
|
||||||
|
@click="moveSelected(1)"
|
||||||
|
>
|
||||||
|
🔽
|
||||||
|
</v-btn>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -33,6 +68,10 @@ export default {
|
|||||||
modelValue: {
|
modelValue: {
|
||||||
type: Array,
|
type: Array,
|
||||||
required: true
|
required: true
|
||||||
|
},
|
||||||
|
movable: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@@ -61,6 +100,18 @@ export default {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
this.selected = null
|
this.selected = null
|
||||||
|
},
|
||||||
|
moveSelected(direction) {
|
||||||
|
let selectedIndex = this.modelValue.indexOf(this.selected)
|
||||||
|
if (selectedIndex + direction > this.modelValue.length ||
|
||||||
|
selectedIndex + direction < 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let tempArray = Array.from(this.modelValue)
|
||||||
|
let temp = this.modelValue[selectedIndex]
|
||||||
|
tempArray[selectedIndex] = tempArray[selectedIndex + direction]
|
||||||
|
tempArray[selectedIndex + direction] = temp
|
||||||
|
this.$emit("update:modelValue", tempArray)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,6 +59,28 @@ export class OTAConfiguration {
|
|||||||
return responses
|
return responses
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Take in an ordered list of target builds and generate OTA packages between
|
||||||
|
* them in order. For example, if there are n target builds, there will be
|
||||||
|
* n-1 OTA packages.
|
||||||
|
* @param {Array<String>} targetBuilds
|
||||||
|
* @return Array<String>
|
||||||
|
*/
|
||||||
|
async sendChainForms(targetBuilds) {
|
||||||
|
const responses = []
|
||||||
|
this.isIncremental = true
|
||||||
|
for (let i = 0; i < targetBuilds.length-1; i++) {
|
||||||
|
try {
|
||||||
|
let response =
|
||||||
|
await this.sendForm(targetBuilds[i+1], targetBuilds[i])
|
||||||
|
responses.push(response)
|
||||||
|
} catch (err) {
|
||||||
|
throw err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return responses
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start an OTA package generation from target build to incremental source.
|
* Start an OTA package generation from target build to incremental source.
|
||||||
* Throw an error if not succeed, otherwise will return the message from
|
* Throw an error if not succeed, otherwise will return the message from
|
||||||
|
|||||||
@@ -42,12 +42,14 @@
|
|||||||
<script>
|
<script>
|
||||||
import SingleOTAOptions from '@/components/SingleOTAOptions.vue'
|
import SingleOTAOptions from '@/components/SingleOTAOptions.vue'
|
||||||
import BatchOTAOptions from '@/components/BatchOTAOptions.vue'
|
import BatchOTAOptions from '@/components/BatchOTAOptions.vue'
|
||||||
|
import ChainOTAOptions from '@/components/ChainOTAOptions.vue'
|
||||||
import BuildLibrary from '@/components/BuildLibrary.vue'
|
import BuildLibrary from '@/components/BuildLibrary.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
SingleOTAOptions,
|
SingleOTAOptions,
|
||||||
BatchOTAOptions,
|
BatchOTAOptions,
|
||||||
|
ChainOTAOptions,
|
||||||
BuildLibrary,
|
BuildLibrary,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@@ -58,7 +60,8 @@ export default {
|
|||||||
refresh: false,
|
refresh: false,
|
||||||
tabs: [
|
tabs: [
|
||||||
{label: 'Single OTA', component: 'SingleOTAOptions'},
|
{label: 'Single OTA', component: 'SingleOTAOptions'},
|
||||||
{label: 'Batch OTA', component: 'BatchOTAOptions'}
|
{label: 'Batch OTA', component: 'BatchOTAOptions'},
|
||||||
|
{label: 'Chain OTA', component: 'ChainOTAOptions'}
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user