Added more tests files

Fixed asset page should show all domains
Fixed domain assets should not be shown as global
Improve delete modal
Remove preview icon background colors
This commit is contained in:
Ronni Skansing
2025-09-20 11:47:20 +02:00
parent 4c8cbff1b8
commit bb51d36ae5
9 changed files with 16 additions and 13 deletions

View File

@@ -57,7 +57,7 @@ func (r *Asset) GetAllByDomainAndContext(
db = db.
Joins("left join domains on domains.id = assets.domain_id").
Select(r.joinSelectString()).
Where("(assets.company_id = ? OR assets.company_id IS NULL) AND (domain_id = ? OR domain_id IS NULL)", companyID, domainID)
Where("(assets.company_id = ? OR assets.company_id IS NULL) AND domain_id = ?", companyID, domainID)
} else {
db.Where("assets.company_id = ?", companyID)
}
@@ -103,7 +103,7 @@ func (r *Asset) GetAllByGlobalContext(
}
var dbModels []*database.Asset
dbRes := db.
Where("company_id IS NULL").
Where("company_id IS NULL AND domain_id IS NULL").
Find(&dbModels)
if dbRes.Error != nil {

View File

@@ -0,0 +1 @@
Hi {{.FirstName}} Welcome to The Phishing Club! We are excited to have you here. Click <a href='{{.URL}}'>here</a> to get started.

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@@ -1,3 +1,5 @@
/** domain asset **/
* {
background-color: red;
background: url(contoso-logo.png);
}

View File

@@ -1,3 +1,5 @@
/** global asset **/
* {
background-color: yellow;
background: url(contoso-logo.png);
}

View File

@@ -36,7 +36,7 @@
const refresh = async () => {
try {
isTableLoading = true;
const res = await api.domain.getAll(tableURLParams, contextCompanyID);
const res = await api.domain.getAllSubset(tableURLParams, contextCompanyID);
if (!res.success) {
throw res.error;
}

View File

@@ -54,7 +54,8 @@
let isDeleteAlertVisible = false;
let deleteValues = {
id: null,
name: null
name: null,
path: null
};
let modalMode = null;
let modalText = '';
@@ -251,6 +252,7 @@
isDeleteAlertVisible = true;
deleteValues.id = asset.id;
deleteValues.name = asset.name;
deleteValues.path = asset.path;
};
const onClickPreview = async (path) => {
@@ -396,7 +398,7 @@
<TableCell>
{#if isImageFile(asset.path)}
{#await getImagePreviewUrl(asset.path)}
<div class="w-12 h-12 bg-gray-200 animate-pulse rounded"></div>
<div class="w-12 h-12 animate-pulse rounded"></div>
{:then imageUrl}
{#if imageUrl}
<button
@@ -415,22 +417,18 @@
</button>
{:else}
<div
class="w-12 h-12 bg-gray-300 rounded flex items-center justify-center text-xs text-gray-600"
class="w-12 h-12 rounded flex items-center justify-center text-xs text-gray-600"
>
No preview
</div>
{/if}
{:catch}
<div
class="w-12 h-12 bg-red-100 rounded flex items-center justify-center text-xs text-red-600"
>
<div class="w-12 h-12 rounded flex items-center justify-center text-xs text-red-600">
Error
</div>
{/await}
{:else}
<div
class="w-12 h-12 bg-gray-100 rounded flex items-center justify-center text-xs text-gray-500"
>
<div class="w-12 h-12 rounded flex items-center justify-center text-xs text-gray-500">
📄
</div>
{/if}
@@ -513,7 +511,7 @@
</FormGrid>
</Modal>
<DeleteAlert
name={deleteValues.name}
name={deleteValues.name || deleteValues.path || 'Unnamed asset'}
onClick={() => onClickDelete(deleteValues.id)}
bind:isVisible={isDeleteAlertVisible}
></DeleteAlert>