removed old templates

This commit is contained in:
alecmerdler 2017-02-22 17:22:34 -08:00 committed by Joseph Schorr
parent ea9d47ba75
commit 8fcd76c0be
8 changed files with 87 additions and 246 deletions

View file

@ -1,6 +0,0 @@
<div class="linear-workflow-section-element" ng-show="sectionVisible"
ng-class="isCurrentSection ? 'current-section' : ''">
<form ng-submit="submitSection()">
<div ng-transclude />
</form>
</div>

View file

@ -1,31 +0,0 @@
<div class="linear-workflow-element">
<!-- Contents -->
<div ng-transclude/>
<div class="bottom-controls">
<table class="upcoming-table">
<tr>
<td>
<!-- Next button -->
<button class="btn btn-primary" ng-disabled="!currentSection.valid"
ng-click="nextSection()"
ng-class="{'btn-success': currentSection.index == sections.length - 1, 'btn-lg': currentSection.index == sections.length - 1}">
<span ng-if="currentSection.index != sections.length - 1">Continue</span>
<span ng-if="currentSection.index == sections.length - 1"><i class="fa fa-check-circle"></i>{{ doneTitle }}</span>
</button>
</td>
<td>
<!-- Next sections -->
<div class="upcoming" ng-if="currentSection.index != sections.length - 1">
<b>Next:</b>
<ul>
<li ng-repeat="section in sections" ng-if="section.index > currentSection.index">
{{ section.title }}
</li>
</ul>
</div>
</td>
</tr>
</table>
</div>
</div>

View file

@ -1,141 +0,0 @@
/**
* An element which displays a linear workflow of sections, each completed in order before the next
* step is made visible.
*/
angular.module('quay').directive('linearWorkflow', function () {
var directiveDefinitionObject = {
priority: 0,
templateUrl: '/static/directives/linear-workflow.html',
replace: false,
transclude: true,
restrict: 'C',
scope: {
'workflowState': '=?workflowState',
'workflowComplete': '&workflowComplete',
'doneTitle': '@doneTitle'
},
controller: function($scope, $element, $timeout) {
$scope.sections = [];
$scope.nextSection = function() {
if (!$scope.currentSection.valid) { return; }
var currentIndex = $scope.currentSection.index;
if (currentIndex + 1 >= $scope.sections.length) {
$scope.workflowComplete();
return;
}
$scope.workflowState = $scope.sections[currentIndex + 1].id;
};
this.registerSection = function(sectionScope, sectionElement) {
// Add the section to the list.
var sectionInfo = {
'index': $scope.sections.length,
'id': sectionScope.sectionId,
'title': sectionScope.sectionTitle,
'scope': sectionScope,
'element': sectionElement
};
$scope.sections.push(sectionInfo);
// Add a watch on the `sectionValid` value on the section itself. If/when this value
// changes, we copy it over to the sectionInfo, so that the overall workflow can watch
// the change.
sectionScope.$watch('sectionValid', function(isValid) {
sectionInfo['valid'] = isValid;
if (!isValid) {
// Reset the sections back to this section.
updateState();
}
});
// Bind the `submitSection` callback to move to the next section when the user hits
// enter (which calls this method on the scope via an ng-submit set on a wrapping
// <form> tag).
sectionScope.submitSection = function() {
$scope.nextSection();
};
// Update the state of the workflow to account for the new section.
updateState();
};
var updateState = function() {
// Find the furthest state we can show.
var foundIndex = 0;
var maxValidIndex = -1;
$scope.sections.forEach(function(section, index) {
if (section.id == $scope.workflowState) {
foundIndex = index;
}
if (maxValidIndex == index - 1 && section.valid) {
maxValidIndex = index;
}
});
var minSectionIndex = Math.min(maxValidIndex + 1, foundIndex);
$scope.sections.forEach(function(section, index) {
section.scope.sectionVisible = index <= minSectionIndex;
section.scope.isCurrentSection = false;
});
$scope.workflowState = null;
if (minSectionIndex >= 0 && minSectionIndex < $scope.sections.length) {
$scope.currentSection = $scope.sections[minSectionIndex];
$scope.workflowState = $scope.currentSection.id;
$scope.currentSection.scope.isCurrentSection = true;
// Focus to the first input (if any) in the section.
$timeout(function() {
var inputs = $scope.currentSection.element.find('input');
if (inputs.length == 1) {
inputs.focus();
}
}, 10);
}
};
$scope.$watch('workflowState', updateState);
}
};
return directiveDefinitionObject;
});
/**
* An element which displays a single section in a linear workflow.
*/
angular.module('quay').directive('linearWorkflowSection', function () {
var directiveDefinitionObject = {
priority: 0,
templateUrl: '/static/directives/linear-workflow-section.html',
replace: false,
transclude: true,
restrict: 'C',
require: '^linearWorkflow',
scope: {
'sectionId': '@sectionId',
'sectionTitle': '@sectionTitle',
'sectionValid': '=?sectionValid',
},
link: function($scope, $element, $attrs, $ctrl) {
$ctrl.registerSection($scope, $element);
},
controller: function($scope, $element) {
$scope.$watch('sectionVisible', function(visible) {
if (visible) {
$element.show();
} else {
$element.hide();
}
});
}
};
return directiveDefinitionObject;
});

View file

@ -1,6 +1,5 @@
<div class="manage-trigger-custom-git-element manage-trigger-control">
<linear-workflow
workflow-state="$ctrl.currentState"
done-title="Create Trigger"
on-workflow-complete="$ctrl.activateTrigger({'config': $ctrl.config})">
<!-- Section: Repository -->

View file

@ -1,15 +1,15 @@
<div class="manage-trigger-githost-element manage-trigger-control">
<div class="linear-workflow"
workflow-state="$ctrl.currentState"
<linear-workflow
done-title="Create Trigger"
workflow-complete="$ctrl.createTrigger()">
on-workflow-complete="$ctrl.createTrigger()">
<!-- Section: Namespace -->
<div class="linear-workflow-section row"
<linear-workflow-section class="row"
section-id="namespace"
section-title="{{ 'Select ' + $ctrl.namespaceTitle }}"
section-valid="$ctrl.local.selectedNamespace">
<div class="col-lg-7 col-md-7 col-sm-12 main-col" ng-show="$ctrl.local.namespaces">
<div class="col-lg-7 col-md-7 col-sm-12 main-col"
ng-if="$ctrl.local.namespaces">
<h3>Select {{ $ctrl.namespaceTitle }}</h3>
<strong>Please select the {{ $ctrl.namespaceTitle }} under which the repository lives</strong>
@ -48,7 +48,9 @@
</td>
<td>
<img class="namespace-avatar" ng-src="{{ namespace.avatar_url }}">
<span class="anchor" href="{{ namespace.url }}" is-text-only="!namespace.url">{{ namespace.id }}</span>
<span class="anchor"
href="{{ namespace.url }}"
is-text-only="!namespace.url">{{ namespace.id }}</span>
</td>
<td class="importance-col hidden-xs">
<span class="strength-indicator" value="::namespace.score" maximum="::$ctrl.local.maxScore"
@ -56,17 +58,18 @@
</td>
</tr>
</table>
<div class="empty" ng-if="$ctrl.local.namespaces.length && !$ctrl.local.orderedNamespaces.entries.length"
<div class="empty"
ng-if="$ctrl.local.namespaces.length && !$ctrl.local.orderedNamespaces.entries.length"
style="margin-top: 20px;">
<div class="empty-primary-msg">No matching {{ $ctrl.namespaceTitle }} found.</div>
<div class="empty-secondary-msg">Try expanding your filtering terms.</div>
</div>
</div>
<div class="col-lg-8 col-md-8 col-sm-12 main-col" ng-show="!$ctrl.local.namespaces">
<div class="col-lg-8 col-md-8 col-sm-12 main-col" ng-if="!$ctrl.local.namespaces">
<span class="cor-loader-inline"></span> Retrieving {{ $ctrl.namespaceTitle }}s
</div>
<div class="col-lg-4 col-md-4 hidden-sm hidden-xs help-col" ng-show="$ctrl.local.namespaces">
<div class="col-lg-4 col-md-4 hidden-sm hidden-xs help-col" ng-if="$ctrl.local.namespaces">
<p>
<span class="registry-name"></span> has been granted access to read and view these {{ $ctrl.namespaceTitle }}s.
</p>
@ -74,15 +77,15 @@
Don't see an expected {{ $ctrl.namespaceTitle }} here? Please make sure third-party access is enabled for <span class="registry-name"></span> under that {{ $ctrl.namespaceTitle }}.
</p>
</div>
</div><!-- /Section: Namespace -->
</linear-workflow-section><!-- /Section: Namespace -->
<!-- Section: Repository -->
<div class="linear-workflow-section row"
<linear-workflow-section class="row"
section-id="repo"
section-title="Select Repository"
section-valid="$ctrl.local.selectedRepository">
<div class="col-lg-7 col-md-7 col-sm-12 main-col" ng-show="$ctrl.local.repositories">
<div class="col-lg-7 col-md-7 col-sm-12 main-col" ng-if="$ctrl.local.repositories">
<h3>Select Repository</h3>
<strong>
Select a repository in
@ -131,12 +134,16 @@
<i class="fa fa-exclamation-triangle"
data-title="Admin access is required to add the webhook trigger to this repository" bs-tooltip></i>
</span>
<input type="radio" ng-model="$ctrl.local.selectedRepository" ng-value="repository"
<input type="radio"
ng-model="$ctrl.local.selectedRepository"
ng-value="repository"
ng-if="repository.has_admin_permissions">
</td>
<td class="nowrap-col">
<i class="service-icon fa {{ $ctrl.getTriggerIcon() }}"></i>
<span class="anchor" href="{{ repository.url }}" is-text-only="!repository.url">{{ repository.name }}</span>
<span class="anchor"
href="{{ repository.url }}"
is-text-only="!repository.url">{{ repository.name }}</span>
</td>
<td class="last-updated-col nowrap-col">
<span am-time-ago="repository.last_updated_datetime"></span>
@ -147,17 +154,20 @@
</td>
</tr>
</table>
<div class="empty" ng-if="$ctrl.local.repositories.length && !$ctrl.local.orderedRepositories.entries.length"
<div class="empty"
ng-if="$ctrl.local.repositories.length && !$ctrl.local.orderedRepositories.entries.length"
style="margin-top: 20px;">
<div class="empty-primary-msg">No matching repositories found.</div>
<div class="empty-secondary-msg">Try expanding your filtering terms.</div>
</div>
</div>
<div class="col-lg-8 col-md-8 col-sm-12 main-col" ng-show="!$ctrl.local.repositories">
<div class="col-lg-8 col-md-8 col-sm-12 main-col"
ng-if="!$ctrl.local.repositories">
<span class="cor-loader-inline"></span> Retrieving repositories
</div>
<div class="col-lg-4 col-md-4 hidden-sm hidden-xs help-col" ng-show="$ctrl.local.repositories">
<div class="col-lg-4 col-md-4 hidden-sm hidden-xs help-col"
ng-if="$ctrl.local.repositories">
<p>
A webhook will be added to the selected repository in order to detect when new commits are made.
</p>
@ -166,14 +176,14 @@
</p>
</div>
</div><!-- /Section: Repository -->
</linear-workflow-section><!-- /Section: Repository -->
<!-- Section: Trigger Options -->
<div class="linear-workflow-section row"
<linear-workflow-section class="row"
section-id="triggeroptions"
section-title="Configure Trigger"
section-valid="$ctrl.local.triggerOptions">
<div class="col-lg-7 col-md-7 col-sm-12 main-col" ng-show="$ctrl.local.repositoryRefs">
<div class="col-lg-7 col-md-7 col-sm-12 main-col" ng-if="$ctrl.local.repositoryRefs">
<h3>Configure Trigger</h3>
<strong>
Configure trigger options for
@ -183,7 +193,9 @@
<div class="radio" style="margin-top: 20px;">
<label>
<input type="radio" name="optionRadio" ng-model="$ctrl.local.triggerOptions.hasBranchTagFilter" ng-value="false">
<input type="radio" name="optionRadio"
ng-model="$ctrl.local.triggerOptions.hasBranchTagFilter"
ng-value="false">
<div class="title">Trigger for all branches and tags <span class="weak">(default)</span></div>
<div class="description">Build a container image for each commit across all branches and tags</div>
</label>
@ -198,7 +210,9 @@
<tr>
<td style="white-space: nowrap;">Regular Expression:</td>
<td>
<input type="text" class="form-control" ng-model="$ctrl.local.triggerOptions.branchTagFilter" required>
<input type="text" class="form-control"
ng-model="$ctrl.local.triggerOptions.branchTagFilter"
required>
<div class="description">Examples: heads/master, tags/tagname, heads/.+</div>
<regex-match-view
items="$ctrl.local.repositoryFullRefs"
@ -212,7 +226,8 @@
</div>
</div>
<div class="col-lg-8 col-md-8 col-sm-12 main-col" ng-show="!$ctrl.local.repositoryRefs">
<div class="col-lg-8 col-md-8 col-sm-12 main-col"
ng-if="!$ctrl.local.repositoryRefs">
<span class="cor-loader-inline"></span> Retrieving repository refs
</div>
<div class="col-lg-4 col-md-4 hidden-sm hidden-xs help-col">
@ -220,20 +235,21 @@
<p>For example, if you use release branches instead of <code>master</code> for building versions of your software, you can configure the trigger to only build images for these branches.</p>
<p>All images built will be tagged with the name of the branch or tag whose change invoked the trigger</p>
</div>
</div><!-- /Section: Trigger Options -->
</linear-workflow-section><!-- /Section: Trigger Options -->
<!-- Section: Dockerfile Location -->
<div class="linear-workflow-section row"
<linear-workflow-section class="row"
section-id="dockerfilelocation"
section-title="Select Dockerfile"
section-valid="$ctrl.local.hasValidDockerfilePath">
<div class="col-lg-7 col-md-7 col-sm-12 main-col" ng-show="$ctrl.local.dockerfileLocations.status == 'error'">
<div class="col-lg-7 col-md-7 col-sm-12 main-col"
ng-if="$ctrl.local.dockerfileLocations.status == 'error'">
<div class="co-alert co-alert-warning">
{{ $ctrl.local.dockerfileLocations.message }}
</div>
</div>
<div class="col-lg-7 col-md-7 col-sm-12 main-col" ng-show="$ctrl.local.dockerfileLocations.status == 'success'">
<div class="col-lg-7 col-md-7 col-sm-12 main-col" ng-if="$ctrl.local.dockerfileLocations.status == 'success'">
<h3>Select Dockerfile</h3>
<strong>
Please select the location of the Dockerfile to build when this trigger is invoked
@ -246,22 +262,24 @@
is-valid-path="$ctrl.local.hasValidDockerfilePath"></dockerfile-path-select>
</div>
<div class="col-lg-8 col-md-8 col-sm-12 main-col" ng-show="!$ctrl.local.dockerfileLocations">
<div class="col-lg-8 col-md-8 col-sm-12 main-col"
ng-if="!$ctrl.local.dockerfileLocations">
<span class="cor-loader-inline"></span> Retrieving Dockerfile locations
</div>
<div class="col-lg-4 col-md-4 hidden-sm hidden-xs help-col">
<p>Please select the location containing the Dockerfile to be built.</p>
<p>The build context will start at the location selected.</p>
</div>
</div><!-- /Section: Dockerfile Location -->
</linear-workflow-section><!-- /Section: Dockerfile Location -->
<!-- Section: Verification and Robot Account -->
<div class="linear-workflow-section row"
<linear-workflow-section class="row"
section-id="verification"
section-title="Confirm"
section-valid="$ctrl.local.triggerAnalysis.status != 'error' && ($ctrl.local.triggerAnalysis.status != 'requiresrobot' || $ctrl.local.robotAccount != null)">
<!-- Error -->
<div class="col-lg-7 col-md-7 col-sm-12 main-col" ng-show="$ctrl.local.triggerAnalysis.status == 'error'">
<div class="col-lg-7 col-md-7 col-sm-12 main-col"
ng-if="$ctrl.local.triggerAnalysis.status == 'error'">
<h3 class="error"><i class="fa fa-exclamation-circle"></i> Verification Error</h3>
<strong>
There was an error when verifying the state of <img class="namespace-avatar" ng-src="{{ $ctrl.local.selectedNamespace.avatar_url }}">
@ -272,19 +290,19 @@
</div>
<!-- Warning -->
<div class="col-lg-7 col-md-7 col-sm-12 main-col" ng-show="$ctrl.local.triggerAnalysis.status == 'warning'">
<div class="col-lg-7 col-md-7 col-sm-12 main-col" ng-if="$ctrl.local.triggerAnalysis.status == 'warning'">
<h3 class="warning"><i class="fa fa-exclamation-triangle"></i> Verification Warning</h3>
{{ $ctrl.local.triggerAnalysis.message }}
</div>
<!-- Public base -->
<div class="col-lg-7 col-md-7 col-sm-12 main-col" ng-show="$ctrl.local.triggerAnalysis.status == 'publicbase'">
<div class="col-lg-7 col-md-7 col-sm-12 main-col" ng-if="$ctrl.local.triggerAnalysis.status == 'publicbase'">
<h3 class="success"><i class="fa fa-check-circle"></i> Ready to go!</h3>
<strong>Click "Create Trigger" to complete setup of this build trigger</strong>
</div>
<!-- Requires robot and is not admin -->
<div class="col-lg-7 col-md-7 col-sm-12 main-col" ng-show="$ctrl.local.triggerAnalysis.status == 'requiresrobot' && !$ctrl.local.triggerAnalysis.is_admin">
<div class="col-lg-7 col-md-7 col-sm-12 main-col" ng-if="$ctrl.local.triggerAnalysis.status == 'requiresrobot' && !$ctrl.local.triggerAnalysis.is_admin">
<h3>Robot Account Required</h3>
<p>The selected Dockerfile in the selected repository depends upon a private base image</p>
<p>A robot account with access to the base image is required to setup this trigger, but you are not the administrator of this namespace.</p>
@ -292,7 +310,7 @@
</div>
<!-- Requires robot and is admin -->
<div class="col-lg-7 col-md-7 col-sm-12 main-col" ng-show="$ctrl.local.triggerAnalysis.status == 'requiresrobot' && $ctrl.local.triggerAnalysis.is_admin">
<div class="col-lg-7 col-md-7 col-sm-12 main-col" ng-if="$ctrl.local.triggerAnalysis.status == 'requiresrobot' && $ctrl.local.triggerAnalysis.is_admin">
<h3>Select Robot Account</h3>
<strong>
The selected Dockerfile in the selected repository depends upon a private base image. Select a robot account with access:
@ -324,7 +342,9 @@
ng-class="$ctrl.local.robotAccount == robot ? 'checked' : ''"
bindonce>
<td>
<input type="radio" ng-model="$ctrl.local.robotAccount" ng-value="robot">
<input type="radio"
ng-model="$ctrl.local.robotAccount"
ng-value="robot">
</td>
<td>
<span class="entity-reference" entity="robot"></span>
@ -348,6 +368,7 @@
<p>In order for the <span class="registry-name"></span> to pull the base image during the build process, a robot account with access must be selected.</p>
<p>Robot accounts that already have access to this base image are listed first. If you select a robot account that does not currently have access, read permission will be granted to that robot account on trigger creation.</p>
</div>
</div><!-- /Section: Robot Account -->
</linear-workflow-section><!-- /Section: Robot Account -->
</linear-workflow>
</div>

View file

@ -27,15 +27,11 @@ describe("ManageTriggerGithostComponent", () => {
}));
describe("constructor", () => {
// TODO
});
describe("$onInit", () => {
});
describe("$onChanges", () => {
// TODO
});
describe("getTriggerIcon", () => {
@ -48,6 +44,6 @@ describe("ManageTriggerGithostComponent", () => {
});
describe("createTrigger", () => {
// TODO
});
});

View file

@ -11,6 +11,7 @@ import * as moment from 'moment';
})
export class ManageTriggerGithostComponent implements ng.IComponentController {
// FIXME: Use one-way data binding
@Input('=') public repository: any;
@Input('=') public trigger: Trigger;
@Output() public activateTrigger: (trigger: {config: any, pull_robot: any}) => void;
@ -101,10 +102,6 @@ export class ManageTriggerGithostComponent implements ng.IComponentController {
this.$scope.$watch(() => this.local.robotOptions.filter, this.buildOrderedRobotAccounts);
}
public $onChanges(changes: ng.IOnChangesObject): void {
}
public getTriggerIcon(): any {
return this.TriggerService.getIcon(this.trigger.service);
}
@ -323,6 +320,9 @@ export class ManageTriggerGithostComponent implements ng.IComponentController {
}
/**
* A type representing local application data.
*/
export type Local = {
namespaceOptions: {
filter: string;
@ -343,10 +343,13 @@ export type Local = {
reverse: boolean;
page: number;
};
}
};
/**
* A type representing a trigger.
*/
export type Trigger = {
id: number;
service: any;
}
};

Binary file not shown.