Skip to content

Mobile client overview enhancements#3017

Closed
sedroche wants to merge 2 commits intoopenshift:masterfrom
aerogear-attic:overview-mobile-row-enhancements
Closed

Mobile client overview enhancements#3017
sedroche wants to merge 2 commits intoopenshift:masterfrom
aerogear-attic:overview-mobile-row-enhancements

Conversation

@sedroche
Copy link
Copy Markdown

Adding mobile service related information to the mobile client component on the overview screen.

The component will display:

  • Bound/unbound services
  • Copy to clipboard component containg sdk info to connect to services
  • Mobile client builds status and history.

mobile-overview-row-enhancements

NOTE: This PR makes use of openshift/origin-web-common#320 and openshift/origin-web-catalog#669

@openshift-ci-robot openshift-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 12, 2018
@sedroche sedroche force-pushed the overview-mobile-row-enhancements branch from 74e512f to 62bc93d Compare June 14, 2018 15:43
@openshift-ci-robot openshift-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 14, 2018
@benjaminapetersen
Copy link
Copy Markdown
Contributor

@openshift/team-ux-review

@benjaminapetersen benjaminapetersen self-requested a review June 15, 2018 18:14
@spadgett
Copy link
Copy Markdown
Member

/ok-to-test

@openshift-ci-robot openshift-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jun 18, 2018
@witmicko witmicko force-pushed the overview-mobile-row-enhancements branch 2 times, most recently from cd8c727 to 3475848 Compare June 19, 2018 10:58
@witmicko
Copy link
Copy Markdown

/retest

@witmicko witmicko force-pushed the overview-mobile-row-enhancements branch from 3475848 to 7ad13ac Compare June 19, 2018 12:49
@beanh66
Copy link
Copy Markdown

beanh66 commented Jun 19, 2018

@benjaminapetersen @sedroche Same comment @cshinn made on this PR #3022 applies here for the copy icon and action. Please also note an open issue around the tooltip behavior. openshift/console#144

@witmicko witmicko force-pushed the overview-mobile-row-enhancements branch from 7ad13ac to 50ee81d Compare June 19, 2018 13:20
@witmicko witmicko force-pushed the overview-mobile-row-enhancements branch from 51cfbbd to a2eaca1 Compare June 19, 2018 15:59
@openshift-ci-robot openshift-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jun 19, 2018
@sedroche
Copy link
Copy Markdown
Author

Just linking this comment here re copy icon -> #3022 (comment)

Copy link
Copy Markdown
Contributor

@benjaminapetersen benjaminapetersen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some observations & a bit of clarifications, thanks!

namespace: _.get(mobileClient, 'metadata.namespace'),
clientId: _.get(mobileClient, 'metadata.name'),
services: serviceConfig
}, null, ' ');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How important is the null, ' ' args to you? I don't think we have done this anywhere else. Fine for dev, but consider removing if not essential (both are optional to the stringify() fn).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it allows us to pretty print this json, without it we get it inline:

image
VS
image

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, consider a named prettyPrint({obj}) helper function, to make that explicit.

Almost exactly the same:

var getClientConfig = function(mobileClient, serviceConfig, clusterInfo) { 
   return prettyPrintJSON({yourObj})
}

};

var getServiceConfig = function(secrets, externalURL, SecretsService) {
var urlRgx = /http(s)?:\/\/.*\//;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really only testing for https://, unless you want to go for something more complex, you might just try _.includes(myUrl, 'https://').

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the s is optional, we re looking for http(s)://name.domain/ pattern https://regexr.com/3rcll
any reason why we shouldn't use regex here?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a prob. I may just suggest (broken record, sorry) you make that explicit with a named function. validProtocol(str) .


var getServiceConfig = function(secrets, externalURL, SecretsService) {
var urlRgx = /http(s)?:\/\/.*\//;
if(externalURL && externalURL.substr(externalURL.length -1) !== "/"){
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer _.endsWith(myUrl, '/')


return _.map(secrets, function(secret) {
var decodedData = SecretsService.decodeSecretData(secret.data);
if (decodedData.uri && !decodedData.uri.match(urlRgx)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have a couple different ways you are testing & handling adding the trailing /, possible to extract a helper?

url: decodedData.uri,
config: decodedData.config ? JSON.parse(decodedData.config) : {}
};
if(externalURL){
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You already tested for externalUrl above. I wonder if some of this logic can be extracted into a separate named function that will help document the intent.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meaning, there is a reason you are making a pivot & replacing the URL. A named function here would tell me "why".

row.context = {namespace: _.get(row, 'apiObject.metadata.namespace')};
}

if (apiObjectChanges && !row.serviceInstancesWatched) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my other comment about using _.once() to reduce some of this bookkeeping. You won't need to track row.serviceInstancesWatched = true;

var startWatchingServiceClasses = _.once(function() {  watches.push(/* */) });

if(apiObjectChanges) {
   startWatchingServiceClasses();
}


if (apiObjectChanges && !row.serviceInstancesWatched) {
row.serviceInstancesWatched = true;
DataService.list(serviceClassesVersion, row.context, function(serviceClasses) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extract to named function?

});
}

if (apiObjectChanges && !row.bindingsWatched) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extract to named function?

group: "mobile.k8s.io",
version: "v1alpha1",
resource: "mobileclients"
if (apiObjectChanges && !row.buildsWatched) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extract to named function?


row.actionsDropdownVisible = function () {
// no actions on those marked for deletion
if (_.get(row.apiObject, 'metadata.deletionTimestamp')) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than a return false, I'd prob just do:

return !!_.get(row.apiObject, 'metadata.deletionTimestamp') ||
  AuthorizationService.canI(row.mobileClientsVersion, 'delete');

Its a little more idiomatic.

<span class="status-icon" ng-class="build.status.phase">
<span ng-switch="build.status.phase" class="hide-ng-leave">
<span ng-switch-when="Complete" aria-hidden="true">
<i class="fa fa-check-circle fa-fw"></i>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aria-hidden="true" on the <i>.

<i class="fa fa-check-circle fa-fw"></i>
</span>
<span ng-switch-when="Failed" aria-hidden="true">
<i class="fa fa-times-circle fa-fw"></i>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aria-hidden="true" on the <i>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants