Browse Source

doclive

master
zeus 4 years ago
parent
commit
50ca2ccb8a
  1. 1
      .gitignore
  2. 5
      babel.config.js
  3. 1
      dist/css/app.4439dee6.css
  4. 11
      dist/css/chunk-vendors.0cbe91b8.css
  5. BIN
      dist/favicon.ico
  6. BIN
      dist/fonts/themify.2c454669.eot
  7. BIN
      dist/fonts/themify.a1ecc3b8.woff
  8. BIN
      dist/fonts/themify.e23a7dca.ttf
  9. 362
      dist/img/themify.9c8e96ec.svg
  10. 1
      dist/index.html
  11. 2
      dist/js/app.ee144f76.js
  12. 1
      dist/js/app.ee144f76.js.map
  13. 65
      dist/js/chunk-vendors.f8c3f4a6.js
  14. 1
      dist/js/chunk-vendors.f8c3f4a6.js.map
  15. 14399
      package-lock.json
  16. 51
      package.json
  17. BIN
      public/favicon.ico
  18. 17
      public/index.html
  19. 253
      src/App.vue
  20. 1093
      src/assets/css/themify-icons.css
  21. BIN
      src/assets/fonts/glyphicons-halflings-regular.448c34a.woff2
  22. BIN
      src/assets/fonts/glyphicons-halflings-regular.e18bbf6.ttf
  23. BIN
      src/assets/fonts/glyphicons-halflings-regular.f4769f9.eot
  24. BIN
      src/assets/fonts/glyphicons-halflings-regular.fa27723.woff
  25. BIN
      src/assets/fonts/themify.eot
  26. 362
      src/assets/fonts/themify.svg
  27. BIN
      src/assets/fonts/themify.ttf
  28. BIN
      src/assets/fonts/themify.woff
  29. BIN
      src/assets/logo.png
  30. 162
      src/components/DocLive.vue
  31. 370
      src/components/doclive/AdhocView.vue
  32. 327
      src/components/doclive/runLlo.vue
  33. 18
      src/main.js

1
.gitignore

@ -4,4 +4,5 @@
*.ori
*.orig
*.tmp
node_modules/

5
babel.config.js

@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/app'
]
}

1
dist/css/app.4439dee6.css

File diff suppressed because one or more lines are too long

11
dist/css/chunk-vendors.0cbe91b8.css

File diff suppressed because one or more lines are too long

BIN
dist/favicon.ico

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
dist/fonts/themify.2c454669.eot

Binary file not shown.

BIN
dist/fonts/themify.a1ecc3b8.woff

Binary file not shown.

BIN
dist/fonts/themify.e23a7dca.ttf

Binary file not shown.

362
dist/img/themify.9c8e96ec.svg

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 229 KiB

1
dist/index.html

@ -0,0 +1 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>bootstrap-vue-example</title><link href="/css/app.4439dee6.css" rel="preload" as="style"><link href="/css/chunk-vendors.0cbe91b8.css" rel="preload" as="style"><link href="/js/app.ee144f76.js" rel="preload" as="script"><link href="/js/chunk-vendors.f8c3f4a6.js" rel="preload" as="script"><link href="/css/chunk-vendors.0cbe91b8.css" rel="stylesheet"><link href="/css/app.4439dee6.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but bootstrap-vue-example doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/js/chunk-vendors.f8c3f4a6.js"></script><script src="/js/app.ee144f76.js"></script></body></html>

2
dist/js/app.ee144f76.js

File diff suppressed because one or more lines are too long

1
dist/js/app.ee144f76.js.map

File diff suppressed because one or more lines are too long

65
dist/js/chunk-vendors.f8c3f4a6.js

File diff suppressed because one or more lines are too long

1
dist/js/chunk-vendors.f8c3f4a6.js.map

File diff suppressed because one or more lines are too long

14399
package-lock.json

File diff suppressed because it is too large

51
package.json

@ -0,0 +1,51 @@
{
"name": "bootstrap-vue-example",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"@vue/compiler-sfc": "^3.0.1",
"asciidoctor": "^2.2.0",
"bootstrap-vue": "^2.17.3",
"file-saver": "^2.0.2",
"jszip": "^3.5.0",
"mkdirp": "^1.0.4",
"vue": "^2.6.12",
"vue-codemirror": "^4.0.6",
"vue-sweetalert2": "^3.0.8"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^4.5.7",
"@vue/cli-plugin-eslint": "^3.0.0",
"@vue/cli-service": "^4.5.7",
"vue-template-compiler": "^2.6.12"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"rules": {},
"parserOptions": {
"parser": "babel-eslint"
}
},
"postcss": {
"plugins": {
"autoprefixer": {}
}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}

BIN
public/favicon.ico

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

17
public/index.html

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>bootstrap-vue-example</title>
</head>
<body>
<noscript>
<strong>We're sorry but bootstrap-vue-example doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>

253
src/App.vue

