diff --git a/app/app.js b/app/app.js
index 27287206a..8694829f4 100644
--- a/app/app.js
+++ b/app/app.js
@@ -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',
diff --git a/lib/pipeline/addon/components/pipeline-jobs-table/component.js b/lib/pipeline/addon/components/pipeline-jobs-table/component.js
index 42dbdf0ab..3791b2a56 100644
--- a/lib/pipeline/addon/components/pipeline-jobs-table/component.js
+++ b/lib/pipeline/addon/components/pipeline-jobs-table/component.js
@@ -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'),
});
diff --git a/lib/pipeline/addon/components/pipeline-jobs-table/template.hbs b/lib/pipeline/addon/components/pipeline-jobs-table/template.hbs
index b8a1f4328..eaa3c7217 100644
--- a/lib/pipeline/addon/components/pipeline-jobs-table/template.hbs
+++ b/lib/pipeline/addon/components/pipeline-jobs-table/template.hbs
@@ -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")}}
-
- {{#if filtered.length}}
- |
- {{check-box nodeId=inst.id}}
- |
- {{/if}}
-
-
- {{#if inst.isActive}}
- {{t 'pipelinesPage.active'}}
- {{else}}
- {{t 'pipelinesPage.inactive'}}
- {{/if}}
-
- |
-
- {{#link-to "pipeline" inst.id (query-params mode="review")}}
- {{inst.name}}
- {{/link-to}}
- |
-
- {{inst.repository}}
- {{inst.branchConditionLabel}} {{inst.branch}}
- |
-
- {{#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"}}
- #{{inst.lastRun}} {{inst.lastRunState}}
- {{date-from-now inst.lastStarted}}
- {{/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")}}
+ |
+ {{#if filtered.length}}
+ |
+ {{check-box nodeId=inst.id}}
+ |
{{/if}}
-
-
- {{#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}}
- {{t 'pipelinesPage.awaitingWebhook'}}
- {{/if}}
- {{#unless (or inst.triggerWebhook inst.nextStart)}}
- {{t 'pipelinesPage.triggerManually'}}
- {{/unless}}
- |
-
-
- {{action-menu model=inst showPrimary=true}}
- |
-
- {{else if (eq kind "nomatch")}}
- | {{t 'pipelinesPage.table.noMatch'}} |
- {{else if (eq kind "norows")}}
- | {{t 'pipelinesPage.table.noData'}} |
- {{/if}}
-{{/sortable-table}}
+
+
+ {{#if inst.isActive}}
+ {{t 'pipelinesPage.active'}}
+ {{else}}
+ {{t 'pipelinesPage.inactive'}}
+ {{/if}}
+
+ |
+
+ {{#link-to "pipeline" inst.id (query-params mode="review")}}
+ {{inst.name}}
+ {{/link-to}}
+ |
+
+ {{inst.repository}}
+ {{inst.branchConditionLabel}} {{inst.branch}}
+ |
+
+ {{#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"}}
+ #{{inst.lastRun}} {{inst.lastRunState}}
+ {{date-from-now inst.lastStarted}}
+ {{/tooltip-element}}
+ {{else}}
+ N/A
+ {{/if}}
+ |
+
+ {{#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}}
+ {{t 'pipelinesPage.awaitingWebhook'}}
+ {{/if}}
+ {{#unless (or inst.triggerWebhook inst.nextStart)}}
+ {{t 'pipelinesPage.triggerManually'}}
+ {{/unless}}
+ |
+
+
+ {{action-menu model=inst showPrimary=true}}
+ |
+
+ {{else if (eq kind "nomatch")}}
+ | {{t 'pipelinesPage.table.noMatch'}} |
+ {{else if (eq kind "norows")}}
+ | {{t 'pipelinesPage.table.noData'}} |
+ {{/if}}
+ {{/sortable-table}}
+{{else}}
+ {{empty-table resource="container" newRoute="authenticated.project.pipeline.new-pipeline" newTranslationKey="pipelinesPage.add"}}
+{{/if}}
\ No newline at end of file
diff --git a/lib/pipeline/addon/components/pipeline-steps/component.js b/lib/pipeline/addon/components/pipeline-steps/component.js
index 468d3400e..72c8a0dba 100644
--- a/lib/pipeline/addon/components/pipeline-steps/component.js
+++ b/lib/pipeline/addon/components/pipeline-steps/component.js
@@ -13,7 +13,6 @@ export default Component.extend({
this._super(...arguments);
setTimeout(()=>{
let route = this.get('route');
- debugger
this.showStepAdd();
},0);
},
diff --git a/lib/pipeline/addon/engine.js b/lib/pipeline/addon/engine.js
index 813485db1..2fd29c674 100644
--- a/lib/pipeline/addon/engine.js
+++ b/lib/pipeline/addon/engine.js
@@ -28,6 +28,7 @@ const Eng = Engine.extend({
'failWhale',
'authenticated',
'authenticated.cluster',
+ 'authenticated.cluster.index',
'authenticated.cluster.projects',
'authenticated.project',
'authenticated.prefs',
diff --git a/lib/pipeline/addon/pipelines/controller.js b/lib/pipeline/addon/pipelines/controller.js
index a439f31e0..96e95ac82 100644
--- a/lib/pipeline/addon/pipelines/controller.js
+++ b/lib/pipeline/addon/pipelines/controller.js
@@ -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 here to enable Pipline`)
+ return route
+ }.property(),
});
diff --git a/lib/pipeline/addon/pipelines/route.js b/lib/pipeline/addon/pipelines/route.js
index 1e2396b5a..b13d548db 100644
--- a/lib/pipeline/addon/pipelines/route.js
+++ b/lib/pipeline/addon/pipelines/route.js
@@ -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');
diff --git a/lib/pipeline/addon/pipelines/template.hbs b/lib/pipeline/addon/pipelines/template.hbs
index 13c7fe6dc..cd183c279 100644
--- a/lib/pipeline/addon/pipelines/template.hbs
+++ b/lib/pipeline/addon/pipelines/template.hbs
@@ -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}} --}}
+
+ {{#link-to "new-pipeline" class="btn bg-link icon-btn p-0"}}
+
+ {{t 'pipelinesPage.add'}}
+ {{/link-to}}
+
+ {{/if}}
{{/containers-header}}
-
- {{pipeline-jobs-table
- body=model
- sortBy=sortBy
- bulkActions=true
- search=true
- paging=true
- }}
-
+{{#if model.deployed}}
+
+ {{pipeline-jobs-table
+ body=model.pipelines
+ sortBy=sortBy
+ bulkActions=true
+ search=true
+ paging=true
+ }}
+
+{{else}}
+ {{banner-message color='bg-warning mb-0 mt-10' message=(t 'pipelinesPage.notDeployed' route=linkToDeploy htmlSafe=true)}}
+{{/if}}
diff --git a/lib/pipeline/addon/services/pipeline.js b/lib/pipeline/addon/services/pipeline.js
index 36d9f47ad..90c3b5632 100644
--- a/lib/pipeline/addon/services/pipeline.js
+++ b/lib/pipeline/addon/services/pipeline.js
@@ -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;
})
},
});
diff --git a/lib/pipeline/addon/settings/route.js b/lib/pipeline/addon/settings/route.js
index 4a74a4295..b23f887cf 100644
--- a/lib/pipeline/addon/settings/route.js
+++ b/lib/pipeline/addon/settings/route.js
@@ -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
}
});
diff --git a/lib/pipeline/translations/en-us.yaml b/lib/pipeline/translations/en-us.yaml
index be6931d92..c2faecfa4 100644
--- a/lib/pipeline/translations/en-us.yaml
+++ b/lib/pipeline/translations/en-us.yaml
@@ -41,6 +41,7 @@ pipelinesPage:
nextRun: NextRun
awaitingWebhook: Awaiting Webhook
triggerManually: Trigger Manually
+ notDeployed: Pipeline is not enabled, click here to enable Pipline
pipelinesSetting:
gitAuthentication: Git Authentication
authenticateWithGit: Authenticate with git repository
diff --git a/lib/shared/addon/components/containers-header/component.js b/lib/shared/addon/components/containers-header/component.js
index 85a458430..ea4555610 100644
--- a/lib/shared/addon/components/containers-header/component.js
+++ b/lib/shared/addon/components/containers-header/component.js
@@ -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: {
diff --git a/lib/shared/addon/components/containers-header/template.hbs b/lib/shared/addon/components/containers-header/template.hbs
index fa535f135..1399f2e63 100644
--- a/lib/shared/addon/components/containers-header/template.hbs
+++ b/lib/shared/addon/components/containers-header/template.hbs
@@ -10,9 +10,7 @@
{{#link-to-external "authenticated.project.dns.index" scope.currentProject.id}}{{t 'nav.containers.dns'}}{{/link-to-external}}
{{/if}}
{{#link-to-external "volumes.index" scope.currentProject.id}}{{t 'nav.containers.volumes'}}{{/link-to-external}}
- {{#if pipelineDeploy}}
- {{#link-to-external "authenticated.project.pipeline.pipelines" scope.currentProject.id}}Pipeline{{/link-to-external}}
- {{/if}}
+ {{#link-to-external "authenticated.project.pipeline.pipelines" scope.currentProject.id}}Pipeline{{/link-to-external}}