fix: code review

This commit is contained in:
Arman committed 2023-08-16 17:28:00 +02:00
1 parent 316b61f8cf
commit f5c8ad72ef
6 files changed
+48 -40

No files matched your search

+6 -7
View File
@@ -30,13 +30,12 @@
* Cancel navigation when wizard is open and triggered by popstate
*/
beforeNavigate((n) => {
if ($wizard.show || $wizard.cover) {
if (n.type === 'popstate') {
n.cancel();
}
if (n.type !== 'leave') {
wizard.hide();
}
if (!$wizard.show || !$wizard.cover) return;
if (n.type === 'popstate') {
n.cancel();
}
if (n.type !== 'leave') {
wizard.hide();
}
});
</script>
+37 -28
View File
@@ -21,34 +21,43 @@
import ExecuteAccess from './steps/executeAccess.svelte';
async function create() {
const response = await sdk.forProject.functions.create(
$createFunction.$id || ID.unique(),
$createFunction.name,
$createFunction.runtime,
$createFunction.entrypoint,
$createFunction.execute || undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
$createFunction.commands || undefined
);
await sdk.forProject.functions.createDeployment(
response.$id,
$createFunctionDeployment[0],
true
);
goto(`${base}/console/project-${$page.params.project}/functions/function-${response.$id}`);
addNotification({
message: `${$createFunction.name} has been created`,
type: 'success'
});
trackEvent(Submit.FunctionCreate, {
customId: !!$createFunction.$id
});
resetState();
wizard.hide();
try {
const response = await sdk.forProject.functions.create(
$createFunction.$id || ID.unique(),
$createFunction.name,
$createFunction.runtime,
$createFunction.entrypoint,
$createFunction.execute || undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
$createFunction.commands || undefined
);
await sdk.forProject.functions.createDeployment(
response.$id,
$createFunctionDeployment[0],
true
);
goto(
`${base}/console/project-${$page.params.project}/functions/function-${response.$id}`
);
addNotification({
message: `${$createFunction.name} has been created`,
type: 'success'
});
trackEvent(Submit.FunctionCreate, {
customId: !!$createFunction.$id
});
resetState();
wizard.hide();
} catch (error) {
addNotification({
message: error.message,
type: 'error'
});
}
}
function resetState() {
@@ -11,6 +11,6 @@ export const load: LayoutLoad = async ({ depends }) => {
return {
header: Header,
breadcrumbs: Breadcrumbs,
installations: await sdk.forProject.vcs.listInstallations([Query.limit(100)])
installations: sdk.forProject.vcs.listInstallations([Query.limit(100)])
};
};
@@ -13,8 +13,8 @@ export const load: LayoutLoad = async ({ params, depends }) => {
return {
header: Header,
breadcrumbs: Breadcrumbs,
function: await sdk.forProject.functions.get(params.function),
domain: await sdk.forProject.proxy.listRules([
function: sdk.forProject.functions.get(params.function),
domain: sdk.forProject.proxy.listRules([
Query.equal('resourceType', 'function'),
Query.equal('resourceId', params.function),
Query.limit(1)
@@ -116,7 +116,7 @@
<div class="u-flex u-gap-12 u-cross-center">
<a
class="u-underline u-cursor-pointer"
href={'//' + data.domain.rules[0].domain}
href={`https//${data.domain.rules[0].domain}`}
target="_blank">
{data.domain.rules[0].domain}
</a>
@@ -21,7 +21,7 @@
);
addNotification({
type: 'success',
message: `${$func.name} has been redeployed.`
message: `Redeploying ${$func.name}`
});
trackEvent(Submit.FunctionRedeploy);