-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
260 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2274,7 +2274,7 @@ i.icon { | |
/** button section **/ | ||
|
||
.btn { | ||
font-size: 14px; | ||
/*font-size: 14px;*/ | ||
} | ||
|
||
.button_sction { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,235 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" xmlns:th="http://www.thymeleaf.org"> | ||
<head th:replace="layout/header :: header(~{::title})"> | ||
|
||
<title>Gaia - Import Module</title> | ||
|
||
</head> | ||
<body class="dashboard dashboard_2"> | ||
|
||
<div th:replace="layout/include_scripts"></div> | ||
|
||
<div class="full_container"> | ||
<div class="inner_container"> | ||
|
||
<div id="sidebar" th:class="${sidebar_collapsed ? 'active' : ''}"></div> | ||
|
||
<!-- right content --> | ||
<div id="content"> | ||
|
||
<div th:replace="~{layout/topbar}"></div> | ||
|
||
<div class="container-fluid"> | ||
<div class="row column_title"> | ||
<div class="col-md-12"> | ||
<div class="page_title"> | ||
<div id="navigation"></div> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="row column_title"> | ||
<div class="col-md-12"> | ||
<div id="controls"></div> | ||
</div> | ||
</div> | ||
<div id="app"></div> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
|
||
<style> | ||
.btn-gitlab { | ||
color: #fca326; | ||
} | ||
|
||
.btn-gitlab:hover { | ||
background-color: #fca326; | ||
border-color: #fca326; | ||
color: #fff; | ||
} | ||
|
||
.btn-github { | ||
color: #333; | ||
} | ||
|
||
.btn-github:hover { | ||
background-color: #333; | ||
border-color: #333; | ||
color: #fff; | ||
} | ||
</style> | ||
|
||
<template id="template"> | ||
<div class="row"> | ||
<div class="col-md-4"> | ||
<b-card no-body> | ||
<b-button size="lg" variant="outline-secondary" class="btn-github" squared @click="toggle('github')"> | ||
<i class="fab fa-github"></i> from Github | ||
</b-button> | ||
|
||
<repository-import v-if="selected == 'github'" :registry="'github'"></repository-import> | ||
|
||
<template v-slot:footer> | ||
<em>Import an existing module code from existing Github repository</em> | ||
</template> | ||
</b-card> | ||
</div> | ||
<!-- <div class="col-md-4">--> | ||
<!-- <b-card no-body>--> | ||
<!-- <b-button size="lg" variant="outline-secondary" class="btn-gitlab" squared @click="toggle('gitlab')">--> | ||
<!-- <i class="fab fa-gitlab"></i> from Gitlab--> | ||
<!-- </b-button>--> | ||
|
||
<!-- <repository-import v-if="selected == 'gitlab'" :registry="'gitlab'"></repository-import>--> | ||
|
||
<!-- <template v-slot:footer>--> | ||
<!-- <em>Import an existing module code from existing Gitlab repository</em>--> | ||
<!-- </template>--> | ||
<!-- </b-card>--> | ||
<!-- </div>--> | ||
<div class="col-md-4"> | ||
<b-card no-body> | ||
<b-button size="lg" variant="outline-danger" squared @click="toggle('manual')"> | ||
<i class="fab fa-superpowers"></i> manually | ||
</b-button> | ||
|
||
<manual-import v-if="selected == 'manual'"></manual-import> | ||
|
||
<template v-slot:footer> | ||
<em>Import a module manually (only for users with superpowers)</em> | ||
</template> | ||
</b-card> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<template id="repository-import"> | ||
<b-card> | ||
<b-card-text> | ||
<label for="repoSelect">Select your {{registry}} repository</label> | ||
<vue-multiselect | ||
v-model="selectedRepository" | ||
id="repoSelect" | ||
placeholder="Type to search" | ||
:options="repositories" | ||
:loading="isLoading" | ||
@open="search"> | ||
<span slot="noResult">Oops! No repository found. </span> | ||
</vue-multiselect> | ||
</b-card-text> | ||
|
||
<b-button :disabled="! selectedRepository" href="#" variant="primary" @click="importRepository">Import this repository !</b-button> | ||
</b-card> | ||
</template> | ||
|
||
<template id="manual-import"> | ||
<b-card> | ||
<b-card-text> | ||
<b-form-group | ||
label="Enter the module name" | ||
label-for="module-name"> | ||
<b-form-input id="module-name" v-model="moduleName" trim></b-form-input> | ||
</b-form-group> | ||
</b-card-text> | ||
|
||
<b-button :disabled="! moduleName" href="#" variant="primary" @click="createModule">Import manually</b-button> | ||
</b-card> | ||
</template> | ||
|
||
<template id="template-navigation"> | ||
<breadcrumb :page="page"></breadcrumb> | ||
</template> | ||
|
||
<div th:replace="vue_templates/sidebar"></div> | ||
|
||
<div th:replace="helpers/messenger"></div> | ||
|
||
<div th:replace="vue_templates/breadcrumb"></div> | ||
|
||
<script src="/js/ansi_to_html.js"></script> | ||
|
||
<script th:inline="javascript" type="application/ecmascript"> | ||
Vue.component('vue-multiselect', window.VueMultiselect.default); | ||
|
||
Vue.component('manual-import', { | ||
template: "#manual-import", | ||
data: () => ({ | ||
moduleName: null, | ||
} | ||
), | ||
methods: { | ||
createModule: function(){ | ||
let module = { | ||
name: this.moduleName | ||
}; | ||
$.ajax({ | ||
url: `/api/modules`, | ||
data: JSON.stringify(module), | ||
contentType: "application/json", | ||
method: "POST" | ||
}).then(module => { | ||
window.location = `/modules/${module.id}` | ||
}); | ||
} | ||
} | ||
}); | ||
|
||
Vue.component('repository-import', { | ||
template: "#repository-import", | ||
props: ["registry"], | ||
data: () => ({ | ||
selectedRepository: null, | ||
repositories: [], | ||
isLoading: false, | ||
loaded: false, | ||
isImporting: false | ||
} | ||
), | ||
methods: { | ||
search(query) { | ||
if(! this.loaded){ | ||
this.isLoading = true; | ||
$.get(`/api/registries/${this.registry}/repositories`).then(response => { | ||
this.repositories = response; | ||
this.loaded = true; | ||
this.isLoading = false; | ||
}) | ||
} | ||
}, | ||
importRepository: function() { | ||
this.isImporting = true; | ||
$.get(`/api/registries/${this.registry}/repositories/${this.selectedRepository}/import`).then(module => { | ||
window.location = `/modules/${module.id}` | ||
}) | ||
} | ||
} | ||
}); | ||
|
||
new Vue({ | ||
el: "#app", | ||
template: "#template", | ||
data: () => ({ | ||
selected: "none" | ||
}), | ||
methods: { | ||
toggle: function(type) { | ||
this.selected = type | ||
} | ||
} | ||
}); | ||
|
||
|
||
</script> | ||
|
||
<script th:inline="javascript" type="application/ecmascript"> | ||
new Vue({ | ||
el: "#navigation", | ||
data: () => ({page: 'module_import'}), | ||
template: "#template-navigation", | ||
}); | ||
</script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters