Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/OpenTOSCA/winery into pro…
Browse files Browse the repository at this point in the history
…ject/radon
  • Loading branch information
miwurster committed Nov 22, 2019
2 parents 569c612 + cec1c2b commit 4540850
Show file tree
Hide file tree
Showing 19 changed files with 2,144 additions and 1,246 deletions.
3 changes: 1 addition & 2 deletions Dockerfile
Expand Up @@ -50,12 +50,11 @@ COPY --from=builder /tmp/winery/org.eclipse.winery.frontends/target/topologymode
COPY --from=builder /tmp/winery/org.eclipse.winery.frontends/target/workflowmodeler.war ${CATALINA_HOME}/webapps/winery-workflowmodeler.war

ADD docker/winery.yml.tpl /root/.winery/winery.yml.tpl
ADD docker/winery-repository /var/opentosca/repository/

EXPOSE 8080

CMD dockerize -template /root/.winery/winery.yml.tpl:/root/.winery/winery.yml \
&& if [ ! "x${WINERY_REPOSITORY_URL}" = "x" ]; then git clone ${WINERY_REPOSITORY_URL} ${WINERY_REPOSITORY_PATH}; else git init $WINERY_REPOSITORY_PATH; fi \
&& if [ -d "${WINERY_REPOSITORY_PATH}" ] && [ "$(ls -A ${WINERY_REPOSITORY_PATH})" ]; then echo "Repository at ${WINERY_REPOSITORY_PATH} is already initialized!"; else if [ ! "x${WINERY_REPOSITORY_URL}" = "x" ]; then git clone ${WINERY_REPOSITORY_URL} ${WINERY_REPOSITORY_PATH}; else git init $WINERY_REPOSITORY_PATH; fi fi \
&& cd ${WINERY_REPOSITORY_PATH} \
&& git config --global core.fscache true \
&& git lfs install \
Expand Down
15 changes: 15 additions & 0 deletions Dockerfile.cli
@@ -0,0 +1,15 @@
FROM maven:3-jdk-8 as builder
WORKDIR /tmp/winery
COPY . /tmp/winery
RUN mvn package -pl org.eclipse.winery.cli -am -DskipTests
RUN chmod u+x /tmp/winery/org.eclipse.winery.cli/target/winery.jar

FROM openjdk:8-jre
LABEL maintainer "Oliver Kopp <kopp.dev@gmail.com>"
RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
RUN apt-get update && apt-get install -y git git-lfs
COPY --from=builder /tmp/winery/org.eclipse.winery.cli/target/winery.jar /usr/local/bin
COPY docker/winery /usr/local/bin
RUN chmod +x /usr/local/bin/winery

CMD winery
37 changes: 37 additions & 0 deletions README.md
Expand Up @@ -14,7 +14,44 @@ Winery is also part of the OpenTOSCA ecosystem where more information is availab
Both development and user documentation is rendered at <https://eclipse.github.io/winery/>.
The source for the documentation can be found at [docs/](docs).

## Running Winery

### Running via Docker

1. `docker build -t winery .`.
In case, there are issues, you can also try `docker build --no-cache -t winery .`
2. `docker run -p 8080:8080 winery` to run Winery on <http://localhost:8080>

You can also use the pre-built image and bin it to a local repository:

docker run -it -p 8080:8080 -v $(pwd):/var/opentosca/repository opentosca/winery

### Running Winery CLI via Docker

1. `docker build -t winery-cli -f Dockerfile.cli .`
2. `docker run -v $(pwd):/root/winery-repository -it winery-cli` to check `${pwd}` for consistency.

You can also use the pre-built image:

- Linux: `docker run -it -v $(pwd):/root/winery-repository opentosca/winery-cli`
- Windows: `docker run -it -v ${PWD}:/root/winery-repository opentosca/winery-cli`

In case you want to have verbose information, you can execute following:

- Linux: `docker run -it -v $(pwd):/root/winery-repository opentosca/winery-cli winery -v`
- Windows: `docker run -it -v ${PWD}:/root/winery-repository opentosca/winery-cli winery -v`

Currently supported CLI arguments:

```
usage: winery
-h,--help prints this help
-p,--path <arg> use given path as repository path
-v,--verbose be verbose: Output the checked elements
```

## Next steps

Winery currently is far from being a production ready modeling tool.
The next steps are:

