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

Replace Webpack with Vite #1728

Merged
merged 31 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0cfb18b
starting to get things working on vite
ryan-pratt Nov 13, 2024
2783eab
fix up vite things
ryan-pratt Nov 15, 2024
783c2e4
migrate the rest of the tools to vite except admin
ryan-pratt Nov 15, 2024
f57e0a2
migrate admin to vite
ryan-pratt Nov 15, 2024
9b399f6
fix graph styles and widgets
ryan-pratt Nov 19, 2024
5be3a76
partial work migrating demo to vite
ryan-pratt Nov 19, 2024
9ca6513
partial work
ryan-pratt Nov 19, 2024
63dc5a1
change from base to base_url
ryan-pratt Nov 20, 2024
7a22ffa
Add dev server plugin
ryan-pratt Nov 20, 2024
9e432b7
Merge branch 'vite-serve' into vite
ryan-pratt Nov 20, 2024
88d8ca5
Vite with working externals
ryanmelt Nov 25, 2024
19ba780
Single import map
ryanmelt Nov 25, 2024
f389120
Fix module syntax for notify plugin
ryan-pratt Nov 25, 2024
95b1e1b
Include index-allow-http.html in build
ryan-pratt Nov 25, 2024
8cd2e4f
Fix rux component warnings
ryan-pratt Nov 25, 2024
1a60377
Remove regenerator-runtime
ryan-pratt Nov 25, 2024
b96a7f8
Add single-spa to externals. Add index to public. Adjust index conten…
ryanmelt Nov 26, 2024
d4dddaf
compile base like other tools
ryanmelt Nov 26, 2024
f545a6c
Fix hash use on chunks and assets
ryanmelt Nov 26, 2024
703b705
Move openc3-tool-base into packages like everything else
ryanmelt Nov 26, 2024
f8823a0
Properly external vuetify
ryanmelt Nov 27, 2024
1c8a3c4
Merge branch 'main' into vite
ryanmelt Nov 27, 2024
9edee64
Finish externalize vuetify
ryanmelt Nov 28, 2024
d379d5b
fix vue warnings. Switch to production vue by default
ryanmelt Nov 28, 2024
6f4e56b
Address CICD issues
ryanmelt Nov 28, 2024
6fd3a0c
fix spelling action
ryanmelt Nov 29, 2024
9941b5f
Merge branch 'main' into vite
ryanmelt Nov 29, 2024
8b00a5d
Add shard to python models. Remove python microservice config handling
ryanmelt Nov 29, 2024
eb54aa8
Fix ruff
ryanmelt Nov 29, 2024
66af742
docusaurus 3.6
ryanmelt Nov 29, 2024
bdfeda3
import lodash. remove comment
ryanmelt Dec 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
14 changes: 7 additions & 7 deletions .github/workflows/spelling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
name: Codespell
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: codespell-project/actions-codespell@v2
with:
# Skip generated code as well as cstol_converter which has false
# positivies on ADN and Adn
skip: ./docs,*.map,*.min.js,*.pem,*.bin,cstol_converter
ignore_words_file: .whitelist
- uses: actions/checkout@v4
- uses: codespell-project/actions-codespell@v2
with:
# Skip generated code as well as cstol_converter which has false
# positivies on ADN and Adn
skip: ./docs,*.map,*.min.js,*.pem,*.bin,cstol_converter,vue.global*,vuetify-labs*
ignore_words_file: .whitelist
4 changes: 4 additions & 0 deletions docs.openc3.com/docusaurus-plugin.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ const config = {
tagline: 'OpenC3 COSMOS Documentation',
favicon: 'img/favicon.png',

future: {
experimental_faster: true,
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes the build faster?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. See the Docusaurus 3.6 release notes.


// Set the production url of your site here
url: 'https://docs.openc3.com',
// Set the /<baseUrl>/ pathname under which your site is served
Expand Down
4 changes: 4 additions & 0 deletions docs.openc3.com/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ const config = {
tagline: 'OpenC3 COSMOS Documentation',
favicon: 'img/favicon.png',

future: {
experimental_faster: true,
},

// Set the production url of your site here
url: 'https://docs.openc3.com',
// Set the /<baseUrl>/ pathname under which your site is served
Expand Down
11 changes: 6 additions & 5 deletions docs.openc3.com/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,19 @@
"write-heading-ids": "docusaurus write-heading-ids"
},
"dependencies": {
"@docusaurus/core": "^3.5.2",
"@docusaurus/plugin-client-redirects": "^3.5.2",
"@docusaurus/preset-classic": "^3.5.2",
"@docusaurus/core": "^3.6.3",
"@docusaurus/faster": "^3.6.3",
"@docusaurus/plugin-client-redirects": "^3.6.3",
"@docusaurus/preset-classic": "^3.6.3",
"@mdx-js/react": "3.1.0",
"docusaurus-lunr-search": "3.5.0",
"prism-react-renderer": "2.4.0",
"react": "18.3.1",
"react-dom": "18.3.1"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "^3.5.2",
"@docusaurus/types": "^3.5.2"
"@docusaurus/module-type-aliases": "^3.6.3",
"@docusaurus/types": "^3.6.3"
},
"browserslist": {
"production": [
Expand Down
59 changes: 59 additions & 0 deletions examples/external_script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Copyright 2024 OpenC3, Inc.
# All Rights Reserved.
#
# This program is free software; you can modify and/or redistribute it
# under the terms of the GNU Affero General Public License
# as published by the Free Software Foundation; version 3 with
# attribution addendums as found in the LICENSE.txt
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# This file may also be used under the terms of a commercial license
# if purchased from OpenC3, Inc.

import os

os.environ["OPENC3_API_SCHEMA"] = "http"
os.environ["OPENC3_API_HOSTNAME"] = "127.0.0.1"
os.environ["OPENC3_API_PORT"] = "2900"
os.environ["OPENC3_SCRIPT_API_SCHEMA"] = "http"
os.environ["OPENC3_SCRIPT_API_HOSTNAME"] = "127.0.0.1"
os.environ["OPENC3_SCRIPT_API_PORT"] = "2900"
# os.environ["OPENC3_API_USER"] = "admin" # Only set for Enterprise
os.environ["OPENC3_API_PASSWORD"] = "password"
os.environ["OPENC3_NO_STORE"] = "1"
# os.environ["OPENC3_KEYCLOAK_REALM"] = "openc3" # Only set for Enterprise
# os.environ["OPENC3_KEYCLOAK_URL"] = "http://127.0.0.1:2900/auth" # Only set for Enterprise

from openc3.utilities.string import formatted
from openc3.script import *

print(get_target_names())

print(tlm("INST ADCS POSX"))

print(cmd("INST ABORT"))

put_target_file("INST/test.txt", "this is a string test")
file = get_target_file("INST/test.txt")
print(file.read())
file.close()
delete_target_file("INST/test.txt")

with tempfile.NamedTemporaryFile(mode="w+t", suffix=".txt") as save_file:
save_file.write("this is a Io test")
save_file.seek(0)
put_target_file("INST/test.txt", save_file)
file = get_target_file("INST/test.txt")
print(file.read())
file.close()
delete_target_file("INST/test.txt")

put_target_file("INST/test.bin", "\x00\x01\x02\x03\xFF\xEE\xDD\xCC".encode())
file = get_target_file("INST/test.bin")
print(formatted(file.read()))
file.close()
delete_target_file("INST/test.bin")
10 changes: 5 additions & 5 deletions examples/external_script.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# encoding: ascii-8bit

# Copyright 2022 Ball Aerospace & Technologies Corp.
# Copyright 2024 OpenC3, Inc.
# All Rights Reserved.
#
# This program is free software; you can modify and/or redistribute it
Expand All @@ -12,10 +12,6 @@
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.

# Modified by OpenC3, Inc.
# All changes Copyright 2022, OpenC3, Inc.
# All Rights Reserved
#
# This file may also be used under the terms of a commercial license
# if purchased from OpenC3, Inc.
Expand All @@ -26,8 +22,12 @@
ENV['OPENC3_SCRIPT_API_SCHEMA'] ||= 'http'
ENV['OPENC3_SCRIPT_API_HOSTNAME'] ||= '127.0.0.1'
ENV['OPENC3_SCRIPT_API_PORT'] ||= '2900'
# ENV['OPENC3_API_USER'] ||= 'admin' # Only set for Enterprise
ENV['OPENC3_API_PASSWORD'] ||= 'password'
ENV['OPENC3_NO_STORE'] ||= '1'
# ENV['OPENC3_KEYCLOAK_REALM'] ||= 'openc3' # Only set for Enterprise
# ENV['OPENC3_KEYCLOAK_URL'] ||= 'http://127.0.0.1:2900/auth' # Only set for Enterprise


require 'openc3'
require 'openc3/script'
Expand Down
2 changes: 1 addition & 1 deletion examples/hostinstall/centos7/openc3_install_openc3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ GEMS="$SCRIPT_DIR/../../../openc3-cosmos-init/plugins/gems/"
OPENC3_RELEASE_VERSION=5.21.0-beta0

mkdir -p ${GEMS}
cd ${PLUGINS}openc3-tool-base && yarn install && yarn run build && rake build VERSION=${OPENC3_RELEASE_VERSION} && mv *.gem ${GEMS}
cd ${PLUGINS}packages/openc3-tool-base && yarn run build && rake build VERSION=${OPENC3_RELEASE_VERSION} && mv *.gem ${GEMS}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we planning on deleting this hostinstall example?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought you already did that?
If not, then yes I want that removed for the 6.0 release.

cd ${PLUGINS}packages/openc3-cosmos-tool-admin && yarn run build && rake build VERSION=${OPENC3_RELEASE_VERSION} && mv *.gem ${GEMS}
cd ${PLUGINS}packages/openc3-cosmos-tool-cmdsender && yarn run build && rake build VERSION=${OPENC3_RELEASE_VERSION} && mv *.gem ${GEMS}
cd ${PLUGINS}packages/openc3-cosmos-tool-cmdtlmserver && yarn run build && rake build VERSION=${OPENC3_RELEASE_VERSION} && mv *.gem ${GEMS}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,13 @@ def build_cmd_snippet(packet, target_info)
params = filtered_items.each_with_index.map do |item, index|
if item['data_type'] == 'BLOCK'
# Unpack binary data to uppercase hex string
default = "0x#{item['default'].unpack('H*').first.upcase}"
if item['default'] and String === item['default']
default = "0x#{item['default'].unpack('H*').first.upcase}"
else
default = "''"
end
elsif item['data_type'] == 'STRING'
default = "'#{item['default']}'" || ''
default = "'#{item['default']}'"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this to address a specific issue with BLOCK vs STRING?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That or never did anything so I removed it.

else
default = item['default'] || 0
end
Expand Down
18 changes: 11 additions & 7 deletions openc3-cosmos-cmd-tlm-api/app/controllers/tools_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,20 @@ def position
end

def importmap
result = ""
result = Hash.new
result["imports"] = Hash.new

tools = @model_class.all_scopes
inline_tools = {}
tools.each do |key, tool|
inline_tools[key] = tool if tool['inline_url'] and tool['window'] == 'INLINE'
end
result = Hash.new
result["imports"] = Hash.new
inline_tools.each do |key, tool|
result["imports"]["@openc3/tool-#{tool['folder_name']}"] = "/tools/#{tool['folder_name']}/#{tool['inline_url']}"
if tool['import_map_items']
tool['import_map_items'].each do |item_key, item|
result["imports"][item_key] = item
end
end
if tool['inline_url'] and tool['window'] == 'INLINE'
result["imports"]["@openc3/tool-#{tool['folder_name']}"] = "/tools/#{tool['folder_name']}/#{tool['inline_url']}"
end
end
render json: result
end
Expand Down
16 changes: 9 additions & 7 deletions openc3-cosmos-init/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ WORKDIR /openc3/plugins/
USER root

COPY ./plugins/*.json ./
COPY ./plugins/openc3-tool-base/*.json openc3-tool-base/
COPY ./plugins/packages/openc3-tool-base/*.json packages/openc3-tool-base/
COPY ./plugins/packages/openc3-cosmos-tool-admin/*.json packages/openc3-cosmos-tool-admin/
COPY ./plugins/packages/openc3-cosmos-tool-bucketexplorer/*.json packages/openc3-cosmos-tool-bucketexplorer/
COPY ./plugins/packages/openc3-cosmos-tool-cmdsender/*.json packages/openc3-cosmos-tool-cmdsender/
Expand All @@ -36,14 +36,15 @@ COPY ./plugins/packages/openc3-cosmos-demo/*.json packages/openc3-cosmos-demo/
ARG NPM_URL=https://registry.npmjs.org
RUN yarn config set registry $NPM_URL && yarn --network-timeout 600000

COPY ./plugins/docker-package-build.sh ./plugins/docker-package-install.sh ./plugins/babel.config.js ./plugins/.eslintrc.js ./plugins/.nycrc ./
RUN chmod +x ./docker-package-build.sh ./docker-package-install.sh
COPY ./plugins/openc3-tool-base/ openc3-tool-base/
RUN ["/openc3/plugins/docker-package-install.sh", "openc3-tool-base"]
COPY ./plugins/docker-package-build.sh ./plugins/.eslintrc.cjs ./plugins/.nycrc ./
RUN chmod +x ./docker-package-build.sh
COPY ./plugins/packages/openc3-tool-base/ packages/openc3-tool-base/
RUN ["/openc3/plugins/docker-package-build.sh", "openc3-tool-base"]

# Build admin tool
FROM openc3-frontend-tmp AS openc3-tmp1
RUN cd packages/openc3-cosmos-ace-diff && yarn build

# Build admin tool
COPY ./plugins/packages/openc3-cosmos-tool-admin/ packages/openc3-cosmos-tool-admin/
RUN ["/openc3/plugins/docker-package-build.sh", "openc3-cosmos-tool-admin"]

Expand Down Expand Up @@ -117,6 +118,8 @@ RUN ["/openc3/plugins/docker-package-build.sh", "openc3-cosmos-tool-docs"]

FROM ${OPENC3_REGISTRY}/${OPENC3_NAMESPACE}/${OPENC3_BASE_IMAGE}:${OPENC3_TAG}

USER ${USER_ID}:${GROUP_ID}

COPY --from=openc3-tmp1 --chown=${IMAGE_USER}:${IMAGE_GROUP} /openc3/plugins/packages/openc3-cosmos-ace-diff/ /openc3/plugins/packages/openc3-cosmos-ace-diff/
COPY --from=openc3-tmp1 --chown=${IMAGE_USER}:${IMAGE_GROUP} /openc3/plugins/gems/* /openc3/plugins/gems/
COPY --from=openc3-tmp2 --chown=${IMAGE_USER}:${IMAGE_GROUP} /openc3/plugins/gems/* /openc3/plugins/gems/
Expand All @@ -125,7 +128,6 @@ COPY --from=openc3-tmp4 --chown=${IMAGE_USER}:${IMAGE_GROUP} /openc3/plugins/gem
COPY --from=openc3-tmp5 --chown=${IMAGE_USER}:${IMAGE_GROUP} /openc3/plugins/gems/* /openc3/plugins/gems/
COPY --from=openc3-frontend-tmp --chown=${IMAGE_USER}:${IMAGE_GROUP} /openc3/plugins/packages/openc3-tool-common/ /openc3/plugins/packages/openc3-tool-common/
COPY --from=openc3-frontend-tmp --chown=${IMAGE_USER}:${IMAGE_GROUP} /openc3/plugins/yarn.lock /openc3/plugins/yarn.lock
COPY --from=openc3-frontend-tmp --chown=${IMAGE_USER}:${IMAGE_GROUP} /openc3/plugins/openc3-tool-base/yarn.lock /openc3/plugins/yarn-tool-base.lock
COPY --chown=${IMAGE_USER}:${IMAGE_GROUP} ./init.sh /openc3/

COPY --from=minio-mc /bin/mc /bin/mc
Expand Down
11 changes: 0 additions & 11 deletions openc3-cosmos-init/plugins/babel.config.js

This file was deleted.

25 changes: 0 additions & 25 deletions openc3-cosmos-init/plugins/docker-package-install.sh

This file was deleted.

24 changes: 0 additions & 24 deletions openc3-cosmos-init/plugins/openc3-tool-base/babel.config.json

This file was deleted.

49 changes: 0 additions & 49 deletions openc3-cosmos-init/plugins/openc3-tool-base/package.json

This file was deleted.

Loading
Loading