Skip to content

Commit

Permalink
Merge pull request #2426 from spadgett/fix-import-yaml-msg
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue.

Bug 1505281 - Improve import YAML results message

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1505281
See also #2217 

List:

![openshift web console 2017-11-01 13-30-16](https://user-images.githubusercontent.com/1167259/32288915-bafbb06c-bf0b-11e7-9322-50c6b252f44c.png)

Single resource:

![openshift web console 2017-11-01 13-46-08](https://user-images.githubusercontent.com/1167259/32288894-b2e9ef10-bf0b-11e7-816b-bce315c1b036.png)

/kind bug

cc @rhamilto @jwforres
  • Loading branch information
openshift-merge-robot authored Nov 1, 2017
2 parents 0bb17eb + 136dd4b commit 84d6d04
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 84d6d04

Please sign in to comment.