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
e0b9ec8e
Commit
e0b9ec8e
authored
Apr 24, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use vue files for vue components.
Remove from globalnamespace
parent
b8988cb6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
101 additions
and
83 deletions
+101
-83
app/assets/javascripts/environments/components/environment.vue
...ssets/javascripts/environments/components/environment.vue
+85
-71
app/assets/javascripts/environments/environments_bundle.js
app/assets/javascripts/environments/environments_bundle.js
+10
-10
spec/javascripts/environments/environment_spec.js
spec/javascripts/environments/environment_spec.js
+6
-2
No files found.
app/assets/javascripts/environments/components/environment.
js
→
app/assets/javascripts/environments/components/environment.
vue
View file @
e0b9ec8e
<
script
>
/* eslint-disable no-new */
/* eslint-disable no-new */
/* global Flash */
/* global Flash */
import
Vue
from
'
vue
'
;
import
EnvironmentsService
from
'
../services/environments_service
'
;
import
EnvironmentsService
from
'
../services/environments_service
'
;
import
EnvironmentTable
from
'
./environments_table.vue
'
;
import
EnvironmentTable
from
'
./environments_table.vue
'
;
import
EnvironmentsStore
from
'
../stores/environments_store
'
;
import
EnvironmentsStore
from
'
../stores/environments_store
'
;
...
@@ -8,7 +9,7 @@ import TablePaginationComponent from '../../vue_shared/components/table_paginati
...
@@ -8,7 +9,7 @@ import TablePaginationComponent from '../../vue_shared/components/table_paginati
import
'
../../lib/utils/common_utils
'
;
import
'
../../lib/utils/common_utils
'
;
import
eventHub
from
'
../event_hub
'
;
import
eventHub
from
'
../event_hub
'
;
export
default
Vue
.
component
(
'
environment-component
'
,
{
export
default
{
components
:
{
components
:
{
'
environment-table
'
:
EnvironmentTable
,
'
environment-table
'
:
EnvironmentTable
,
...
@@ -162,78 +163,91 @@ export default Vue.component('environment-component', {
...
@@ -162,78 +163,91 @@ export default Vue.component('environment-component', {
});
});
},
},
},
},
};
template
:
`
</
script
>
<div :class="cssContainerClass">
<
template
>
<div class="top-area">
<div
:class=
"cssContainerClass"
>
<ul v-if="!isLoading" class="nav-links">
<div
class=
"top-area"
>
<li v-bind:class="{ 'active': scope === null || scope === 'available' }">
<ul
<a :href="projectEnvironmentsPath">
v-if=
"!isLoading"
Available
class=
"nav-links"
>
<span class="badge js-available-environments-count">
<li
:class=
"
{ 'active': scope === null || scope === 'available' }">
{{state.availableCounter}}
<a
:href=
"projectEnvironmentsPath"
>
</span>
Available
</a>
<span
class=
"badge js-available-environments-count"
>
</li>
{{
state
.
availableCounter
}}
<li v-bind:class="{ 'active' : scope === 'stopped' }">
</span>
<a :href="projectStoppedEnvironmentsPath">
</a>
Stopped
</li>
<span class="badge js-stopped-environments-count">
<li
:class=
"
{ 'active' : scope === 'stopped' }">
{{state.stoppedCounter}}
<a
:href=
"projectStoppedEnvironmentsPath"
>
</span>
Stopped
</a>
<span
class=
"badge js-stopped-environments-count"
>
</li>
{{
state
.
stoppedCounter
}}
</ul>
</span>
<div v-if="canCreateEnvironmentParsed && !isLoading" class="nav-controls">
<a :href="newEnvironmentPath" class="btn btn-create">
New environment
</a>
</a>
</div>
</li>
</ul>
<div
v-if=
"canCreateEnvironmentParsed && !isLoading"
class=
"nav-controls"
>
<a
:href=
"newEnvironmentPath"
class=
"btn btn-create"
>
New environment
</a>
</div>
</div>
<div
class=
"content-list environments-container"
>
<div
class=
"environments-list-loading text-center"
v-if=
"isLoading"
>
<i
class=
"fa fa-spinner fa-spin"
aria-hidden=
"true"
/>
</div>
</div>
<div class="content-list environments-container">
<div
<div class="environments-list-loading text-center" v-if="isLoading">
class=
"blank-state blank-state-no-icon"
<i class="fa fa-spinner fa-spin" aria-hidden="true"></i>
v-if=
"!isLoading && state.environments.length === 0"
>
</div>
<h2
class=
"blank-state-title js-blank-state-title"
>
You don't have any environments right now.
<div class="blank-state blank-state-no-icon"
</h2>
v-if="!isLoading && state.environments.length === 0">
<p
class=
"blank-state-text"
>
<h2 class="blank-state-title js-blank-state-title">
Environments are places where code gets deployed, such as staging or production.
You don't have any environments right now.
<br
/>
</h2>
<a
:href=
"helpPagePath"
>
<p class="blank-state-text">
Read more about environments
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>
</a>
</div>
</p>
<div class="table-holder"
<a
v-if="!isLoading && state.environments.length > 0">
v-if=
"canCreateEnvironmentParsed"
:href=
"newEnvironmentPath"
<environment-table
class=
"btn btn-create js-new-environment-button"
>
:environments="state.environments"
New Environment
:can-create-deployment="canCreateDeploymentParsed"
</a>
:can-read-environment="canReadEnvironmentParsed"
:toggleDeployBoard="toggleDeployBoard"
:store="store"
:service="service"
:is-loading-folder-content="isLoadingFolderContent" />
</div>
<table-pagination v-if="state.paginationInformation && state.paginationInformation.totalPages > 1"
:change="changePage"
:pageInfo="state.paginationInformation">
</table-pagination>
</div>
</div>
<div
class=
"table-holder"
v-if=
"!isLoading && state.environments.length > 0"
>
<environment-table
:environments=
"state.environments"
:can-create-deployment=
"canCreateDeploymentParsed"
:can-read-environment=
"canReadEnvironmentParsed"
:toggleDeployBoard=
"toggleDeployBoard"
:store=
"store"
:service=
"service"
:is-loading-folder-content=
"isLoadingFolderContent"
/>
</div>
<table-pagination
v-if=
"state.paginationInformation && state.paginationInformation.totalPages > 1"
:change=
"changePage"
:pageInfo=
"state.paginationInformation"
/>
</div>
</div>
`
,
</div>
});
</
template
>
app/assets/javascripts/environments/environments_bundle.js
View file @
e0b9ec8e
import
EnvironmentsComponent
from
'
./components/environment
'
;
import
Vue
from
'
vue
'
;
import
EnvironmentsComponent
from
'
./components/environment.vue
'
;
$
(()
=>
{
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
window
.
gl
=
window
.
gl
||
{};
// eslint-disable-next-line no-new
new
Vue
({
if
(
gl
.
EnvironmentsListApp
)
{
el
:
'
#environments-list-view
'
,
gl
.
EnvironmentsListApp
.
$destroy
(
true
);
components
:
{
}
'
environments-table-app
'
:
EnvironmentsComponent
,
},
gl
.
EnvironmentsListApp
=
new
EnvironmentsComponent
({
render
:
createElement
=>
createElement
(
'
environments-table-app
'
),
el
:
document
.
querySelector
(
'
#environments-list-view
'
),
});
});
});
});
spec/javascripts/environments/environment_spec.js
View file @
e0b9ec8e
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
'
~/flash
'
;
import
'
~/flash
'
;
import
EnvironmentsComponent
from
'
~/environments/components/environment
'
;
import
environmentsComponent
from
'
~/environments/components/environment.vue
'
;
import
{
environment
,
folder
}
from
'
./mock_data
'
;
import
{
environment
,
folder
}
from
'
./mock_data
'
;
describe
(
'
Environment
'
,
()
=>
{
describe
(
'
Environment
'
,
()
=>
{
preloadFixtures
(
'
static/environments/environments.html.raw
'
);
preloadFixtures
(
'
static/environments/environments.html.raw
'
);
let
EnvironmentsComponent
;
let
component
;
let
component
;
beforeEach
(()
=>
{
beforeEach
(()
=>
{
loadFixtures
(
'
static/environments/environments.html.raw
'
);
loadFixtures
(
'
static/environments/environments.html.raw
'
);
EnvironmentsComponent
=
Vue
.
extend
(
environmentsComponent
);
});
});
describe
(
'
successfull request
'
,
()
=>
{
describe
(
'
successfull request
'
,
()
=>
{
...
@@ -31,9 +34,10 @@ describe('Environment', () => {
...
@@ -31,9 +34,10 @@ describe('Environment', () => {
});
});
it
(
'
should render the empty state
'
,
(
done
)
=>
{
it
(
'
should render the empty state
'
,
(
done
)
=>
{
console
.
log
(
EnvironmentsComponent
);
component
=
new
EnvironmentsComponent
({
component
=
new
EnvironmentsComponent
({
el
:
document
.
querySelector
(
'
#environments-list-view
'
),
el
:
document
.
querySelector
(
'
#environments-list-view
'
),
});
})
.
$mount
()
;
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
expect
(
...
...
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