BigW Consortium Gitlab

Commit 3ea611e7 by Filipa Lacerda

Adds counter for number of children in each folder

parent 070165f0
...@@ -37,10 +37,10 @@ ...@@ -37,10 +37,10 @@
* Folder items have different behaviours - it is possible to toggle * Folder items have different behaviours - it is possible to toggle
* them and show their children. * them and show their children.
* *
* @returns {Number} The length of the children array * @returns {Boolean}
*/ */
isFolder () { isFolder () {
return this.model.children && this.model.children.length return this.model.children && this.model.children.length ? true : false;
}, },
/** /**
...@@ -51,6 +51,17 @@ ...@@ -51,6 +51,17 @@
*/ */
isChildren () { isChildren () {
return this.model['vue-isChildren']; return this.model['vue-isChildren'];
},
/**
* Counts the number of environments in each folder.
* Used to show a badge with the counter.
*
* @returns {Boolean} The number of environments for the current folder
*/
childrenCounter () {
return this.model.children && this.model.children.length;
} }
}, },
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
} }
} }
.children-row .environment-name{ .children-row .environment-name {
margin-left: 17px; margin-left: 17px;
margin-right: -17px; margin-right: -17px;
} }
...@@ -75,6 +75,13 @@ ...@@ -75,6 +75,13 @@
.folder-name { .folder-name {
cursor: pointer; cursor: pointer;
.badge {
font-weight: normal;
background-color: $gray-darker;
color: $gl-placeholder-color;
vertical-align: baseline;
}
} }
} }
......
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
=icon("caret-right") =icon("caret-right")
{{model.name}} {{model.name}}
%span.badge
{{childrenCounter}}
%td.deployment-column %td.deployment-column
%span{ "v-if" => "!isFolder && model.last_deployment && model.last_deployment.iid"} %span{ "v-if" => "!isFolder && model.last_deployment && model.last_deployment.iid"}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment