Merge pull request #1680 from biblesyme/cicd-engine-fix-3_1

Pipeline Bug fix
This commit is contained in:
Vincent Fiduccia 2018-03-01 11:39:30 -07:00 committed by GitHub
commit af3238868c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 135 additions and 96 deletions

View File

@ -128,6 +128,7 @@ const App = Application.extend({
failWhale: 'failWhale', failWhale: 'failWhale',
authenticated: 'authenticated', authenticated: 'authenticated',
'authenticated.cluster': 'authenticated.cluster', 'authenticated.cluster': 'authenticated.cluster',
'authenticated.cluster.index': 'authenticated.cluster.index',
'authenticated.cluster.projects': 'authenticated.cluster.projects', 'authenticated.cluster.projects': 'authenticated.cluster.projects',
'authenticated.project': 'authenticated.project', 'authenticated.project': 'authenticated.project',
'authenticated.prefs': 'authenticated.prefs', 'authenticated.prefs': 'authenticated.prefs',

View File

@ -51,7 +51,6 @@ export default Component.extend({
filtered: function() { filtered: function() {
const data = this.get('body') || []; const data = this.get('body') || [];
const projectId = this.get('projectId') const projectId = this.get('projectId')
console.log(projectId)
return data.filterBy('projectId', projectId); return data.filterBy('projectId', projectId);
}.property('model.@each.{projectId}', 'projectId'), }.property('body.@each.{projectId}', 'projectId'),
}); });

View File

