Skip to content
This repository has been archived by the owner on Dec 6, 2023. It is now read-only.

Commit

Permalink
rebased
Browse files Browse the repository at this point in the history
  • Loading branch information
sciabarracom committed Mar 3, 2020
2 parents 419926b + e6b2df6 commit 1ad16b5
Show file tree
Hide file tree
Showing 32 changed files with 376 additions and 227 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ jobs:
- name: Build
run: go build -o bin/iosdk

- name: Test
- name: Go test
run: cd wskide && go test -v

- name: Test iosdk
run : |
docker pull openwhisk/standalone:nightly
docker pull actionloop/ide-js:latest
bin/iosdk start --verbose --skip-docker-version
bin/iosdk start "" --skip-docker-version
docker exec openwhisk waitready
#bin/iosdk debug ide-deploy --verbose
docker ps
docker exec -t ide-js sh /home/project/test.sh
16 changes: 16 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# v0.4-pre

- sample send message (not yet operative)
- automated deployment of backoffice
- backoffice
- status cmd

# v0.3-pre

- init command
- sample importer

# v0.2-pre

- the backend
- the ide
4 changes: 4 additions & 0 deletions backend/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
IMG=actionloop/iosdk:latest
<<<<<<< HEAD
=======
AUTH=23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP
>>>>>>> e6b2df6053b8c531571140e1242f37e38454cd8b

.PHONE: build
build:
Expand Down
10 changes: 7 additions & 3 deletions backend/actions/manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ packages:
backend:
version: 1.0
actions:
hello:
runtime: nodejs:8
echo:
docker: openwhisk/action-golang-v1.12
web: true
function: src/hello.js
function: src/echo.go
send:
docker: openwhisk/action-golang-v1.12
web: true
function: src/send/main.go
8 changes: 8 additions & 0 deletions backend/actions/src/echo.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package main

// Main function for the action
func Main(obj map[string]interface{}) map[string]interface{} {
res := make(map[string]interface{})
res["body"] = obj
return res
}
24 changes: 24 additions & 0 deletions backend/actions/src/send/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package main

import (
"bytes"
"html/template"
)

const answer = `<table>
<tr><th>CodFiscDesc</th><td>{{.CodFiscDest}}</td></td>
<tr><th>Message</th><td>{{.Message}}</td></td>
</table>
`

// Main function for the action
func Main(data map[string]interface{}) map[string]interface{} {
t := template.Must(template.New("answer").Parse(answer))
buf := new(bytes.Buffer)
t.Execute(buf, data)

// result
res := make(map[string]interface{})
res["body"] = buf.String()
return res
}
17 changes: 17 additions & 0 deletions backend/actions/src/send/main_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package main

import "fmt"

func ExampleMain() {
data := map[string]interface{}{
"CodFiscDest": "123456",
"Message": "HelloWord",
}
fmt.Printf("%v\n", Main(data))
// Output:
// map[body:<table>
// <tr><th>CodFiscDesc</th><td>123456</td></td>
// <tr><th>Message</th><td>HelloWord</td></td>
// </table>
// ]
}
9 changes: 2 additions & 7 deletions wskide/send.go → backend/actions/src/send/send.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package wskide
package main

import (
"bytes"
Expand All @@ -8,12 +8,7 @@ import (
"time"
)

var (
sendDestArg = sendCmd.Arg("recipient", "Message Recipient (fiscal code)").String()
sendSubjectArg = sendCmd.Arg("subject", "Message Subject").String()
sendMarkdownArg = sendCmd.Arg("markdown", "Message Markdown").String()
sendKeyArg = sendCmd.Arg("key", "API Key").String()
)
var APIHOST = ""

// SendMessage send message to IO
func SendMessage(subject, markdown, dest, key string) error {
Expand Down
9 changes: 4 additions & 5 deletions wskide/send_test.go → backend/actions/src/send/send_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package wskide
package main

func ExampleSendMessage() {
Debug("test disabled - need to store secrets in a safe way")
import "fmt"

func ExampleSendMessage() {
fmt.Println("test disabled - need to store secrets in a safe way")
return
*DryRunFlag = true
DryRunPush("response Body: {\"id\":\"01E1FHC33GSY6CE64JTGDYTYMP\"}")
var subject = "Welcome new user !"
var markdown = `# This is a markdown header\n\nto show how easily markdown can be converted to **HTML**\n\nRemember: this has to be a long text.`
// need this for the Example!!
Expand Down
5 changes: 5 additions & 0 deletions backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"svelte": "^3.18.2"
},
"dependencies": {
"marked": "^0.8.0",
"sirv-cli": "^0.4.4",
"svelte-routing": "^1.4.1"
}
Expand Down
18 changes: 18 additions & 0 deletions backend/src/About.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<script>
import marked from 'marked';
let body = marked(`
# Benvenuto ad IO-SDK
IO-SDK è il kit di sviluppo per sviluppare Application per la app dei servizi pubblici italiani.
Il nostro team è composto da:
- Federico Feroldi, Team Leader
- Mirko Calvaresi, Projct Manager
- Michele Sciabarrà, Developer
`);
</script>

<div>{@html body}</div>

40 changes: 22 additions & 18 deletions backend/src/Body.svelte
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
<script>
import { Router, Route } from "svelte-routing";
import Lorem from "./Lorem.svelte";
import Card from "./Card.svelte";
import Form from "./Form.svelte";
import Profilo from "./Profilo.svelte";
import Home from "./Home.svelte";
import Menu from "./Menu.svelte";
import About from "./About.svelte";
import Devel from "./Devel.svelte";
import Send from "./Send.svelte";
</script>

<section class="row">
<Menu />
<Router>
<Route path="/">
<Profilo />
</Route>
<Route path="send">
<Form />
</Route>
<Route path="ide">
<Card />
</Route>
<Route path="info">
<Lorem />
</Route>
</Router>
<div class="col-9">
<div class="mr-4 pt-5 pb-5">
<Router>
<Route path="/">
<Home />
</Route>
<Route path="send">
<Send/>
</Route>
<Route path="devel">
<Devel />
</Route>
<Route path="about">
<About />
</Route>
</Router>
</div>
</div>
</section>
30 changes: 0 additions & 30 deletions backend/src/Card.svelte

This file was deleted.

1 change: 1 addition & 0 deletions backend/src/Devel.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<iframe width="100%" height="100%" title="Development" src="http://localhost:3000"></iframe>
62 changes: 0 additions & 62 deletions backend/src/Form.svelte

This file was deleted.

13 changes: 13 additions & 0 deletions backend/src/Home.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<div class="it-hero-wrapper">
<div class="container">
<div class="row">
<div class="col-12">
<div class="it-hero-text-wrapper bg-dark">
<span class="it-category">Welcome</span>
<h1 class="no_toc">IO-SDK</h1>
<p class="d-none d-lg-block">Welcome to the development kit to easily build IO importers.</p>
</div>
</div>
</div>
</div>
</div>
6 changes: 0 additions & 6 deletions backend/src/Lorem.svelte

This file was deleted.

4 changes: 2 additions & 2 deletions backend/src/Menu.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<Router>
<MenuItem />
<MenuItem icon="far fa-envelope" description="Send Message" to="send"/>
<MenuItem icon="fas fa-file-code" description="Development" to="ide" />
<MenuItem icon="fas fa-info-circle" description="About" to="info"/>
<MenuItem icon="fas fa-file-code" description="Development" to="devel" />
<MenuItem icon="fas fa-info-circle" description="About" to="about"/>
</Router>
</ul>
</div>
Expand Down
Loading

0 comments on commit 1ad16b5

Please sign in to comment.