forked from portainer/portainer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(global): add templates support ('apps') (portainer#154)
- Loading branch information
1 parent
faccf2a
commit 1c8aa35
Showing
15 changed files
with
366 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
FROM scratch | ||
FROM centurylink/ca-certs | ||
|
||
COPY dist / | ||
|
||
VOLUME /data | ||
|
||
EXPOSE 9000 | ||
|
||
ENTRYPOINT ["/ui-for-docker"] |
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,27 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"io/ioutil" | ||
"log" | ||
"net/http" | ||
) | ||
|
||
// templatesHandler defines a handler function used to retrieve the templates from a URL and put them in the response | ||
func templatesHandler(w http.ResponseWriter, r *http.Request, templatesURL string) { | ||
resp, err := http.Get(templatesURL) | ||
if err != nil { | ||
http.Error(w, fmt.Sprintf("Error making request to %s: %s", templatesURL, err.Error()), http.StatusInternalServerError) | ||
log.Print(err) | ||
return | ||
} | ||
defer resp.Body.Close() | ||
body, err := ioutil.ReadAll(resp.Body) | ||
if err != nil { | ||
http.Error(w, "Error reading body from templates URL", http.StatusInternalServerError) | ||
log.Print(err) | ||
return | ||
} | ||
w.Header().Set("Content-Type", "application/json") | ||
w.Write(body) | ||
} |
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,76 @@ | ||
<rd-header> | ||
<rd-header-title title="Apps list"> | ||
<a data-toggle="tooltip" title="Refresh" ui-sref="templates" ui-sref-opts="{reload: true}"> | ||
<i class="fa fa-refresh" aria-hidden="true"></i> | ||
</a> | ||
</rd-header-title> | ||
<rd-header-content>Apps</rd-header-content> | ||
</rd-header> | ||
|
||
<div class="row"> | ||
<div class="col-lg-12 col-md-12 col-xs-12"> | ||
<rd-widget> | ||
<rd-widget-header icon="fa-rocket" title="Available apps"> | ||
<div class="pull-right"> | ||
<i id="loadTemplatesSpinner" class="fa fa-cog fa-2x fa-spin" style="margin-top: 5px;"></i> | ||
</div> | ||
</rd-widget-header> | ||
<rd-widget-body classes="padding"> | ||
<div class="template-list"> | ||
<div ng-repeat="tpl in templates" class="container-template hvr-grow" id="template_{{ $index }}" ng-click="selectTemplate($index)"> | ||
<img class="logo" ng-src="{{ tpl.logo }}" /> | ||
<div class="title">{{ tpl.title }}</div> | ||
<div class="comment">{{ tpl.comment }}</div> | ||
</div> | ||
</div> | ||
</rd-widget-body> | ||
</rd-widget> | ||
</div> | ||
</div> | ||
|
||
<div class="row" ng-if="selectedTemplate"> | ||
<div class="col-lg-12 col-md-12 col-xs-12"> | ||
<rd-widget> | ||
<rd-widget-header icon="fa-cogs" title="Configuration"></rd-widget-header> | ||
<rd-widget-body classes="padding"> | ||
<form class="form-horizontal"> | ||
<div class="form-group" ng-if="globalNetworkCount === 0"> | ||
<div class="col-sm-12"> | ||
<span class="small text-muted">When using Swarm, we recommend deploying containers in a shared network. Looks like you don't have any shared network, head over the <a ui-sref="networks">networks view</a> to create one.</span> | ||
</div> | ||
</div> | ||
<!-- name-and-network-inputs --> | ||
<div class="form-group"> | ||
<label for="image_registry" class="col-sm-2 control-label text-left">Name</label> | ||
<div class="col-sm-4"> | ||
<input type="text" class="form-control" ng-model="formValues.name" placeholder="e.g. web (optional)"> | ||
</div> | ||
<label for="container_network" class="col-sm-2 control-label text-right">Network</label> | ||
<div class="col-sm-4"> | ||
<select class="selectpicker form-control" ng-model="formValues.network"> | ||
<option selected disabled hidden value="">Select a network</option> | ||
<option ng-repeat="net in availableNetworks" ng-value="net.Name">{{ net.Name }}</option> | ||
</select> | ||
</div> | ||
</div> | ||
<!-- !name-and-network-inputs --> | ||
<div ng-repeat="var in selectedTemplate.env" class="form-group"> | ||
<label for="field_{{ $index }}" class="col-sm-2 control-label text-left">{{ var.label }}</label> | ||
<div class="col-sm-10"> | ||
<input type="text" class="form-control" ng-model="var.value" id="field_{{ $index }}"> | ||
</div> | ||
</div> | ||
</form> | ||
</rd-widget-body> | ||
</rd-widget> | ||
</div> | ||
</div> | ||
|
||
<div class="row" ng-if="selectedTemplate"> | ||
<div class="col-lg-12 col-md-12 col-xs-12" style="text-align: center;"> | ||
<div> | ||
<i id="createContainerSpinner" class="fa fa-cog fa-3x fa-spin" style="margin-bottom: 5px; display: none;"></i> | ||
</div> | ||
<button type="button" class="btn btn-default btn-lg" ng-disabled="!formValues.network" ng-click="createTemplate()">Create</button> | ||
</div> | ||
</div> |
Oops, something went wrong.