mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-10-21 21:44:08 +00:00
Refactor JSON and SDK fields (#3968)
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
|
||||
<div class="flex flex-row items-center ml-auto gap-x-2">
|
||||
<IconButton
|
||||
v-if="step?.end_time !== undefined && hasLogs"
|
||||
v-if="step?.finished !== undefined && hasLogs"
|
||||
:is-loading="downloadInProgress"
|
||||
:title="$t('repo.pipeline.actions.log_download')"
|
||||
class="!hover:bg-white !hover:bg-opacity-10"
|
||||
@@ -21,14 +21,14 @@
|
||||
@click="download"
|
||||
/>
|
||||
<IconButton
|
||||
v-if="step?.end_time !== undefined && hasLogs && hasPushPermission"
|
||||
v-if="step?.finished !== undefined && hasLogs && hasPushPermission"
|
||||
:title="$t('repo.pipeline.actions.log_delete')"
|
||||
class="!hover:bg-white !hover:bg-opacity-10"
|
||||
icon="trash"
|
||||
@click="deleteLogs"
|
||||
/>
|
||||
<IconButton
|
||||
v-if="step?.end_time === undefined"
|
||||
v-if="step?.finished === undefined"
|
||||
:title="
|
||||
autoScroll ? $t('repo.pipeline.actions.log_auto_scroll_off') : $t('repo.pipeline.actions.log_auto_scroll')
|
||||
"
|
||||
@@ -89,13 +89,13 @@
|
||||
|
||||
<div class="m-auto text-xl text-wp-text-alt-100">
|
||||
<span v-if="step?.state === 'skipped'">{{ $t('repo.pipeline.actions.canceled') }}</span>
|
||||
<span v-else-if="!step?.start_time">{{ $t('repo.pipeline.step_not_started') }}</span>
|
||||
<span v-else-if="!step?.started">{{ $t('repo.pipeline.step_not_started') }}</span>
|
||||
<div v-else-if="!loadedLogs">{{ $t('repo.pipeline.loading') }}</div>
|
||||
<div v-else-if="log?.length === 0">{{ $t('repo.pipeline.no_logs') }}</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="step?.end_time !== undefined"
|
||||
v-if="step?.finished !== undefined"
|
||||
class="flex items-center w-full bg-wp-code-100 text-md text-wp-code-text-alt-100 p-4 font-bold"
|
||||
>
|
||||
<PipelineStatusIcon :status="step.state" class="!h-4 !w-4" />
|
||||
@@ -350,7 +350,7 @@ watch(stepSlug, async () => {
|
||||
|
||||
watch(step, async (newStep, oldStep) => {
|
||||
if (oldStep?.name === newStep?.name) {
|
||||
if (oldStep?.end_time !== newStep?.end_time && autoScroll.value) {
|
||||
if (oldStep?.finished !== newStep?.finished && autoScroll.value) {
|
||||
scrollDown();
|
||||
}
|
||||
|
||||
|
@@ -19,8 +19,8 @@ const workflow = toRef(props, 'workflow');
|
||||
const { durationAsNumber } = useDate();
|
||||
|
||||
const durationRaw = computed(() => {
|
||||
const start = (step.value ? step.value?.start_time : workflow.value?.start_time) || 0;
|
||||
const end = (step.value ? step.value?.end_time : workflow.value?.end_time) || 0;
|
||||
const start = (step.value ? step.value?.started : workflow.value?.started) || 0;
|
||||
const end = (step.value ? step.value?.finished : workflow.value?.finished) || 0;
|
||||
|
||||
if (end === 0 && start === 0) {
|
||||
return undefined;
|
||||
@@ -43,5 +43,5 @@ const duration = computed(() => {
|
||||
|
||||
return durationAsNumber(durationElapsed.value || 0);
|
||||
});
|
||||
const started = computed(() => (step.value ? step.value?.start_time : workflow.value?.start_time) !== undefined);
|
||||
const started = computed(() => (step.value ? step.value?.started : workflow.value?.started) !== undefined);
|
||||
</script>
|
||||
|
@@ -82,7 +82,7 @@
|
||||
<PipelineStatusIcon :status="workflow.state" class="!h-4 !w-4" />
|
||||
<span class="truncate">{{ workflow.name }}</span>
|
||||
<PipelineStepDuration
|
||||
v-if="workflow.start_time !== workflow.end_time"
|
||||
v-if="workflow.started !== workflow.finished"
|
||||
:workflow="workflow"
|
||||
class="mr-1 pr-2px"
|
||||
/>
|
||||
|
@@ -14,7 +14,7 @@ export default (pipeline: Ref<Pipeline | undefined>) => {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const start = pipeline.value.created_at || 0;
|
||||
const start = pipeline.value.created || 0;
|
||||
|
||||
return start * 1000;
|
||||
});
|
||||
@@ -44,8 +44,8 @@ export default (pipeline: Ref<Pipeline | undefined>) => {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const start = pipeline.value.started_at || 0;
|
||||
const end = pipeline.value.finished_at || pipeline.value.updated_at || 0;
|
||||
const start = pipeline.value.started || 0;
|
||||
const end = pipeline.value.finished || pipeline.value.updated || 0;
|
||||
|
||||
if (start === 0 || end === 0) {
|
||||
return 0;
|
||||
@@ -109,7 +109,7 @@ export default (pipeline: Ref<Pipeline | undefined>) => {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const start = pipeline.value.created_at || 0;
|
||||
const start = pipeline.value.created || 0;
|
||||
|
||||
return toLocaleString(new Date(start * 1000));
|
||||
});
|
||||
|
@@ -25,16 +25,16 @@ export interface Pipeline {
|
||||
errors?: PipelineError[];
|
||||
|
||||
// When the pipeline request was received.
|
||||
created_at: number;
|
||||
created: number;
|
||||
|
||||
// When the pipeline was updated last time in database.
|
||||
updated_at: number;
|
||||
updated: number;
|
||||
|
||||
// When the pipeline began execution.
|
||||
started_at: number;
|
||||
started: number;
|
||||
|
||||
// When the pipeline was finished.
|
||||
finished_at: number;
|
||||
finished: number;
|
||||
|
||||
// Where the deployment should go.
|
||||
deploy_to: string;
|
||||
@@ -76,13 +76,9 @@ export interface Pipeline {
|
||||
// This url will point to the repository state associated with the pipeline's commit.
|
||||
forge_url: string;
|
||||
|
||||
signed: boolean;
|
||||
|
||||
verified: boolean;
|
||||
|
||||
reviewed_by: string;
|
||||
|
||||
reviewed_at: number;
|
||||
reviewed: number;
|
||||
|
||||
// The steps associated with this pipeline.
|
||||
// A pipeline will have multiple steps if a matrix pipeline was used or if a rebuild was requested.
|
||||
@@ -110,8 +106,8 @@ export interface PipelineWorkflow {
|
||||
name: string;
|
||||
state: PipelineStatus;
|
||||
environ?: Record<string, string>;
|
||||
start_time?: number;
|
||||
end_time?: number;
|
||||
started?: number;
|
||||
finished?: number;
|
||||
agent_id?: number;
|
||||
error?: string;
|
||||
children: PipelineStep[];
|
||||
@@ -126,8 +122,8 @@ export interface PipelineStep {
|
||||
name: string;
|
||||
state: PipelineStatus;
|
||||
exit_code: number;
|
||||
start_time?: number;
|
||||
end_time?: number;
|
||||
started?: number;
|
||||
finished?: number;
|
||||
error?: string;
|
||||
type?: StepType;
|
||||
}
|
||||
|
@@ -46,7 +46,7 @@ export function isStepRunning(step: PipelineStep): boolean {
|
||||
* @returns {number} 0 if created at the same time, < 0 if b was create before a, > 0 otherwise
|
||||
*/
|
||||
export function comparePipelines(a: Pipeline, b: Pipeline): number {
|
||||
return (b.created_at || -1) - (a.created_at || -1);
|
||||
return (b.created || -1) - (a.created || -1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user