mirror of
https://github.com/nasa/openmct.git
synced 2025-01-13 00:09:47 +00:00
Show version information for Plans if available (#5703)
* Show document version if it is available * Add test for plan version display in the inspector
This commit is contained in:
parent
2a689b896f
commit
425e662d6e
@ -23,6 +23,7 @@
|
|||||||
import {createOpenMct, resetApplicationState} from "utils/testing";
|
import {createOpenMct, resetApplicationState} from "utils/testing";
|
||||||
import PlanPlugin from "../plan/plugin";
|
import PlanPlugin from "../plan/plugin";
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
import Properties from "@/ui/inspector/details/Properties.vue";
|
||||||
|
|
||||||
describe('the plugin', function () {
|
describe('the plugin', function () {
|
||||||
let planDefinition;
|
let planDefinition;
|
||||||
@ -212,4 +213,63 @@ describe('the plugin', function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('the plan version', () => {
|
||||||
|
let component;
|
||||||
|
let componentObject;
|
||||||
|
let testPlanObject = {
|
||||||
|
name: 'Plan',
|
||||||
|
type: 'plan',
|
||||||
|
identifier: {
|
||||||
|
key: 'test-plan',
|
||||||
|
namespace: ''
|
||||||
|
},
|
||||||
|
version: 'v1'
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
openmct.selection.select([{
|
||||||
|
element: element,
|
||||||
|
context: {
|
||||||
|
item: testPlanObject
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
element: openmct.layout.$refs.browseObject.$el,
|
||||||
|
context: {
|
||||||
|
item: testPlanObject,
|
||||||
|
supportsMultiSelect: false
|
||||||
|
}
|
||||||
|
}], false);
|
||||||
|
|
||||||
|
return Vue.nextTick().then(() => {
|
||||||
|
let viewContainer = document.createElement('div');
|
||||||
|
child.append(viewContainer);
|
||||||
|
component = new Vue({
|
||||||
|
el: viewContainer,
|
||||||
|
components: {
|
||||||
|
Properties
|
||||||
|
},
|
||||||
|
provide: {
|
||||||
|
openmct: openmct
|
||||||
|
},
|
||||||
|
template: '<properties/>'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
component.$destroy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('provides an inspector view with the version information if available', () => {
|
||||||
|
componentObject = component.$root.$children[0];
|
||||||
|
const propertiesEls = componentObject.$el.querySelectorAll('.c-inspect-properties__row');
|
||||||
|
expect(propertiesEls.length).toEqual(4);
|
||||||
|
const found = Array.from(propertiesEls).some((propertyEl) => {
|
||||||
|
return (propertyEl.children[0].innerHTML.trim() === 'Version'
|
||||||
|
&& propertyEl.children[1].innerHTML.trim() === 'v1');
|
||||||
|
});
|
||||||
|
expect(found).toBeTrue();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -95,6 +95,7 @@ export default {
|
|||||||
const timestampLabel = this.domainObject.modified ? 'Modified' : 'Created';
|
const timestampLabel = this.domainObject.modified ? 'Modified' : 'Created';
|
||||||
const timestamp = this.domainObject.modified ? this.domainObject.modified : this.domainObject.created;
|
const timestamp = this.domainObject.modified ? this.domainObject.modified : this.domainObject.created;
|
||||||
const notes = this.domainObject.notes;
|
const notes = this.domainObject.notes;
|
||||||
|
const version = this.domainObject.version;
|
||||||
|
|
||||||
const details = [
|
const details = [
|
||||||
{
|
{
|
||||||
@ -127,6 +128,13 @@ export default {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (version) {
|
||||||
|
details.push({
|
||||||
|
name: 'Version',
|
||||||
|
value: version
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return [...details, ...this.typeProperties];
|
return [...details, ...this.typeProperties];
|
||||||
},
|
},
|
||||||
context() {
|
context() {
|
||||||
|
Loading…
Reference in New Issue
Block a user