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
Jérome Perrin
gitlab-ce
Commits
08234849
Commit
08234849
authored
Feb 12, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds url for folder;
Creates new subview to show envirnoments that belong to a folder
parent
26d18387
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
96 deletions
+59
-96
app/assets/javascripts/environments/components/environment_item.js.es6
...vascripts/environments/components/environment_item.js.es6
+11
-1
app/assets/javascripts/environments/folder/environments_folder_bundle.js.es6
...pts/environments/folder/environments_folder_bundle.js.es6
+0
-1
app/assets/javascripts/environments/folder/environments_folder_view.js.es6
...ripts/environments/folder/environments_folder_view.js.es6
+42
-44
app/assets/javascripts/environments/stores/environments_folder_store.js.es6
...ipts/environments/stores/environments_folder_store.js.es6
+0
-49
app/views/projects/environments/folder.html.haml
app/views/projects/environments/folder.html.haml
+6
-1
No files found.
app/assets/javascripts/environments/components/environment_item.js.es6
View file @
08234849
...
@@ -407,6 +407,16 @@ module.exports = Vue.component('environment-item', {
...
@@ -407,6 +407,16 @@ module.exports = Vue.component('environment-item', {
return '';
return '';
},
},
/**
* Constructs folder URL based on the current location and the folder id.
*
* @return {String}
*/
folderUrl() {
return `${window.location.pathname}/folders/${this.model.latest.id}`;
},
},
},
/**
/**
...
@@ -432,7 +442,7 @@ module.exports = Vue.component('environment-item', {
...
@@ -432,7 +442,7 @@ module.exports = Vue.component('environment-item', {
:href="environmentPath">
:href="environmentPath">
{{model.name}}
{{model.name}}
</a>
</a>
<a v-else class="folder-name">
<a v-else class="folder-name"
:href="folderUrl"
>
<span class="folder-icon">
<span class="folder-icon">
<i class="fa fa-caret-right" aria-hidden="true"></i>
<i class="fa fa-caret-right" aria-hidden="true"></i>
<i class="fa fa-folder" aria-hidden="true"></i>
<i class="fa fa-folder" aria-hidden="true"></i>
...
...
app/assets/javascripts/environments/folder/environments_folder_bundle.js.es6
View file @
08234849
const EnvironmentsFolderComponent = require('./environments_folder_view');
const EnvironmentsFolderComponent = require('./environments_folder_view');
require('../vue_shared/vue_resource_interceptor');
$(() => {
$(() => {
window.gl = window.gl || {};
window.gl = window.gl || {};
...
...
app/assets/javascripts/environments/folder/environments_folder_view.js.es6
View file @
08234849
...
@@ -4,9 +4,8 @@
...
@@ -4,9 +4,8 @@
const Vue = require('vue');
const Vue = require('vue');
Vue.use(require('vue-resource'));
Vue.use(require('vue-resource'));
const EnvironmentsService = require('../services/environments_service');
const EnvironmentsService = require('../services/environments_service');
const EnvironmentTable = require('./environments_table');
const EnvironmentTable = require('../components/environments_table');
const Store = require('../stores/environments_folder_store');
const Store = require('../stores/environments_store');
require('../../vue_shared/components/table_pagination');
module.exports = Vue.component('environment-folder-view', {
module.exports = Vue.component('environment-folder-view', {
...
@@ -15,27 +14,25 @@ module.exports = Vue.component('environment-folder-view', {
...
@@ -15,27 +14,25 @@ module.exports = Vue.component('environment-folder-view', {
'table-pagination': gl.VueGlPagination,
'table-pagination': gl.VueGlPagination,
},
},
props: {
endpoint: {
type: String,
required: true,
default: '',
},
folderName: {
type: String,
required: true,
default: '',
},
},
data() {
data() {
const environmentsData = document.querySelector('#environments-folder-list-view').dataset;
const store = new Store();
const store = new Store();
const endpoint = `${window.location.pathname}.json`;
return {
return {
store,
store,
endpoint,
state: store.state,
state: store.state,
visibility: 'available',
isLoading: false,
isLoading: false,
cssContainerClass: environmentsData.cssClass,
canCreateDeployment: environmentsData.canCreateDeployment,
canReadEnvironment: environmentsData.canReadEnvironment,
// svgs
commitIconSvg: environmentsData.commitIconSvg,
playIconSvg: environmentsData.playIconSvg,
terminalIconSvg: environmentsData.terminalIconSvg,
// Pagination Properties,
// Pagination Properties,
paginationInformation: {},
paginationInformation: {},
...
@@ -43,6 +40,29 @@ module.exports = Vue.component('environment-folder-view', {
...
@@ -43,6 +40,29 @@ module.exports = Vue.component('environment-folder-view', {
};
};
},
},
computed: {
scope() {
return this.$options.getQueryParameter('scope');
},
canReadEnvironmentParsed() {
return this.$options.convertPermissionToBoolean(this.canReadEnvironment);
},
canCreateDeploymentParsed() {
return this.$options.convertPermissionToBoolean(this.canCreateDeployment);
},
stoppedPath() {
return `${window.location.pathname}?scope=stopped`;
},
availablePath() {
return window.location.pathname;
},
},
/**
/**
* Fetches all the environments and stores them.
* Fetches all the environments and stores them.
* Toggles loading property.
* Toggles loading property.
...
@@ -123,9 +143,12 @@ module.exports = Vue.component('environment-folder-view', {
...
@@ -123,9 +143,12 @@ module.exports = Vue.component('environment-folder-view', {
template: `
template: `
<div :class="cssContainerClass">
<div :class="cssContainerClass">
<div class="top-area">
<div class="top-area">
<h3>FOLDER NAME</h3>
<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 === undefined || scope === 'available' }">
<a :href="
projectEnvironments
Path">
<a :href="
available
Path">
Available
Available
<span class="badge js-available-environments-count">
<span class="badge js-available-environments-count">
{{state.availableCounter}}
{{state.availableCounter}}
...
@@ -133,7 +156,7 @@ module.exports = Vue.component('environment-folder-view', {
...
@@ -133,7 +156,7 @@ module.exports = Vue.component('environment-folder-view', {
</a>
</a>
</li>
</li>
<li v-bind:class="{ 'active' : scope === 'stopped' }">
<li v-bind:class="{ 'active' : scope === 'stopped' }">
<a :href="
projectStoppedEnvironments
Path">
<a :href="
stopped
Path">
Stopped
Stopped
<span class="badge js-stopped-environments-count">
<span class="badge js-stopped-environments-count">
{{state.stoppedCounter}}
{{state.stoppedCounter}}
...
@@ -141,11 +164,6 @@ module.exports = Vue.component('environment-folder-view', {
...
@@ -141,11 +164,6 @@ module.exports = Vue.component('environment-folder-view', {
</a>
</a>
</li>
</li>
</ul>
</ul>
<div v-if="canCreateEnvironmentParsed && !isLoading" class="nav-controls">
<a :href="newEnvironmentPath" class="btn btn-create">
New environment
</a>
</div>
</div>
</div>
<div class="environments-container">
<div class="environments-container">
...
@@ -153,26 +171,6 @@ module.exports = Vue.component('environment-folder-view', {
...
@@ -153,26 +171,6 @@ module.exports = Vue.component('environment-folder-view', {
<i class="fa fa-spinner fa-spin"></i>
<i class="fa fa-spinner fa-spin"></i>
</div>
</div>
<div class="blank-state blank-state-no-icon"
v-if="!isLoading && state.environments.length === 0">
<h2 class="blank-state-title js-blank-state-title">
You don't have any environments right now.
</h2>
<p class="blank-state-text">
Environments are places where code gets deployed, such as staging or production.
<br />
<a :href="helpPagePath">
Read more about environments
</a>
</p>
<a v-if="canCreateEnvironmentParsed"
:href="newEnvironmentPath"
class="btn btn-create js-new-environment-button">
New Environment
</a>
</div>
<div class="table-holder"
<div class="table-holder"
v-if="!isLoading && state.environments.length > 0">
v-if="!isLoading && state.environments.length > 0">
...
...
app/assets/javascripts/environments/stores/environments_folder_store.js.es6
deleted
100644 → 0
View file @
26d18387
require('~/lib/utils/common_utils');
/**
* Environments Folder Store.
*
* Stores received environments that belong to a parent store.
*/
class EnvironmentsFolderStore {
constructor() {
this.state = {};
this.state.environments = [];
this.state.paginationInformation = {};
return this;
}
/**
*
* Stores the received environments.
*
* Each environment has the following schema
* { name: String, size: Number, latest: Object }
*
*
* @param {Array} environments
* @returns {Array}
*/
storeEnvironments(environments = []) {
this.state.environments = environments;
return environments;
}
storePagination(pagination = {}) {
const normalizedHeaders = gl.utils.normalizeHeaders(pagination);
const paginationInformation = {
perPage: parseInt(normalizedHeaders['X-PER-PAGE'], 10),
page: parseInt(normalizedHeaders['X-PAGE'], 10),
total: parseInt(normalizedHeaders['X-TOTAL'], 10),
totalPages: parseInt(normalizedHeaders['X-TOTAL-PAGES'], 10),
nextPage: parseInt(normalizedHeaders['X-NEXT-PAGE'], 10),
previousPage: parseInt(normalizedHeaders['X-PREV-PAGE'], 10),
};
this.state.paginationInformation = paginationInformation;
return paginationInformation;
}
}
module.exports = EnvironmentsFolderStore;
app/views/projects/environments/folder.html.haml
View file @
08234849
...
@@ -5,4 +5,9 @@
...
@@ -5,4 +5,9 @@
-
content_for
:page_specific_javascripts
do
-
content_for
:page_specific_javascripts
do
=
page_specific_javascript_bundle_tag
(
"environments_folder"
)
=
page_specific_javascript_bundle_tag
(
"environments_folder"
)
#environments-folder-list-view
#environments-folder-list-view
{
data:
{
"can-create-deployment"
=>
can?
(
current_user
,
:create_deployment
,
@project
).
to_s
,
"can-read-environment"
=>
can?
(
current_user
,
:read_environment
,
@project
).
to_s
,
"css-class"
=>
container_class
,
"commit-icon-svg"
=>
custom_icon
(
"icon_commit"
),
"terminal-icon-svg"
=>
custom_icon
(
"icon_terminal"
),
"play-icon-svg"
=>
custom_icon
(
"icon_play"
)
}
}
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