mirror of
https://github.com/hanzo-io/press.git
synced 2026-10-30 18:56:50 +00:00
* refactor: group analytics, jobs, logs and reports * fix: double import and remove unused code * fix: tab highlight on navigating using browser controls * refactor: move inner sidebar to right with fw like design * fix: option to view job from backup * fix: navigation buttons * fix: highlight inner sidebar item for children as well * refactor: add bottom border for inner sidebar items * fix: wrong params while routing * refactor: add padding per page * fix: add childroute for reports * fix: switch type of error from String to Error * fix(SiteActivity): show relevant job on click * fix(SiteActivity): add filters * fix(SiteActivity): filter width * fix(SiteTags): show tags in overview * refactor: separate advanced and basic charts * fix(SiteInsights): mobile view * fix: fetch advanced analytics only once * fix: add schedule backup action * fix: use proper route for site job list * fix: don't allow duplicate tags * fix: remove slow query variable * fix: revert complexity reduction change * fix(Charts): loading state for charts without card * refactor: add tag dialog * refactor: group logs - better heading for charts - link some charts to logs * chore: remove unused code * fix: typo
203 lines
4.3 KiB
Vue
203 lines
4.3 KiB
Vue
<template>
|
|
<Dialog
|
|
:options="{
|
|
title: 'Move Site to another Bench Group',
|
|
actions: [
|
|
{
|
|
label: 'Change Bench Group',
|
|
loading: $resources.changeGroup.loading,
|
|
disabled: !$resources.changeGroupOptions?.data?.length,
|
|
variant: 'solid',
|
|
onClick: () =>
|
|
$resources.changeGroup.submit({
|
|
skip_failing_patches: skipFailingPatches,
|
|
group: targetGroup.value,
|
|
name: site
|
|
})
|
|
},
|
|
{
|
|
label: 'Clone current Bench Group',
|
|
onClick: () => {
|
|
$emit('update:modelValue', false);
|
|
showCloneBenchDialog = true;
|
|
}
|
|
}
|
|
]
|
|
}"
|
|
v-model="show"
|
|
>
|
|
<template #body-content>
|
|
<LoadingIndicator
|
|
class="mx-auto h-4 w-4"
|
|
v-if="$resources.changeGroupOptions.loading"
|
|
/>
|
|
<div
|
|
v-else-if="$resources.changeGroupOptions.data.length > 0"
|
|
class="space-y-4"
|
|
>
|
|
<FormControl
|
|
variant="outline"
|
|
label="Select Bench Group"
|
|
type="autocomplete"
|
|
:options="
|
|
$resources.changeGroupOptions.data.map(group => ({
|
|
label: group.title || group.name,
|
|
description: group.name,
|
|
value: group.name
|
|
}))
|
|
"
|
|
v-model="targetGroup"
|
|
/>
|
|
<FormControl
|
|
label="Skip failing patches if any"
|
|
type="checkbox"
|
|
v-model="skipFailingPatches"
|
|
/>
|
|
</div>
|
|
<p v-else-if="!errorMessage" class="text-md text-base text-gray-800">
|
|
There are no other bench groups that you own for this site to move to.
|
|
You can clone this bench group to move the site.
|
|
</p>
|
|
<ErrorMessage class="mt-3" :message="errorMessage" />
|
|
</template>
|
|
</Dialog>
|
|
<Dialog
|
|
:options="{
|
|
title: 'Clone Bench Group',
|
|
actions: [
|
|
{
|
|
label: 'Clone Bench Group',
|
|
variant: 'solid',
|
|
loading: $resources.cloneGroup.loading,
|
|
onClick: () =>
|
|
$resources.cloneGroup.submit({
|
|
name: site,
|
|
new_group_title: newGroupTitle,
|
|
server: selectedServer
|
|
})
|
|
}
|
|
]
|
|
}"
|
|
v-model="showCloneBenchDialog"
|
|
>
|
|
<template #body-content>
|
|
<FormControl label="New Bench Group Name" v-model="newGroupTitle" />
|
|
<FormControl
|
|
v-if="$resources.serverOptions.data.length > 0"
|
|
class="mt-4"
|
|
label="Select Server"
|
|
type="select"
|
|
:options="$resources.serverOptions.data"
|
|
v-model="selectedServer"
|
|
/>
|
|
<ErrorMessage :message="$resources.cloneGroup.error" />
|
|
</template>
|
|
</Dialog>
|
|
</template>
|
|
|
|
<script>
|
|
import { toast } from 'vue-sonner';
|
|
|
|
export default {
|
|
props: ['site'],
|
|
data() {
|
|
return {
|
|
show: true,
|
|
targetGroup: {
|
|
label: '',
|
|
value: ''
|
|
},
|
|
newGroupTitle: '',
|
|
skipFailingPatches: false,
|
|
showCloneBenchDialog: false,
|
|
selectedServer: null
|
|
};
|
|
},
|
|
computed: {
|
|
errorMessage() {
|
|
return (
|
|
this.$resources.changeGroupOptions.error ||
|
|
this.$resources.changeGroup.error ||
|
|
this.$resources.cloneGroup.error
|
|
);
|
|
}
|
|
},
|
|
resources: {
|
|
changeGroup() {
|
|
return {
|
|
url: 'press.api.site.change_group',
|
|
onSuccess() {
|
|
const destinationGroupTitle =
|
|
this.$resources.changeGroupOptions.data.find(
|
|
group => group.name === this.targetGroup.value
|
|
).title;
|
|
|
|
toast.success(
|
|
`The site has been scheduled to move to the ${destinationGroupTitle} bench group successfully.`
|
|
);
|
|
|
|
this.$router.push({
|
|
name: 'Site Jobs',
|
|
params: {
|
|
name: this.site
|
|
}
|
|
});
|
|
|
|
this.targetGroup = {
|
|
label: '',
|
|
value: ''
|
|
};
|
|
this.show = false;
|
|
}
|
|
};
|
|
},
|
|
changeGroupOptions() {
|
|
return {
|
|
url: 'press.api.site.change_group_options',
|
|
params: {
|
|
name: this.site
|
|
},
|
|
initialData: [],
|
|
onSuccess(data) {
|
|
if (data.length > 0) this.targetGroup.value = data[0].name;
|
|
},
|
|
auto: true
|
|
};
|
|
},
|
|
cloneGroup() {
|
|
return {
|
|
url: 'press.api.site.clone_group',
|
|
onSuccess(data) {
|
|
toast.success(
|
|
'The current bench group has been cloned successfully. Redirecting to the new bench group...'
|
|
);
|
|
this.showCloneBenchDialog = false;
|
|
|
|
this.$router.push({
|
|
name: 'Deploy Candidate',
|
|
params: {
|
|
name: data.bench_name,
|
|
id: data.candidate_name
|
|
}
|
|
});
|
|
}
|
|
};
|
|
},
|
|
serverOptions() {
|
|
return {
|
|
type: 'list',
|
|
doctype: 'Server',
|
|
fields: ['name', 'title'],
|
|
auto: true,
|
|
transform(data) {
|
|
return data.map(server => ({
|
|
label: server.title,
|
|
value: server.name
|
|
}));
|
|
}
|
|
};
|
|
}
|
|
}
|
|
};
|
|
</script>
|