Add 'Select/Unselect All' in partition selection.

Now both OTA configuration and OTA analysis page support select/unselect
all partitions.

Test: Mannual tested.
Change-Id: I684912886f3d3da259aeafea6aea1e53ae4a1c9a
diff --git a/tools/otagui/src/components/PartialCheckbox.vue b/tools/otagui/src/components/PartialCheckbox.vue
index fc7694f..3cd2de8 100644
--- a/tools/otagui/src/components/PartialCheckbox.vue
+++ b/tools/otagui/src/components/PartialCheckbox.vue
@@ -1,5 +1,11 @@
 <template>
   <ul v-bind="$attrs">
+    <button
+      type="button"
+      @click="revertAllSelection"
+      v-text="selectAllText[selectAll]"
+    />
+    <br>
     <li
       v-for="label in labels"
       :key="label"
@@ -27,11 +33,29 @@
       default: new Map(),
     },
   },
+  data() {
+    return {
+      selectAll: 1,
+      selectAllText: ['Select All', 'Unselect All'],
+    }
+  },
+  mounted() {
+    // Set the default value to be true once mounted
+    for (let key of this.labels) {
+      this.modelValue.set(key, true)
+    }
+  },
   methods: {
     updateSelected(newSelect) {
       this.modelValue.set(newSelect, !this.modelValue.get(newSelect))
       this.$emit('update:modelValue', this.modelValue)
     },
+    revertAllSelection() {
+      this.selectAll = 1 - this.selectAll
+      for (let key of this.modelValue.keys()) {
+        this.modelValue.set(key, Boolean(this.selectAll))
+      }
+    },
   },
 }
 </script>
diff --git a/tools/otagui/src/components/PayloadComposition.vue b/tools/otagui/src/components/PayloadComposition.vue
index 96a4884..47b67ba 100644
--- a/tools/otagui/src/components/PayloadComposition.vue
+++ b/tools/otagui/src/components/PayloadComposition.vue
@@ -49,11 +49,6 @@
       })
     },
   },
-  mounted() {
-    this.manifest.partitions.forEach((partition) => {
-      this.partitionInclude.set(partition.partitionName, true)
-    })
-  },
   methods: {
     updateChart(metrics) {
       let partitionSelected = this.manifest.partitions.filter((partition) =>
diff --git a/tools/otagui/src/views/SimpleForm.vue b/tools/otagui/src/views/SimpleForm.vue
index 809f80f..3ade7d5 100644
--- a/tools/otagui/src/views/SimpleForm.vue
+++ b/tools/otagui/src/views/SimpleForm.vue
@@ -125,6 +125,7 @@
   },
   computed: {
     updatePartitions() {
+      if (!this.input.target) return []
       let target = this.targetDetails.filter(
         (d) => d.path === this.input.target
       )
@@ -145,7 +146,7 @@
       handler: function () {
         this.input.partial = this.partitionList
       },
-    },
+    }
   },
   created() {
     this.resetInput()