-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate hyades frontend features (#12)
- Loading branch information
1 parent
4bd8ff0
commit a34247f
Showing
11 changed files
with
630 additions
and
16 deletions.
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
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
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,79 @@ | ||
<template> | ||
<div ref="monaco-editor" style="border: 1px solid #52525e; border-radius: 0.25rem; height: 100px;"></div> | ||
</template> | ||
|
||
<script> | ||
import loader from "@monaco-editor/loader"; | ||
export default { | ||
name: "MonacoEditor", | ||
props: { | ||
value: String, | ||
readOnly: Boolean, | ||
markers: [], | ||
}, | ||
data() { | ||
return { | ||
monaco: null, | ||
editor: null, | ||
editorModel: null, | ||
} | ||
}, | ||
mounted() { | ||
loader.init().then(monaco => { | ||
this.monaco = monaco; | ||
this.editor = monaco.editor.create(this.$refs["monaco-editor"], { | ||
automaticLayout: true, | ||
bracketPairColorization: true, | ||
cursorBlinking: 'phase', | ||
language: "python", | ||
lineDecorationsWidth: 0, | ||
matchBrackets: true, | ||
minimap: { | ||
enabled: false, | ||
}, | ||
lineNumbersMinChars: 3, | ||
overviewRulerLanes: 0, | ||
scrollBeyondLastLine: false, | ||
theme: "vs-dark", | ||
wordWrap: "on", | ||
wrappingStrategy: "advanced", | ||
readOnly: this.readOnly | ||
}); | ||
this.editorModel = this.editor.getModel(); | ||
this.editorModel.onDidChangeContent(this.handleContentChange); | ||
this.editorModel.setValue(this.value ? this.value : ''); | ||
}); | ||
}, | ||
beforeDestroy() { | ||
if (this.editor) { | ||
this.editorModel.dispose(); | ||
this.editor.dispose(); | ||
this.editor = null; | ||
this.editorModel = null; | ||
} | ||
}, | ||
methods: { | ||
handleContentChange: function (event) { | ||
this.monaco.editor.removeAllMarkers("foo"); | ||
this.$emit("change", this.editor.getValue(), event); | ||
this.$emit("input", this.editor.getValue()); | ||
}, | ||
}, | ||
watch: { | ||
value() { | ||
if (this.editor && this.value !== this.editor.getValue()) { | ||
this.editorModel.setValue(this.value); | ||
} | ||
}, | ||
markers() { | ||
if (!this.markers) { | ||
this.monaco.editor.removeAllMarkers("foo"); | ||
} | ||
this.monaco.editor.setModelMarkers(this.editorModel, "foo", this.markers); | ||
} | ||
} | ||
} | ||
</script> |
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,87 @@ | ||
<template> | ||
<b-modal id="policyBundleInfoModal" size="lg" hide-header-close no-stacking :title="$t('message.policy_bundle_info')"> | ||
<b-tabs class="body-bg-color" style="border:0;padding:0"> | ||
<b-tab class="body-bg-color" style="border:0;padding:0" active> | ||
<template v-slot:title><i class="fa fa-edit"></i> {{ $t('message.general') }}</template> | ||
<b-card> | ||
<b-input-group-form-input id="bundle-url" input-group-size="mb-3" type="text" v-model="bundleInfo.url" | ||
lazy="true" feedback="false" autofocus="true" | ||
:label="$t('message.policy_bundle_url')" disabled="true" /> | ||
<b-input-group-form-input id="bundle-hash" input-group-size="mb-3" type="text" v-model="bundleInfo.hash" | ||
lazy="true" feedback="false" autofocus="false" | ||
:label="$t('message.policy_bundle_hash')" disabled="true" /> | ||
<b-input-group-form-input id="bundle-created" input-group-size="mb-3" type="text" :value="bundleCreated" | ||
lazy="true" feedback="false" autofocus="false" | ||
:label="$t('message.created')" disabled="true" /> | ||
<b-input-group-form-input id="bundle-last-sync" :value="bundleLastSynced" feedback="false" | ||
:label="$t('message.policy_bundle_sync_timestamp')" disabled="true" /> | ||
</b-card> | ||
</b-tab> | ||
</b-tabs> | ||
<template v-slot:modal-footer="{ cancel }"> | ||
<b-button size="md" variant="secondary" @click="cancel()">{{ $t('message.close') }}</b-button> | ||
</template> | ||
</b-modal> | ||
</template> | ||
|
||
<script> | ||
import BInputGroupFormInput from "../../forms/BInputGroupFormInput"; | ||
import BInputGroupFormSelect from "../../forms/BInputGroupFormSelect"; | ||
import { Switch as cSwitch } from '@coreui/vue'; | ||
import permissionsMixin from "../../mixins/permissionsMixin"; | ||
import Multiselect from "vue-multiselect" | ||
import VueTagsInput from '@johmun/vue-tags-input'; | ||
import common from "../../shared/common"; | ||
export default { | ||
name: "PolicyBundleInfoModal", | ||
mixins: [permissionsMixin], | ||
components: { | ||
BInputGroupFormInput, | ||
VueTagsInput, | ||
BInputGroupFormSelect, | ||
cSwitch, | ||
Multiselect | ||
}, | ||
props: { | ||
bundleInfo: Object, | ||
}, | ||
data() { | ||
return { | ||
syncToken: {} | ||
} | ||
}, | ||
computed: { | ||
bundleCreated: { | ||
get() { | ||
return (typeof this.bundleInfo.created !== 'undefined' && this.bundleInfo.created != null) ? common.formatTimestamp(this.bundleInfo.created) : "-"; | ||
} | ||
}, | ||
bundleLastSynced: { | ||
get() { | ||
return typeof (this.bundleInfo.lastSuccessfulSync != null && this.bundleInfo.lastSuccessfulSync === "number") | ||
? common.formatTimestamp(this.bundleInfo.lastSuccessfulSync, true) | ||
: "-"; | ||
} | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style lang="scss"> | ||
@import "../../assets/scss/vendors/vue-tags-input/vue-tags-input"; | ||
</style> | ||
|
||
<style scoped> | ||
.tab-content .tab-pane{ | ||
padding: 0 !important; | ||
} | ||
.tab-content { | ||
border: 0 !important; | ||
} | ||
.card { | ||
border:0; | ||
padding:0; | ||
margin-bottom:0; | ||
} | ||
</style> |
Oops, something went wrong.