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',
authenticated: 'authenticated',
'authenticated.cluster': 'authenticated.cluster',
'authenticated.cluster.index': 'authenticated.cluster.index',
'authenticated.cluster.projects': 'authenticated.cluster.projects',
'authenticated.project': 'authenticated.project',
'authenticated.prefs': 'authenticated.prefs',

View File

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

View File

@ -1,71 +1,75 @@
{{#sortable-table
tableClassNames="double-rows"
bulkActions=bulkActions
body=filtered
sortBy=sortBy
stickyHeader=stickyHeader
fullRows=true
search=search
groupByKey=groupByKey
groupByRef=groupByRef
headers=headers as |sortable kind inst dt|
}}
{{#if (eq kind "row")}}
<tr class="main-row">
{{#if filtered.length}}
<td valign="middle" class="row-check" style="padding-top: 2px;">
{{check-box nodeId=inst.id}}
</td>
{{/if}}
<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 filtered.length}}
{{#sortable-table
tableClassNames="double-rows"
bulkActions=bulkActions
body=filtered
sortBy=sortBy
stickyHeader=stickyHeader
fullRows=true
search=search
groupByKey=groupByKey
groupByRef=groupByRef
headers=headers as |sortable kind inst dt|
}}
{{#if (eq kind "row")}}
<tr class="main-row">
{{#if filtered.length}}
<td valign="middle" class="row-check" style="padding-top: 2px;">
{{check-box nodeId=inst.id}}
</td>
{{/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">
{{action-menu model=inst showPrimary=true}}
</td>
</tr>
{{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>
{{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>
{{/if}}
{{/sortable-table}}
<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}}
</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">
{{action-menu model=inst showPrimary=true}}
</td>
</tr>
{{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>
{{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>
{{/if}}
{{/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);
setTimeout(()=>{
let route = this.get('route');
debugger
this.showStepAdd();
},0);
},

View File

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

View File

@ -1,5 +1,15 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
import { htmlSafe } from '@ember/string';
export default Controller.extend({
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 { on } from '@ember/object/evented';
import C from 'ui/utils/constants';
import { hash } from 'rsvp';
export default Route.extend({
globalStore: service(),
session: service(),
pipeline: service(),
model: function() {
var globalStore = this.get('globalStore');
let projectModel = window.l('route:application').modelFor('authenticated.project');
let projectId = projectModel.project.id;
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() {
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}}
{{#link-to "new-pipeline" class="btn bg-primary btn-sm"}}
{{t 'pipelinesPage.add'}}
{{/link-to}}
{{#if model.deployed}}
{{!-- {{#link-to "pipelines.project.import" classNames="btn btn-sm bg-default mr-10"}}{{t 'pipelinesPage.import'}}{{/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}}
<div class="mt-10"></div>
<section class="instances">
{{pipeline-jobs-table
body=model
sortBy=sortBy
bulkActions=true
search=true
paging=true
}}
</section>
{{#if model.deployed}}
<section class="instances">
{{pipeline-jobs-table
body=model.pipelines
sortBy=sortBy
bulkActions=true
search=true
paging=true
}}
</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(),
scope: service(),
deploy: false,
isReady() {
let clusterId = this.get('scope').currentCluster.id;
this.get('globalStore').find('clusterPipeline', `${clusterId}:${clusterId}`)
isReady(clusterId) {
let requestClusterId = clusterId||this.get('scope').currentCluster.id;
this.set('deploy', false);
return this.get('globalStore').find('clusterPipeline', `${requestClusterId}:${requestClusterId}`)
.then((res)=>{
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_id = cluster.id;
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});
// return model
return model
}
});

View File

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

View File

@ -14,12 +14,10 @@ export default Component.extend({
showGroup: true,
tagName: '',
pipelineDeploy: alias('pipeline.deploy'),
allStacks: null,
init() {
this._super(...arguments);
this.set('allStacks', this.get('store').all('stack'));
this.get('pipeline').isReady();
},
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>
{{/if}}
<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>
{{/if}}
<li>{{#link-to-external "authenticated.project.pipeline.pipelines" scope.currentProject.id}}Pipeline{{/link-to-external}}</li>
</ul>
<div class="right-buttons">