@ -0,0 +1,253 @@
<template>
<div id="app">
<!-- ***************** nav items ****************** -->
<b-navbar toggleable="md" class="navbar-secondary" >
<b-navbar-toggle target="nav_collapse"> </b-navbar-toggle>
<b-navbar-brand class="logo simple-text ti-swarmlab text-secondary">
Swarmlab.io Doclive
</b-navbar-brand>
<b-collapse is-nav id="nav_collapse">
<b-navbar-nav>
</b-navbar-nav>
<!-- Right aligned nav items -->
<b-navbar-nav class="ml-auto">
<b-nav-item href="http://docs.swarmlab.io/SwarmLab-HowTos/labs/Howtos/asciidoc/AsciiDocSyntaxQuickReference.adoc.html" target="_ascii" > Asciidoc_QuickReference </b-nav-item>
<b-nav-item > | </b-nav-item>
<b-nav-item href="https://git.swarmlab.io:3000" target="_swarmlabgit"> Swarmlab_git </b-nav-item>
<b-nav-item > | </b-nav-item>
<b-nav-item href="https://api-client.swarmlab.io:8088/#/signin?redirect=%2Fdashboard" target="_swarmlab"> Lab_onDemand </b-nav-item>
<b-nav-item > | </b-nav-item>
<!--
<b-nav-form>
<b-form-input size="sm" class="mr-sm-2" type="text" placeholder="Search"/>
<b-button size="sm" class="my-2 my-sm-0" type="submit">Search</b-button>
</b-nav-form>
-->
<b-nav-item-dropdown right>
<!-- Using template slot -->
<template slot="button-content">
<em>Template</em>
</template>
<b-dropdown-item >
<button type="button"
round
class="btn btn-outline-info btn-sm"
@click="addtemplate('LabTemplate')">
LabTemplate</button>
</b-dropdown-item>
</b-nav-item-dropdown>
<b-nav-item > &nbsp; &nbsp; &nbsp; </b-nav-item>
<button type="button"
round
class="btn btn-outline-info btn-sm"
@click="saveDocLive">
Save As Zip</button>
<button type="button"
round
class="btn btn-outline-secondary btn-sm"
@click="moreFormats">
More Formats</button>
</b-navbar-nav>
</b-collapse>
</b-navbar>
<!-- ***************** container items ****************** -->
<b-row>
<b-col cols="12">
<doc-live
style="background-color: #f8f9fa"
>
</doc-live>
</b-col>
</b-row>
</div>
</template>
<script>
import DocLive from './components/DocLive.vue'
import Asciidoctor from 'asciidoctor'
import "@/assets/css/themify-icons.css";
export default {
name: 'app',
components: {
DocLive
},
data() {
return {
show: true,
SwarmabAsciiLabTemplate:''
}
},
mounted() {
},
methods: {
saveDocLive() {
this.$root.$emit('asciilive_save','save')
},
addtemplate(template) {
if( template == 'LabTemplate' ){
this.SwarmabAsciiLabTemplate = `= Title!
myName email@emailserver.foo
:description: Description
:keywords: Lab, myLab
:data-uri:
:toc: true
:toc-title: Table of Contents
:toclevels: 4
:source-highlighter: highlight
:icons: font
:sectnums:
{empty} +
.Welcome to Swarmlab.io
****
Swarmlab is a powerful collaboration tool that connects tutors and students in a unique all-in-one environment that gets work done fast and easily
Ready-to-Use Virtual Labs one click away.
****
== Chapter 1
.NOTE
[NOTE]
====
Assuming you're already logged in
====
=== Install docker
To Docker είναι μια πλατφόρμα λογισμικού ανοιχτού κώδικα που υλοποιεί Εικονικοποίηση (Virtualization) σε επίπεδο Λειτουργικού Συστήματος.
Tο Docker προσφέρει αυτοματοποιημένες διαδικασίες για την ανάπτυξη εφαρμογών σε απομονωμένες Περιοχές Χρήστη (User Spaces) που ονομάζονται Software Containers
Το λογισμικό χρησιμοποιεί τεχνολογιές του πυρήνα του Linux όπως τα cgroups και οι χώροι ονομάτων πυρήνα (kernel namespaces), για να επιτρέπει σε ανεξάρτητα software containers να εκτελούνται στο ίδιο λειτουργικό σύστημα.
Έτσι αποφεύγεται η χρήση επιπλέον υπολογιστικών πόρων που θα απαιτούσε μια εικονική μηχανή (virtual machine).
Ορισμός, βασικά χαρακτηριστικά και αρχιτεκτονικές IoT, εφαρμογές ΙοΤ, αντιδιαστολή με τον ιστό των αντικειμένων (Web of Things / WoT), προκλήσεις του IoT όπως προτυποποίηση, κλιμάκωση, μέγεθος συσκευών, κατανάλωση ενέργειας, διευθυνσιοδότηση, ασφάλεια/ιδιωτικότητα, ποιότητας υπηρεσιών, κινητικότητα κ.α
More Info +
https://en.wikipedia.org/wiki/Docker_(software)[^]
[[cheat-Dockervideo]]
== docker Intro
* Docker - Explained
+
video::wi-MGFhrad0[youtube]
* How DOCKER works - Virtualization vs containerization
+
video::0e-KiGJIiDc[youtube]
== Installation (Ubuntu)
.Run with sudo
[source,bash]
----
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update
sudo apt install -y docker-ce
echo "or"
sudo apt install docker*
sudo systemctl status docker
sudo usermod -aG docker username #οπου username το όνομα του χρήστη που θα δουλεύει με docker
----
== Usage swarmlab.io DocLive
- Open a console
- Switch to the directory that contains *.adoc documents
- Call the Asciidoctor processor with the command
.If you need to convert only one file
[TIP]
====
[source,bash]
----
docker run --rm -v $(pwd):/documents/ registry.vlabs.uniwa.gr:5080/swarmlab-asciidoctor asciidoctor --safe -b html5 -a theme=flask -a toc2 -o ./path/to/FILENAME.html ./path/from/FILENAME.adoc
----
Please note, there is a **.** in ./path
====
`
this.$root.$emit('asciilive_template_add', this.SwarmabAsciiLabTemplate)
}
}
}
}
</script>
<style>
@import url('https://fonts.googleapis.com/css?family=Lato:400,700');
body {
background: #EEF1F4 !important;
//font-family: 'Lato', sans-serif !important;
}
.nav-background {
background: #353535;
//background: #74b3c8;
}
.ti-swarmlab:before {
position: relative;
top:-5px;
right:-8px;
font-size: 1.5em;
font-weight: 300;
content: "\e606";
color: #222;
/*color: #5FCF80; */
color: #74B3C8;
border-color: #c60000;
}
.ti-themify-logo:before {
content: "\e6d1";
}
.menoutext {
font-family: 'Lato', sans-serif !important;
}
</style>

