-
Notifications
You must be signed in to change notification settings - Fork 32
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
View Script Logs / Report #1655
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6f01236
View Script Logs / Report
jmthomas 60247eb
Fix admin playwright tests
jmthomas 458aec1
Fix var let
jmthomas 0a23120
Merge branch 'main' into sr_show_logs
jmthomas f3f755c
Cleanup tmp_dir
jmthomas 3a147bb
Sanitize input path
jmthomas c0fd630
Merge branch 'main' into sr_show_logs
jmthomas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
172 changes: 172 additions & 0 deletions
172
openc3-cosmos-init/plugins/packages/openc3-tool-common/src/components/OutputDialog.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,172 @@ | ||
<!-- | ||
# Copyright 2022 Ball Aerospace & Technologies Corp. | ||
# 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. | ||
|
||
# Modified by OpenC3, Inc. | ||
# All changes Copyright 2024, OpenC3, Inc. | ||
# All Rights Reserved | ||
# | ||
# This file may also be used under the terms of a commercial license | ||
# if purchased from OpenC3, Inc. | ||
--> | ||
|
||
<template> | ||
<v-dialog v-model="show" width="85vw"> | ||
<v-card> | ||
<v-system-bar> | ||
<v-spacer /> | ||
<span v-text="title" /> | ||
<v-spacer /> | ||
<div class="mx-2"> | ||
<v-tooltip top> | ||
<template v-slot:activator="{ on, attrs }"> | ||
<div v-on="on" v-bind="attrs"> | ||
<v-icon data-test="downloadIcon" @click="download"> | ||
mdi-download | ||
</v-icon> | ||
</div> | ||
</template> | ||
<span> Download </span> | ||
</v-tooltip> | ||
</div> | ||
</v-system-bar> | ||
<v-card-text> | ||
<pre class="editor" ref="editor"></pre> | ||
</v-card-text> | ||
<v-card-actions> | ||
<v-spacer /> | ||
<v-btn color="primary" @click="close"> Ok </v-btn> | ||
</v-card-actions> | ||
</v-card> | ||
</v-dialog> | ||
</template> | ||
|
||
<script> | ||
import * as ace from 'ace-builds' | ||
import 'ace-builds/src-min-noconflict/mode-ruby' | ||
import 'ace-builds/src-min-noconflict/mode-json' | ||
import 'ace-builds/src-min-noconflict/theme-twilight' | ||
import 'ace-builds/src-min-noconflict/ext-language_tools' | ||
import 'ace-builds/src-min-noconflict/ext-searchbox' | ||
|
||
export default { | ||
props: { | ||
content: { | ||
type: String, | ||
required: true, | ||
}, | ||
type: String, | ||
name: String, | ||
value: Boolean, // value is the default prop when using v-model | ||
filename: { | ||
type: String, | ||
required: false, | ||
}, | ||
}, | ||
data() { | ||
return { | ||
editor: null, | ||
} | ||
}, | ||
mounted() { | ||
const openPluginMode = this.buildPluginMode() | ||
this.editor = ace.edit(this.$refs.editor) | ||
this.editor.setTheme('ace/theme/twilight') | ||
this.editor.session.setMode(new openPluginMode()) | ||
this.editor.session.setTabSize(2) | ||
this.editor.session.setUseWrapMode(true) | ||
this.editor.$blockScrolling = Infinity | ||
this.editor.setHighlightActiveLine(false) | ||
this.editor.setValue(this.content) | ||
this.editor.clearSelection() | ||
this.editor.focus() | ||
this.editor.setReadOnly(true) | ||
}, | ||
beforeDestroy() { | ||
if (this.editor) { | ||
this.editor.destroy() | ||
} | ||
}, | ||
computed: { | ||
show: { | ||
get() { | ||
return this.value | ||
}, | ||
set(value) { | ||
this.$emit('input', value) // input is the default event when using v-model | ||
}, | ||
}, | ||
title: function () { | ||
return `${this.type}: ${this.name}` | ||
}, | ||
}, | ||
methods: { | ||
close: function () { | ||
this.show = !this.show | ||
}, | ||
download: function () { | ||
const blob = new Blob([this.editor.getValue()], { | ||
type: 'text/plain', | ||
}) | ||
// Make a link and then 'click' on it to start the download | ||
let filename = `${this.type.toLowerCase()}_${this.name.toLowerCase()}.json` | ||
if (this.filename) { | ||
filename = this.filename | ||
} | ||
const link = document.createElement('a') | ||
link.href = URL.createObjectURL(blob) | ||
link.setAttribute('download', filename) | ||
link.click() | ||
}, | ||
buildPluginMode() { | ||
let oop = ace.require('ace/lib/oop') | ||
let JsonHighlightRules = ace.require( | ||
'ace/mode/json_highlight_rules' | ||
).JsonHighlightRules | ||
|
||
let MatchingBraceOutdent = ace.require( | ||
'ace/mode/matching_brace_outdent' | ||
).MatchingBraceOutdent | ||
let CstyleBehaviour = ace.require( | ||
'ace/mode/behaviour/cstyle' | ||
).CstyleBehaviour | ||
let FoldMode = ace.require('ace/mode/folding/ruby').FoldMode | ||
let Mode = function () { | ||
this.HighlightRules = JsonHighlightRules | ||
this.$outdent = new MatchingBraceOutdent() | ||
this.$behaviour = new CstyleBehaviour() | ||
this.foldingRules = new FoldMode() | ||
this.indentKeywords = this.foldingRules.indentKeywords | ||
} | ||
let RubyMode = ace.require('ace/mode/ruby').Mode | ||
oop.inherits(Mode, RubyMode) | ||
;(function () { | ||
this.$id = 'ace/mode/openc3' | ||
}).call(Mode.prototype) | ||
return Mode | ||
}, | ||
}, | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
.editor { | ||
height: 75vh; | ||
width: 80vw; | ||
position: relative; | ||
font-size: 16px; | ||
} | ||
.v-textarea :deep(textarea) { | ||
padding: 5px; | ||
} | ||
</style> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why no bucket before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We never did a download from a bucket before ... just volumes. We always used the
get_download_presigned_request
instead because the result was always a file to download. Now we're downloading to memory so we can display.