Skip to content

Commit

Permalink
feat:增加鸿蒙仓库前端 #2877
Browse files Browse the repository at this point in the history
  • Loading branch information
lannoy0523 committed Jan 7, 2025
1 parent e684a9a commit 0f42ae3
Show file tree
Hide file tree
Showing 5 changed files with 165 additions and 4 deletions.
58 changes: 58 additions & 0 deletions src/frontend/devops-repository/src/images/ohpm.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ export default {
docker: 'docker/ext/addr',
npm: 'npm/ext/address',
helm: 'helm/ext/address',
conan: 'conan/ext/address'
conan: 'conan/ext/address',
ohpm: 'npm/ext/address'
}
if (!urlMap[repoType] || state.domain[repoType]) return
Vue.prototype.$ajax.get(
Expand Down
6 changes: 4 additions & 2 deletions src/frontend/devops-repository/src/store/publicEnum.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ export const repoEnum = MODE_CONFIG === 'ci'
// { label: 'Rds', value: 'rds' },
{ label: 'Nuget', value: 'nuget' },
{ label: 'S3', value: 's3' },
{ label: 'Conan', value: 'conan' }
{ label: 'Conan', value: 'conan' },
{ label: 'Ohpm', value: 'ohpm' }
]
: [
{ label: 'Generic', value: 'generic' },
Expand All @@ -24,7 +25,8 @@ export const repoEnum = MODE_CONFIG === 'ci'
{ label: 'Git', value: 'git' },
{ label: 'Nuget', value: 'nuget' },
{ label: 'S3', value: 's3' },
{ label: 'Conan', value: 'conan' }
{ label: 'Conan', value: 'conan' },
{ label: 'Ohpm', value: 'ohpm' }
]

// 文件类型
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{{ $t('tokenDependSubTitle') }}
<router-link :to="{ name: 'repoToken' }">{{ $t('token') }}</router-link>
</div>
<div v-if="repoType !== 'npm'">
<div v-if="repoType !== 'npm' && repoType !== 'ohpm'">
<div>{{$t('accessTokenPlaceholder')}}</div>
<bk-input
class="mt10"
Expand Down Expand Up @@ -98,6 +98,7 @@
}).filter(Boolean) || []
},
repoType () {
console.log(this.$route.params.repoType)
return this.$route.params.repoType || ''
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,105 @@ export default {
}
]
},
ohpmGuide () {
return [
{
title: this.$t('npmCreditGuideSubTitle1'),
optionType: 'setCredentials',
main: [
{
subTitle: this.$t('npmCreditGuideSubTitle3'),
codeList: [
'node -e "require(\'readline\') .createInterface({input:process.stdin,output:process.stdout,historySize:0}) .question(\'PAT> \',p => { b64=Buffer.from(p.trim()).toString(\'base64\');console.log(b64);process.exit(); })"'
]
},
{
subTitle: this.$t('npmCreditGuideSubTitle4')
},
{
subTitle: this.$t('npmCreditGuideSubTitle2'),
codeList: [
`registry=${this.domain.ohpm}/${this.projectId}/${this.repoName}/`,
`publish_registry=${this.domain.ohpm}/${this.projectId}/${this.repoName}/`,
`//${this.domain.ohpm.split('//')[1]}/${this.projectId}/${this.repoName}/:_auth=Basic <BASE64_ENCODE_PERSONAL_ACCESS_TOKEN>`
]
}
]
},
{
title: this.$t('push'),
optionType: 'push',
inputBoxList: [
{
key: 'dependInputValue1', // vux中存储的变量名
label: this.$t('filePath'), // 输入框左侧label文案
placeholder: this.$t('ohpmPushPlaceHolder'), // 输入框提示文案
methodFunctionName: 'SET_DEPEND_INPUT_VALUE1' // vuex中mutations中的方法名
}
],
main: [
{
subTitle: this.$t('ohpmPushGuideSubTitle1'),
codeList: [
`ohpm publish "${this.dependInputValue1 || '<PATH_TO_PACKAGE_FILE>'}"`
]
},
{
subTitle: this.$t('ohpmPushGuideSubTitle2'),
codeList: [`ohpm publish "${this.dependInputValue1 || '<PATH_TO_PACKAGE_FILE>'}" --publish_registry ${this.domain.ohpm}/${this.projectId}/${this.repoName}/`]
}
]
},
{
title: this.$t('pull'),
optionType: 'pull',
inputBoxList: [
{
key: 'dependInputValue1', // vux中存储的变量名
label: this.$t('artifactName'), // 输入框左侧label文案
placeholder: this.$t('artifactNamePlaceholder'), // 输入框提示文案
methodFunctionName: 'SET_DEPEND_INPUT_VALUE1' // vuex中mutations中的方法名
},
{
key: 'dependInputValue2', // vux中存储的变量名
label: this.$t('artifactVersion'), // 输入框左侧label文案
placeholder: this.$t('npmVersionInputPlaceholder'), // 输入框提示文案
methodFunctionName: 'SET_DEPEND_INPUT_VALUE2' // vuex中mutations中的方法名
}
],
main: [
{
subTitle: this.$t('npmDownloadGuideSubTitle1'),
codeList: [`ohpm install ${this.dependInputValue1 || this.packageName + '@' + this.versionLabel}${this.dependInputValue1 && this.dependInputValue2 ? '@' + this.dependInputValue2 : ''}`]
},
{
subTitle: this.$t('npmDownloadGuideSubTitle1'),
codeList: [`ohpm install ${this.dependInputValue1 || this.packageName + '@' + this.versionLabel}${this.dependInputValue1 && this.dependInputValue2 ? '@' + this.dependInputValue2 : ''} --registry ${this.domain.ohpm}/${this.projectId}/${this.repoName}`]
}
]
}
]
},
ohpmInstall () {
return [
{
main: [
{
subTitle: this.$t('npmDownloadGuideSubTitle1'),
codeList: [
`ohpm install ${this.packageName}@${this.versionLabel}`
]
},
{
subTitle: this.$t('npmDownloadGuideSubTitle2'),
codeList: [
`ohpm install ${this.packageName}@${this.versionLabel} --registry ${this.domain.ohpm}/${this.projectId}/${this.repoName}/`
]
}
]
}
]
},
articleGuide () {
return this[`${guideMap[this.repoType] || this.repoType}Guide`]
},
Expand Down

0 comments on commit 0f42ae3

Please sign in to comment.