Mobile client overview enhancements#3017
Conversation
74e512f to
62bc93d
Compare
|
@openshift/team-ux-review |
|
/ok-to-test |
cd8c727 to
3475848
Compare
|
/retest |
3475848 to
7ad13ac
Compare
|
@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 |
7ad13ac to
50ee81d
Compare
51cfbbd to
a2eaca1
Compare
|
Just linking this comment here re copy icon -> #3022 (comment) |
benjaminapetersen
left a comment
There was a problem hiding this comment.
Some observations & a bit of clarifications, thanks!
| namespace: _.get(mobileClient, 'metadata.namespace'), | ||
| clientId: _.get(mobileClient, 'metadata.name'), | ||
| services: serviceConfig | ||
| }, null, ' '); |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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)?:\/\/.*\//; |
There was a problem hiding this comment.
This is really only testing for https://, unless you want to go for something more complex, you might just try _.includes(myUrl, 'https://').
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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) !== "/"){ |
There was a problem hiding this comment.
Prefer _.endsWith(myUrl, '/')
|
|
||
| return _.map(secrets, function(secret) { | ||
| var decodedData = SecretsService.decodeSecretData(secret.data); | ||
| if (decodedData.uri && !decodedData.uri.match(urlRgx)) { |
There was a problem hiding this comment.
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){ |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
Extract to named function?
| }); | ||
| } | ||
|
|
||
| if (apiObjectChanges && !row.bindingsWatched) { |
There was a problem hiding this comment.
Extract to named function?
| group: "mobile.k8s.io", | ||
| version: "v1alpha1", | ||
| resource: "mobileclients" | ||
| if (apiObjectChanges && !row.buildsWatched) { |
There was a problem hiding this comment.
Extract to named function?
|
|
||
| row.actionsDropdownVisible = function () { | ||
| // no actions on those marked for deletion | ||
| if (_.get(row.apiObject, 'metadata.deletionTimestamp')) { |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
aria-hidden="true" on the <i>.


Adding mobile service related information to the mobile client component on the overview screen.
The component will display:
NOTE: This PR makes use of openshift/origin-web-common#320 and openshift/origin-web-catalog#669