mirror of https://github.com/rancher/ui.git
Merge pull request #1680 from biblesyme/cicd-engine-fix-3_1
Pipeline Bug fix
This commit is contained in:
commit
af3238868c
|
|
@ -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',
|
||||||
|
|
|
||||||
|
|
@ -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'),
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
{{#if filtered.length}}
|
||||||
{{#sortable-table
|
{{#sortable-table
|
||||||
tableClassNames="double-rows"
|
tableClassNames="double-rows"
|
||||||
bulkActions=bulkActions
|
bulkActions=bulkActions
|
||||||
|
|
@ -69,3 +70,6 @@
|
||||||
<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}}
|
||||||
|
|
@ -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);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -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',
|
||||||
|
|
|
||||||
|
|
@ -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(),
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -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');
|
||||||
|
|
|
||||||
|
|
@ -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}} --}}
|
||||||
|
<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}}
|
{{/link-to}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
{{/containers-header}}
|
{{/containers-header}}
|
||||||
|
|
||||||
<div class="mt-10"></div>
|
<div class="mt-10"></div>
|
||||||
|
{{#if model.deployed}}
|
||||||
<section class="instances">
|
<section class="instances">
|
||||||
{{pipeline-jobs-table
|
{{pipeline-jobs-table
|
||||||
body=model
|
body=model.pipelines
|
||||||
sortBy=sortBy
|
sortBy=sortBy
|
||||||
bulkActions=true
|
bulkActions=true
|
||||||
search=true
|
search=true
|
||||||
paging=true
|
paging=true
|
||||||
}}
|
}}
|
||||||
</section>
|
</section>
|
||||||
|
{{else}}
|
||||||
|
{{banner-message color='bg-warning mb-0 mt-10' message=(t 'pipelinesPage.notDeployed' route=linkToDeploy htmlSafe=true)}}
|
||||||
|
{{/if}}
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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: {
|
||||||
|
|
|
||||||
|
|
@ -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">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue