New Credentials dialog

Fixes #279
This commit is contained in:
Joseph Schorr 2016-04-29 19:37:35 -04:00
parent 972e4be811
commit 08d7b4babe
23 changed files with 1290 additions and 630 deletions

View file

@ -1 +0,0 @@
<div class="co-tab-content tab-content col-md-11" ng-transclude></div>

View file

@ -0,0 +1,168 @@
<div class="credentials-dialog-element">
<div class="modal fade co-dialog wider">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body" ng-show="credentials.loading">
<div class="cor-loader"></div>
</div>
<div class="co-tab-modal-body" ng-show="!credentials.loading">
<div class="co-tab-panel">
<!-- Tabs -->
<div class="cor-tabs" remember-cookie="quay.credentialsTab">
<span class="cor-tab" tab-active="true" tab-target="#cred-secret-{{ dialogID }}">
<i class="fa" ng-class="entityIcon"></i> {{ secretTitle }}
</span>
<span class="cor-tab" tab-target="#cred-kubernetes-{{ dialogID }}">
<i class="fa kubernetes-icon icon"></i> Kubernetes Secret
</span>
<span class="cor-tab" tab-target="#cred-rkt-{{ dialogID }}">
<i class="fa rocket-icon icon"></i> rkt Configuration
</span>
<span class="cor-tab" tab-target="#cred-docker-login-{{ dialogID }}">
<i class="fa docker-icon icon"></i> Docker Login
</span>
<span class="cor-tab" tab-target="#cred-docker-{{ dialogID }}">
<i class="fa docker-icon icon"></i> Docker Configuration
</span>
<span class="cor-tab" tab-target="#cred-mesos-{{ dialogID }}" quay-show="isDownloadSupported()">
<i class="fa mesos-icon icon"></i> Mesos Credentials
</span>
</div>
<!-- Tab contents -->
<div class="cor-tab-content">
<h3>
Credentials for {{ credentials.username }}
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
</h3>
<div id="cred-secret-{{ dialogID }}" class="tab-pane active">
<label>{{ secretTitle }}:</label>
<div class="copy-box" value="credentials.password"></div>
<div class="help-text">
Username is {{ credentials.username }} and password is the {{ secretTitle }}
</div>
<div ng-transclude/>
</div>
<div id="cred-kubernetes-{{ dialogID }}" class="tab-pane">
<label>Step 1: Download secret</label>
<div class="action-text">First, download the Kubernetes pull secret for the {{ entityTitle }}:</div>
<ul class="action-bar">
<li><a ng-click="downloadFile(getKubernetesFile(credentials))" ng-if="isDownloadSupported()"><i class="fa fa-download"></i> Download {{ getKubernetesFilename(credentials) }}</li></a>
<li><a ng-click="viewFile(k8s)"><i class="fa fa-code"></i> View {{ getKubernetesFilename(credentials) }}</li></a>
</ul>
<textarea class="form-control viewing-file" ng-if="k8s.viewingFile" readonly>{{ getKubernetesFile(credentials).contents }}</textarea>
<label>Step 2: Submit</label>
<div class="action-text">Second, submit the secret to the cluster using this command:</div>
<div class="copy-box" value="'kubectl create -f ' + getKubernetesFilename(credentials) + ' --namespace=NAMESPACEHERE'"></div>
<label>Step 3: Update Kubernetes configuration</label>
<div class="action-text">
Finally, <a href="http://kubernetes.io/docs/user-guide/images/#specifying-imagepullsecrets-on-a-pod" ng-safenewtab>add a reference to the secret to your Kuberenetes pod config</a> via an <code>imagePullSecrets</code> field. For example:
<pre>
apiVersion: v1
kind: Pod
metadata:
name: somepod
namespace: all
spec:
containers:
- name: web
image: {{ Config.SERVER_HOSTNAME }}/{{ getNamespace(credentials) }}/somerepo
<code style="font-weight: bold;">
imagePullSecrets:
- name: {{ getKubernetesSecretName(credentials) }}</code></pre>
</div>
</div>
<div id="cred-mesos-{{ dialogID }}" class="tab-pane">
<label>Step 1: Download credentials bundle</label>
<div class="action-text">First, download the Docker credentials file as a bundle:</div>
<ul class="action-bar">
<li><a ng-click="downloadFile(getMesosFile(credentials))" ng-if="isDownloadSupported()"><i class="fa fa-download"></i> Download {{ getMesosFilename(credentials) }}</li></a>
</ul>
<label>Step 2: Copy credentials bundle</label>
<div class="action-text">
Second, copy the credentials bundle file <strong>{{ getMesosFilename(credentials) }}</strong>
into a location accessible to Mesos:
</div>
<div class="copy-box" value="'cp ' + getMesosFilename(credentials) + ' /etc/'"></div>
<label>Step 3: Update Mesos configuration</label>
<div class="action-text">
Finally, <a href="https://mesosphere.github.io/marathon/docs/native-docker-private-registry.html" ng-safenewtab>add a reference to the bundle to your Mesos config</a> via a <code>uris</code> field. For example:
<pre>
{
"id": "/some/name/or/id",
"cpus": 1,
"mem": 1024,
"instances": 1,
"container": {
"type": "DOCKER",
"docker": {
"image": "{{ Config.SERVER_HOSTNAME }}/{{ getNamespace(credentials) }}/somerepo",
"network": "HOST"
}
},
<code style="font-weight: bold;">
"uris": [
"file:///etc/{{ getMesosFilename(credentials) }}"
]</code>
}</pre>
</div>
</div>
<div id="cred-rkt-{{ dialogID }}" class="tab-pane">
<label>Step 1: Download credentials config</label>
<div class="action-text">First, download the rkt credentials file for the {{ entityTitle }}:</div>
<ul class="action-bar">
<li><a ng-click="downloadFile(getRktFile(credentials))" ng-if="isDownloadSupported()"><i class="fa fa-download"></i> Download {{ getRktFilename(credentials) }}</li></a>
<li><a ng-click="viewFile(rkt)"><i class="fa fa-code"></i> View {{ getRktFilename(credentials) }}</li></a>
</ul>
<textarea class="form-control viewing-file" ng-if="rkt.viewingFile" readonly>{{ getRktFile(credentials).contents }}</textarea>
<label>Step 2: Write to disk</label>
<div class="action-text">Second, place the file in the rkt configuration directory:</div>
<div class="copy-box" value="'mv ' + getRktFilename(credentials) + ' /etc/rkt/auth.d/'"></div>
</div>
<div id="cred-docker-login-{{ dialogID }}" class="tab-pane">
<label>Run docker login</label>
<div class="action-text">Enter the following command on the command line:</div>
<div class="copy-box" value="getDockerLogin(credentials)"></div>
</div>
<div id="cred-docker-{{ dialogID }}" class="tab-pane">
<label>Step 1: Download credentials config</label>
<div class="action-text">First, download the Docker credentials file for the {{ entityTitle }}:</div>
<ul class="action-bar">
<li><a ng-click="downloadFile(getDockerFile(credentials))" ng-if="isDownloadSupported()"><i class="fa fa-download"></i> Download {{ getDockerFilename(credentials) }}</li></a>
<li><a ng-click="viewFile(docker)"><i class="fa fa-code"></i> View {{ getDockerFilename(credentials) }}</li></a>
</ul>
<textarea class="form-control viewing-file" ng-if="docker.viewingFile" readonly>{{ getDockerFile(credentials).contents }}</textarea>
<label>Step 2: Write to disk</label>
<div class="action-text">Second, place the file in the Docker configuration directory. <strong>Note:</strong> This will <strong>overwrite</strong> existing credentials:</div>
<div class="copy-box" value="'mv ' + getDockerFilename(credentials) + ' ~/.docker/config.json'"></div>
</div>
</div>
</div>
</div><!-- /.co-tab-modal-body -->
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</div>

View file

@ -1,47 +0,0 @@
<!-- Modal message dialog -->
<div class="modal fade" id="dockerauthmodal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">
<span ng-transclude></span>
</h4>
</div>
<div class="modal-body token-dialog-body">
<div class="alert alert-info">The docker <u>username</u> is <b>{{ username }}</b> and the <u>password</u> is the token below. You may use any value for email.</div>
<div class="well well-sm" ng-show="regenerating">
Regenerating Token...
<i class="fa fa-refresh fa-spin"></i>
</div>
<div class="well well-sm" ng-show="!regenerating">
<input id="token-view" class="token-view" type="text" value="{{ token }}" onClick="this.select();" readonly>
<i class="fa fa-refresh" ng-show="supportsRegenerate" ng-click="askRegenerate()"
data-title="Regenerate Token"
data-placement="left"
bs-tooltip></i>
</div>
</div>
<div class="modal-footer" ng-show="regenerating">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
<div class="modal-footer" ng-show="!regenerating">
<span class="download-cfg" ng-show="isDownloadSupported()">
<i class="fa fa-download"></i>
<a ng-click="downloadCfg(shownRobot)">Download .dockercfg file</a>
</span>
<span class="download-cfg not-supported" ng-show="!isDownloadSupported()">
.dockercfg download not supported in this browser
</span>
<div class="clipboard-copied-message" style="display: none">
Copied
</div>
<input type="hidden" name="command-data" id="command-data" value="{{ command }}">
<button id="copyClipboard" type="button" class="btn btn-primary" data-clipboard-target="command-data">Copy Login Command</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->

View file

@ -30,8 +30,11 @@
<!-- Robot -->
<span ng-if="entity.is_robot">
<i class="fa ci-robot fa-lg"></i>
<span class="entity-name anchor" href="{{ getRobotUrl(entity.name) }}"
is-only-text="!getIsAdmin(getPrefix(entity.name))">
<a class="entity-name" ng-if="getIsAdmin(getPrefix(entity.name))" ng-click="showRobotCredentials()">
<span class="prefix">{{ getPrefix(entity.name) }}+</span>
<span>{{ getShortenedName(entity.name) }}</span>
</a>
<span class="entity-name" ng-if="!getIsAdmin(getPrefix(entity.name))">
<span class="prefix">{{ getPrefix(entity.name) }}+</span>
<span>{{ getShortenedName(entity.name) }}</span>
</span>
@ -39,4 +42,6 @@
</span>
</span>
</span>
<div class="robot-credentials-dialog" info="robotToShow" ng-if="robotToShow"></div>
</span>

View file

@ -0,0 +1,11 @@
<div class="robot-credentials-dialog-element">
<div class="credentials-dialog" credentials="credentials" secret-title="Robot Token" entity-title="robot account" entity-icon="ci-robot">
<label>Regenerate Token:</label>
<div class="action-text">Click the below to regenerate the token for this robot. Note that <strong>all existing logins</strong> of this robot account will become invalid.</div>
<a ng-click="askRegenerateToken()" class="co-modify-link" ng-show="!showRegenerateToken">Regenerate Token</a>
<button class="btn btn-warning" ng-click="regenerateToken()" ng-show="showRegenerateToken">Regenerate Token Now</button>
<div ng-show="tokenRegenerated" class="token-regenerated">
<i class="fa fa-check-circle"></i>Token successfully regenerated
</div>
</div>
</div>

View file

@ -134,8 +134,5 @@
</table>
</div>
<div class="docker-auth-dialog" username="shownRobot.name" token="shownRobot.token"
shown="!!shownRobot" counter="showRobotCounter" supports-regenerate="true" regenerate="regenerateToken(username)">
<i class="fa ci-robot"></i> {{ shownRobot.name }}
</div>
<div class="robot-credentials-dialog" info="robotDisplayInfo"></div>
</div>