Skip to content

Commit

Permalink
Bug 1505281 - Improve import YAML results message
Browse files Browse the repository at this point in the history
  • Loading branch information
spadgett committed Nov 1, 2017
1 parent b5efba1 commit 136dd4b
Show file tree
Hide file tree
Showing 7 changed files with 190 additions and 156 deletions.
7 changes: 6 additions & 1 deletion app/scripts/directives/create/nextSteps.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,19 @@
createdBuildConfig: '<',
onContinue: '<',
showProjectName: '<',
name: '<'
// Optional kind to show in front of the name
kind: '<?',
name: '<',
// Optional action to use instead of "created" (for example, "imported")
actionLabel: '<?'
},
templateUrl: 'views/directives/next-steps.html'
});

function NextSteps(ProcessedTemplateService, Navigate) {
var ctrl = this;
ctrl.showParamsTable = false;
ctrl.actionLabel = ctrl.actionLabel || 'created';

var processedTemplateData = ProcessedTemplateService.getTemplateData();
ctrl.parameters = processedTemplateData.params;
Expand Down
4 changes: 3 additions & 1 deletion app/scripts/directives/fromFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,9 @@ angular.module("openshiftConsole")
}
else if ($scope.isDialog) {
$scope.$emit('fileImportedFromYAMLOrJSON', {
project: $scope.input.selectedProject
project: $scope.input.selectedProject,
resource: $scope.resource,
isList: $scope.isList
});
}
else {
Expand Down
11 changes: 10 additions & 1 deletion app/scripts/directives/fromFileDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,14 @@
ctrl.vendor = annotation(message.template, "openshift.io/provider-display-name");
ctrl.docUrl = annotation(ctrl.template, "openshift.io/documentation-url");
ctrl.supportUrl = annotation(ctrl.template, "openshift.io/support-url");
ctrl.name = "YAML / JSON";
ctrl.actionLabel = "imported";
if (message.isList) {
ctrl.kind = null;
ctrl.name = "YAML / JSON";
} else if (message.resource) {
ctrl.kind = message.resource.kind;
ctrl.name = message.resource.metadata.name;
}
// Need to let the current digest loop finish so the template config step becomes visible or the wizard will throw an error
// from the change to currentStep
$timeout(function() {
Expand All @@ -73,6 +80,8 @@
$scope.$on('templateInstantiated', function(event, message) {
ctrl.selectedProject = message.project;
ctrl.name = $filter('displayName')(ctrl.template);
ctrl.actionLabel = null;
ctrl.kind = null;
ctrl.currentStep = "Results";
});

Expand Down
4 changes: 3 additions & 1 deletion app/views/directives/from-file-dialog.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@
login-base-url="$ctrl.loginBaseUrl"
on-continue="$ctrl.close"
show-project-name="$ctrl.showProjectName"
name="$ctrl.name">
kind="$ctrl.kind"
name="$ctrl.name"
action-label="$ctrl.actionLabel">
</next-steps>
</div>
</div>
Expand Down
18 changes: 12 additions & 6 deletions app/views/directives/next-steps.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
<span class="sr-only">Pending</span>
<div class="results-message">
<h1 class="h3">
<strong>{{$ctrl.name}}</strong> is being created<span ng-if="$ctrl.showProjectName && $ctrl.projectName"> in <strong>{{$ctrl.projectName}}</strong></span>.
<span ng-if="$ctrl.kind">{{$ctrl.kind | humanizeKind | upperFirst}}</span>
<strong>{{$ctrl.name}}</strong> is being {{$ctrl.actionLabel}}<span ng-if="$ctrl.showProjectName && $ctrl.projectName"> in <strong>{{$ctrl.projectName}}</strong></span>.
</h1>
</div>
</div>
Expand All @@ -16,17 +17,21 @@ <h1 class="h3">
<span class="sr-only">Error</span>
<div class="results-message">
<h1 class="h3">
<strong>{{$ctrl.name}}</strong> failed to be created<span ng-if="$ctrl.showProjectName && $ctrl.projectName"> in <strong>{{$ctrl.projectName}}</strong></span>.
<span ng-if="$ctrl.kind">{{$ctrl.kind | humanizeKind | upperFirst}}</span>
<strong>{{$ctrl.name}}</strong> failed to be {{$ctrl.actionLabel}}<span ng-if="$ctrl.showProjectName && $ctrl.projectName"> in <strong>{{$ctrl.projectName}}</strong></span>.
</h1>
</div>
</div>
</div>
<!-- if the user refreshes the next steps page -->
<!-- Import YAML of a single resource. -->
<div ng-if="!tasks().length">
<div class="results-status results-status-unknown">
<div class="results-status">
<span class="pficon pficon-ok" aria-hidden="true"></span>
<span class="sr-only">Success</span>
<div class="results-message">
<h1 class="h3">
<strong>{{$ctrl.name}}</strong> completed.
<span ng-if="$ctrl.kind">{{$ctrl.kind | humanizeKind | upperFirst}}</span>
<strong>{{$ctrl.name}}</strong> has been {{$ctrl.actionLabel}}<span ng-if="$ctrl.showProjectName && $ctrl.projectName"> in <strong>{{$ctrl.projectName}}</strong> successfully</span>.
</h1>
</div>
</div>
Expand All @@ -37,7 +42,8 @@ <h1 class="h3">
<span class="sr-only">Success</span>
<div class="results-message">
<h1 class="h3">
<strong>{{$ctrl.name}}</strong> has been created<span ng-if="$ctrl.showProjectName && $ctrl.projectName"> in <strong>{{$ctrl.projectName}}</strong> successfully</span>.
<span ng-if="$ctrl.kind">{{$ctrl.kind | humanizeKind | upperFirst}}</span>
<strong>{{$ctrl.name}}</strong> has been {{$ctrl.actionLabel}}<span ng-if="$ctrl.showProjectName && $ctrl.projectName"> in <strong>{{$ctrl.projectName}}</strong> successfully</span>.
</h1>
</div>
</div>
Expand Down
Loading

0 comments on commit 136dd4b

Please sign in to comment.