From 4532177cc876419c993a0b8f198dcc2626c79b01 Mon Sep 17 00:00:00 2001 From: Andrii Mysko Date: Wed, 2 Aug 2023 18:57:34 +0300 Subject: [PATCH] [PRD] TCI/Assembla Handshake with SVN/P4 (#2769) --- app/components/dashboard-row.js | 16 ++++++++++++++++ app/components/github-apps-repository.js | 15 +++++++++++++++ app/components/repository-layout.js | 15 +++++++++++++++ app/models/repo.js | 1 + app/models/user.js | 5 ++--- app/routes/settings.js | 2 ++ app/styles/app/layout.scss | 3 +++ app/styles/app/layouts/profile.scss | 16 ++++++++++++++-- app/templates/components/dashboard-row.hbs | 10 ++++++++++ .../components/github-apps-repository.hbs | 10 +++++++++- app/templates/components/repository-layout.hbs | 10 ++++++++++ app/templates/settings.hbs | 2 +- 12 files changed, 98 insertions(+), 7 deletions(-) diff --git a/app/components/dashboard-row.js b/app/components/dashboard-row.js index 94636c81aa..afec5b4805 100644 --- a/app/components/dashboard-row.js +++ b/app/components/dashboard-row.js @@ -1,4 +1,5 @@ import Component from '@ember/component'; +import { computed } from '@ember/object'; import { inject as service } from '@ember/service'; import { alias, reads } from '@ember/object/computed'; import { task, timeout } from 'ember-concurrency'; @@ -24,6 +25,21 @@ export default Component.extend({ displayMenuTofu: alias('repo.permissions.create_request'), + repositoryProvider: computed('repo.provider', function () { + return this.repo.provider.capitalize(); + }), + + repositoryType: computed('repo.serverType', function () { + switch (this.repo.serverType) { + case 'git': + return 'GIT'; + case 'subversion': + return 'SVN'; + case 'perforce': + return 'P4'; + } + }), + openDropup() { this.set('dropupIsOpen', true); }, diff --git a/app/components/github-apps-repository.js b/app/components/github-apps-repository.js index 5025b17d36..22e0aa95d6 100644 --- a/app/components/github-apps-repository.js +++ b/app/components/github-apps-repository.js @@ -22,6 +22,21 @@ export default Component.extend({ isMatchGithub: match('vcsType', /Github\S+$/), isNotMatchGithub: not('isMatchGithub'), + repositoryProvider: computed('repository.provider', function () { + return this.repository.provider.capitalize(); + }), + + repositoryType: computed('repository.serverType', function () { + switch (this.repository.serverType) { + case 'git': + return 'GIT'; + case 'subversion': + return 'SVN'; + case 'perforce': + return 'P4'; + } + }), + accessSettingsUrl: computed('user.vcsType', 'user.vcsId', function () { return this.user && vcsLinks.accessSettingsUrl(this.user.vcsType, { owner: this.user.login }); }), diff --git a/app/components/repository-layout.js b/app/components/repository-layout.js index c6e9a7dfca..c4b4b0342c 100644 --- a/app/components/repository-layout.js +++ b/app/components/repository-layout.js @@ -14,6 +14,21 @@ export default Component.extend({ currentUser: alias('auth.currentUser'), userRoMode: reads('currentUser.roMode'), + repositoryProvider: computed('repo.provider', function () { + return this.repo.provider.capitalize(); + }), + + repositoryType: computed('repo.serverType', function () { + switch (this.repo.serverType) { + case 'git': + return 'GIT'; + case 'subversion': + return 'SVN'; + case 'perforce': + return 'P4'; + } + }), + repoUrl: computed('repo.{ownerName,vcsName,vcsType}', function () { const owner = this.get('repo.ownerName'); const repo = this.get('repo.vcsName'); diff --git a/app/models/repo.js b/app/models/repo.js index c9e076dfc7..4233f9e01d 100644 --- a/app/models/repo.js +++ b/app/models/repo.js @@ -50,6 +50,7 @@ const Repo = VcsEntity.extend({ migrationStatus: attr('string'), historyMigrationStatus: attr('string'), scanFailedAt: attr('date'), + serverType: attr('string', { defaultValue: 'git' }), currentScan: computed('scanFailedAt', function () { let scanFailedAt = this.get('scanFailedAt'); diff --git a/app/models/user.js b/app/models/user.js index 115e96b047..91c7f31402 100644 --- a/app/models/user.js +++ b/app/models/user.js @@ -78,8 +78,7 @@ export default Owner.extend({ this.set('applyFilterRepos', !isOrganization); return this.api .post(`/user/${this.id}/sync`) - .then(() => this.poll(), - () => this.set('isSyncing', false)); + .then(() => this.poll()); }, schedulePoll() { @@ -91,7 +90,7 @@ export default Owner.extend({ poll() { return this.reload().then(() => { - if (!this.isSyncing) { + if (this.isSyncing) { this.schedulePoll(); } else { this.permissionsService.fetchPermissions.perform(); diff --git a/app/routes/settings.js b/app/routes/settings.js index 94e125871b..bc781cfb1a 100644 --- a/app/routes/settings.js +++ b/app/routes/settings.js @@ -43,6 +43,8 @@ export default TravisRoute.extend({ fetchSshKey() { if (config.endpoints.sshKey) { const repo = this.modelFor('repo'); + if (repo.serverType === 'perforce') return; + const url = `/repos/${repo.get('id')}/key`; return this.api.get(url, { travisApiVersion: null }).then((data) => { const fingerprint = EmberObject.create({ diff --git a/app/styles/app/layout.scss b/app/styles/app/layout.scss index 2b5d8ac634..02eb488bbe 100644 --- a/app/styles/app/layout.scss +++ b/app/styles/app/layout.scss @@ -167,3 +167,6 @@ $padding-top: 24px; display: none !important; } } +.mr-1_2 { + margin-right: 1.2rem; +} diff --git a/app/styles/app/layouts/profile.scss b/app/styles/app/layouts/profile.scss index a97e4e4a62..48e3e6680a 100644 --- a/app/styles/app/layouts/profile.scss +++ b/app/styles/app/layouts/profile.scss @@ -220,13 +220,13 @@ $profile-breakpoint: 600px; .profile-repo { display: flex; position: relative; - flex: 1; + flex: 0; padding: 0.25em 0.5em 0.3em; border-radius: 2px; - margin-right: 1rem; .profile-repo-name { height: 21px; + white-space: nowrap; overflow: hidden; } @@ -239,6 +239,18 @@ $profile-breakpoint: 600px; } } +.profile-repo-type { + display: flex; + flex: 1; + + .profile-repo-type-span { + background-color: #d8d8d8; + padding: 2px 6px; + border-radius: 25%; + font-weight: 600; + } +} + .profile-text, .profile-additional, .profile-betafeatures { diff --git a/app/templates/components/dashboard-row.hbs b/app/templates/components/dashboard-row.hbs index 2dd57ff861..efc11609e1 100644 --- a/app/templates/components/dashboard-row.hbs +++ b/app/templates/components/dashboard-row.hbs @@ -70,6 +70,16 @@ {{/if}}

+ {{#if (eq this.repo.provider 'assembla')}} +
+

+ Repo type +

+

+ {{this.repositoryType}} +

+
+ {{/if}} {{#if this.repo.currentBuild}}

diff --git a/app/templates/components/github-apps-repository.hbs b/app/templates/components/github-apps-repository.hbs index d8b2c8d310..a1a23192be 100644 --- a/app/templates/components/github-apps-repository.hbs +++ b/app/templates/components/github-apps-repository.hbs @@ -13,6 +13,14 @@ {{/if}} +{{#if (eq this.repository.provider 'assembla')}} + + + {{this.repositoryType}} + + + +{{/if}} {{#if this.hasSettingsPermission}} {{#if this.isNotMatchGithub}} -{{/if}} \ No newline at end of file +{{/if}} diff --git a/app/templates/components/repository-layout.hbs b/app/templates/components/repository-layout.hbs index df177b3862..0268369de1 100644 --- a/app/templates/components/repository-layout.hbs +++ b/app/templates/components/repository-layout.hbs @@ -22,6 +22,16 @@ > + {{#if (eq this.repo.provider 'assembla')}} +
+ + + {{this.repositoryType}} + + + +
+ {{/if}} diff --git a/app/templates/settings.hbs b/app/templates/settings.hbs index 35954ef9f1..1705e9b5c5 100644 --- a/app/templates/settings.hbs +++ b/app/templates/settings.hbs @@ -235,7 +235,7 @@

- {{#if (and (config-get 'endpoints.sshKey') (or this.features.enterpriseVersion this.repo.private))}} + {{#if (and (and (config-get 'endpoints.sshKey') (or this.features.enterpriseVersion this.repo.private)) (not (eq this.repo.serverType 'perforce')))}}

SSH Key