-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
17 changed files
with
205 additions
and
9 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
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,14 @@ | ||
#!/bin/bash | ||
echo "HTTP/1.0 200 OK" | ||
echo "Content-type: text/plain" | ||
echo "" | ||
|
||
PULL_IMAGES=( | ||
treehouses/planet:db-init | ||
treehouses/planet:latest | ||
treehouses/couchdb:2.1.1 | ||
) | ||
|
||
for image in "${PULL_IMAGES[@]}" ; do | ||
curl --unix-socket /var/run/docker.sock -X POST "http://localhost/images/create?fromImage=$image" | ||
done |
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,45 @@ | ||
|
||
<div class="space-container"> | ||
<div class="upgrade_buttons"> | ||
<button mat-stroked-button color="primary" (click)="start()" [disabled]="!enabled || done">{{ message }}</button> | ||
</div> | ||
<div style="height: 5px; padding: 5px;" *ngIf="!done"> | ||
<mat-progress-bar mode="indeterminate" *ngIf="working"></mat-progress-bar> | ||
</div> | ||
|
||
<pre class="upgrade_output" [innerHTML]="output"></pre> | ||
|
||
<mat-card class="upgrade_mat-card" *ngIf="done && !error"> | ||
<mat-card-header> | ||
<div mat-card-avatar class="upgrade_mat-card-icon"></div> | ||
<mat-card-title>Success!</mat-card-title> | ||
<mat-card-subtitle>Reboot is required</mat-card-subtitle> | ||
</mat-card-header> | ||
<mat-card-content> | ||
<p> | ||
The upgrade of the system has been done successfully.<br> | ||
Please reboot your Raspberry Pi to apply changes | ||
</p> | ||
</mat-card-content> | ||
<mat-card-actions> | ||
<button mat-raised-button color="primary" routerLink="/">OK</button> | ||
</mat-card-actions> | ||
</mat-card> | ||
|
||
<mat-card class="upgrade_mat-card" *ngIf="error && done"> | ||
<mat-card-header> | ||
<div mat-card-avatar class="upgrade_mat-card-icon"></div> | ||
<mat-card-title>Error :(</mat-card-title> | ||
<mat-card-subtitle>Please let us know</mat-card-subtitle> | ||
</mat-card-header> | ||
<mat-card-content> | ||
<p> | ||
There has been an error when trying to upgrade the system | ||
</p> | ||
</mat-card-content> | ||
<mat-card-actions> | ||
<button mat-raised-button color="primary" planetFeedback [message]="cleanOutput" [type]="'Bug'" [priority]="'Yes'"><mat-icon>feedback</mat-icon> Send feedback</button> | ||
</mat-card-actions> | ||
</mat-card> | ||
|
||
</div> |
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,72 @@ | ||
import { Component, ViewEncapsulation } from '@angular/core'; | ||
import { HttpClient } from '@angular/common/http'; | ||
import { environment } from '../../environments/environment'; | ||
|
||
@Component({ | ||
templateUrl: './upgrade.component.html', | ||
styleUrls: [ './upgrade.scss' ], | ||
encapsulation: ViewEncapsulation.None | ||
}) | ||
export class UpgradeComponent { | ||
enabled: Boolean = true; | ||
message = 'Start upgrade'; | ||
output = ''; | ||
working: Boolean = false; | ||
done: Boolean = false; | ||
error: Boolean = false; | ||
cleanOutput = ''; | ||
|
||
constructor(private http: HttpClient) { | ||
this.addLine('Not started'); | ||
} | ||
|
||
start() { | ||
this.enabled = false; | ||
this.message = 'Upgrading'; | ||
this.working = true; | ||
this.addLine('Server request started'); | ||
this.upgrade(); | ||
} | ||
|
||
upgrade() { | ||
this.http.get(environment.upgradeAddress, { responseType: 'text' }).subscribe(result => { | ||
result.split('\n').forEach(line => { | ||
this.addLine(line, false, true); | ||
}); | ||
this.message = 'Success'; | ||
this.error = false; | ||
this.done = true; | ||
}, err => { | ||
this.addLine('An error ocurred:', true); | ||
JSON.stringify(err, null, 1).split('\n').forEach(line => { | ||
this.addLine(line, true); | ||
}); | ||
this.working = false; | ||
this.message = 'Start upgrade'; | ||
this.error = true; | ||
this.done = true; | ||
}); | ||
} | ||
|
||
getDateTime () { | ||
const date = new Date(); | ||
const d = ('0' + date.getDate()).slice(-2); | ||
const M = ('0' + date.getMonth()).slice(-2); | ||
const Y = date.getFullYear(); | ||
const h = ('0' + date.getHours()).slice(-2); | ||
const m = ('0' + date.getMinutes()).slice(-2); | ||
const s = ('0' + date.getSeconds()).slice(-2); | ||
return `[${d}/${M}/${Y} ${h}:${m}:${s}]`; | ||
} | ||
|
||
addLine(string, error?, success?) { | ||
if (!string.length) { return; } | ||
string = string.trim(); | ||
const dTime = this.getDateTime(); | ||
let start = '<span>'; | ||
if (error) { start = '<span class=\'upgrade_error\'>'; } | ||
if (success) { start = '<span class=\'upgrade_success\'>'; } | ||
this.output += `${start}${dTime} ${string}</span>\n`; | ||
this.cleanOutput += `${dTime} ${string}\n`; | ||
} | ||
} |
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,29 @@ | ||
.upgrade_error { | ||
color: #C70039; | ||
} | ||
|
||
.upgrade_success { | ||
color: #8DC75F; | ||
} | ||
|
||
.upgrade_buttons button { | ||
margin: 0px 0px 0px 2px; | ||
} | ||
|
||
.upgrade_mat-card { | ||
max-width: 400px; | ||
} | ||
|
||
.upgrade_mat-card-icon { | ||
background-image: url('/assets/OLE_Logo1.png'); | ||
background-size: cover; | ||
} | ||
|
||
.upgrade_output { | ||
border: 1px solid #D5D5D5; | ||
padding-top: 2px; | ||
padding-bottom: 2px; | ||
max-height: 300px; | ||
min-height: 300px; | ||
overflow: auto; | ||
} |
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