1093
src/assets/css/themify-icons.css

File diff suppressed because it is too large

BIN
src/assets/fonts/glyphicons-halflings-regular.448c34a.woff2

Binary file not shown.

BIN
src/assets/fonts/glyphicons-halflings-regular.e18bbf6.ttf

Binary file not shown.

BIN
src/assets/fonts/glyphicons-halflings-regular.f4769f9.eot

Binary file not shown.

BIN
src/assets/fonts/glyphicons-halflings-regular.fa27723.woff

Binary file not shown.

BIN
src/assets/fonts/themify.eot

Binary file not shown.

362
src/assets/fonts/themify.svg

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 229 KiB

BIN
src/assets/fonts/themify.ttf

Binary file not shown.

BIN
src/assets/fonts/themify.woff

Binary file not shown.

BIN
src/assets/logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

162
src/components/DocLive.vue

@ -0,0 +1,162 @@
<template>
<div>
<!-- menou -->
<div class="row"
v-show="showmenou == 1"
>
<div class="col-3">
<div class="input-group-append">
<button type="button"
round
v-if="columnviewdefault == '0'"
class="ti-layout-sidebar-none btn btn-outline-info btn-sm"
@click="fullscreen('max')">
Max-Notebook View </button>
<button type="button"
round
v-if="columnviewdefault == '1'"
class="ti-layout-sidebar-right btn btn-outline-info btn-sm"
@click="fullscreen('min')">
Min-Notebook View</button>
</div>
</div>
<div class="col-6">
<span></span>
</div>
<div class="col-3">
<div class="input-group-prepend">
<button type="button"
round
v-if="columncodedefault == '0'"
class="ti-layout-sidebar-none btn btn-outline-info btn-sm"
style="float: right;"
@click="fullscreen('codemax')">
Max-Code View </button>
<button type="button"
round
v-if="columncodedefault == '1'"
style="float: right;"
class="ti-layout-sidebar-left btn btn-outline-info btn-sm"
@click="fullscreen('codemin')">
Min-Code View</button>
</div>
</div>
</div>
<!-- menou -->
<div class="row" >
<div :class="columnview">
<run-llo
style="background-color: #f8f9fa"
>
</run-llo>
</div>
<div :class="columncode">
<ad-hoc
style="background-color: #f8f9fa"
>
</ad-hoc>
</div>
</div>
</div>
</template>
<script>
import RunLlo from "./doclive/runLlo.vue";
import AdHoc from "./doclive/AdhocView.vue";
export default {
name: 'DocLive',
props: {
},
components: {
RunLlo,
AdHoc
},
data () {
return {
loading: false,
showhistory : 0,
productIndex: 1,
showmenou: 1,
columnviewdefault : 0,
columncodedefault : 0,
columnview : 'col-7 order-first',
columncode : 'col-5 order-last',
tutorMenou: 'student'
}
},
created: function () {
},
mounted() {
this.$root.$on('LLOshowmenounotebooks', () => {
this.showmenou = 1
}),
this.$root.$on('lloshowchallengehistory', (llo,active) => {
this.showhistory = 1
})
},
beforeDestroy () {
this.$root.$off('LLOshowmenounotebooks'),
this.$root.$off('lloshowchallengehistory') // working
},
methods: {
fullscreen(action){
if(action == 'max'){
this.columnview = 'col-11 order-first'
this.columncode = 'col-1 order-last'
this.columnviewdefault = 1
this.columncodedefault = 0
//set height iframe
this.$root.$emit('LLOresizemenounotebooks','max')
console.log(this.columnview)
}
else if(action == 'min'){
this.columnview = 'col-7 order-first'
this.columncode = 'col-5 order-last'
this.columnviewdefault = 0
this.columncodedefault = 1
//set height iframe
this.$root.$emit('LLOresizemenounotebooks','min')
console.log(this.columnview)
}
else if(action == 'codemax'){
this.columnview = 'col-1 order-first'
this.columncode = 'col-11 order-last'
this.columnviewdefault = 0
this.columncodedefault = 1
console.log(this.columnview)
}
else if(action == 'codemin'){
this.columnview = 'col-7 order-first'
this.columncode = 'col-5 order-last'
this.columnviewdefault = 1
this.columncodedefault = 0
this.$root.$emit('LLOresizemenounotebooks','min')
console.log(this.columnview)
}
},
async onAction (action) {
this.tutorMenou='tutor'
//this.tutorMenou='student'
}
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
</style>

370
src/components/doclive/AdhocView.vue

@ -0,0 +1,370 @@
<template>
<div>
<b-row no-gutters w-100 h-100
v-if="showlloedit"
>
<b-col cols="12" sm="12" md="12" >
<b-row >
<b-col cols="5">
<div class="input-group input-group-sm sm-3">
<select
class="custom-select custom-select-sm "
@change="setKeymap"
v-model="selected">
<option
v-for="option in options"
v-bind:value="option.value">
{{ option.text }}
</option>
</select>
<div class="input-group-append">
<button type="button"
round
class="btn btn-outline-info btn-sm"
v-if="cmOptions.keyMap == 'sublime'"
@click="infoFilter">
i</button>
</div>
</div>
</b-col>
<b-col cols="7" >
<div class="input-group input-group-sm d-flex justify-content-end">
</div>
<div class="input-group input-group-sm d-flex justify-content-end">
<div class="input-group-append">
<button type="button"
round
class="btn btn-outline-warning btn-sm"
v-if="tryLLO[active]"
@click="closelog(key)">
Close</button>
</div>
<div class="input-group-append">
<button
type="button"
class="btn btn-outline-dark btn-sm"
v-if="tryLLO[active]"
@click="addlloasciisource"
>Create task!</button>
</div>
</div>
</b-col>
</b-row>
<div class="codemirror" >
<codemirror
ref="myCm"
:value="code"
:options="cmOptions"
@cursorActivity="onCmCursorActivity"
@ready="onCmReady"
@focus="onCmFocus"
@input="onCmCodeChange"
></codemirror>
</div>
</b-col>
</b-row>
</div>
</template>
<script>
//import {mapState, mapGetters, mapActions,dispatch} from 'vuex'
import Vue from 'vue'
//import store from '@/store/index'
//import '@asciidoctor/core/dist/browser/asciidoctor'
import Asciidoctor from 'asciidoctor'
//import '@asciidoctor/core/dist/css/asciidoctor.css'
import { codemirror } from 'vue-codemirror'
import JSZip from 'jszip';
import FileSaver from 'file-saver';
import 'codemirror/lib/codemirror.css'
import 'codemirror/theme/neat.css'
import'codemirror/addon/selection/active-line.js'
// hint
import'codemirror/addon/hint/show-hint.js'
import'codemirror/addon/hint/show-hint.css'
import'codemirror/addon/hint/javascript-hint.js'
import'codemirror/addon/selection/active-line.js'
import'codemirror/addon/scroll/annotatescrollbar.js'
import'codemirror/addon/search/matchesonscrollbar.js'
import'codemirror/addon/search/searchcursor.js'
import'codemirror/addon/search/match-highlighter.js'
// keyMap
import'codemirror/mode/shell/shell.js'
import'codemirror/addon/edit/matchbrackets.js'
import'codemirror/addon/comment/comment.js'
import'codemirror/addon/dialog/dialog.js'
import'codemirror/addon/dialog/dialog.css'
import'codemirror/addon/search/searchcursor.js'
import'codemirror/addon/search/search.js'
import'codemirror/keymap/sublime.js'
import'codemirror/keymap/vim.js'
// foldGutter
import'codemirror/addon/fold/foldgutter.css'
import'codemirror/addon/fold/brace-fold.js'
import'codemirror/addon/fold/comment-fold.js'
import'codemirror/addon/fold/foldcode.js'
import'codemirror/addon/fold/foldgutter.js'
import'codemirror/addon/fold/indent-fold.js'
import'codemirror/addon/fold/markdown-fold.js'
import'codemirror/addon/fold/xml-fold.js'
import 'codemirror/lib/codemirror';
import 'codemirror/addon/display/placeholder';
//import yaml from 'js-yaml'
export default {
components: {
codemirror
},
data () {
return {
swarmlabllo: 'https://git.swarmlab.io:3000/labs/examples-mpi2/raw/branch/master/llo-index.yml',
ssl:{},
url_asciijshighlight:[
'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/highlight.min.js'
],
url_asciijs:[
//'https://code.jquery.com/jquery-3.5.1.slim.min.js',
//'https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js',
'https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js'
],
url_asciicss:[
'https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css',
'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/styles/github.min.css',
'https://cdnjs.cloudflare.com/ajax/libs/asciidoctor.js/1.5.9/css/asciidoctor.min.css',
'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/css/all.min.css'
],
code: '# Try!',
editchoice: '',
optionsedit: [
{ text: 'code', value: 'code' },
{ text: 'text', value: 'text' }
],
llodesc:[{
llo_url : '',
llo_name : '',
llo_author : '',
llo_intro : ''
}],
llo:[{
id : 0,
rm : false,
data_info : 'Asciidoc \n',
data_code : '#Your source code',
data_service : '',
code_datafile : 'url',
code_name : '',
code_exec : '',
code_options : '',
code_mime : '',
code_info : '',
code_code : '',
code_codeout : '',
code_codeoutput : 'console',
points : '',
challenge_question : '',
code_challenge_question : '',
challenge_answer : '',
challenge_answer_hint : '',
code_challenge_answer_hint : '',
challenge_answer_source : '',
challenge_answer_code_out : '',
challenge_answer_code : '',
code_challenge_answer_code : ''
}],
searchLLO: [],
searchLLOactive : false,
ADOC_html_code:'',
challenge:[],
action:'',
tryLLO:[],
service:'os2',
active:0,
activecount:0,
remove:'',
activeField:'',
bootstrap:false,
firstbootstrap:0,
htmlasciitmp:'',
datafile: 'https://git.swarmlab.io:3000/labs/examples-mpi2/raw/branch/master/0_netstat/data',
datadir: '0_netstat/data',
LearningObject:'',
showllo:true,
showlloedit:true,
selected: 'sublime',
options: [
{ text: 'vim', value: 'vim' },
{ text: 'sublime', value: 'sublime' }
],
optionsmime: [
{ text: 'sh', value: 'bash' },
{ text: 'javascript', value: 'javascript' },
{ text: 'python', value: 'python' },
{ text: 'php', value: 'php' },
{ text: 'sql', value: 'sq;' },
{ text: 'xml', value: 'xml' },
{ text: 'c', value: 'c' }
],
pValidate: false,
cmOptions: {
tabSize: 2,
styleActiveLine: true,
lineNumbers: true,
lineSeparator:'\n',
line: true,
foldGutter: true,
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
highlightSelectionMatches: { showToken: /\w/, annotateScrollbar: true },
styleSelectedText: true,
mode: 'shell',
hintOptions:{
completeSingle: false
},
keyMap: "sublime",
//keyMap: "vim",
matchBrackets: true,
showCursorWhenSelecting: true,
indentUnit:this.ADOC_html_code,
lineWrapping: true,
theme: 'neat',
refresh:true,
autofocus: false,
extraKeys: { "Ctrl": "autocomplete" }
},
ADOC_html:[]
}
},
methods: {
async showactive(index) {
this.topwindow(index)
},
onCmReady(cm) {
cm.on('change', (cm, chg) => {
}),
cm.on('keypress', () => {
cm.showHint({completeSingle:false})
})
},
onCmCursorActivity(a, b, c) {
},
onCmFocus(cm) {
},
onCmCodeChange(newCode) {
this.code = newCode
this.$root.$emit('asciilive_add',this.code)
},
handleChange() {
},
setKeymap () {
this.cmOptions.keyMap = this.selected
},
infoFilter() {
var title1='<h3>Playbook Images</h3>'
var winfop='<table class="table table-striped table-sm ">'+
'<tr><td class="text-left">Shift-Tab</td> <td class="text-left">indentLess</td></tr>'+
'<tr><td class="text-left">Shift-Ctrl-K</td> <td class="text-left">deleteLine</td></tr>'+
'<tr><td class="text-left">Alt-Q</td> <td class="text-left">wrapLines</td></tr>'+
'<tr><td class="text-left">Ctrl-T</td> <td class="text-left">transposeChars</td></tr>'+
'<tr><td class="text-left">Alt-Left</td> <td class="text-left">goSubwordLeft</td></tr>'+
'<tr><td class="text-left">Alt-Right</td> <td class="text-left">goSubwordRight</td></tr>'+
'<tr><td class="text-left">Ctrl-Up</td> <td class="text-left">scrollLineUp</td></tr>'+
'<tr><td class="text-left">Ctrl-Down</td> <td class="text-left">scrollLineDown</td></tr>'+
'<tr><td class="text-left">Ctrl-L</td> <td class="text-left">selectLine</td></tr>'+
'<tr><td class="text-left">Shift-Ctrl-L</td> <td class="text-left">splitSelectionByLine</td></tr>'+
'<tr><td class="text-left">Esc</td> <td class="text-left">singleSelectionTop</td></tr>'+
'<tr><td class="text-left">Ctrl-Enter</td> <td class="text-left">insertLineAfter</td></tr>'+
'<tr><td class="text-left">Shift-Ctrl-Enter</td> <td class="text-left">insertLineBefore</td></tr>'+
'<tr><td class="text-left">Ctrl-D</td> <td class="text-left">selectNextOccurrence</td></tr>'+
'<tr><td class="text-left">Shift-Ctrl-Space</td> <td class="text-left">selectScope</td></tr>'+
'<tr><td class="text-left">Shift-Ctrl-M</td> <td class="text-left">selectBetweenBrackets</td></tr>'+
'<tr><td class="text-left">Ctrl-M</td> <td class="text-left">goToBracket</td></tr>'+
'<tr><td class="text-left">Shift-Ctrl-Up</td> <td class="text-left">swapLineUp</td></tr>'+
'<tr><td class="text-left">Shift-Ctrl-Down</td> <td class="text-left">swapLineDown</td></tr>'+
'<tr><td class="text-left">Ctrl-/</td> <td class="text-left">toggleCommentIndented</td></tr>'+
'<tr><td class="text-left">Ctrl-J</td> <td class="text-left">joinLines</td></tr>'+
'<tr><td class="text-left">Shift-Ctrl-D</td> <td class="text-left">duplicateLine</td></tr>'+
'<tr><td class="text-left">F9</td> <td class="text-left">sortLines</td></tr>'+
'<tr><td class="text-left">Ctrl-F9</td> <td class="text-left">sortLinesInsensitive</td></tr>'+
'<tr><td class="text-left">F2</td> <td class="text-left">nextBookmark</td></tr>'+
'<tr><td class="text-left">Shift-F2</td> <td class="text-left">prevBookmark</td></tr>'+
'<tr><td class="text-left">Ctrl-F2</td> <td class="text-left">toggleBookmark</td></tr>'+
'<tr><td class="text-left">Shift-Ctrl-F2</td> <td class="text-left">clearBookmarks</td></tr>'+
'<tr><td class="text-left">Alt-F2</td> <td class="text-left">selectBookmarks</td></tr>'+
'<tr><td class="text-left">Backspace</td> <td class="text-left">smartBackspace</td></tr>'+
'<tr><td class="text-left">Ctrl-K Ctrl-K</td> <td class="text-left">delLineRight</td></tr>'+
'<tr><td class="text-left">Ctrl-K Ctrl-U</td> <td class="text-left">upcaseAtCursor</td></tr>'+
'<tr><td class="text-left">Ctrl-K Ctrl-L</td> <td class="text-left">downcaseAtCursor</td></tr>'+
'<tr><td class="text-left">Ctrl-K Ctrl-Space</td> <td class="text-left">setSublimeMark</td></tr>'+
'<tr><td class="text-left">Ctrl-K Ctrl-A</td> <td class="text-left">selectToSublimeMark</td></tr>'+
'<tr><td class="text-left">Ctrl-K Ctrl-W</td> <td class="text-left">deleteToSublimeMark</td></tr>'+
'<tr><td class="text-left">Ctrl-K Ctrl-X</td> <td class="text-left">swapWithSublimeMark</td></tr>'+
'<tr><td class="text-left">Ctrl-K Ctrl-Y</td> <td class="text-left">sublimeYank</td></tr>'+
'<tr><td class="text-left">Ctrl-K Ctrl-C</td> <td class="text-left">showInCenter</td></tr>'+
'<tr><td class="text-left">Ctrl-K Ctrl-G</td> <td class="text-left">clearBookmarks</td></tr>'+
'<tr><td class="text-left">Ctrl-K Ctrl-Backspace</td> <td class="text-left">delLineLeft</td></tr>'+
'<tr><td class="text-left">Ctrl-K Ctrl-0</td> <td class="text-left">unfoldAll</td></tr>'+
'<tr><td class="text-left">Ctrl-K Ctrl-J</td> <td class="text-left">unfoldAll</td></tr>'+
'<tr><td class="text-left">Ctrl-Alt-Up</td> <td class="text-left">addCursorToPrevLine</td></tr>'+
'<tr><td class="text-left">Ctrl-Alt-Down</td> <td class="text-left">addCursorToNextLine</td></tr>'+
'<tr><td class="text-left">Ctrl-F3</td> <td class="text-left">findUnder</td></tr>'+
'<tr><td class="text-left">Shift-Ctrl-F3</td> <td class="text-left">findUnderPrevious</td></tr>'+
'<tr><td class="text-left">Shift-Ctrl-[</td> <td class="text-left">fold</td></tr>'+
'<tr><td class="text-left">Shift-Ctrl-]</td> <td class="text-left">unfold</td></tr>'+
'<tr><td class="text-left">Ctrl-H</td> <td class="text-left">replace</td></tr>'+
'</table>'
//var title1='<div>Repositories are set to Default</div>'
//var winfo='if you want sumthing special plaese first insert the repo'
var title1=''
var winfo=''
this.$swal({
title: '<strong>Sublime Text bindings</strong>',
type: 'info',
html: winfop+title1+winfo,
showCloseButton: true,
showLoaderOnConfirm: false,
allowOutsideClick: false
})
}
},
computed: {
codemirror() {
return this.$refs.myCm.codemirror
}
},
mounted() {
this.$root.$on('asciilive_template_add', (v) => {
this.$nextTick(function () {
this.code = v
})
})
},
beforeDestroy () {
this.$root.$off('PipelineRunSwarmserviceLLOAdhoc')
},
created () {
}
};
</script>
<style>
.CodeMirror {
/* Set height, width, borders, and global font properties here */
font-family: monospace;
height: 750px;
}
</style>

327
src/components/doclive/runLlo.vue

@ -0,0 +1,327 @@
<template>
<b-row no-gutters w-100 h-100
v-if="showlloedit"
>
<b-col cols="12" sm="12" md="12" >
<iframe id="llocontainer"
:srcdoc="htmlasciitmp"
width="100%"
height="750"
frameBorder="0"
name="Forgot_Iframe">
</iframe>
</b-col>
</b-row>
</template>
<script>
import Vue from 'vue'
import Asciidoctor from 'asciidoctor'
import JSZip from 'jszip';
import FileSaver from 'file-saver';
export default {
components: {
},
data () {
return {
swarmlabllo: 'https://git.swarmlab.io:3000/labs/examples-mpi2/raw/branch/master/llo-index.yml',
ssl:{},
url_asciijshighlight:[
'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/highlight.min.js'
],
url_asciijs:[
//'https://code.jquery.com/jquery-3.5.1.slim.min.js',
//'https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js',
'https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js'
],
url_asciicss:[
'https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css',
'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/styles/github.min.css',
'https://cdnjs.cloudflare.com/ajax/libs/asciidoctor.js/1.5.9/css/asciidoctor.min.css',
'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/css/all.min.css'
],
code: '',
editchoice: '',
optionsedit: [
{ text: 'code', value: 'code' },
{ text: 'text', value: 'text' }
],
llodesc:[{
llo_url : '',
llo_name : '',
llo_author : '',
llo_intro : ''
}],
searchLLO: [],
searchLLOactive : false,
ADOC_html_code:'',
challenge:[],
action:'',
tryLLO:[],
service:'os2',
active:0,
activecount:0,
remove:'',
activeField:'',
bootstrap:false,
firstbootstrap:0,
htmlasciitmp:'',
datafile: 'https://git.swarmlab.io:3000/labs/examples-mpi2/raw/branch/master/0_netstat/data',
datadir: '0_netstat/data',
LearningObject:'',
asciidochtml:'',
showllo:true,
showlloedit:true,
selected: 'sublime',
options: [
{ text: 'vim', value: 'vim' },
{ text: 'sublime', value: 'sublime' }
],
pValidate: false,
ADOC_html:[]
}
},
methods: {
async saveascii() {
var asciiname = 'myname'
var filesave = asciiname+"_DocLive.zip"
var zip = new JSZip();
var llofile = zip.folder(asciiname);
llofile.file("ascii.adoc.html", this.asciidochtml);
llofile.file("ascii.adoc", this.code);
zip.generateAsync({type:"blob"})
.then(function(content) {
FileSaver.saveAs(content, filesave);
});
},
async bootsrapllo() {
console.log('created');
var action=this.action
var value=this.code
var service=this.service
var asciiID = this.active
var asciiid = "llo_"+asciiID+"_ascii"
try {
// *************************************
// ***** ------- HTML ------- *****
// *************************************
try{
// -------------------------------------
// ------- create file
// -------------------------------------
var thishtml = `<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
</head>
<body>
<div id="firstElement">
<span id="AsciiElement"></span>
</div>
<div id="lastElement">
<span id="jsElement"></span>
</div>
</body>
</html>`
var htmlAscii = new DOMParser().parseFromString(thishtml, "text/html");
// -------------------------------------
// ------- insert script head
// -------------------------------------
var arrayLengthi1 = this.url_asciijshighlight.length
for (var i = 0; i < arrayLengthi1; i++) {
var asciiscript0 = document.createElement('script');
asciiscript0.type = 'text/javascript';
asciiscript0.src = this.url_asciijshighlight[i]
htmlAscii.head.appendChild(asciiscript0);
}
// -------------------------------------
// ------- create css head
// -------------------------------------
var arrayLength = this.url_asciicss.length
for (var i = 0; i < arrayLength; i++) {
var asciilink = document.createElement('link');
asciilink.rel = 'stylesheet';
asciilink.href = this.url_asciicss[i]
htmlAscii.head.appendChild(asciilink);
//console.log(this.url_asciicss[i])
}
// -------------------------------------
// ------- insert custom functions head
// -------------------------------------
var myfunction = `function llorm(msg) {
var origin = 'https://api-client.swarmlab.io:8088'
window.parent.postMessage({'event': 'warranty-transaction-rm', 'data': msg}, origin);
};
function topwindow(field) {
var asciiid = "llo_"+field+"_ascii"
var llotarget = document.getElementById(asciiid);
if(llotarget){
llotarget.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'start' })
}
};
function lloedit(msg,field) {
var origin = 'https://api-client.swarmlab.io:8088'
topwindow(msg);
window.parent.postMessage({'event': 'warranty-transaction-success', 'data': msg , 'field': field}, origin);
};`
var asciiscript2 = document.createElement('script');
asciiscript2.type = 'text/javascript';
asciiscript2.innerHTML = myfunction
htmlAscii.head.appendChild(asciiscript2);
// -------------------------------------
// ------- insert script body
// -------------------------------------
var arrayLengthi = this.url_asciijs.length
//console.log(arrayLengthi)
for (var i = 0; i < arrayLengthi; i++) {
var asciiscript = document.createElement('script');
asciiscript.type = 'text/javascript';
asciiscript.src = this.url_asciijs[i]
let parentDiv = htmlAscii.getElementById("jsElement").parentNode
let lastel = document.getElementById("jsElement")
parentDiv.insertBefore(asciiscript, lastel)
//htmlAscii.body.appendChild(asciiscript);
}
// -------------------------------------
// ------- run hlhs body
// -------------------------------------
var asciiscript1 = document.createElement('script');
asciiscript1.type = 'text/javascript';
asciiscript1.innerHTML = "hljs.initHighlighting()";
htmlAscii.body.appendChild(asciiscript1);
// -------------------------------------
// ------- html serialize
// -------------------------------------
var Myascii = new XMLSerializer();
this.htmlasciitmp = Myascii.serializeToString(htmlAscii)
// *************************************
// ***** ------- HTML ------- *****
// *************************************
//console.log(" asciii3 "+JSON.stringify(this.htmlasciitmp))
//console.log(asciidoctor1.getRuntime())
this.bootstrap = true
//console.log(" bootstrap "+JSON.stringify(this.htmlasciitmp))
}catch (ex) {
console.log(" asc error "+JSON.stringify(ex))
return
}
}catch (ex) {
console.log(" logi error "+JSON.stringify(ex))
return
}
},
async addlloascii() {
var value = this.code
console.log(" ascii code "+JSON.stringify(this.code))
// *************************************
// ***** ------- HTML ------- *****
// *************************************
try{
var asciidoctor1 = Asciidoctor()
var value_compiled = asciidoctor1.convert(value,
{
standalone: true,
backend: 'html5',
header_footer: false,
doctype: 'article',
safe: 'safe',
attributes: {
'source-highlighter': 'highlightjs',
//'toc':'right',
'sectnumlevels':4,
'toclevels':4,
'sectnums':true,
'icons': 'font',
'copycss':true,
'stylesheet': 'https://cdnjs.cloudflare.com/ajax/libs/asciidoctor.js/1.5.9/css/asciidoctor.min.css',
'iconfont-cdn': 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/css/all.min.css',
'iconfont-name': 'fontawesome-5-14.0',
'iconfont-remote':true,
'linkcss': true
}
}) // (2)
var mydinfunction = ` <div>
${value_compiled}
</div>`
console.log(" ascii "+JSON.stringify(value_compiled))
var asciiidtext = 'firstElement'
this.asciidochtml = value_compiled
document.getElementById('llocontainer').contentWindow.document.getElementById(asciiidtext).innerHTML = this.asciidochtml
//this.addtask (asciiID, divascii);
}catch (ex) {
console.log(" ascerror "+JSON.stringify(ex))
return
}
},
handleChange() {
},
},
computed: {
},
mounted() {
this.$root.$on('asciilive_add', (v) => {
this.code = v
this.addlloascii()
})
this.$root.$on('asciilive_save', (v) => {
this.saveascii()
})
},
beforeDestroy () {
this.$root.$off('asciilive_add')
this.$root.$off('asciilive_save')
},
created () {
this.bootsrapllo()
},
};
</script>
<style>
.CodeMirror {
/* Set height, width, borders, and global font properties here */
font-family: monospace;
height: 750px;
}
</style>

18
src/main.js

@ -0,0 +1,18 @@
import Vue from 'vue'
import App from './App.vue'
import BootstrapVue from 'bootstrap-vue'
import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue/dist/bootstrap-vue.css'
import VueSweetalert2 from 'vue-sweetalert2';
Vue.use(VueSweetalert2);
//eslint-disable
Vue.use(BootstrapVue);
Vue.config.productionTip = false
new Vue({
render: h => h(App)
}).$mount('#app')
Loading…
Cancel
Save