Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
c12a7896
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c12a7896
编写于
10月 08, 2018
作者:
W
Winnie Hellmann
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Display scheduled job actions on environments list
上级
2dd7339c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
45 addition
and
43 deletion
+45
-43
app/assets/javascripts/environments/components/environment_actions.vue
...vascripts/environments/components/environment_actions.vue
+25
-5
app/assets/javascripts/environments/components/environment_item.vue
.../javascripts/environments/components/environment_item.vue
+20
-33
app/assets/stylesheets/pages/environments.scss
app/assets/stylesheets/pages/environments.scss
+0
-5
未找到文件。
app/assets/javascripts/environments/components/environment_actions.vue
浏览文件 @
c12a7896
<
script
>
import
{
s__
,
sprintf
}
from
'
~/locale
'
;
import
{
formatTime
}
from
'
~/lib/utils/datetime_utility
'
;
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
import
eventHub
from
'
../event_hub
'
;
import
tooltip
from
'
../../vue_shared/directives/tooltip
'
;
...
...
@@ -28,10 +30,19 @@ export default {
},
},
methods
:
{
onClickAction
(
endpoint
)
{
onClickAction
(
action
)
{
if
(
action
.
scheduledAt
)
{
const
confirmationMessage
=
sprintf
(
s__
(
"
DelayedJobs|Are you sure you want to run %{jobName} immediately? This job will run automatically after it's timer finishes.
"
),
{
jobName
:
action
.
name
});
// https://gitlab.com/gitlab-org/gitlab-ce/issues/52099
// eslint-disable-next-line no-alert
if
(
!
window
.
confirm
(
confirmationMessage
))
{
return
;
}
}
this
.
isLoading
=
true
;
eventHub
.
$emit
(
'
postAction
'
,
{
endpoint
});
eventHub
.
$emit
(
'
postAction
'
,
{
endpoint
:
action
.
playPath
});
},
isActionDisabled
(
action
)
{
...
...
@@ -41,6 +52,11 @@ export default {
return
!
action
.
playable
;
},
remainingTime
(
action
)
{
const
remainingMilliseconds
=
new
Date
(
action
.
scheduledAt
).
getTime
()
-
Date
.
now
();
return
formatTime
(
Math
.
max
(
0
,
remainingMilliseconds
));
},
},
};
</
script
>
...
...
@@ -77,12 +93,16 @@ export default {
:class=
"
{ disabled: isActionDisabled(action) }"
:disabled="isActionDisabled(action)"
type="button"
class="js-manual-action-link no-btn btn"
@click="onClickAction(action
.play_path
)"
class="js-manual-action-link no-btn btn
d-flex align-items-center
"
@click="onClickAction(action)"
>
<span>
<span
class=
"flex-fill"
>
{{
action
.
name
}}
</span>
<span
v-if=
"action.scheduledAt"
>
<icon
name=
"clock"
/>
{{
remainingTime
(
action
)
}}
</span>
</button>
</li>
</ul>
...
...
app/assets/javascripts/environments/components/environment_item.vue
浏览文件 @
c12a7896
...
...
@@ -12,6 +12,7 @@ import TerminalButtonComponent from './environment_terminal_button.vue';
import
MonitoringButtonComponent
from
'
./environment_monitoring.vue
'
;
import
CommitComponent
from
'
../../vue_shared/components/commit.vue
'
;
import
eventHub
from
'
../event_hub
'
;
import
{
convertObjectPropsToCamelCase
}
from
'
~/lib/utils/common_utils
'
;
/**
* Envrionment Item Component
...
...
@@ -71,21 +72,6 @@ export default {
return
false
;
},
/**
* Verifies is the given environment has manual actions.
* Used to verify if we should render them or nor.
*
* @returns {Boolean|Undefined}
*/
hasManualActions
()
{
return
(
this
.
model
&&
this
.
model
.
last_deployment
&&
this
.
model
.
last_deployment
.
manual_actions
&&
this
.
model
.
last_deployment
.
manual_actions
.
length
>
0
);
},
/**
* Checkes whether the environment is protected.
* (`is_protected` currently only set in EE)
...
...
@@ -152,23 +138,24 @@ export default {
return
''
;
},
/**
* Returns the manual actions with the name parsed.
*
* @returns {Array.<Object>|Undefined}
*/
manualActions
()
{
if
(
this
.
hasManualActions
)
{
return
this
.
model
.
last_deployment
.
manual_actions
.
map
(
action
=>
{
const
parsedAction
=
{
name
:
humanize
(
action
.
name
),
play_path
:
action
.
play_path
,
playable
:
action
.
playable
,
};
return
parsedAction
;
});
actions
()
{
if
(
!
this
.
model
||
!
this
.
model
.
last_deployment
)
{
return
[];
}
const
{
manualActions
,
scheduledActions
}
=
convertObjectPropsToCamelCase
(
this
.
model
.
last_deployment
,
{
deep
:
true
},
);
let
combinedActions
=
[];
if
(
this
.
canCreateDeployment
)
{
combinedActions
=
combinedActions
.
concat
(
manualActions
||
[]);
}
return
[];
combinedActions
=
combinedActions
.
concat
(
scheduledActions
||
[]);
return
combinedActions
.
map
(
action
=>
({
...
action
,
name
:
humanize
(
action
.
name
),
}));
},
/**
...
...
@@ -624,8 +611,8 @@ export default {
/>
<actions-component
v-if=
"
hasManualActions && canCreateDeployment
"
:actions=
"
manualA
ctions"
v-if=
"
actions.length > 0
"
:actions=
"
a
ctions"
/>
<terminal-button-component
...
...
app/assets/stylesheets/pages/environments.scss
浏览文件 @
c12a7896
...
...
@@ -44,11 +44,6 @@
margin
:
0
;
}
.icon-play
{
height
:
13px
;
width
:
12px
;
}
.external-url
,
.dropdown-new
{
color
:
$gl-text-color-secondary
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录