Skip to content

Commit

Permalink
Merge branch 'master' into issue--28941-Improve-Password-Validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Neehakethi authored Aug 22, 2024
2 parents 0755a4d + 873c6a7 commit 6047df2
Show file tree
Hide file tree
Showing 13 changed files with 6,919 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
color: $color-palette-gray-500;
margin-top: 1rem;
gap: 0.65rem;
font-size: $dot-editor-size;
font-size: $font-size-md;

.error-message {
color: $error;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
.url-container {
cursor: pointer;
white-space: nowrap;
font-size: $dot-editor-size;
font-size: $font-size-md;
width: 100%;
word-wrap: normal;
display: flex;
Expand All @@ -52,7 +52,7 @@
display: flex;
gap: 0.2 * $dot-editor-size;
min-width: 100%;
font-size: $dot-editor-size;
font-size: $font-size-md;

.checkbox-container {
cursor: pointer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

h3 {
text-transform: uppercase;
font-size: $dot-editor-size;
font-size: $font-size-md;
margin: (0.5 * $dot-editor-size) $dot-editor-size;
color: #999999;
}
Expand Down
1 change: 1 addition & 0 deletions core-web/libs/dotcms-scss/jsp/scss/dotcms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ legend,
input,
button,
textarea,
select,
p,
blockquote,
th,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,40 +245,82 @@ describe('DotEmaDialogStoreService', () => {
});
});

it('should update the state to show dialog for a translation', () => {
spectator.service.translatePage({
page: {
inode: '123',
liveInode: '1234',
stInode: '12345',
live: true,
title: 'test'
} as DotPage,
newLanguage: 2
});
describe('Dialog for translation', () => {
it('should update the state to show dialog for a translation', () => {
spectator.service.translatePage({
page: {
inode: '123',
liveInode: '1234',
stInode: '12345',
live: true,
title: 'test'
} as DotPage,
newLanguage: 2
});

const queryParams = new URLSearchParams({
p_p_id: 'content',
p_p_action: '1',
p_p_state: 'maximized',
angularCurrentPortlet: 'edit-page',
_content_sibbling: '1234',
_content_cmd: 'edit',
p_p_mode: 'view',
_content_sibblingStructure: '1234',
_content_struts_action: '/ext/contentlet/edit_contentlet',
inode: '',
lang: '2',
populateaccept: 'true',
reuseLastLang: 'true'
const queryParams = new URLSearchParams({
p_p_id: 'content',
p_p_action: '1',
p_p_state: 'maximized',
angularCurrentPortlet: 'edit-page',
_content_sibbling: '123',
_content_cmd: 'edit',
p_p_mode: 'view',
_content_sibblingStructure: '123',
_content_struts_action: '/ext/contentlet/edit_contentlet',
inode: '',
lang: '2',
populateaccept: 'true',
reuseLastLang: 'true'
});

spectator.service.dialogState$.subscribe((state) => {
expect(state).toEqual({
url: LAYOUT_URL + '?' + queryParams.toString(),
status: DialogStatus.LOADING,
header: 'test',
type: 'content'
});
});
});

spectator.service.dialogState$.subscribe((state) => {
expect(state).toEqual({
url: LAYOUT_URL + '?' + queryParams.toString(),
status: DialogStatus.LOADING,
header: 'test',
type: 'content'
it('should update the state to show dialog for a translation with working inode', () => {
spectator.service.translatePage({
page: {
inode: '123',
liveInode: '1234',
stInode: '12345',
live: true,
title: 'test',
working: true,
workingInode: '56789'
} as DotPage,
newLanguage: 2
});

const queryParams = new URLSearchParams({
p_p_id: 'content',
p_p_action: '1',
p_p_state: 'maximized',
angularCurrentPortlet: 'edit-page',
_content_sibbling: '56789',
_content_cmd: 'edit',
p_p_mode: 'view',
_content_sibblingStructure: '56789',
_content_struts_action: '/ext/contentlet/edit_contentlet',
inode: '',
lang: '2',
populateaccept: 'true',
reuseLastLang: 'true'
});

spectator.service.dialogState$.subscribe((state) => {
expect(state).toEqual({
url: LAYOUT_URL + '?' + queryParams.toString(),
status: DialogStatus.LOADING,
header: 'test',
type: 'content'
});
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,20 +309,17 @@ export class DotEmaDialogStore extends ComponentStore<EditEmaDialogState> {
}

private createTranslatePageUrl(page: DotPage, newLanguage: number | string) {
const isLive = page.live;
const pageLiveInode = page.liveInode;
const iNode = page.inode;
const stInode = page.stInode;

const { working, workingInode, inode } = page;
const pageInode = working ? workingInode : inode;
const queryParams = new URLSearchParams({
p_p_id: 'content',
p_p_action: '1',
p_p_state: 'maximized',
angularCurrentPortlet: 'edit-page',
_content_sibbling: isLive ? pageLiveInode : iNode,
_content_sibbling: pageInode,
_content_cmd: 'edit',
p_p_mode: 'view',
_content_sibblingStructure: isLive ? pageLiveInode : stInode,
_content_sibblingStructure: pageInode,
_content_struts_action: '/ext/contentlet/edit_contentlet',
inode: '',
lang: newLanguage.toString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ export interface DotPage {
live: boolean;
liveInode?: string;
stInode?: string;
working?: boolean;
workingInode?: string;
}

export interface DotDeviceWithIcon extends DotDevice {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
.p-card-title {
flex-grow: 1;
h2 {
font-size: $dot-editor-size;
font-size: $font-size-md;
line-height: 140%;
margin: 0;
overflow: hidden;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package com.dotcms.ai.workflow;

import com.dotcms.ai.app.ConfigService;
import com.dotcms.ai.api.ImageAPI;
import com.dotcms.ai.api.OpenAIImageAPIImpl;
import com.dotcms.ai.app.ConfigService;
import com.dotcms.ai.util.VelocityContextFactory;
import com.dotcms.api.system.event.message.MessageSeverity;
import com.dotcms.api.system.event.message.MessageType;
Expand All @@ -28,6 +27,7 @@
import org.apache.velocity.context.Context;

import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.util.List;
import java.util.Map;
import java.util.Optional;
Expand Down Expand Up @@ -120,15 +120,15 @@ public void run() {
.onFailure(e -> Logger.warn(OpenAIGenerateImageRunner.class, "error generating image:" + e))
.getOrElse(JSONObject::new);

final String tempFile = resp.optString("response");
if (UtilMethods.isEmpty(tempFile)) {
final String tempFile = resp.optString("tempFile");
if (UtilMethods.isEmpty(tempFile) && !new File(tempFile).exists()) {
Logger.warn(
this.getClass(),
"Unable to generate image for contentlet: " + workingContentlet.getTitle());
return;
}

contentlet.setProperty(fieldToTry.get().variable(), tempFile);
contentlet.setProperty(fieldToTry.get().variable(), new File(tempFile));
} catch (Exception e) {
handleError(e, user);
} finally{
Expand Down
11 changes: 6 additions & 5 deletions dotCMS/src/main/webapp/html/css/dijit-dotcms/dotcms.css
Original file line number Diff line number Diff line change
Expand Up @@ -3844,7 +3844,7 @@
color: #ffffff;
line-height: 2.5rem;
margin: 0;
font-size: 1.25rem;
font-size: 1rem;
}
.dijitDropDownActionButton .dijitButtonNode {
height: 2.5rem;
Expand Down Expand Up @@ -8829,7 +8829,7 @@ Styles for commons fields along the backend

.lineDividerTitle {
color: #6c7389;
font-size: 1.5rem;
font-size: 1.25rem;
border-bottom: 1px solid #d1d4db;
padding-bottom: 1rem;
margin: 3rem 0 1.5rem;
Expand Down Expand Up @@ -9358,7 +9358,7 @@ dd .buttonCaption {
}
.calendar-events .portlet-toolbar__info {
flex: 1 0 auto;
font-size: 1.25rem;
font-size: 1rem;
justify-content: center;
}

Expand Down Expand Up @@ -10141,7 +10141,7 @@ a.category_higlighted, a.tag_higlighted {

.nameText {
align-self: center;
font-size: 1.25rem;
font-size: 1rem;
font-weight: normal;
}

Expand Down Expand Up @@ -10259,7 +10259,7 @@ a.category_higlighted, a.tag_higlighted {
}

.fullUserName {
font-size: 1.25rem;
font-size: 1rem;
font-weight: bold;
margin-bottom: 0.5rem;
padding-bottom: 0;
Expand Down Expand Up @@ -11234,6 +11234,7 @@ legend,
input,
button,
textarea,
select,
p,
blockquote,
th,
Expand Down
5 changes: 0 additions & 5 deletions dotCMS/src/main/webapp/html/portlet/ext/dotai/dotai.css
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@


input[type="text"] {
font-size: 1rem;
padding: 10px;
margin-top: -10px;
border-color: var(--color-palette-primary-op-20);
Expand All @@ -298,7 +297,6 @@ input[type="text"]:focus {
}

input[type="number"] {
font-size: 1rem;
padding: 10px;
min-width: 100px;
margin-top: -10px;
Expand Down Expand Up @@ -337,7 +335,6 @@ input[type="radio"]:hover {
}

textarea {
font-size: 1rem;
padding: 10px;
margin-top: -10px;
border-color: var(--color-palette-primary-op-20);
Expand All @@ -353,7 +350,6 @@ textarea:focus {
}

select {
font-size: 1rem;
padding: 10px;
margin-top: -10px;
border-color: var(--color-palette-primary-op-20);
Expand All @@ -370,7 +366,6 @@ select:focus {
}

.button {
font-size: 1rem;
padding: 20px 40px;
border: 1px solid #9D9D9D;
border-radius: .25em;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.junit.BeforeClass;
import org.junit.Test;

import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -85,7 +86,8 @@ public ImageAPI getImageAPI(Object... initArguments) {
@Override
public JSONObject sendTextPrompt(String prompt) {
return new JSONObject("{\n" +
" \"response\":\"image_id123\"\n" +
" \"response\":\"image_id123\",\n" +
" \"tempFile\":\"image_id123\"\n" +
"}");
}

Expand Down Expand Up @@ -215,9 +217,9 @@ OpenAIParams.FIELD_TO_WRITE.key, new WorkflowActionClassParameter("image")

final Object bodyObject = contentlet.get("image");
Assert.assertNotNull("Body returned can not be null",bodyObject);
Assert.assertTrue("Body returned should be a String",bodyObject instanceof CharSequence);
final CharSequence body = (CharSequence) bodyObject;
Assert.assertEquals("Body returned should be not empty", body, "image_id123");
Assert.assertTrue("Body returned should be a String",bodyObject instanceof File);
final File body = (File) bodyObject;
Assert.assertEquals("Body returned should be not empty", body.getName(), "image_id123");
}

}
Loading

0 comments on commit 6047df2

Please sign in to comment.