|
7 | 7 | :headers="[
|
8 | 8 | { text: 'Name', value: 'name' },
|
9 | 9 | { text: 'Description', value: 'description' },
|
10 |
| - { text: 'Value', value: 'value', width: '150px' }, |
| 10 | + { text: 'Value', value: 'value', width: '170px' }, |
11 | 11 | ]"
|
12 | 12 | :loading="!finished_loading"
|
13 | 13 | :items="search && search != '' ? fuse.search(search) : params_no_input"
|
|
62 | 62 | </template>
|
63 | 63 | <!-- eslint-enable -->
|
64 | 64 | <template #item.value="{ item }">
|
65 |
| - {{ printParam(item.item) }} {{ item.item.units ? `[${item.item.units}]` : '' }} |
| 65 | + <div class="value-cell-content"> |
| 66 | + {{ printParam(item.item) }} {{ item.item.units ? `[${item.item.units}]` : '' }} |
| 67 | + <v-btn |
| 68 | + v-if="!item.item?.readonly && item.item?.default !== undefined && item.item?.default !== item.item.value" |
| 69 | + v-tooltip="item.item?.rebootRequired ? 'Reboot required' : undefined" |
| 70 | + icon |
| 71 | + :color="item.item?.rebootRequired ? 'warning' : 'primary'" |
| 72 | + class="value-cell-content-restore" |
| 73 | + @click.stop="setDefaultParamValue(item.item)" |
| 74 | + > |
| 75 | + <v-icon>mdi-backup-restore</v-icon> |
| 76 | + </v-btn> |
| 77 | + </div> |
66 | 78 | </template>
|
67 | 79 | <template #footer.prepend>
|
68 | 80 | <v-btn
|
@@ -146,6 +158,7 @@ import { saveAs } from 'file-saver'
|
146 | 158 | import Fuse from 'fuse.js'
|
147 | 159 | import Vue from 'vue'
|
148 | 160 |
|
| 161 | +import mavlink2rest from '@/libs/MAVLink2Rest' |
149 | 162 | import autopilot_data from '@/store/autopilot'
|
150 | 163 | import autopilot from '@/store/autopilot_manager'
|
151 | 164 | import Parameter, { printParam } from '@/types/autopilot/parameter'
|
@@ -217,6 +230,16 @@ export default Vue.extend({
|
217 | 230 | },
|
218 | 231 | },
|
219 | 232 | methods: {
|
| 233 | + setDefaultParamValue(param: Parameter) { |
| 234 | + if (param.default === undefined || param.readonly) { |
| 235 | + return |
| 236 | + } |
| 237 | + mavlink2rest.setParam(param.name, param.default, autopilot_data.system_id, param.paramType.type) |
| 238 | +
|
| 239 | + if (param.rebootRequired) { |
| 240 | + autopilot_data.setRebootRequired(true) |
| 241 | + } |
| 242 | + }, |
220 | 243 | editParam(param: Parameter) {
|
221 | 244 | if (param.readonly) {
|
222 | 245 | return
|
@@ -330,4 +353,14 @@ div.v-messages {
|
330 | 353 | .hand-cursor {
|
331 | 354 | cursor: pointer;
|
332 | 355 | }
|
| 356 | +
|
| 357 | +.value-cell-content { |
| 358 | + display: flex; |
| 359 | + justify-content: space-between; |
| 360 | + align-items: center; |
| 361 | +} |
| 362 | +
|
| 363 | +.value-cell-content-restore { |
| 364 | + margin-left: auto; |
| 365 | +} |
333 | 366 | </style>
|
0 commit comments