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
0
Merge Requests
0
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
Tatuya Kamada
gitlab-ce
Commits
73accafe
Commit
73accafe
authored
Feb 13, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use common util to get parameter name
parent
17897c37
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
22 deletions
+9
-22
app/assets/javascripts/environments/components/environment.js.es6
...ts/javascripts/environments/components/environment.js.es6
+5
-19
app/assets/javascripts/environments/folder/environments_folder_view.js.es6
...ripts/environments/folder/environments_folder_view.js.es6
+4
-3
No files found.
app/assets/javascripts/environments/components/environment.js.es6
View file @
73accafe
...
@@ -7,6 +7,7 @@ const EnvironmentsService = require('../services/environments_service');
...
@@ -7,6 +7,7 @@ const EnvironmentsService = require('../services/environments_service');
const EnvironmentTable = require('./environments_table');
const EnvironmentTable = require('./environments_table');
const Store = require('../stores/environments_store');
const Store = require('../stores/environments_store');
require('../../vue_shared/components/table_pagination');
require('../../vue_shared/components/table_pagination');
require('../../lib/utils/common_utils');
module.exports = Vue.component('environment-component', {
module.exports = Vue.component('environment-component', {
...
@@ -45,7 +46,7 @@ module.exports = Vue.component('environment-component', {
...
@@ -45,7 +46,7 @@ module.exports = Vue.component('environment-component', {
computed: {
computed: {
scope() {
scope() {
return
this.$options.getQueryParameter
('scope');
return
gl.utils.getParameterByName
('scope');
},
},
canReadEnvironmentParsed() {
canReadEnvironmentParsed() {
...
@@ -67,8 +68,8 @@ module.exports = Vue.component('environment-component', {
...
@@ -67,8 +68,8 @@ module.exports = Vue.component('environment-component', {
* Toggles loading property.
* Toggles loading property.
*/
*/
created() {
created() {
const scope =
this.$options.getQueryParameter
('scope') || this.visibility;
const scope =
gl.utils.getParameterByName
('scope') || this.visibility;
const pageNumber =
this.$options.getQueryParameter
('page') || this.pageNumber;
const pageNumber =
gl.utils.getParameterByName
('page') || this.pageNumber;
const endpoint = `${this.endpoint}?scope=${scope}&page=${pageNumber}`;
const endpoint = `${this.endpoint}?scope=${scope}&page=${pageNumber}`;
...
@@ -96,21 +97,6 @@ module.exports = Vue.component('environment-component', {
...
@@ -96,21 +97,6 @@ module.exports = Vue.component('environment-component', {
});
});
},
},
/**
* Transforms the url parameter into an object and
* returns the one requested.
*
* @param {String} param
* @returns {String} The value of the requested parameter.
*/
getQueryParameter(parameter) {
return window.location.search.substring(1).split('&').reduce((acc, param) => {
const paramSplited = param.split('=');
acc[paramSplited[0]] = paramSplited[1];
return acc;
}, {})[parameter];
},
/**
/**
* Converts permission provided as strings to booleans.
* Converts permission provided as strings to booleans.
* @param {String} string
* @param {String} string
...
@@ -158,7 +144,7 @@ module.exports = Vue.component('environment-component', {
...
@@ -158,7 +144,7 @@ module.exports = Vue.component('environment-component', {
<div :class="cssContainerClass">
<div :class="cssContainerClass">
<div class="top-area">
<div class="top-area">
<ul v-if="!isLoading" class="nav-links">
<ul v-if="!isLoading" class="nav-links">
<li v-bind:class="{ 'active': scope ===
undefined
|| scope === 'available' }">
<li v-bind:class="{ 'active': scope ===
null
|| scope === 'available' }">
<a :href="projectEnvironmentsPath">
<a :href="projectEnvironmentsPath">
Available
Available
<span class="badge js-available-environments-count">
<span class="badge js-available-environments-count">
...
...
app/assets/javascripts/environments/folder/environments_folder_view.js.es6
View file @
73accafe
...
@@ -6,6 +6,7 @@ Vue.use(require('vue-resource'));
...
@@ -6,6 +6,7 @@ Vue.use(require('vue-resource'));
const EnvironmentsService = require('../services/environments_service');
const EnvironmentsService = require('../services/environments_service');
const EnvironmentTable = require('../components/environments_table');
const EnvironmentTable = require('../components/environments_table');
const Store = require('../stores/environments_store');
const Store = require('../stores/environments_store');
require('../../lib/utils/common_utils');
module.exports = Vue.component('environment-folder-view', {
module.exports = Vue.component('environment-folder-view', {
...
@@ -42,7 +43,7 @@ module.exports = Vue.component('environment-folder-view', {
...
@@ -42,7 +43,7 @@ module.exports = Vue.component('environment-folder-view', {
computed: {
computed: {
scope() {
scope() {
return
this.$options.getQueryParameter
('scope');
return
gl.utils.getParameterByName
('scope');
},
},
canReadEnvironmentParsed() {
canReadEnvironmentParsed() {
...
@@ -68,8 +69,8 @@ module.exports = Vue.component('environment-folder-view', {
...
@@ -68,8 +69,8 @@ module.exports = Vue.component('environment-folder-view', {
* Toggles loading property.
* Toggles loading property.
*/
*/
created() {
created() {
const scope =
this.$options.getQueryParameter
('scope') || this.visibility;
const scope =
gl.utils.getParameterByName
('scope') || this.visibility;
const pageNumber =
this.$options.getQueryParameter
('page') || this.pageNumber;
const pageNumber =
gl.utils.getParameterByName
('page') || this.pageNumber;
const endpoint = `${this.endpoint}?scope=${scope}&page=${pageNumber}`;
const endpoint = `${this.endpoint}?scope=${scope}&page=${pageNumber}`;
...
...
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