Commit 39f0069d authored by Justin Ho's avatar Justin Ho Committed by Tom Quirk

Move integrations list to Vue

Using GlTable
parent f379f644
<script>
import IntegrationsTable from './integrations_table.vue';
export default {
name: 'IntegrationsList',
components: {
IntegrationsTable,
},
props: {
integrations: {
type: Array,
required: true,
},
},
computed: {
activeIntegrations() {
// TODO filter
return this.integrations;
},
},
};
</script>
<template>
<div>
<integrations-table :integrations="activeIntegrations" />
<div>{{ integrations }}</div>
</div>
</template>
<script>
import { GlTable } from '@gitlab/ui';
export default {
components: {
GlTable,
},
props: {
integrations: {
type: Array,
required: true,
},
},
fields: [
{
key: 'active',
label: '',
},
{
key: 'name',
label: 'Integration',
},
{
key: 'description',
label: 'Description',
},
{
key: 'updated_at',
label: 'Last edit',
},
],
};
</script>
<template>
<gl-table :items="integrations" :fields="$options.fields" />
<!-- </gl-table> -->
</template>
import Vue from 'vue';
import IntegrationList from './components/integrations_list.vue';
export default () => {
const el = document.querySelector('.js-integrations-list');
if (!el) {
return null;
}
const { integrations } = el.dataset;
return new Vue({
el,
render(createElement) {
return createElement(IntegrationList, {
props: {
integrations: JSON.parse(integrations),
},
});
},
});
};
import initIntegrationsList from '~/integrations/index';
import PersistentUserCallout from '~/persistent_user_callout'; import PersistentUserCallout from '~/persistent_user_callout';
const callout = document.querySelector('.js-webhooks-moved-alert'); const callout = document.querySelector('.js-webhooks-moved-alert');
PersistentUserCallout.factory(callout); PersistentUserCallout.factory(callout);
initIntegrationsList();
...@@ -115,6 +115,12 @@ module ServicesHelper ...@@ -115,6 +115,12 @@ module ServicesHelper
form_data form_data
end end
def integration_list_data(integrations)
{
integrations: integrations.map { |i| serialize_integration(i) }.to_json
}
end
def trigger_events_for_service(integration) def trigger_events_for_service(integration)
ServiceEventSerializer.new(service: integration).represent(integration.configurable_events).to_json ServiceEventSerializer.new(service: integration).represent(integration.configurable_events).to_json
end end
...@@ -155,6 +161,15 @@ module ServicesHelper ...@@ -155,6 +161,15 @@ module ServicesHelper
'project' 'project'
end end
end end
def serialize_integration(integration)
{
active: integration.activated?,
name: integration.title,
description: integration.description,
updated_at: integration.updated_at
}
end
end end
ServicesHelper.prepend_if_ee('EE::ServicesHelper') ServicesHelper.prepend_if_ee('EE::ServicesHelper')
......
.js-integrations-list{ data: integration_list_data(integrations) }
%table.table.b-table.gl-table{ role: 'table', 'aria-busy': false, 'aria-colcount': 4 } %table.table.b-table.gl-table{ role: 'table', 'aria-busy': false, 'aria-colcount': 4 }
%colgroup %colgroup
%col %col
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment