Merge pull request #1839 from loganhz/fixes

Catalog and Fixes
This commit is contained in:
Vincent Fiduccia 2018-04-20 19:46:20 -07:00 committed by GitHub
commit c6abf5fe63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 202 additions and 111 deletions

View File

@ -42,11 +42,12 @@
expand=(action expandFn) expand=(action expandFn)
expandOnInit=false expandOnInit=false
}} }}
<pre class="log-body" style="margin:0; font-size: 80%; color: whitesmoke;">{{model.app.status.notes}}</pre> {{marked-down markdown=model.app.status.notes}}
{{/accordion-list-item}} {{/accordion-list-item}}
{{/if}} {{/if}}
{{resource-condition-list {{resource-condition-list
resourceType=(t 'generic.application')
conditions=model.app.status.conditions conditions=model.app.status.conditions
expandAll=al.expandAll expandAll=al.expandAll
expandFn=expandFn expandFn=expandFn

View File

@ -87,6 +87,7 @@
}} }}
{{resource-condition-list {{resource-condition-list
resourceType=(t 'generic.pod')
conditions=model.status.conditions conditions=model.status.conditions
expandAll=al.expandAll expandAll=al.expandAll
expandFn=expandFn expandFn=expandFn
@ -119,11 +120,16 @@
}} }}
{{/accordion-list-item}} {{/accordion-list-item}}
{{form-env-var {{#accordion-list-item
model=displayEnvironmentVars title=(t 'containerPage.portsTab.header')
detail=(t 'containerPage.portsTab.detail')
expandAll=al.expandAll expandAll=al.expandAll
expandFn=expandFn expand=(action expandFn)
}} }}
{{form-env-var
model=displayEnvironmentVars
}}
{{/accordion-list-item}}
{{container/form-command {{container/form-command
instance=container instance=container

View File

@ -34,7 +34,7 @@ const App = Resource.extend(StateCounts, {
} }
}); });
}), }),
workloads: computed('namespace.workloads', function() { workloads: computed('namespace.workloads.@each.workloadLabels', function() {
return (get(this, 'namespace.workloads') || []).filter((item) => { return (get(this, 'namespace.workloads') || []).filter((item) => {
if ( item['workloadLabels'] ) { if ( item['workloadLabels'] ) {
return item['workloadLabels']['io.cattle.field/appId'] === get(this, 'name'); return item['workloadLabels']['io.cattle.field/appId'] === get(this, 'name');

View File

@ -42,6 +42,7 @@
<section> <section>
{{#accordion-list as |al expandFn|}} {{#accordion-list as |al expandFn|}}
{{resource-condition-list {{resource-condition-list
resourceType=(t 'generic.node')
conditions=model.node.conditions conditions=model.node.conditions
expandAll=al.expandAll expandAll=al.expandAll
expandFn=expandFn expandFn=expandFn

View File

@ -1,9 +1,10 @@
// Code // Code
$code-color : $info !default; $code-color : $info !default;
$code-bg : $text-color !default; $code-bg : $text-color !default;
$pre-bg : rgba($light-grey, .3) !default; $pre-bg : $text-color !default;
$pre-color : $dark-grey !default; $pre-color : $dark-grey !default;
$pre-border-color : $light-grey !default; $pre-border-color : $light-grey !default;
$setting-bg : rgba($light-grey, .3) !default;
code { code {
padding: 5px 10px; padding: 5px 10px;
@ -32,6 +33,11 @@ pre {
} }
} }
.bg-setting {
@include bg-color($setting-bg);
@include contrasted($setting-bg);
}
.bg-code { .bg-code {
@include bg-color($code-bg); @include bg-color($code-bg);
@include contrasted($code-bg); @include contrasted($code-bg);

View File

@ -84,27 +84,21 @@
}} }}
{{#if service.canHaveEnvironment}} {{#if service.canHaveEnvironment}}
{{form-env-var
model=displayEnvironmentVars
expandAll=al.expandAll
expandFn=expandFn
}}
{{/if}}
{{#if service.canHaveSecrets}}
{{#accordion-list-item {{#accordion-list-item
title=(t 'formSources.title') title=(t 'formEnvVar.title')
detail=(t 'formSources.detail') detail=(t 'formEnvVar.detail')
expandAll=al.expandAll expandAll=al.expandAll
expand=(action expandFn) expand=(action expandFn)
}} }}
{{container/form-sources {{form-env-var
sources=activeLaunchConfig.environmentFrom model=displayEnvironmentVars
editing=false }}
expandAll=al.expandAll <hr class="mt-30 mb-30" />
expandFn=expandFn {{container/form-sources
classNames="accordion" namespace=service.namespace
}} sources=activeLaunchConfig.environmentFrom
editing=false
}}
{{/accordion-list-item}} {{/accordion-list-item}}
{{/if}} {{/if}}

View File

@ -16,6 +16,7 @@ export default Component.extend(ClusterDriver, {
clusterState: alias('model.originalCluster.state'), clusterState: alias('model.originalCluster.state'),
step: 1, step: 1,
loading: false,
didReceiveAttrs() { didReceiveAttrs() {
if ( get(this,'isEdit') && if ( get(this,'isEdit') &&
@ -34,7 +35,7 @@ export default Component.extend(ClusterDriver, {
}, },
clusterChanged: observer('cluster.state', function() { clusterChanged: observer('cluster.state', function() {
if ( get(this, 'step') >= 2 ) { if ( get(this, 'step') >= 2 ) {
const state = get(this, 'cluster.state') const state = get(this, 'cluster.state')
if ( ! ['pending','initializing'].includes(state) ) { if ( ! ['pending','initializing'].includes(state) ) {
this.sendAction('close'); this.sendAction('close');
@ -44,9 +45,15 @@ export default Component.extend(ClusterDriver, {
loadToken() { loadToken() {
const cluster = get(this,'cluster'); const cluster = get(this,'cluster');
set(this, 'step', 2);
set(this, 'loading', true);
return cluster.getOrCreateToken().then((token) => { return cluster.getOrCreateToken().then((token) => {
if ( this.isDestroyed || this.isDestroying ) {
return;
}
set(this, 'token', token); set(this, 'token', token);
set(this, 'step', 2); set(this, 'loading', false);
}); });
} }
}); });

View File

@ -8,8 +8,12 @@
</div> </div>
<div class="copy-pre mt-20 mb-20"> <div class="copy-pre mt-20 mb-20">
{{copy-to-clipboard clipboardText=token.command tagName="div" classNames="copy-to-pre"}} {{#if loading}}
<pre id="registration-command" style="font-size: 14px;">{{token.command}}</pre> <div class="text-center"><i class="icon icon-spinner icon-spin"></i> {{t 'generic.loading'}}</div>
{{else}}
{{copy-to-clipboard clipboardText=token.command tagName="div" classNames="copy-to-pre"}}
<pre id="registration-command" style="font-size: 14px;">{{token.command}}</pre>
{{/if}}
</div> </div>
<div class="mt-20"> <div class="mt-20">
@ -21,8 +25,12 @@
</div> </div>
<div class="copy-pre mt-20 mb-20"> <div class="copy-pre mt-20 mb-20">
{{copy-to-clipboard clipboardText=token.insecureCommand tagName="div" classNames="copy-to-pre"}} {{#if loading}}
<pre id="registration-command" style="font-size: 14px;">{{token.insecureCommand}}</pre> <div class="text-center"><i class="icon icon-spinner icon-spin"></i> {{t 'generic.loading'}}</div>
{{else}}
{{copy-to-clipboard clipboardText=token.insecureCommand tagName="div" classNames="copy-to-pre"}}
<pre id="registration-command" style="font-size: 14px;">{{token.insecureCommand}}</pre>
{{/if}}
</div> </div>
{{#if isEdit}} {{#if isEdit}}

View File

@ -68,7 +68,7 @@
{{/if}} {{/if}}
{{t 'formScale.scaleMode.scaleSuffix' scale=asInteger}} {{t 'formScale.scaleMode.scaleSuffix' scale=asInteger}}
{{else if (eq scaleMode "statefulSet")}} {{else if (eq scaleMode "statefulSet")}}
<i class="icon icon-lg icon-service"></i> <i class="icon icon-lg icon-database"></i>
{{t 'formScale.scaleMode.statefulSetPrefix' scale=asInteger}} {{t 'formScale.scaleMode.statefulSetPrefix' scale=asInteger}}
{{#if editing}} {{#if editing}}
{{input-integer safeStyle="width: 60px; padding: 0 2px; display: inline-block" value=userInput min=min max=max}} {{input-integer safeStyle="width: 60px; padding: 0 2px; display: inline-block" value=userInput min=min max=max}}

View File

@ -1,7 +1,7 @@
import { inject as service } from '@ember/service'; import { inject as service } from '@ember/service';
import Component from '@ember/component'; import Component from '@ember/component';
import layout from './template'; import layout from './template';
import { get, set, computed } from '@ember/object'; import { get, set } from '@ember/object';
export default Component.extend({ export default Component.extend({
layout, layout,
@ -11,6 +11,32 @@ export default Component.extend({
statusClass: null, statusClass: null,
fetching: false, fetching: false,
editing: true, editing: true,
headers: [
{
name: 'source',
sort: ['source'],
translationKey: 'formSources.type.label',
searchField: 'source',
},
{
name: 'sourceName',
sort: ['sourceName','source'],
searchField: 'sourceName',
translationKey: 'formSources.source.label',
},
{
name: 'sourceKey',
sort: ['sourceKey', 'sourceName','source'],
searchField: 'sourceKey',
translationKey: 'formSources.prefixOrKey.label',
},
{
name: 'targetKey',
sort: ['targetKey', 'sourceKey', 'sourceName','source'],
searchField: 'targetKey',
translationKey: 'formSources.prefix.label',
}
],
actions: { actions: {
addSource() { addSource() {

View File

@ -1,41 +1,73 @@
<div class="clearfix"> {{#if editing}}
<label class="acc-label">{{t 'newContainer.environment.from'}}</label> <div class="clearfix">
</div> <label class="acc-label">{{t 'newContainer.environment.from'}}</label>
<div> </div>
{{#if sources.length}} <div>
<table class="table fixed no-lines small mb-10"> {{#if sources.length}}
<thead> <table class="table fixed no-lines small mb-10">
<tr class="hidden-sm"> <thead>
<th width="140" class="{{unless editing 'acc-label'}}">{{t 'formSources.type.label'}}{{#if editing}}{{field-required}}{{/if}}</th> <tr class="hidden-sm">
<th width="10"></th> <th width="140">{{t 'formSources.type.label'}}{{field-required}}</th>
<th width="220" class="{{unless editing 'acc-label'}}">{{t 'formSources.source.label'}}{{#if editing}}{{field-required}}{{/if}}</th> <th width="10"></th>
<th width="10"></th> <th width="220">{{t 'formSources.source.label'}}{{field-required}}</th>
<th class="{{unless editing 'acc-label'}}">{{t 'formSources.prefixOrKey.label'}}{{#if editing}}{{field-required}}{{/if}}</th> <th width="10"></th>
<th width="70"></th> <th>{{t 'formSources.prefixOrKey.label'}}{{field-required}}</th>
<th class="{{unless editing 'acc-label'}}">{{t 'formSources.prefix.label'}}</th> <th width="70"></th>
<th width="40">&nbsp;</th> <th>{{t 'formSources.prefix.label'}}</th>
</tr> <th width="40">&nbsp;</th>
</thead> </tr>
<tbody> </thead>
{{#each sources as |source|}} <tbody>
{{form-sources-row {{#each sources as |source|}}
source=source {{form-sources-row
namespace=namespace source=source
editing=editing namespace=namespace
remove=(action "removeSource") remove=(action "removeSource")
}} }}
{{/each}} {{/each}}
</tbody> </tbody>
</table> </table>
{{else}} {{/if}}
{{#unless editing}}
<span class="text-center text-muted">{{t 'formSources.noData'}}</span>
{{/unless}}
{{/if}}
{{#if editing}}
<button type="button" class="btn bg-link icon-btn" {{action "addSource"}}> <button type="button" class="btn bg-link icon-btn" {{action "addSource"}}>
<span class="darken"><i class="icon icon-plus icon-small"></i></span> <span class="darken"><i class="icon icon-plus icon-small"></i></span>
<span>{{t 'newContainer.environment.addFrom'}}</span> <span>{{t 'newContainer.environment.addFrom'}}</span>
</button> </button>
{{/if}} </div>
</div> {{else}}
{{#sortable-table
classNames="grid fixed mb-0 sortable-table"
bulkActions=false
rowActions=false
paging=false
search=true
sortBy=sortBy
stickyHeader=false
descending=descending
headers=headers
body=sources
as |sortable kind source|
}}
{{#if (eq kind "row")}}
<tr>
<td data-title="{{t 'formSources.type.label'}}:" class="force-wrap">{{source.source}}</td>
<td data-title="{{t 'formSources.source.label'}}:" class="force-wrap">{{source.sourceName}}</td>
<td data-title="{{t 'formSources.prefixOrKey.label'}}:" class="force-wrap">
{{#if source.sourceKey}}
{{source.sourceKey}}
{{else}}
{{t 'generic.all'}}
{{/if}}
</td>
<td data-title="{{t 'formSources.prefix.label'}}:" class="force-wrap">{{source.targetKey}}</td>
</tr>
{{else if (eq kind "nomatch")}}
<tr>
<td colspan="{{sortable.fullColspan}}" class="text-center text-muted pt-20 pb-20">{{t 'formSources.noMatch'}}</td>
</tr>
{{else if (eq kind "norows")}}
<tr>
<td colspan="{{sortable.fullColspan}}" class="text-center text-muted pt-20 pb-20">{{t 'formSources.noData'}}</td>
</tr>
{{/if}}
{{/sortable-table}}
{{/if}}

View File

@ -33,7 +33,9 @@ export default Component.extend({
set(this, 'configAnswers', get(this, AWS_PATH)); set(this, 'configAnswers', get(this, AWS_PATH));
} else if ( cloudProviderName === 'azure' ) { } else if ( cloudProviderName === 'azure' ) {
set(this, 'selectedCloudProvider', 'azure'); set(this, 'selectedCloudProvider', 'azure');
set(this, 'configAnswers', get(this, AZURE_PATH)); const answers = get(this, AZURE_PATH);
delete answers.type;
set(this, 'configAnswers', answers);
} else if ( !cloudProviderName ) { } else if ( !cloudProviderName ) {
set(this, 'selectedCloudProvider', 'none'); set(this, 'selectedCloudProvider', 'none');
} else { } else {

View File

@ -1,35 +1,24 @@
{{#accordion-list-item {{#sortable-table
title=(t 'formEnvVar.title') classNames="grid fixed mb-0 sortable-table"
detail=(t 'formEnvVar.detail' appName=settings.appName) bulkActions=false
status=(t 'formEnvVar.status' count=(or model.length 0)) rowActions=false
statusClass=(if model.length 'bg-success' 'text-muted') paging=false
expandAll=expandAll search=true
expand=(action expandFn) sortBy=sortBy
componentName='sortable-table' stickyHeader=false
as | parent | descending=descending
headers=headers
body=model
as |sortable kind label|
}} }}
{{#component parent.intent {{#if (eq kind "row")}}
classNames="grid fixed mb-0 sortable-table" <tr>
bulkActions=false <td data-title="{{t 'formEnvVar.labels.key'}}:" class="force-wrap">{{label.key}}</td>
rowActions=false <td data-title="{{t 'formEnvVar.labels.value'}}:" class="force-wrap">{{label.value}}</td>
paging=false </tr>
search=true {{else if (eq kind "norows")}}
sortBy=sortBy <tr>
stickyHeader=false <td colspan="{{sortable.fullColspan}}" class="text-center text-muted pt-20 pb-20">{{t 'formEnvVar.noData'}}</td>
descending=descending </tr>
headers=headers {{/if}}
body=model {{/sortable-table}}
as |sortable kind label|
}}
{{#if (eq kind "row")}}
<tr>
<td data-title="{{t 'formEnvVar.labels.key'}}:" class="force-wrap">{{label.key}}</td>
<td data-title="{{t 'formEnvVar.labels.value'}}:" class="force-wrap">{{label.value}}</td>
</tr>
{{else if (eq kind "norows")}}
<tr>
<td colspan="{{sortable.fullColspan}}" class="text-center text-muted pt-20 pb-20">{{t 'labelsSection.noData'}}</td>
</tr>
{{/if}}
{{/component}}
{{/accordion-list-item}}

View File

@ -3,6 +3,17 @@ import Component from '@ember/component';
import ModalBase from 'shared/mixins/modal-base'; import ModalBase from 'shared/mixins/modal-base';
import layout from './template'; import layout from './template';
const HIDDEN_FIELDS = ['digest'];
function sanitize(config) {
HIDDEN_FIELDS.forEach(key => {
if (config.hasOwnProperty(key)) {
delete config[key];
}
});
return config;
}
export default Component.extend(ModalBase, { export default Component.extend(ModalBase, {
layout, layout,
@ -67,7 +78,7 @@ export default Component.extend(ModalBase, {
if (get(this, 'current') && get(this, 'selected')) { if (get(this, 'current') && get(this, 'selected')) {
let left = get(this, 'current.status'); let left = get(this, 'current.status');
let right = get(this, 'selected.status'); let right = get(this, 'selected.status');
var delta = jsondiffpatch.diff(left, right); var delta = jsondiffpatch.diff(sanitize(left), sanitize(right));
jsondiffpatch.formatters.html.hideUnchanged(); jsondiffpatch.formatters.html.hideUnchanged();
return jsondiffpatch.formatters.html.format(delta, left).htmlSafe(); return jsondiffpatch.formatters.html.format(delta, left).htmlSafe();
} }

View File

@ -8,6 +8,7 @@ export default Component.extend({
sortBy: 'type', sortBy: 'type',
descending: false, descending: false,
resourceType: null,
headers: [ headers: [
{ {

View File

@ -1,6 +1,6 @@
{{#accordion-list-item {{#accordion-list-item
title=(t 'conditionSections.title') title=(t 'conditionSections.title')
detail=(t 'conditionSections.detail') detail=(t 'conditionSections.detail' resourceType=resourceType)
expandAll=expandAll expandAll=expandAll
expand=(action expandFn) expand=(action expandFn)
componentName='sortable-table' componentName='sortable-table'

View File

@ -31,6 +31,10 @@ export default Component.extend({
this.set('saving', true); this.set('saving', true);
this.set('saved', false); this.set('saved', false);
this.sendAction('save', (success) => { this.sendAction('save', (success) => {
if ( this.isDestroyed || this.isDestroying ) {
return;
}
this.set('saving', false); this.set('saving', false);
this.set('saved', ( success === true )); this.set('saved', ( success === true ));
}); });

View File

@ -20,7 +20,7 @@
</div> </div>
{{else}} {{else}}
<div class=""> <div class="">
<pre class=""> <pre class="bg-setting">
{{~#if row.obj.value~}} {{~#if row.obj.value~}}
{{~#if (or (not row.obj) (eq row.obj.default row.obj.value))~}} {{~#if (or (not row.obj) (eq row.obj.default row.obj.value))~}}
{{~row.obj.value~}} {{~row.obj.value~}}

View File

@ -11,6 +11,7 @@ generic:
all: All all: All
any: Any any: Any
as: as as: as
application: application
cancel: Cancel cancel: Cancel
closeModal: Close closeModal: Close
cluster: Cluster cluster: Cluster
@ -67,6 +68,7 @@ generic:
none: None none: None
owner: Owner owner: Owner
paste: Paste paste: Paste
pod: pod
port: Port port: Port
ports: Ports ports: Ports
project: Project project: Project
@ -176,7 +178,7 @@ appDetailPage:
header: "App: {appName}" header: "App: {appName}"
notes: notes:
title: Notes title: Notes
detail: 'Notes for this application' detail: 'Instructions on how to use this application'
workloads: workloads:
title: Workloads title: Workloads
detail: Workloads created for this application. detail: Workloads created for this application.
@ -1926,8 +1928,8 @@ clusterNew:
instructionsInsecure: "If you get an error about 'certificate signed by unknown authority' because your {appName} installation is running with an untrusted/self-signed SSL certificate, run the command below instead to bypass the certificate check:" instructionsInsecure: "If you get an error about 'certificate signed by unknown authority' because your {appName} installation is running with an untrusted/self-signed SSL certificate, run the command below instead to bypass the certificate check:"
conditionSections: conditionSections:
title: Conditions title: Status
detail: Current conditions detail: Status of current {resourceType}
table: table:
type: Type type: Type
status: Status status: Status
@ -3462,7 +3464,8 @@ formScheduling:
formSources: formSources:
title: Environments From Sources title: Environments From Sources
detail: Environments from sources allow you to inject passwords, keys, or other information into the containers that need them. detail: Environments from sources allow you to inject passwords, keys, or other information into the containers that need them.
noData: No Sources noData: No Environments From Sources
noMatch: No Environments From Sources match the current search
addLabel: Add Source addLabel: Add Source
type: type:
label: Type label: Type
@ -4254,7 +4257,7 @@ newCatalog:
maintainer: "Maintainer:" maintainer: "Maintainer:"
newNamespace: New Namespace newNamespace: New Namespace
newAppDetail: Choose application version and namespace for the application newAppDetail: Choose application version and namespace for the application
appInfo: Detailed Description appInfo: Detailed Descriptions
appInfoDetail: Application information and user guid appInfoDetail: Application information and user guid
noConfig: This template has no configuration options noConfig: This template has no configuration options
official: Officially Certified official: Officially Certified