Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
79e9b890
Commit
79e9b890
authored
Oct 24, 2016
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sort environments by name
parent
3ea611e7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
3 deletions
+19
-3
app/assets/javascripts/environments/stores/environmnets_store.js.es6
...javascripts/environments/stores/environmnets_store.js.es6
+18
-3
app/views/projects/environments/components/_environment.html.haml
...s/projects/environments/components/_environment.html.haml
+1
-0
No files found.
app/assets/javascripts/environments/stores/environmnets_store.js.es6
View file @
79e9b890
...
@@ -60,14 +60,14 @@
...
@@ -60,14 +60,14 @@
if (environment.environment_type !== null) {
if (environment.environment_type !== null) {
const occurs = acc.find((element, index, array) => {
const occurs = acc.find((element, index, array) => {
return element.
nam
e === environment.environment_type;
return element.
environment_typ
e === environment.environment_type;
});
});
data["vue-isChildren"] = true;
data["vue-isChildren"] = true;
if (occurs !== undefined) {
if (occurs !== undefined) {
acc[acc.indexOf(occurs)].children.push(data);
acc[acc.indexOf(occurs)].children.push(data);
acc[acc.indexOf(occurs)].children.
sort();
acc[acc.indexOf(occurs)].children.
push(data).sort(this.sortByName)
} else {
} else {
acc.push({
acc.push({
name: environment.environment_type,
name: environment.environment_type,
...
@@ -81,11 +81,26 @@
...
@@ -81,11 +81,26 @@
}
}
return acc;
return acc;
}, []).sort();
}, []).sort(
this.sortByName
);
this.state.environments = environmentsTree;
this.state.environments = environmentsTree;
return environmentsTree;
return environmentsTree;
},
sortByName (a,b) {
const nameA = a.name.toUpperCase();
const nameB = b.name.toUpperCase();
if (nameA < nameB) {
return -1;
}
if (nameA > nameB) {
return 1;
}
return 0;
}
}
}
}
})();
})();
app/views/projects/environments/components/_environment.html.haml
View file @
79e9b890
...
@@ -52,6 +52,7 @@
...
@@ -52,6 +52,7 @@
%td
.hidden-xs
%td
.hidden-xs
.pull-right
{
"v-if"
=>
"!isFolder"
}
.pull-right
{
"v-if"
=>
"!isFolder"
}
=
render
"projects/environments/components/external_url"
=
render
"projects/environments/components/external_url"
=
render
"projects/environments/components/actions"
%tr
{
"v-if"
=>
"open && isFolder"
,
%tr
{
"v-if"
=>
"open && isFolder"
,
"is"
=>
"environment-item"
,
"is"
=>
"environment-item"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment