Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Update add to collection modal #1293

Merged
merged 5 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 0 additions & 58 deletions app/components/collection/modal/add-to-collection/styles.scss

This file was deleted.

5 changes: 0 additions & 5 deletions app/components/collection/styles.scss

This file was deleted.

15 changes: 6 additions & 9 deletions app/components/pipeline/header/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,17 @@ export default class PipelineHeaderComponent extends Component {

@action
async openAddToCollectionModal() {
if (!this.collections) {
this.collections = await this.shuttle
.fetchFromApi('get', '/collections')
.catch(err => {
this.errorMessage = `Could not get collections. ${err.message}`;
});
}
this.collections = await this.shuttle
.fetchFromApi('get', '/collections')
.catch(err => {
this.errorMessage = `Could not get collections. ${err.message}`;
});

this.addToCollectionModalOpen = true;
}

@action
closeAddToCollectionModal(collections) {
closeAddToCollectionModal() {
this.addToCollectionModalOpen = false;
this.collections = collections;
}
}
2 changes: 1 addition & 1 deletion app/components/pipeline/header/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
/>

{{#if this.addToCollectionModalOpen}}
<Collection::Modal::AddToCollection
<Pipeline::Modal::AddToCollection
@pipeline={{@pipeline}}
@collections={{this.collections}}
@errorMessage={{this.errorMessage}}
Expand Down
65 changes: 65 additions & 0 deletions app/components/pipeline/modal/add-to-collection/styles.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
@use 'screwdriver-colors' as colors;
@use 'variables';

@mixin styles {
#add-to-collection-modal {
&.modal {
.modal-dialog {
max-width: 30rem;

.modal-body {
.modal-title {
font-size: 1.25rem;
font-weight: variables.$weight-bold;
padding-bottom: 0.75rem;
}

.create-new-collection {
label {
display: flex;
justify-content: space-between;

> div {
margin: auto;
padding-right: 0.25rem;
width: 6rem;
}

input {
flex: 1;
border-radius: 4px;
border: 1px solid colors.$sd-text-med;
padding-left: 0.5rem;
margin-left: 0.25rem;
}
}
}

.select-collections {
max-height: 10rem;
overflow: scroll;

.btn-group {
display: flex;
flex-direction: column;

> .btn {
border-radius: 3px;
margin: 0.25rem;

&.active {
background-color: rgba(colors.$sd-running, 0.75);
color: colors.$sd-white;
}
}
}
}
}

#submit-collections {
width: 15rem;
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,19 @@
<div class="modal-title">Add to a new collection</div>
<div class="create-new-collection">
<label>
<div>Collection name:</div>
<div>Name:</div>
<Input
id="new-collection-name-input"
@type="text"
@value={{this.newCollectionName}}
placeholder="Please enter a name for your new collection"
/>
</label>
<label>
<div>Collection description:</div>
<div>Description:</div>
<Input
@type="text"
@value={{this.newCollectionDescription}}
placeholder="Optional: enter a name description for your new collection"
placeholder="Optional"
/>
</label>
</div>
Expand Down
2 changes: 2 additions & 0 deletions app/components/pipeline/modal/styles.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
@use 'add-to-collection/styles' as addToCollection;
@use 'confirm-action/styles' as confirmAction;
@use 'event-group-history/styles' as eventGroup;
@use 'search-event/styles' as searchEvent;
@use 'start-event/styles' as startEvent;
@use 'toggle-job/styles' as toggleJob;

@mixin styles {
@include addToCollection.styles;
@include confirmAction.styles;
@include eventGroup.styles;
@include searchEvent.styles;
Expand Down
2 changes: 0 additions & 2 deletions app/components/styles.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
@use 'collection/styles' as collection;
@use 'pipeline/styles' as pipeline;

@mixin styles {
@include collection.styles;
@include pipeline.styles;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { setupRenderingTest } from 'screwdriver-ui/tests/helpers';
import { click, fillIn, render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
import sinon from 'sinon';
import { createCollectionBody } from 'screwdriver-ui/components/collection/modal/add-to-collection/util';
import { createCollectionBody } from 'screwdriver-ui/components/pipeline/modal/add-to-collection/util';

module(
'Integration | Component | collection/modal/add-to-collection',
'Integration | Component | pipeline/modal/add-to-collection',
function (hooks) {
setupRenderingTest(hooks);

Expand All @@ -17,7 +17,7 @@ module(
});

await render(
hbs`<Collection::Modal::AddToCollection
hbs`<Pipeline::Modal::AddToCollection
@pipeline={{this.pipeline}}
@closeModal={{this.closeModal}}
/>`
Expand All @@ -42,7 +42,7 @@ module(
});

await render(
hbs`<Collection::Modal::AddToCollection
hbs`<Pipeline::Modal::AddToCollection
@errorMessage={{this.errorMessage}}
@pipeline={{this.pipeline}}
@closeModal={{this.closeModal}}
Expand All @@ -64,7 +64,7 @@ module(
});

await render(
hbs`<Collection::Modal::AddToCollection
hbs`<Pipeline::Modal::AddToCollection
@pipeline={{this.pipeline}}
@collections={{this.collections}}
@closeModal={{this.closeModal}}
Expand All @@ -84,7 +84,7 @@ module(
});

await render(
hbs`<Collection::Modal::AddToCollection
hbs`<Pipeline::Modal::AddToCollection
@pipeline={{this.pipeline}}
@closeModal={{this.closeModal}}
/>`
Expand All @@ -105,7 +105,7 @@ module(
});

await render(
hbs`<Collection::Modal::AddToCollection
hbs`<Pipeline::Modal::AddToCollection
@pipeline={{this.pipeline}}
@collections={{this.collections}}
@closeModal={{this.closeModal}}
Expand All @@ -129,7 +129,7 @@ module(
});

await render(
hbs`<Collection::Modal::AddToCollection
hbs`<Pipeline::Modal::AddToCollection
@pipeline={{this.pipeline}}
@closeModal={{this.closeModal}}
/>`
Expand Down Expand Up @@ -163,7 +163,7 @@ module(
});

await render(
hbs`<Collection::Modal::AddToCollection
hbs`<Pipeline::Modal::AddToCollection
@pipeline={{this.pipeline}}
@closeModal={{this.closeModal}}
/>`
Expand All @@ -188,7 +188,7 @@ module(
});

await render(
hbs`<Collection::Modal::AddToCollection
hbs`<Pipeline::Modal::AddToCollection
@pipeline={{this.pipeline}}
@collections={{this.collections}}
@closeModal={{this.closeModal}}
Expand Down Expand Up @@ -220,7 +220,7 @@ module(
});

await render(
hbs`<Collection::Modal::AddToCollection
hbs`<Pipeline::Modal::AddToCollection
@pipeline={{this.pipeline}}
@collections={{this.collections}}
@closeModal={{this.closeModal}}
Expand Down Expand Up @@ -249,7 +249,7 @@ module(
});

await render(
hbs`<Collection::Modal::AddToCollection
hbs`<Pipeline::Modal::AddToCollection
@pipeline={{this.pipeline}}
@collections={{this.collections}}
@closeModal={{this.closeModal}}
Expand Down Expand Up @@ -284,7 +284,7 @@ module(
});

await render(
hbs`<Collection::Modal::AddToCollection
hbs`<Pipeline::Modal::AddToCollection
@pipeline={{this.pipeline}}
@collections={{this.collections}}
@closeModal={{this.closeModal}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { module, test } from 'qunit';
import {
createCollectionBody,
getCollectionsWithoutPipeline
} from 'screwdriver-ui/components/collection/modal/add-to-collection/util';
} from 'screwdriver-ui/components/pipeline/modal/add-to-collection/util';

module(
'Unit | Component | collection/modal/add-to-collection/util',
Expand Down