Expand Down
2 changes: 2 additions & 0 deletions docker/winery
@@ -0,0 +1,2 @@
#!/bin/bash
java -jar /usr/local/bin/winery.jar "$@"
Expand Up @@ -30,7 +30,7 @@
(ioBtnClicked)="onEditPlanIOParameters($event);">
<div class="button-group pull-right">
<button type="button" class="btn btn-primary"
(click)="onGeneratePlans($event)">
(click)="onGeneratePlans()">
Generate Plans
</button>
</div>
Expand Down
@@ -0,0 +1,103 @@
/**
* SPDX-License-Identifier: MIT
*
* Taken from: https://github.com/dimpu/angular2-markdown/blob/1c36831d2c9f48ddd7183db33e886ed9ab0a3345/demo/src/app/home/home.component.ts#L11
*/

#textbox {
width: 100%;
height: 100vh;
}

table.table2 {
font-size: 14px;
color: #212121;
margin: 0 auto;
border-collapse: collapse;
}

table.table2 thead th {
font-size: 20px;
color: #212121;
height: 40px;
border: 1px solid #e6e6e6;
border-top: 0;
border-right: 0;
border-left: 0;
}

table.table2 tbody tr:nth-child(odd) {
background-color: #f6f6f6;
}

table.table2 td {
height: 40px;
width: 230px;
border-bottom: 1px solid #e6e6e6;
border-right: 1px solid #e6e6e6;
}

table.table2 td:last-of-type {
border-right: 0;
}

/* From https://codepen.io/maxds/pen/DcveB */
blockquote.king-quote {
display: block;
background: #fff;
padding: 15px 20px 15px 45px;
margin: 0 0 20px;
position: relative;

/*Font*/
font-family: Georgia, serif;
font-size: 16px;
line-height: 1.2;
color: #666;
text-align: justify;

/*Borders - (Optional)*/
border-left: 15px solid #c76c0c;
border-right: 2px solid #c76c0c;

/*Box Shadow - (Optional)*/
-moz-box-shadow: 2px 2px 15px #ccc;
-webkit-box-shadow: 2px 2px 15px #ccc;
box-shadow: 2px 2px 15px #ccc;
}

blockquote.king-quote::before {
content: "\201C"; /*Unicode for Left Double Quote*/

/*Font*/
font-family: Georgia, serif;
font-size: 60px;
font-weight: bold;
color: #999;

/*Positioning*/
position: absolute;
left: 10px;
top: 5px;
}

blockquote.king-quote::after {
/*Reset to make sure*/
content: "";
}

blockquote.king-quote a {
text-decoration: none;
background: #eee;
cursor: pointer;
padding: 0 3px;
color: #c76c0c;
}

blockquote.king-quote a:hover {
color: #666;
}

blockquote.king-quote em {
font-style: italic;
}
@@ -0,0 +1,12 @@
<!--
/**
* Copyright (c) 2017 University of Stuttgart.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* and the Apache License 2.0 which both accompany this distribution,
* and are available at http://www.eclipse.org/legal/epl-v20.html
* and http://www.apache.org/licenses/LICENSE-2.0
*/
-->

<markdown [data]='markdownContent'></markdown>
@@ -0,0 +1,57 @@
/**
* Copyright (c) 2017 University of Stuttgart.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* and the Apache License 2.0 which both accompany this distribution,
* and are available at http://www.eclipse.org/legal/epl-v20.html
* and http://www.apache.org/licenses/LICENSE-2.0
*/

import { Component, Input, OnInit, ViewEncapsulation } from '@angular/core';
import { MarkdownService } from 'angular2-markdown';

@Component({
selector: 'winery-markdown',
encapsulation: ViewEncapsulation.None,
templateUrl: './wineryMarkdown.component.html',
providers: [],
styleUrls: ['wineryMarkdown.component.css'],

})
export class WineryMarkdownComponent implements OnInit {

@Input() markdownContent = '';

constructor(private _markdown: MarkdownService) {
}

ngOnInit() {
this._markdown.setMarkedOptions({});
this._markdown.setMarkedOptions({
gfm: true,
tables: true,
breaks: false,
pedantic: false,
sanitize: false,
smartLists: true,
smartypants: false
});

this._markdown.renderer.table = (header: string, body: string) => {
return `
<table class="table2">
<thead>
${header}
</thead>
<tbody>
${body}
</tbody>
</table>
`;
};
this._markdown.renderer.blockquote = (quote: string) => {
return `<blockquote class="king-quote">${quote}</blockquote>`;
};
}

}
@@ -0,0 +1,28 @@
/**
* Copyright (c) 2017 University of Stuttgart.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* and the Apache License 2.0 which both accompany this distribution,
* and are available at http://www.eclipse.org/legal/epl-v20.html
* and http://www.apache.org/licenses/LICENSE-2.0
*/
import { NgModule } from '@angular/core';

import { FormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser';
import { WineryMarkdownComponent } from './wineryMarkdown.component';
import { MarkdownModule } from 'angular2-markdown';

@NgModule({
imports: [
FormsModule,
BrowserModule,
MarkdownModule.forRoot(),

],
exports: [WineryMarkdownComponent],
declarations: [WineryMarkdownComponent],
providers: [],
})
export class WineryMarkdownModule {
}
Expand Up @@ -25,3 +25,7 @@
background-image: linear-gradient(#79d858, #569e3d);
border-color: #569e3d;
}

.pad-6px {
padding: 6px;
}
Expand Up @@ -23,22 +23,65 @@
</div>

<div *ngIf="!isEditable && readmeAvailable">
<div class="right" style="width: 100%; margin-bottom: 2px;">
<button class="btn fa fa-pencil" aria-hidden="true" name="edit" style="float: right;"
<div class="right">
<button class="btn fa fa-pencil" aria-hidden="true" name="edit"
[disabled]="!sharedData?.currentVersion?.editable"
(click)="isEditable = true;"></button>
</div>
<textarea readonly tabIndex="-1" style="width: 95%;height: 500px; resize: none;">{{readmeContent}}</textarea>
<winery-markdown [markdownContent]="readmeContent"></winery-markdown>

</div>

<div *ngIf="isEditable">
<div class="right" style="margin-bottom: 2px;">
<div class="right">
<button class="btn fa fa-floppy-o" aria-hidden="true" name="save" (click)="saveReadmeFile()"> Save</button>
<button class="btn fa fa-ban" name="cancel" aria-hidden="true" (click)="cancelEdit()"> Cancel</button>
</div>

<textarea style="width: 95%; height: 500px; resize: none; font-family: monospace"
[(ngModel)]="readmeContent"></textarea>
<div>
<tabset #markdownTabs>
<tab heading="Edit File" active="true">
<div>
<form>
<textarea name="readmeEdit" id="textbox" class="form-control pad-6px"
style="min-height: -webkit-fill-available; font-family: monospace"
[(ngModel)]="readmeContent"></textarea>
</form>
</div>
</tab>

<tab heading="Preview Changes">
<div class="panel-body">
<winery-markdown [markdownContent]="readmeContent"></winery-markdown>
</div>
</tab>

<tab heading="Both">
<div class="container-fluid">
<div class="row">
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6" style="padding-left: 0px">
<div class="panel panel-default">
<textarea name="readmeEditBoth" id="textbox_b" class="form-control pad-6px"
style="min-height: -webkit-fill-available; font-family: monospace"
[(ngModel)]="readmeContent"></textarea>
</div>

</div>
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6" style="padding-left: 0px">
<div class="panel panel-default">
<div class="panel-body pad-6px" style="min-height: -webkit-fill-available;
max-height: -webkit-fill-available; overflow-y: scroll;">
<winery-markdown [markdownContent]="readmeContent"></winery-markdown>
</div>
</div>
</div>
</div>
</div>
</tab>
</tabset>
</div>

<textarea style="width: 95%; height: 500px; resize: none; font-family: monospace" [(ngModel)]="readmeContent"></textarea>
</div>


Expand Down
Expand Up @@ -18,12 +18,14 @@ import {FormsModule} from '@angular/forms';
import {WineryLoaderModule} from '../wineryLoader/wineryLoader.module';
import {TabsModule} from 'ngx-bootstrap';
import {WineryPipesModule} from '../wineryPipes/wineryPipes.module';
import {WineryMarkdownModule} from '../wineryMarkdownComponent/wineryMarkdown.module';

@NgModule({
imports: [
CommonModule,
WineryLoaderModule,
FormsModule,
WineryMarkdownModule,
TabsModule,
WineryPipesModule
],
Expand Down

0 comments on commit 4540850

Please sign in to comment.