Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to Vue 3 Migration Build #6767

Merged
merged 120 commits into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
5169676
fix: update usage of named slots
ozyx Jun 13, 2023
3f7d071
fix: more deprecated slot syntax
ozyx Jun 13, 2023
e323d4f
chore: add dependencies, modify webpack
ozyx Jun 14, 2023
e3dffc5
chore: update vue alias
ozyx Jun 14, 2023
6610793
chore: fix warnings
ozyx Jun 14, 2023
2896520
chore: `beforeDestroy()` --> `beforeUnmount()`
ozyx Jun 14, 2023
e7d9e37
chore: use `createApp` in MCT.js
ozyx Jun 15, 2023
5bdfa04
chore: `destroyed()` --> `unmounted()`
ozyx Jun 15, 2023
4322956
chore `destroyed:` --> `unmounted:`
ozyx Jun 15, 2023
afce934
chore: update webpack
ozyx Jun 15, 2023
41d2809
chore: add div for mount
ozyx Jun 15, 2023
8fce444
chore: destroy all `$destroy()`s
ozyx Jun 15, 2023
bc61b32
chore: REVISIT: not sure this is the right way to do this but makes t…
ozyx Jun 15, 2023
9f66843
chore: do not convert conductor to proxy, ever
ozyx Jun 15, 2023
5438711
chore: update array watchers
ozyx Jun 15, 2023
12a0a6f
fix: click handler for ImageryView
ozyx Jun 20, 2023
609b3c2
fix: inspectorViews selected tab
ozyx Jun 20, 2023
8cfa812
fix: remove private methods as they conflict with Vue3 proxy system
ozyx Jun 20, 2023
90459c3
fix: TelemetryTable migration
ozyx Jun 21, 2023
59bde31
fix: use regular js assignment isntead of $set
ozyx Jun 23, 2023
68ac6b6
fix: warning for boolean coercion
ozyx Jun 23, 2023
55ebfcd
fix: use `deep: true` option for watched arrays
ozyx Jun 23, 2023
2279637
fix: use $refs and replace $on, $off, $once with tiny-emitter
ozyx Jun 23, 2023
ac1e1ef
fix: restore call $destroy on Objects
ozyx Jun 29, 2023
fd84897
fix: misc fixes
ozyx Jun 29, 2023
120e907
chore: pin versions
ozyx Jun 29, 2023
45bd00b
chore: run `lint:fix`
ozyx Jun 29, 2023
d8f0b6e
Merge branch 'master' into vue3-compat-migration
ozyx Jun 29, 2023
44cbbe9
Revert "chore: pin versions"
ozyx Jun 29, 2023
c994d05
fix(TTable): horizontal header scroll, etc
ozyx Jun 30, 2023
43f10be
fix infinite loop issue
scottbell Jul 3, 2023
3338e59
refactor: PopupMenu to use MenuAPI
ozyx Jul 3, 2023
eefd3ac
fix: upgrade Menu and SuperMenu to Vue 3
ozyx Jul 3, 2023
fc170fd
fix(WIP): `new Vue()` -> `Vue.createApp()`
ozyx Jul 5, 2023
fa4bdbc
fix: unmount AboutDialog onDestroy
ozyx Jul 5, 2023
41a540a
old object was a proxy and causing further object propagations with O…
scottbell Jul 6, 2023
fd6cb38
fix: beforeUnmount and array handler
ozyx Jul 6, 2023
4bacbc0
fix: use correct distfile for webpack
ozyx Jul 6, 2023
bb3a367
fix: expose the main Vue app on `openmct`
ozyx Jul 8, 2023
710fd2e
fix: use `mount` pattern to create Vue components
ozyx Jul 8, 2023
7db0d51
fix: replace some `$set` with regular assignment
ozyx Jul 8, 2023
f20aa8c
fix: typo
ozyx Jul 8, 2023
70b3db0
fix: GH code scan warnings
ozyx Jul 8, 2023
c1263c3
fix: do not convert the publicAPI to a Proxy
ozyx Jul 8, 2023
4994433
fix: revert emitter changes for MctPlot
ozyx Jul 8, 2023
8838279
fix: make notification indicator reactive again
ozyx Jul 9, 2023
ffaedc9
fix: use regular assignment instead of `$set`
ozyx Jul 9, 2023
103ad6c
fix: remove unused import
ozyx Jul 9, 2023
690fd42
style: `display: none` no longer needed here
ozyx Jul 9, 2023
93f3093
fix: mounted app no longer replaces HTMLElement
ozyx Jul 9, 2023
9489ee4
Merge branch 'master' into vue3-compat-migration
scottbell Jul 10, 2023
96af897
to raw the whole tagging process
scottbell Jul 10, 2023
ee45402
fix plan acitvity
scottbell Jul 10, 2023
d56ad6d
fix: revert tiny-emitter changes for now
ozyx Jul 10, 2023
34111c9
fix: fixes issue causing Inspector to block object name updates
ozyx Jul 11, 2023
7b4e4af
fix: add `deep: true` on array watcher
ozyx Jul 11, 2023
2891744
fix(StackedPlotItem): mounting no longer replaces the element
ozyx Jul 11, 2023
7b9958e
fix: pass `objectPath` as a prop to Timer
ozyx Jul 11, 2023
bb26169
fix: call me the memory leak destoyer 😎
ozyx Jul 11, 2023
089a19c
fix: vue warning
ozyx Jul 12, 2023
679fe76
fix: remove unnecessary element append
ozyx Jul 12, 2023
a63c945
Mod the mutation API to emit event for array property when any member…
akhenry Jul 12, 2023
7d53ffa
Do not make a copy of the domain object. This causes issues with Vue …
akhenry Jul 12, 2023
23906c7
Remove dependency on Vue reactivity to detect changes from Toolbar AP…
akhenry Jul 12, 2023
fd37d88
fix: use public vue methods to get the layout ref
ozyx Jul 13, 2023
09f58ef
fix: define `_destroy`
ozyx Jul 13, 2023
810c67a
fix: ensure component is mounted before starting open mct
ozyx Jul 13, 2023
6ac980c
fix: follow mutation events for clock configuration changes
ozyx Jul 13, 2023
a5734e8
fix: follow mutation events for timer configuration
ozyx Jul 13, 2023
a7ad895
fix: add fallback if no child of document.body exists
ozyx Jul 13, 2023
dfb4b53
fix: remove debug code
ozyx Jul 13, 2023
1e19485
Merge branch 'master' into vue3-compat-migration
ozyx Jul 13, 2023
3a83f2a
run lint:fix, adjust eslint rule for vue 3
ozyx Jul 13, 2023
f269f33
refactor: fix eslint warnings without losing progress
ozyx Jul 13, 2023
1f4408e
Merge branch 'master' into vue3-compat-migration
ozyx Jul 14, 2023
b2ff80f
fix sections persisting on notebook load, and fixed router error
scottbell Jul 14, 2023
068ba69
Changed 'callback' to 'onItemClicked' for popup menu items
akhenry Jul 14, 2023
9eaaa81
can add sections
scottbell Jul 14, 2023
6c49bba
fix: add observer for notebook section changes so it can detect secti…
ozyx Jul 14, 2023
3a9cc42
fix: update tooltips for vue 3
ozyx Jul 14, 2023
fc98896
fix: toRaw before structuredClone of notebook entries
ozyx Jul 14, 2023
315b39a
Revert "fix: remove private methods as they conflict with Vue3 proxy …
ozyx Jul 14, 2023
d1f3c22
fix: never reactify the composition collection
ozyx Jul 14, 2023
db2bdb8
fix: remove console.debug
ozyx Jul 14, 2023
a70859d
Merge branch 'master' into vue3-compat-migration
ozyx Jul 14, 2023
08a3cd7
fix: `Vue()` --> `mount()`
ozyx Jul 14, 2023
c62a314
refactor: `lint:fix`
ozyx Jul 14, 2023
4452b98
style: a ton of css fixes
ozyx Jul 14, 2023
8c808d9
style: fix Preview
ozyx Jul 14, 2023
888c3fd
style: fix AboutDialog
ozyx Jul 15, 2023
fae18bd
Merge branch 'master' into vue3-compat-migration
ozyx Jul 15, 2023
0b55361
style: fix tree pane width snapback issue
ozyx Jul 15, 2023
344993a
fix: ImageryView controls update correctly on TimeContext change
ozyx Jul 15, 2023
12085d6
Revert "fix: fixes issue causing Inspector to block object name updates"
ozyx Jul 15, 2023
8f11b0f
fix: prevent Properties re-render from blocking object name change
ozyx Jul 15, 2023
9447c60
fix: undo accidental find and replace
ozyx Jul 16, 2023
66738eb
fix: viewLargeAction for Imagery
ozyx Jul 17, 2023
eca17ae
fix(e2e): fix forms test selector
ozyx Jul 17, 2023
637c2a5
refactor: use optional chaining
ozyx Jul 17, 2023
29a492c
fix: ensure dependencies on computed properties remain reactive (Proxy)
ozyx Jul 17, 2023
da63de2
fix: observe sections so we can delete
ozyx Jul 17, 2023
0185d5f
fix(RestrictedNotebook): Multiple reactivity fixes
ozyx Jul 17, 2023
9d3709b
refactor: run `lint:fix`
ozyx Jul 17, 2023
4f1a58b
Merge branch 'master' into vue3-compat-migration
unlikelyzero Jul 17, 2023
53fb7d7
fix: `beforeDestroy()` --> `beforeUnmount()`
ozyx Jul 17, 2023
7b11236
Revert "fix: prevent Properties re-render from blocking object name c…
ozyx Jul 17, 2023
8a6bbca
fix: modify `this.selection` without losing reactivity
ozyx Jul 17, 2023
fe2ae0f
fix: respond to code review comments
ozyx Jul 18, 2023
4fc8233
fix: Operator Status popup use `componentInstance`
ozyx Jul 18, 2023
6a1b1db
fix: don't make `roleChannel` reactive
ozyx Jul 18, 2023
75072e3
fix: make `spellcheck` static
ozyx Jul 18, 2023
826599f
fix: make static
ozyx Jul 18, 2023
c837953
refactor: change variable name
ozyx Jul 18, 2023
67fd649
refactor: simplify methods w/ optional chaining
ozyx Jul 18, 2023
c2749e4
refactor: run `lint:fix`
ozyx Jul 18, 2023
5095e87
chore: revert commented code in unit tests
ozyx Jul 18, 2023
aa8f60f
fix: restore `nextTick()`
ozyx Jul 18, 2023
8d2068f
fix: alphanumericFormat
ozyx Jul 18, 2023
62db57b
fix: reactify yaxis config
ozyx Jul 18, 2023
fdfca3a
Merge branch 'master' into vue3-compat-migration
ozyx Jul 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ module.exports = {
}
},
rules: {
'vue/no-v-for-template-key': 'off',
'vue/no-v-for-template-key-on-child': 'error',
'prettier/prettier': 'error',
'you-dont-need-lodash-underscore/omit': 'off',
'you-dont-need-lodash-underscore/throttle': 'off',
Expand Down
13 changes: 11 additions & 2 deletions .webpack/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ const config = {
MCT: path.join(projectRootDir, 'src/MCT'),
testUtils: path.join(projectRootDir, 'src/utils/testUtils.js'),
objectUtils: path.join(projectRootDir, 'src/api/objects/object-utils.js'),
utils: path.join(projectRootDir, 'src/utils')
utils: path.join(projectRootDir, 'src/utils'),
vue: path.join(projectRootDir, 'node_modules/@vue/compat/dist/vue.esm-bundler.js'),
}
},
plugins: [
Expand Down Expand Up @@ -121,7 +122,15 @@ const config = {
},
{
test: /\.vue$/,
use: 'vue-loader'
loader: 'vue-loader',
options: {
compilerOptions: {
whitespace: 'preserve',
compatConfig: {
MODE: 2
}
}
}
},
{
test: /\.html$/,
Expand Down
5 changes: 0 additions & 5 deletions .webpack/webpack.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ module.exports = merge(common, {
'**/.*' // dotfiles and dotfolders
]
},
resolve: {
alias: {
vue: path.join(projectRootDir, 'node_modules/vue/dist/vue.js')
}
},
plugins: [
new webpack.DefinePlugin({
__OPENMCT_ROOT_RELATIVE__: '"dist/"'
Expand Down
5 changes: 0 additions & 5 deletions .webpack/webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ const projectRootDir = path.resolve(__dirname, '..');

module.exports = merge(common, {
mode: 'production',
resolve: {
alias: {
vue: path.join(projectRootDir, 'node_modules/vue/dist/vue.min.js')
}
},
plugins: [
new webpack.DefinePlugin({
__OPENMCT_ROOT_RELATIVE__: '""'
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/functional/forms.e2e.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ test.describe('Form Validation Behavior', () => {
await page.goto('./', { waitUntil: 'domcontentloaded' });

await page.click('button:has-text("Create")');
await page.click(':nth-match(:text("Folder"), 2)');
await page.getByRole('menuitem', { name: ' Folder' }).click();

// Fill in empty string into title and trigger validation with 'Tab'
await page.click('text=Properties Title Notes >> input[type="text"]');
Expand Down
2 changes: 1 addition & 1 deletion example/simpleVuePlugin/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function SimpleVuePlugin() {
container.appendChild(vm.$mount().$el);
},
destroy: function (container) {
vm.$destroy();
//vm.$destroy();
scottbell marked this conversation as resolved.
Show resolved Hide resolved
}
};
}
Expand Down
4 changes: 3 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@
}
</style>
</head>
<body></body>
<body>
<div id="app"></div>
</body>
<script>
const THIRTY_SECONDS = 30 * 1000;
const ONE_MINUTE = THIRTY_SECONDS * 2;
Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"@types/eventemitter3": "1.2.0",
"@types/jasmine": "4.3.4",
"@types/lodash": "4.14.192",
"@vue/compat": "^3.1.0",
"@vue/compiler-sfc": "^3.1.0",
"babel-loader": "9.1.0",
"babel-plugin-istanbul": "6.1.1",
"codecov": "3.8.3",
Expand All @@ -22,8 +24,8 @@
"d3-scale": "3.3.0",
"d3-selection": "3.0.0",
"eslint": "8.43.0",
"eslint-plugin-compat": "4.1.4",
"eslint-config-prettier": "8.8.0",
"eslint-plugin-compat": "4.1.4",
"eslint-plugin-playwright": "0.12.0",
"eslint-plugin-prettier": "4.2.1",
"eslint-plugin-vue": "9.15.0",
Expand Down Expand Up @@ -66,11 +68,10 @@
"style-loader": "3.3.3",
"typescript": "5.1.3",
"uuid": "9.0.0",
"vue": "2.6.14",
"vue": "^3.1.0",
"vue-eslint-parser": "9.3.1",
"vue-loader": "15.9.8",
"vue-template-compiler": "2.6.14",
"webpack": "5.88.0",
"vue-loader": "^16.0.0",
"webpack-cli": "5.1.1",
"webpack-dev-server": "4.15.1",
"webpack-merge": "5.9.0"
Expand Down
37 changes: 26 additions & 11 deletions src/MCT.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,17 @@ define([
* @param {HTMLElement} [domElement] the DOM element in which to run
* MCT; if undefined, MCT will be run in the body of the document
*/
MCT.prototype.start = function (domElement = document.body, isHeadlessMode = false) {
MCT.prototype.start = function (
domElement = document.body.firstElementChild,
isHeadlessMode = false
) {
// Create element to mount Layout if it doesn't exist
if (domElement === null) {
domElement = document.createElement('div');
document.body.appendChild(domElement);
}
domElement.id = 'openmct-app';

if (this.types.get('layout') === undefined) {
this.install(
this.plugins.DisplayLayout({
Expand All @@ -370,25 +380,30 @@ define([
*/

if (!isHeadlessMode) {
const appLayout = new Vue({
const appLayout = Vue.createApp({
components: {
Layout: Layout.default
},
provide: {
openmct: this
openmct: Vue.markRaw(this)
},
template: '<Layout ref="layout"></Layout>'
});
domElement.appendChild(appLayout.$mount().$el);
const component = appLayout.mount(domElement);
component.$nextTick(() => {
this.layout = component.$refs.layout;
this.app = appLayout;
Browse(this);
window.addEventListener('beforeunload', this.destroy);
this.router.start();
this.emit('start');
});
} else {
window.addEventListener('beforeunload', this.destroy);

this.layout = appLayout.$refs.layout;
Browse(this);
this.router.start();
this.emit('start');
}

window.addEventListener('beforeunload', this.destroy);

this.router.start();
this.emit('start');
};

MCT.prototype.startHeadless = function () {
Expand Down
3 changes: 2 additions & 1 deletion src/api/composition/DefaultCompositionProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*****************************************************************************/
import objectUtils from '../objects/object-utils';
import CompositionProvider from './CompositionProvider';
import { toRaw } from 'vue';

/**
* @typedef {import('../objects/ObjectAPI').DomainObject} DomainObject
Expand Down Expand Up @@ -167,7 +168,7 @@ export default class DefaultCompositionProvider extends CompositionProvider {
*/
add(parent, childId) {
if (!this.includes(parent, childId)) {
const composition = structuredClone(parent.composition);
const composition = structuredClone(toRaw(parent.composition));
scottbell marked this conversation as resolved.
Show resolved Hide resolved
composition.push(childId);
this.publicAPI.objects.mutate(parent, 'composition', composition);
}
Expand Down
48 changes: 28 additions & 20 deletions src/api/forms/FormController.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import TextAreaField from './components/controls/TextAreaField.vue';
import TextField from './components/controls/TextField.vue';
import ToggleSwitchField from './components/controls/ToggleSwitchField.vue';

import Vue from 'vue';

import mount from 'utils/mount';
ozyx marked this conversation as resolved.
Show resolved Hide resolved
export const DEFAULT_CONTROLS_MAP = {
autocomplete: AutoCompleteField,
checkbox: CheckBoxField,
Expand Down Expand Up @@ -69,31 +68,40 @@ export default class FormControl {
*/
_getControlViewProvider(control) {
const self = this;
let rowComponent;
let _destroy = null;

return {
show(element, model, onChange) {
rowComponent = new Vue({
el: element,
components: {
FormControlComponent: DEFAULT_CONTROLS_MAP[control]
},
provide: {
openmct: self.openmct
},
data() {
return {
model,
onChange
};
const { vNode, destroy } = mount(
{
el: element,
components: {
FormControlComponent: DEFAULT_CONTROLS_MAP[control]
},
provide: {
openmct: self.openmct
},
data() {
return {
model,
onChange
};
},
template: `<FormControlComponent :model="model" @onChange="onChange"></FormControlComponent>`
},
template: `<FormControlComponent :model="model" @onChange="onChange"></FormControlComponent>`
});
{
element,
app: self.openmct.app
}
);
_destroy = destroy;

return rowComponent;
return vNode;
},
destroy() {
rowComponent.$destroy();
if (_destroy) {
_destroy();
}
}
};
}
Expand Down
44 changes: 23 additions & 21 deletions src/api/forms/FormsAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import FormController from './FormController';
import FormProperties from './components/FormProperties.vue';

import Vue from 'vue';
import _ from 'lodash';
import mount from 'utils/mount';

export default class FormsAPI {
constructor(openmct) {
Expand Down Expand Up @@ -156,25 +156,28 @@ export default class FormsAPI {
formCancel = onFormAction(reject);
});

const vm = new Vue({
components: { FormProperties },
provide: {
openmct: self.openmct
const { destroy } = mount(
{
components: { FormProperties },
provide: {
openmct: self.openmct
},
data() {
return {
formStructure,
onChange: onFormPropertyChange,
onCancel: formCancel,
onSave: formSave
};
},
template:
'<FormProperties :model="formStructure" @onChange="onChange" @onCancel="onCancel" @onSave="onSave"></FormProperties>'
},
data() {
return {
formStructure,
onChange: onFormPropertyChange,
onCancel: formCancel,
onSave: formSave
};
},
template:
'<FormProperties :model="formStructure" @onChange="onChange" @onCancel="onCancel" @onSave="onSave"></FormProperties>'
}).$mount();

const formElement = vm.$el;
element.append(formElement);
{
element,
app: self.openmct.app
}
);

function onFormPropertyChange(data) {
if (onChange) {
Expand All @@ -195,8 +198,7 @@ export default class FormsAPI {

function onFormAction(callback) {
return () => {
formElement.remove();
vm.$destroy();
destroy();

if (callback) {
callback(changes);
Expand Down
2 changes: 1 addition & 1 deletion src/api/forms/components/FormProperties.vue
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export default {
},
methods: {
onChange(data) {
this.$set(this.invalidProperties, data.model.key, data.invalid);
this.invalidProperties[data.model.key] = data.invalid;

this.$emit('onChange', data);
},
Expand Down
6 changes: 2 additions & 4 deletions src/api/forms/components/FormRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
{{ row.name }}
</div>
<div class="c-form-row__state-indicator" :class="reqClass"></div>
<div v-if="row.control" class="c-form-row__controls">
<div ref="rowElement"></div>
</div>
<div v-if="row.control" ref="rowElement" class="c-form-row__controls"></div>
</div>
</template>

Expand Down Expand Up @@ -91,7 +89,7 @@ export default {

this.formControl.show(this.$refs.rowElement, this.row, this.onChange);
},
destroyed() {
unmounted() {
const destroy = this.formControl.destroy;
if (destroy) {
destroy();
Expand Down
2 changes: 1 addition & 1 deletion src/api/forms/components/controls/AutoCompleteField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export default {
this.options = this.model.options;
}
},
destroyed() {
unmounted() {
document.body.removeEventListener('click', this.handleOutsideClick);
},
methods: {
Expand Down