@ -1,71 +1,75 @@
{{#sortable-table {{#if filtered.length}}
tableClassNames="double-rows" {{#sortable-table
bulkActions=bulkActions tableClassNames="double-rows"
body=filtered bulkActions=bulkActions
sortBy=sortBy body=filtered
stickyHeader=stickyHeader sortBy=sortBy
fullRows=true stickyHeader=stickyHeader
search=search fullRows=true
groupByKey=groupByKey search=search
groupByRef=groupByRef groupByKey=groupByKey
headers=headers as |sortable kind inst dt| groupByRef=groupByRef
}} headers=headers as |sortable kind inst dt|
{{#if (eq kind "row")}} }}
<tr class="main-row"> {{#if (eq kind "row")}}
{{#if filtered.length}} <tr class="main-row">
<td valign="middle" class="row-check" style="padding-top: 2px;"> {{#if filtered.length}}
{{check-box nodeId=inst.id}} <td valign="middle" class="row-check" style="padding-top: 2px;">
</td> {{check-box nodeId=inst.id}}
{{/if}} </td>
<td class="text-muted" data-title="{{dt.isActive}}">
<span class="badge-state {{inst.statusClass}}">
{{#if inst.isActive}}
{{t 'pipelinesPage.active'}}
{{else}}
{{t 'pipelinesPage.inactive'}}
{{/if}}
</span>
</td>
<td data-title="{{dt.displayName}}" class="clip">
{{#link-to "pipeline" inst.id (query-params mode="review")}}
{{inst.name}}
{{/link-to}}
</td>
<td data-title="{{dt.repository}}" class="clip text-muted">
<p class="mt-10 mb-5">{{inst.repository}}</p>
<p class="mt-5 mb-10"><b>{{inst.branchConditionLabel}}</b> {{inst.branch}}</p>
</td>
<td data-title="{{dt.runCount}}" class="clip text-muted">
{{#if inst.lastExecutionId}}
{{#tooltip-element style="100%;" inlineBlock=true type="tooltip-basic" tooltipTemplate="tooltip-static" model=(date-str inst.lastStarted) tagName="span" tooltipFor="tooltip-basic"}}
<p class="mt-0 mb-0">#{{inst.lastRun}} {{inst.lastRunState}}</p>
<p class="text-muted text-italic text-small mt-0 mb-0">{{date-from-now inst.lastStarted}}</p>
{{/tooltip-element}}
{{else}}
N/A
{{/if}} {{/if}}
</td> <td class="text-muted" data-title="{{dt.isActive}}">
<td data-title="{{dt.nextRunTime}}" class="clip"> <span class="badge-state {{inst.statusClass}}">
{{#if inst.nextStart}} {{#if inst.isActive}}
{{#tooltip-element style="100%;" inlineBlock=true type="tooltip-basic" tooltipTemplate="tooltip-static" model=(date-str inst.nextStart) tagName="span" tooltipFor="tooltip-basic"}} {{t 'pipelinesPage.active'}}
{{date-from-now inst.nextStart}} {{else}}
{{/tooltip-element}} {{t 'pipelinesPage.inactive'}}
{{/if}} {{/if}}
{{#if inst.triggerWebhook}} </span>
<p class="mt-5 mb-0">{{t 'pipelinesPage.awaitingWebhook'}}</p> </td>
{{/if}} <td data-title="{{dt.displayName}}" class="clip">
{{#unless (or inst.triggerWebhook inst.nextStart)}} {{#link-to "pipeline" inst.id (query-params mode="review")}}
{{t 'pipelinesPage.triggerManually'}} {{inst.name}}
{{/unless}} {{/link-to}}
</td> </td>
<td data-title="{{dt.repository}}" class="clip text-muted">
<p class="mt-10 mb-5">{{inst.repository}}</p>
<p class="mt-5 mb-10"><b>{{inst.branchConditionLabel}}</b> {{inst.branch}}</p>
</td>
<td data-title="{{dt.runCount}}" class="clip text-muted">
{{#if inst.lastExecutionId}}
{{#tooltip-element style="100%;" inlineBlock=true type="tooltip-basic" tooltipTemplate="tooltip-static" model=(date-str inst.lastStarted) tagName="span" tooltipFor="tooltip-basic"}}
<p class="mt-0 mb-0">#{{inst.lastRun}} {{inst.lastRunState}}</p>
<p class="text-muted text-italic text-small mt-0 mb-0">{{date-from-now inst.lastStarted}}</p>
{{/tooltip-element}}
{{else}}
N/A
{{/if}}
</td>
<td data-title="{{dt.nextRunTime}}" class="clip">
{{#if inst.nextStart}}
{{#tooltip-element style="100%;" inlineBlock=true type="tooltip-basic" tooltipTemplate="tooltip-static" model=(date-str inst.nextStart) tagName="span" tooltipFor="tooltip-basic"}}
{{date-from-now inst.nextStart}}
{{/tooltip-element}}
{{/if}}
{{#if inst.triggerWebhook}}
<p class="mt-5 mb-0">{{t 'pipelinesPage.awaitingWebhook'}}</p>
{{/if}}
{{#unless (or inst.triggerWebhook inst.nextStart)}}
{{t 'pipelinesPage.triggerManually'}}
{{/unless}}
</td>
<td data-title="{{dt.actions}}" class="actions"> <td data-title="{{dt.actions}}" class="actions">
{{action-menu model=inst showPrimary=true}} {{action-menu model=inst showPrimary=true}}
</td> </td>
</tr> </tr>
{{else if (eq kind "nomatch")}} {{else if (eq kind "nomatch")}}
<tr><td colspan="{{sortable.fullColspan}}" class="text-center text-muted lacsso pt-20 pb-20">{{t 'pipelinesPage.table.noMatch'}}</td></tr> <tr><td colspan="{{sortable.fullColspan}}" class="text-center text-muted lacsso pt-20 pb-20">{{t 'pipelinesPage.table.noMatch'}}</td></tr>
{{else if (eq kind "norows")}} {{else if (eq kind "norows")}}
<tr><td colspan="{{sortable.fullColspan}}" class="text-center text-muted lacsso pt-20 pb-20">{{t 'pipelinesPage.table.noData'}}</td></tr> <tr><td colspan="{{sortable.fullColspan}}" class="text-center text-muted lacsso pt-20 pb-20">{{t 'pipelinesPage.table.noData'}}</td></tr>
{{/if}} {{/if}}
{{/sortable-table}} {{/sortable-table}}
{{else}}
{{empty-table resource="container" newRoute="authenticated.project.pipeline.new-pipeline" newTranslationKey="pipelinesPage.add"}}
{{/if}}

View File

@ -13,7 +13,6 @@ export default Component.extend({
this._super(...arguments); this._super(...arguments);
setTimeout(()=>{ setTimeout(()=>{
let route = this.get('route'); let route = this.get('route');
debugger
this.showStepAdd(); this.showStepAdd();
},0); },0);
}, },

View File

@ -28,6 +28,7 @@ const Eng = Engine.extend({
'failWhale', 'failWhale',
'authenticated', 'authenticated',
'authenticated.cluster', 'authenticated.cluster',
'authenticated.cluster.index',
'authenticated.cluster.projects', 'authenticated.cluster.projects',
'authenticated.project', 'authenticated.project',
'authenticated.prefs', 'authenticated.prefs',

View File

@ -1,5 +1,15 @@
import Controller from '@ember/controller'; import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
import { htmlSafe } from '@ember/string';
export default Controller.extend({ export default Controller.extend({
sortBy: 'Name', sortBy: 'Name',
router: service(),
linkToDeploy: function(){
let projectModel = window.l('route:application').modelFor('authenticated.project');
let clusterId = projectModel.project.clusterId;
let route = this.get('router').urlFor('authenticated.cluster.pipeline', clusterId);
// return htmlSafe(`Pipeline is not enabled, click <a href="${route}" target="_blank">here</a> to enable Pipline`)
return route
}.property(),
}); });

View File

@ -2,17 +2,31 @@ import { inject as service } from '@ember/service';
import Route from '@ember/routing/route'; import Route from '@ember/routing/route';
import { on } from '@ember/object/evented'; import { on } from '@ember/object/evented';
import C from 'ui/utils/constants'; import C from 'ui/utils/constants';
import { hash } from 'rsvp';
export default Route.extend({ export default Route.extend({
globalStore: service(), globalStore: service(),
session: service(), session: service(),
pipeline: service(),
model: function() { model: function() {
var globalStore = this.get('globalStore'); var globalStore = this.get('globalStore');
let projectModel = window.l('route:application').modelFor('authenticated.project'); let projectModel = window.l('route:application').modelFor('authenticated.project');
let projectId = projectModel.project.id; let projectId = projectModel.project.id;
var model = globalStore.findAll('pipeline', { filter: { projectId }}); var model = globalStore.findAll('pipeline', { filter: { projectId }});
return model return this.get('pipeline').isReady(projectModel.project.clusterId).then((deployed)=>{
if(!deployed){
return {
deployed,
}
}
return model.then((pipelines)=>{
return {
deployed,
pipelines
}
})
})
}, },
setDefaultRoute: on('activate', function() { setDefaultRoute: on('activate', function() {
this.set(`session.${C.SESSION.CONTAINER_ROUTE}`,'authenticated.project.pipeline.pipelines'); this.set(`session.${C.SESSION.CONTAINER_ROUTE}`,'authenticated.project.pipeline.pipelines');

View File

@ -1,16 +1,26 @@
{{#containers-header tags=tags simpleMode=true showGroup=false}} {{#containers-header tags=tags simpleMode=true showGroup=false}}
{{#link-to "new-pipeline" class="btn bg-primary btn-sm"}} {{#if model.deployed}}
{{t 'pipelinesPage.add'}} {{!-- {{#link-to "pipelines.project.import" classNames="btn btn-sm bg-default mr-10"}}{{t 'pipelinesPage.import'}}{{/link-to}} --}}
{{/link-to}} <div class="btn bg-link btn-sm icon-btn p-0">
{{#link-to "new-pipeline" class="btn bg-link icon-btn p-0"}}
<span class="darken"><i class="icon icon-plus text-small"/></span>
<span>{{t 'pipelinesPage.add'}}</span>
{{/link-to}}
</div>
{{/if}}
{{/containers-header}} {{/containers-header}}
<div class="mt-10"></div> <div class="mt-10"></div>
<section class="instances"> {{#if model.deployed}}
{{pipeline-jobs-table <section class="instances">
body=model {{pipeline-jobs-table
sortBy=sortBy body=model.pipelines
bulkActions=true sortBy=sortBy
search=true bulkActions=true
paging=true search=true
}} paging=true
</section> }}
</section>
{{else}}
{{banner-message color='bg-warning mb-0 mt-10' message=(t 'pipelinesPage.notDeployed' route=linkToDeploy htmlSafe=true)}}
{{/if}}

View File

@ -6,11 +6,16 @@ export default Service.extend({
globalStore: service(), globalStore: service(),
scope: service(), scope: service(),
deploy: false, deploy: false,
isReady() { isReady(clusterId) {
let clusterId = this.get('scope').currentCluster.id; let requestClusterId = clusterId||this.get('scope').currentCluster.id;
this.get('globalStore').find('clusterPipeline', `${clusterId}:${clusterId}`) this.set('deploy', false);
return this.get('globalStore').find('clusterPipeline', `${requestClusterId}:${requestClusterId}`)
.then((res)=>{ .then((res)=>{
this.set('deploy', res.deploy); this.set('deploy', res.deploy);
return res.deploy;
}).catch(()=>{
this.set('deploy', false);
return false;
}) })
}, },
}); });

View File

@ -9,11 +9,10 @@ export default Route.extend({
const cluster = window.l('route:application').modelFor('authenticated.cluster') const cluster = window.l('route:application').modelFor('authenticated.cluster')
const cluster_id = cluster.id; const cluster_id = cluster.id;
if ( get(cluster,'state') !== 'active' ) { if ( get(cluster,'state') !== 'active' ) {
this.transitionTo('authenticated.cluster.index'); this.transitionToExternal('authenticated.cluster.index');
} }
let model = globalStore.find('clusterPipeline',`${cluster_id}:${cluster_id}`,{forceReload: true}); let model = globalStore.find('clusterPipeline',`${cluster_id}:${cluster_id}`,{forceReload: true});
// return model
return model return model
} }
}); });

View File

@ -41,6 +41,7 @@ pipelinesPage:
nextRun: NextRun nextRun: NextRun
awaitingWebhook: Awaiting Webhook awaitingWebhook: Awaiting Webhook
triggerManually: Trigger Manually triggerManually: Trigger Manually
notDeployed: Pipeline is not enabled, click <a href="{route}" target="_blank">here</a> to enable Pipline
pipelinesSetting: pipelinesSetting:
gitAuthentication: Git Authentication gitAuthentication: Git Authentication
authenticateWithGit: Authenticate with git repository authenticateWithGit: Authenticate with git repository

View File

@ -14,12 +14,10 @@ export default Component.extend({
showGroup: true, showGroup: true,
tagName: '', tagName: '',
pipelineDeploy: alias('pipeline.deploy'),
allStacks: null, allStacks: null,
init() { init() {
this._super(...arguments); this._super(...arguments);
this.set('allStacks', this.get('store').all('stack')); this.set('allStacks', this.get('store').all('stack'));
this.get('pipeline').isReady();
}, },
actions: { actions: {

View File

@ -10,9 +10,7 @@
<li>{{#link-to-external "authenticated.project.dns.index" scope.currentProject.id}}{{t 'nav.containers.dns'}}{{/link-to-external}}</li> <li>{{#link-to-external "authenticated.project.dns.index" scope.currentProject.id}}{{t 'nav.containers.dns'}}{{/link-to-external}}</li>
{{/if}} {{/if}}
<li>{{#link-to-external "volumes.index" scope.currentProject.id}}{{t 'nav.containers.volumes'}}{{/link-to-external}}</li> <li>{{#link-to-external "volumes.index" scope.currentProject.id}}{{t 'nav.containers.volumes'}}{{/link-to-external}}</li>
{{#if pipelineDeploy}} <li>{{#link-to-external "authenticated.project.pipeline.pipelines" scope.currentProject.id}}Pipeline{{/link-to-external}}</li>
<li>{{#link-to-external "authenticated.project.pipeline.pipelines" scope.currentProject.id}}Pipeline{{/link-to-external}}</li>
{{/if}}
</ul> </ul>
<div class="right-buttons"> <div class="right-buttons">