Skip to content

Commit

Permalink
feat(git): auto sync git repositories
Browse files Browse the repository at this point in the history
  • Loading branch information
tikazyq committed Oct 27, 2022
1 parent fb5ad21 commit 6b59111
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "crawlab-ui",
"version": "0.6.0-15",
"version": "0.6.0-16",
"private": false,
"author": {
"name": "Marvin Zhang",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/lang/en/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ const common: LCommon = {
uninstall: 'Uninstalled successfully',
startInstall: 'Started installation successfully',
startUninstall: 'Started uninstallation successfully',
enabled: 'Enabled successfully',
disabled: 'Disabled successfully',
},
info: {
cancel: 'Attempt to cancel',
Expand Down
1 change: 1 addition & 0 deletions src/i18n/lang/en/components/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const git: LComponentsGit = {
username: 'Username',
password: 'Password',
privateKey: 'Private Key',
autoPull: 'Auto Pull',
},
common: {
currentBranch: 'Current Branch',
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/lang/zh/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ const common: LCommon = {
uninstall: '卸载成功',
startInstall: '开始安装',
startUninstall: '开始卸载',
enabled: '已启用',
disabled: '已禁用',
},
info: {
cancel: '尝试取消',
Expand Down
1 change: 1 addition & 0 deletions src/i18n/lang/zh/components/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const git: LComponentsGit = {
username: '用户名',
password: '密码',
privateKey: '私钥',
autoPull: '自动拉取',
},
common: {
currentBranch: '当前分支',
Expand Down
2 changes: 2 additions & 0 deletions src/interfaces/i18n/common.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ export declare global {
uninstall: string;
startInstall: string;
startUninstall: string;
enabled: string;
disabled: string;
};
info: {
cancel: string;
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/i18n/components/git.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ interface LComponentsGit {
username: string;
password: string;
privateKey: string;
autoPull: string;
};
common: {
currentBranch: string;
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/models/git.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,6 @@ export declare global {
username?: string;
password?: string;
current_branch?: string;
auto_pull?: boolean;
}
}
15 changes: 15 additions & 0 deletions src/views/spider/detail/actions/SpiderDetailActionsGit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@
</template>
</Tag>
</div>
<Switch
v-model="gitForm.auto_pull"
:active-text="t('components.git.form.autoPull')"
:disabled="gitForm.url === '' || gitForm.auth_type === ''"
@change="onAutoFillChange"
/>
</NavActionItem>
</NavActionGroup>
</template>
Expand All @@ -63,10 +69,13 @@ import Tag from '@/components/tag/Tag.vue';
import {useStore} from 'vuex';
import {useI18n} from 'vue-i18n';
import useSpiderDetail from '@/views/spider/detail/useSpiderDetail';
import Switch from '@/components/switch/Switch.vue';
import {ElMessage} from 'element-plus';
export default defineComponent({
name: 'SpiderDetailActionsGit',
components: {
Switch,
NavActionFaIcon,
NavActionGroup,
NavActionItem,
Expand Down Expand Up @@ -119,6 +128,11 @@ export default defineComponent({
isBranchClicked.value = false;
};
const onAutoFillChange = async () => {
await store.dispatch(`git/updateById`, {id: gitForm.value._id, form: gitForm.value});
await ElMessage.success(t('common.message.success.save'));
};
return {
...useSpiderDetail(),
gitForm,
Expand All @@ -129,6 +143,7 @@ export default defineComponent({
onBranchClick,
onBranchCancel,
onBranchCheckout,
onAutoFillChange,
t,
};
},
Expand Down

0 comments on commit 6b59111

Please sign in to comment.