/*
 * Copyright 2020 Simon Edwards <simon@simonzone.com>
 *
 * This source code is licensed under the MIT license which is detailed in the LICENSE.txt file.
 */
import Component from 'vue-class-component';
import Vue from 'vue';

import { } from '../../../Config';
import { trimBetweenTags } from 'extraterm-trim-between-tags';
import { ExtensionMetadata } from 'extraterm/src/ExtensionMetadata';
import { isSupportedOnThisPlatform } from '../../extension/InternalTypes';


@Component(
  {
    template: trimBetweenTags(`
<div class="settings-page">
  <h2><i class="fas fa-puzzle-piece"></i>&nbsp;&nbsp;Extensions</h2>

  <div v-for="extension in allUserExtensions" v-bind:key="extension.path" class="card">
    <h3>{{ extension.displayName || extension.name }}&nbsp;<span class="extension-version">{{ extension.version }}</span></h3>
    <div>{{ extension.description}}</div>
  </div>
</div>
`)
  }
)
export class ExtensionSettingsUi extends Vue {

  allExtensions: ExtensionMetadata[];

  constructor() {
    super();
    this.allExtensions = [];
  }

  get allUserExtensions(): ExtensionMetadata[] {
    return this.allExtensions.filter(ex => ! ex.isInternal && isSupportedOnThisPlatform(ex));
  }
}

/*
 * Copyright 2020 Simon Edwards <simon@simonzone.com>
 *
 * This source code is licensed under the MIT license which is detailed in the LICENSE.txt file.
 */
import Component from 'vue-class-component';
import Vue from 'vue';

import { } from '../../../Config';
import { trimBetweenTags } from 'extraterm-trim-between-tags';
import { ExtensionMetadata } from 'extraterm/src/ExtensionMetadata';


@Component(
  {
    template: trimBetweenTags(`
<div class="settings-page">
  <h2><i class="fas fa-puzzle-piece"></i>&nbsp;&nbsp;Extensions</h2>

  <div v-for="extension in allExtensions" v-bind:key="extension.path" class="card">
    <h3>{{ extension.displayName || extension.name }}&nbsp;<span class="extension-version">{{ extension.version }}</span></h3>
    <div>{{ extension.description}}</div>
  </div>
</div>
`)
  }
)
export class ExtensionSettingsUi extends Vue {

  allExtensions: ExtensionMetadata[];

  constructor() {
    super();
    this.allExtensions = [];
  }
}

--- 
+++ 
@@ -9,6 +9,7 @@
 import { } from '../../../Config';
 import { trimBetweenTags } from 'extraterm-trim-between-tags';
 import { ExtensionMetadata } from 'extraterm/src/ExtensionMetadata';
+import { isSupportedOnThisPlatform } from '../../extension/InternalTypes';
 
 
 @Component(
@@ -17,7 +18,7 @@
 <div class="settings-page">
   <h2><i class="fas fa-puzzle-piece"></i>&nbsp;&nbsp;Extensions</h2>
 
-  <div v-for="extension in allExtensions" v-bind:key="extension.path" class="card">
+  <div v-for="extension in allUserExtensions" v-bind:key="extension.path" class="card">
     <h3>{{ extension.displayName || extension.name }}&nbsp;<span class="extension-version">{{ extension.version }}</span></h3>
     <div>{{ extension.description}}</div>
   </div>
@@ -33,4 +34,8 @@
     super();
     this.allExtensions = [];
   }
+
+  get allUserExtensions(): ExtensionMetadata[] {
+    return this.allExtensions.filter(ex => ! ex.isInternal && isSupportedOnThisPlatform(ex));
+  }
 }
Hide internal extensions from the settings page
