Show version information for Plans if available ()

* Show document version if it is available
* Add test for plan version display in the inspector
This commit is contained in:
Shefali Joshi 2022-09-16 11:36:04 -07:00 committed by GitHub
parent 2a689b896f
commit 425e662d6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 68 additions and 0 deletions
src
plugins/plan
ui/inspector/details

View File

@ -23,6 +23,7 @@
import {createOpenMct, resetApplicationState} from "utils/testing";
import PlanPlugin from "../plan/plugin";
import Vue from 'vue';
import Properties from "@/ui/inspector/details/Properties.vue";
describe('the plugin', function () {
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();
});
});
});

View File

@ -95,6 +95,7 @@ export default {
const timestampLabel = this.domainObject.modified ? 'Modified' : 'Created';
const timestamp = this.domainObject.modified ? this.domainObject.modified : this.domainObject.created;
const notes = this.domainObject.notes;
const version = this.domainObject.version;
const details = [
{
@ -127,6 +128,13 @@ export default {
);
}
if (version) {
details.push({
name: 'Version',
value: version
});
}
return [...details, ...this.typeProperties];
},
context() {