Skip to content

Commit

Permalink
[PRD] TCI/Assembla Handshake with SVN/P4 (#2769)
Browse files Browse the repository at this point in the history
  • Loading branch information
AndriiMysko authored and vitalie committed Aug 9, 2023
1 parent a61a11b commit 4532177
Show file tree
Hide file tree
Showing 12 changed files with 98 additions and 7 deletions.
16 changes: 16 additions & 0 deletions app/components/dashboard-row.js
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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);
},
Expand Down
15 changes: 15 additions & 0 deletions app/components/github-apps-repository.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
}),
Expand Down
15 changes: 15 additions & 0 deletions app/components/repository-layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
1 change: 1 addition & 0 deletions app/models/repo.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
5 changes: 2 additions & 3 deletions app/models/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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();
Expand Down
2 changes: 2 additions & 0 deletions app/routes/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
3 changes: 3 additions & 0 deletions app/styles/app/layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,6 @@ $padding-top: 24px;
display: none !important;
}
}
.mr-1_2 {
margin-right: 1.2rem;
}
16 changes: 14 additions & 2 deletions app/styles/app/layouts/profile.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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 {
Expand Down
10 changes: 10 additions & 0 deletions app/templates/components/dashboard-row.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@
{{/if}}
</p>
</section>
{{#if (eq this.repo.provider 'assembla')}}
<section class="dash-last">
<h3 class="label">
Repo type
</h3>
<p class="row-content color">
{{this.repositoryType}}
</p>
</section>
{{/if}}
{{#if this.repo.currentBuild}}
<section class="dash-last {{this.repo.currentBuild.state}}">
<h3 class="label">
Expand Down
10 changes: 9 additions & 1 deletion app/templates/components/github-apps-repository.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
</span>
{{/if}}
</LinkTo>
{{#if (eq this.repository.provider 'assembla')}}
<span class="profile-repo-type">
<span class="profile-repo-type-span">
{{this.repositoryType}}
<EmberTooltip @text="{{this.repositoryProvider}} {{this.repositoryType}} Repository" />
</span>
</span>
{{/if}}
{{#if this.hasSettingsPermission}}
{{#if this.isNotMatchGithub}}
<TravisSwitch
Expand Down Expand Up @@ -60,4 +68,4 @@
{{/if}}
</p>
</div>
{{/if}}
{{/if}}
10 changes: 10 additions & 0 deletions app/templates/components/repository-layout.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@
>
<SvgImage @name={{vcs-icon this.repo.vcsType}} />
</ExternalLinkTo>
{{#if (eq this.repo.provider 'assembla')}}
<div class="mr-1_2 inline-block vertical-align">
<span class="profile-repo-type">
<span class="profile-repo-type-span">
{{this.repositoryType}}
<EmberTooltip @text="{{this.repositoryProvider}} {{this.repositoryType}} Repository" />
</span>
</span>
</div>
{{/if}}
<RepoStatusBadge @repo={{this.repo}} @onClick={{action 'toggleStatusBadgeModal'}} />
<LogScanStatusBadge @repo={{this.repo}} />
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/templates/settings.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@
</ul>
<AddCronJob @repository={{this.model.repository}} />
</section>
{{#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')))}}
<section class="settings-section" data-test-ssh-key-section>
<h2 class="small-title">
SSH Key
Expand Down

0 comments on commit 4532177

Please sign in to comment.