Skip to content

Commit a53a3a0

Browse files
nikhilmandlikcharlesh88jvigliottaunlikelyzeroakhenry
authored
Add gauge 4896 (#4919)
* Add new Gauge component Co-authored-by: Charles Hacskaylo <[email protected]> Co-authored-by: Jamie V <[email protected]> Co-authored-by: John Hill <[email protected]> Co-authored-by: Andrew Henry <[email protected]>
1 parent 402cd15 commit a53a3a0

25 files changed

+2210
-9
lines changed

e2e/tests/plugins/gauge.e2eSpec.js

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// 1. create an gauge plugin
2+
// 2. create with custom settings
3+
// 3. verify required fields are required
4+
// 4. should not be able to create gaugue inside a gauge.
5+
// 5. should not be able to move/duplicate gaugue inside a gauge.
6+
// 6. delete gauge
7+
// 7. snapshot gauge
8+
// 8. snapshot gauge inside Notebook entry
9+
// 9. gauge inside Notebook entry
10+
// 10. can drop inside other objects:
11+
// can drop to display layout : yes
12+
// can drop to Flexible layout : yes
13+
// can drop to Folder : yes
14+
// can drop to Bar graph: No
15+
// can drop to clock: No
16+
// . can drop to condition set: No
17+
// . can drop to condition widegt: No
18+
// // .............all other objects
19+
// . can drop to webpage: No
20+
// 11. drop telemetry inside a gauge and reflect on data in both fixed and realtime
21+
// 12. can have only one telemetry per gague. (show confirmation dialog if want to replace)
22+
// 12. all form props (except hidefromInspector) shows inside inspector
23+
// 13. should be able to export and import
24+
// 14. able to search in tree
25+
// 15. supports fix and realtime mode
26+
// 17. refresh after creating
27+
// 18. open in new tab
28+
// 19. two separate gauges inside display layout should not show same numbers unless have same telemetry (should show respctive telemetry data).
29+
// 20. inside display layout compare gague values vs its telemetry value (should be same in fixed time and should tick with same rate/value in realtime)
30+
// 21. same for two diff gauges- > inside display layout compare gague values vs its telemetry value (should be same in fixed time and should tick with same rate/value in realtime)
31+
// 22. export jpeg/png of plugin

index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777

7878

7979
openmct.install(openmct.plugins.LocalStorage());
80-
80+
8181
openmct.install(openmct.plugins.example.Generator());
8282
openmct.install(openmct.plugins.example.EventGeneratorPlugin());
8383
openmct.install(openmct.plugins.example.ExampleImagery());

src/MCT.js

+1
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ define([
242242

243243
// Plugins that are installed by default
244244

245+
this.install(this.plugins.Gauge());
245246
this.install(this.plugins.Plot());
246247
this.install(this.plugins.Chart());
247248
this.install(this.plugins.TelemetryTable.default());

src/api/forms/FormController.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,29 @@
11
import AutoCompleteField from './components/controls/AutoCompleteField.vue';
22
import ClockDisplayFormatField from './components/controls/ClockDisplayFormatField.vue';
3+
import CheckBoxField from './components/controls/CheckBoxField.vue';
34
import Datetime from './components/controls/Datetime.vue';
45
import FileInput from './components/controls/FileInput.vue';
56
import Locator from './components/controls/Locator.vue';
67
import NumberField from './components/controls/NumberField.vue';
78
import SelectField from './components/controls/SelectField.vue';
89
import TextAreaField from './components/controls/TextAreaField.vue';
910
import TextField from './components/controls/TextField.vue';
11+
import ToggleSwitchField from './components/controls/ToggleSwitchField.vue';
1012

1113
import Vue from 'vue';
1214

1315
export const DEFAULT_CONTROLS_MAP = {
1416
'autocomplete': AutoCompleteField,
17+
'checkbox': CheckBoxField,
1518
'composite': ClockDisplayFormatField,
1619
'datetime': Datetime,
1720
'file-input': FileInput,
1821
'locator': Locator,
1922
'numberfield': NumberField,
2023
'select': SelectField,
2124
'textarea': TextAreaField,
22-
'textfield': TextField
25+
'textfield': TextField,
26+
'toggleSwitch': ToggleSwitchField
2327
};
2428

2529
export default class FormControl {
@@ -94,4 +98,3 @@ export default class FormControl {
9498
};
9599
}
96100
}
97-

src/api/forms/components/FormRow.vue

+4-2
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,12 @@ export default {
7979
rowClass() {
8080
let cssClass = this.cssClass;
8181
82-
if (this.row.required) {
83-
cssClass = `${cssClass} req`;
82+
if (!this.row.required) {
83+
return;
8484
}
8585
86+
cssClass = `${cssClass} req`;
87+
8688
if (this.visited && this.valid !== undefined) {
8789
if (this.valid === true) {
8890
cssClass = `${cssClass} valid`;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*****************************************************************************
2+
* Open MCT, Copyright (c) 2014-2022, United States Government
3+
* as represented by the Administrator of the National Aeronautics and Space
4+
* Administration. All rights reserved.
5+
*
6+
* Open MCT is licensed under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
* http://www.apache.org/licenses/LICENSE-2.0.
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14+
* License for the specific language governing permissions and limitations
15+
* under the License.
16+
*
17+
* Open MCT includes source code licensed under additional open source
18+
* licenses. See the Open Source Licenses file (LICENSES.md) included with
19+
* this source code distribution or the Licensing information page available
20+
* at runtime from the About dialog for additional information.
21+
*****************************************************************************/
22+
23+
<template>
24+
<span class="form-control shell">
25+
<span
26+
class="field control"
27+
:class="model.cssClass"
28+
>
29+
<input
30+
type="checkbox"
31+
:checked="isChecked"
32+
@input="toggleCheckBox"
33+
>
34+
</span>
35+
</span>
36+
</template>
37+
38+
<script>
39+
import toggleMixin from '../../toggle-check-box-mixin';
40+
41+
export default {
42+
mixins: [toggleMixin],
43+
props: {
44+
model: {
45+
type: Object,
46+
required: true
47+
}
48+
},
49+
data() {
50+
return {
51+
isChecked: this.model.value
52+
};
53+
}
54+
};
55+
</script>

src/api/forms/components/controls/NumberField.vue

-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ export default {
5858
},
5959
methods: {
6060
updateText() {
61-
console.log('updateText', this.field);
6261
const data = {
6362
model: this.model,
6463
value: this.field
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*****************************************************************************
2+
* Open MCT, Copyright (c) 2014-2022, United States Government
3+
* as represented by the Administrator of the National Aeronautics and Space
4+
* Administration. All rights reserved.
5+
*
6+
* Open MCT is licensed under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
* http://www.apache.org/licenses/LICENSE-2.0.
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14+
* License for the specific language governing permissions and limitations
15+
* under the License.
16+
*
17+
* Open MCT includes source code licensed under additional open source
18+
* licenses. See the Open Source Licenses file (LICENSES.md) included with
19+
* this source code distribution or the Licensing information page available
20+
* at runtime from the About dialog for additional information.
21+
*****************************************************************************/
22+
23+
<template>
24+
<span class="form-control shell">
25+
<span
26+
class="field control"
27+
:class="model.cssClass"
28+
>
29+
<ToggleSwitch
30+
id="switchId"
31+
:checked="isChecked"
32+
@change="toggleCheckBox"
33+
/>
34+
</span>
35+
</span>
36+
</template>
37+
38+
<script>
39+
import toggleMixin from '../../toggle-check-box-mixin';
40+
import ToggleSwitch from '@/ui/components/ToggleSwitch.vue';
41+
42+
import uuid from 'uuid';
43+
44+
export default {
45+
components: {
46+
ToggleSwitch
47+
},
48+
mixins: [toggleMixin],
49+
props: {
50+
model: {
51+
type: Object,
52+
required: true
53+
}
54+
},
55+
data() {
56+
return {
57+
switchId: `toggleSwitch-${uuid}`,
58+
isChecked: this.model.value
59+
};
60+
}
61+
};
62+
</script>
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
export default {
2+
data() {
3+
return {
4+
isChecked: false
5+
};
6+
},
7+
methods: {
8+
toggleCheckBox(event) {
9+
this.isChecked = !this.isChecked;
10+
11+
const data = {
12+
model: this.model,
13+
value: this.isChecked
14+
};
15+
16+
this.$emit('onChange', data);
17+
}
18+
}
19+
};

src/plugins/formActions/CreateWizard.js

+3
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ export default class CreateWizard {
9090
rows: this.properties.map(property => {
9191
const row = JSON.parse(JSON.stringify(property));
9292
row.value = this.getValue(row);
93+
if (property.validate) {
94+
row.validate = property.validate;
95+
}
9396

9497
return row;
9598
}).filter(row => row && row.control)

0 commit comments

Comments
 (0)