Skip to content

Commit

Permalink
feat(edit-content) handle 2 workflows for 1 contenttype
Browse files Browse the repository at this point in the history
  • Loading branch information
oidacra committed Nov 14, 2024
1 parent a9626d9 commit 7e0593f
Show file tree
Hide file tree
Showing 28 changed files with 1,299 additions and 348 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Injectable, inject } from '@angular/core';
import { map, pluck } from 'rxjs/operators';

import { DotCMSResponse } from '@dotcms/dotcms-js';
import { DotCMSWorkflowAction, DotCMSWorkflow } from '@dotcms/dotcms-models';
import { DotCMSWorkflow, DotCMSWorkflowAction, DotCMSWorkflowStep } from '@dotcms/dotcms-models';

export enum DotRenderMode {
LISTING = 'LISTING',
Expand Down Expand Up @@ -51,7 +51,7 @@ export class DotWorkflowsActionsService {

/**
* Returns the workflow actions of the passed contentType
*
* @deprecated
* @param {string} inode
* @param {DotRenderMode} [renderMode]
* @returns {Observable<DotCMSWorkflowAction[]>}
Expand All @@ -75,4 +75,27 @@ export class DotWorkflowsActionsService {
private getWorkFlowId(workflow: DotCMSWorkflow): string {
return workflow && workflow.id;
}

getWorkFlowActions(contentTypeName: string): Observable<
{
scheme: DotCMSWorkflow;
action: DotCMSWorkflowAction;
firstStep: DotCMSWorkflowStep;
}[]
> {
return this.httpClient
.get<
DotCMSResponse<
{
scheme: DotCMSWorkflow;
action: DotCMSWorkflowAction;
firstStep: DotCMSWorkflowStep;
}[]
>
>(`${this.BASE_URL}/defaultactions/contenttype/${contentTypeName}`)
.pipe(
pluck('entity'),
map((res) => res || [])
);
}
}
25 changes: 25 additions & 0 deletions core-web/libs/dotcms-models/src/lib/dot-workflow-action.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ export interface DotCMSWorkflowAction {
showOn: string[];
actionInputs: DotCMSWorkflowInput[];
metadata?: Record<string, string>;
hasArchiveActionlet?: boolean;
hasCommentActionlet?: boolean;
hasDeleteActionlet?: boolean;
hasDestroyActionlet?: boolean;
hasMoveActionletActionlet?: boolean;
hasMoveActionletHasPathActionlet?: boolean;
hasOnlyBatchActionlet?: boolean;
hasPublishActionlet?: boolean;
hasPushPublishActionlet?: boolean;
hasResetActionlet?: boolean;
hasSaveActionlet?: boolean;
hasUnarchiveActionlet?: boolean;
hasUnpublishActionlet?: boolean;
}

export enum DotCMSSystemActionType {
Expand Down Expand Up @@ -58,3 +71,15 @@ export interface DotCMSWorkflowInput {
id: string;
body: any;
}

export interface DotCMSWorkflowStep {
creationDate: number;
enableEscalation: boolean;
escalationAction: null;
escalationTime: number;
id: string;
myOrder: number;
name: string;
resolved: boolean;
schemeId: string;
}
Original file line number Diff line number Diff line change
@@ -1,63 +1,132 @@
@use "variables" as *;

/* Base styles for inline messages */
.p-inline-message {
padding: $spacing-2 $spacing-2;
margin: 0;
border-radius: $border-radius-xs;
border-radius: $border-radius-md;
background: transparent;
border: 1px solid;
}

/* Styles for each type of inline message */
.p-inline-message.p-inline-message-info {
background: #b3e5fc;
border: solid transparent;
border-width: 1px;
color: #01579b;
}
.p-inline-message.p-inline-message-info .p-inline-message-icon {
color: #01579b;
background: transparent;
border-color: $color-palette-blue;
color: $black;
}

.p-inline-message.p-inline-message-success {
background: #c8e6c9;
border: solid transparent;
border-width: 1px;
color: #1b5e20;
}
.p-inline-message.p-inline-message-success .p-inline-message-icon {
color: #1b5e20;
background: transparent;
border-color: $color-palette-green;
color: $black;
}

.p-inline-message.p-inline-message-warn {
background: #ffecb3;
border: solid transparent;
border-width: 1px;
color: #7f6003;
}
.p-inline-message.p-inline-message-warn .p-inline-message-icon {
color: #7f6003;
background: transparent;
border-color: $color-palette-yellow;
color: $black;
}

.p-inline-message.p-inline-message-error {
background: #ffcdd2;
border: solid transparent;
border-width: 1px;
color: #b71c1c;
}
.p-inline-message.p-inline-message-error .p-inline-message-icon {
color: #b71c1c;
background: transparent;
border-color: $color-palette-red;
color: $black;
}
.p-inline-message .p-inline-message-icon {
font-size: $font-size-md;
margin-right: $spacing-1;

/* Base styles for regular messages */
.p-message {
margin: 0;
border-radius: $border-radius-md;
position: relative;
background: transparent !important;
border: 1px solid transparent;

/* Wider left border */
&::before {
content: "";
position: absolute;
left: 0;
top: 0;
height: 100%;
width: 9px;
border-radius: $border-radius-md 0 0 $border-radius-md;
}

.p-message-wrapper {
padding: $spacing-2 $spacing-4;
justify-content: center;
}

.p-message-text {
font-size: $font-size-md;
font-weight: $font-weight-semi-bold;
}

.p-message-icon {
font-size: $font-size-lg;
margin-right: $spacing-1;
}
}
.p-inline-message .p-inline-message-text {
font-size: $font-size-md;

/* Specific styles for each message type */
.p-message.p-message-info {
background: transparent;
border-color: $color-palette-blue;
color: $black;

&::before {
background: $color-palette-blue;
}

.p-message-icon {
color: $color-palette-blue;
}
}
.p-inline-message.p-inline-message-icon-only .p-inline-message-icon {
margin-right: 0;

.p-message.p-message-success {
background: transparent;
border-color: $color-palette-green;
color: $black;

&::before {
background: $color-palette-green;
}

.p-message-icon {
color: $color-palette-green;
}
}

.p-message {
margin: 0;
border-radius: $border-radius-xs;
.p-message.p-message-warn {
background: transparent;
border-color: $color-palette-yellow;
color: $black;

&::before {
background: $color-palette-yellow;
}

.p-message-icon {
color: $color-palette-yellow;
}
}
.p-message .p-message-wrapper {
padding: $spacing-3 $spacing-4;

.p-message.p-message-error {
background: transparent;
border-color: $color-palette-red;
color: $black;

&::before {
background: $color-palette-red;
}

.p-message-icon {
color: $color-palette-red;
}
}

/* Styles for close button */
.p-message .p-message-close {
width: $spacing-5;
height: $spacing-5;
Expand All @@ -67,88 +136,47 @@
background-color 0.2s,
color 0.2s,
box-shadow 0.2s;
}
.p-message .p-message-close:hover {
background: $color-palette-white-op-30;
}
.p-message .p-message-close:focus {
outline: 0 none;
outline-offset: 0;
box-shadow: none;
}
.p-message.p-message-info {
background: #b3e5fc;
border: solid transparent;
border-width: 0 0 0 0;
color: #01579b;
}
.p-message.p-message-info .p-message-icon {
color: #01579b;
}
.p-message.p-message-info .p-message-close {
color: #01579b;
}
.p-message.p-message-success {
background: rgba(245, 253, 248, 1);
border: solid transparent;
border-width: 0 0 0 0;
color: $black;

.pi {
color: rgba(62, 217, 122, 1);
&:hover {
background: $color-palette-white-op-30;
}
}
.p-message.p-message-success {
border: solid rgba(62, 217, 122, 1);
border-width: 0 0 0 0;
}
.p-message.p-message-success .p-message-icon {
color: rgba(62, 217, 122, 1);
}
.p-message.p-message-success .p-message-close {
color: rgba(62, 217, 122, 1);
}
.p-messages.p-message-border-y:has(.p-message.p-message-success) {
border: 0 solid rgba(62, 217, 122, 1);
border-top-width: 1px;
border-bottom-width: 1px;
}

.p-message.p-message-warn {
background: #ffecb3;
border: solid transparent;
border-width: 0 0 0 0;
color: #7f6003;
}
.p-message.p-message-warn .p-message-icon {
color: #7f6003;
}
.p-message.p-message-warn .p-message-close {
color: #7f6003;
}
.p-message.p-message-error {
background: #ffcdd2;
border: solid transparent;
border-width: 0 0 0 0;
color: #b71c1c;
&:focus {
outline: 0 none;
outline-offset: 0;
box-shadow: none;
}
}
.p-message.p-message-error .p-message-icon {
color: #b71c1c;

/* Styles for centered messages */
.p-message.message-centered .p-message-wrapper {
justify-content: center;
}
.p-message.p-message-error .p-message-close {
color: #b71c1c;

/* Text and details */
.p-message {
.p-message-summary {
font-weight: 700;
}

.p-message-detail {
margin-left: $spacing-1;
}
}
.p-message .p-message-text {
font-size: $font-size-md;

/* Styles for Warning text */
.p-message.p-message-warn .p-message-text:has(> span)::before {
content: "Warning ";
font-weight: $font-weight-semi-bold;
}
.p-message .p-message-icon {
font-size: $font-size-lg;
margin-right: $spacing-1;
}
.p-message .p-message-summary {
font-weight: 700;
}
.p-message .p-message-detail {
margin-left: $spacing-1;

/* Styles for links inside messages */
.p-message .p-message-text a {
color: var(--primary-color);
text-decoration: none;
margin-left: 0.25rem;

&:hover {
text-decoration: underline;
}
}
Loading

0 comments on commit 7e0593f

Please sign in to comment.