refactor: Extract iconUrl generation of steps to helper
This commit is contained in:
7
packages/backend/src/helpers/generate-icon-url.js
Normal file
7
packages/backend/src/helpers/generate-icon-url.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import appConfig from '../config/app.js';
|
||||||
|
|
||||||
|
export const generateIconUrl = (appKey) => {
|
||||||
|
if (!appKey) return null;
|
||||||
|
|
||||||
|
return `${appConfig.baseUrl}/apps/${appKey}/assets/favicon.svg`;
|
||||||
|
};
|
||||||
@@ -9,6 +9,7 @@ import appConfig from '../config/app.js';
|
|||||||
import globalVariable from '../helpers/global-variable.js';
|
import globalVariable from '../helpers/global-variable.js';
|
||||||
import computeParameters from '../helpers/compute-parameters.js';
|
import computeParameters from '../helpers/compute-parameters.js';
|
||||||
import testRun from '../services/test-run.js';
|
import testRun from '../services/test-run.js';
|
||||||
|
import { generateIconUrl } from '../helpers/generate-icon-url.js';
|
||||||
|
|
||||||
class Step extends Base {
|
class Step extends Base {
|
||||||
static tableName = 'steps';
|
static tableName = 'steps';
|
||||||
@@ -88,9 +89,7 @@ class Step extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get iconUrl() {
|
get iconUrl() {
|
||||||
if (!this.appKey) return null;
|
return generateIconUrl(this.appKey);
|
||||||
|
|
||||||
return `${appConfig.baseUrl}/apps/${this.appKey}/assets/favicon.svg`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get isTrigger() {
|
get isTrigger() {
|
||||||
|
|||||||
Reference in New Issue
Block a user