Skip to content

Commit

Permalink
Version 1.0.6
Browse files Browse the repository at this point in the history
- Change param host to hostname
- Support cache for multiple hosts
  • Loading branch information
fakoua committed Feb 10, 2024
1 parent 0264b29 commit 425a7f6
Show file tree
Hide file tree
Showing 15 changed files with 6,906 additions and 6,807 deletions.
33 changes: 16 additions & 17 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,31 @@ assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.
**Describe the bug** A clear and concise description of what the bug is.

**To Reproduce** Steps to reproduce the behavior:

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.
**Expected behavior** A clear and concise description of what you expected to
happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.
**Screenshots** If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context** Add any other context about the problem here.
16 changes: 8 additions & 8 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Is your feature request related to a problem? Please describe.** A clear and
concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe the solution you'd like** A clear and concise description of what you
want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Describe alternatives you've considered** A clear and concise description of
any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
**Additional context** Add any other context or screenshots about the feature
request here.
52 changes: 26 additions & 26 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
nationality, personal appearance, race, religion, or sexual identity and
orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
Expand All @@ -17,23 +17,23 @@ diverse, inclusive, and healthy community.
Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community
- Focusing on what is best not just for us as individuals, but for the overall
community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
- The use of sexualized language or imagery, and sexual attention or advances of
any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email address,
without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities
Expand All @@ -59,9 +59,8 @@ representative at an online or offline event.
## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
.
All complaints will be reviewed and investigated promptly and fairly.
reported to the community leaders responsible for enforcement at . All
complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
Expand All @@ -82,15 +81,15 @@ behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series
of actions.
**Community Impact**: A violation through a single incident or series of
actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
like social media. Violating these terms may lead to a temporary or permanent
ban.

### 3. Temporary Ban

Expand All @@ -106,19 +105,20 @@ Violating these terms may lead to a permanent ban.
### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
the community.
**Consequence**: A permanent ban from any sort of public interaction within the
community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.

Community Impact Guidelines were inspired by [Mozilla's code of conduct
Community Impact Guidelines were inspired by
[Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: https://www.contributor-covenant.org
Expand Down
30 changes: 16 additions & 14 deletions mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,40 +25,40 @@ router.get("/api/:apiName", async (ctx) => {
username: ctx.request.url.searchParams.get("username")!,
password: ctx.request.url.searchParams.get("password")!,
protocol: (ctx.request.url.searchParams.get("protocol")!),
host: ctx.request.url.searchParams.get("host")!,
hostname: ctx.request.url.searchParams.get("hostname")!,
port: Number(ctx.request.url.searchParams.get("port")!),
};

if (ctx.params.apiName === "service") {
let services: Array<ServiceModel>;
if (cache.has("services")) {
services = cache.get("services")!;
if (cache.has(`${payload.hostname}-services`)) {
services = cache.get(`${payload.hostname}-services`)!;
} else {
services = await getServices(payload);
cache.put("services", services);
cache.put(`${payload.hostname}-services`, services);
}
ctx.response.body = services;
}

if (ctx.params.apiName === "dependencies") {
let deps: Array<DependenciesModel>;
if (cache.has("dependencies")) {
deps = cache.get("dependencies")!;
if (cache.has(`${payload.hostname}-dependencies`)) {
deps = cache.get(`${payload.hostname}-dependencies`)!;
} else {
deps = await getDependsServices(payload);
cache.put("dependencies", deps);
cache.put(`${payload.hostname}-dependencies`, deps);
}
ctx.response.body = deps;
}

if (ctx.params.apiName === "system") {
let system: SystemModel;

if (cache.has("system-info")) {
system = cache.get("system-info")!;
if (cache.has(`${payload.hostname}-system-info`)) {
system = cache.get(`${payload.hostname}-system-info`)!;
} else {
system = await getSystem(payload);
cache.put("system-info", system);
cache.put(`${payload.hostname}-system-info`, system);
}

ctx.response.body = system;
Expand All @@ -70,7 +70,7 @@ router.post("/api/service", async (ctx) => {
username: ctx.request.url.searchParams.get("username")!,
password: ctx.request.url.searchParams.get("password")!,
protocol: (ctx.request.url.searchParams.get("protocol")!),
host: ctx.request.url.searchParams.get("host")!,
hostname: ctx.request.url.searchParams.get("hostname")!,
port: Number(ctx.request.url.searchParams.get("port")!),
};

Expand All @@ -79,15 +79,17 @@ router.post("/api/service", async (ctx) => {

if (service !== undefined) {
//Change the cache
if (cache.has("services")) {
const services = cache.get<ServiceModel[]>("services")!;
if (cache.has(`${payload.hostname}-services`)) {
const services = cache.get<ServiceModel[]>(
`${payload.hostname}-services`,
)!;
const cachedServiceIndex = services.findIndex((v) => {
return v.name === service.name;
});

if (cachedServiceIndex > -1) {
services[cachedServiceIndex] = service;
cache.put("services", services);
cache.put(`${payload.hostname}-services`, services);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions q-manui/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "q-manui",
"version": "1.0.5",
"description": "DenoMan 1.0.5",
"version": "1.0.6",
"description": "DenoMan 1.0.6",
"productName": "DenoMan",
"author": "Sameh Fakoua <s.fakoua@gmail.com>",
"private": true,
Expand Down
4 changes: 3 additions & 1 deletion q-manui/src/components/ServerComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div class="s-right col-grow">
<q-tab-panels v-model="tab">
<q-tab-panel name="dashboard">
<dashboard-component />
<dashboard-component :host="host" />
</q-tab-panel>
<q-tab-panel name="services" style="padding: 0">
<q-splitter
Expand All @@ -21,6 +21,7 @@
<div class="q-a-xl no-margin no-padding">
<service-details-component
:service="selectedService"
:host="host"
v-on:on-open-service="
(svr: ServiceModel) => {
openService(svr);
Expand Down Expand Up @@ -76,6 +77,7 @@
<service-window-component
v-if="isDialogOpen"
:service="doubleClickedService"
:host="host"
/>
</dialog>
</template>
Expand Down
15 changes: 12 additions & 3 deletions q-manui/src/components/ServiceDetailsComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,12 @@
import { PropType, defineComponent, ref } from 'vue';
import { getSystemInformation } from './service-api';
import { ControlAction, ServiceModel, SystemModel } from './models';
import {
ControlAction,
ServiceModel,
SystemModel,
WinRMPayload,
} from './models';
import { bus } from 'boot/bus';
export default defineComponent({
Expand All @@ -157,6 +162,10 @@ export default defineComponent({
type: Object as PropType<ServiceModel>,
required: false,
},
host: {
type: Object as PropType<WinRMPayload>,
required: true,
},
},
methods: {
Expand All @@ -173,11 +182,11 @@ export default defineComponent({
emits: ['onOpenService'],
setup() {
setup(props) {
const data = ref<SystemModel>({} as SystemModel);
const isLoading = ref(true);
getSystemInformation()
getSystemInformation(props.host)
.then((response) => {
data.value = response;
})
Expand Down
17 changes: 12 additions & 5 deletions q-manui/src/components/dashboard/DashboardComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
</template>

<script lang="ts">
import { defineComponent, onMounted, ref } from 'vue';
import { PropType, defineComponent, onMounted, ref } from 'vue';
import _filter from 'lodash/filter';
import _groupBy from 'lodash/groupBy';
import _sortBy from 'lodash/sortBy';
Expand All @@ -85,6 +85,7 @@ import {
SystemModel,
ServiceStatusModel,
DependenciesModel,
WinRMPayload,
} from '../models';
type DashboardModel = {
Expand All @@ -99,6 +100,12 @@ type DashboardModel = {
export default defineComponent({
name: 'DashboardComponent',
props: {
host: {
type: Object as PropType<WinRMPayload>,
required: true,
},
},
components: {
DCardComponent,
SystemInfoComponent,
Expand All @@ -109,7 +116,7 @@ export default defineComponent({
ServiceTypeComponent,
},
setup() {
setup(props) {
const model = ref<DashboardModel>({
services: {},
drivers: {},
Expand Down Expand Up @@ -217,19 +224,19 @@ export default defineComponent({
};
const loadServices = async (): Promise<ServiceModel[] | undefined> => {
const res = await serviceApi.getServices();
const res = await serviceApi.getServices(props.host);
return res;
};
const loadSystem = async (): Promise<SystemModel> => {
const res = await serviceApi.getSystemInformation();
const res = await serviceApi.getSystemInformation(props.host);
return res;
};
const loadDependencies = async (): Promise<
DependenciesModel[] | undefined
> => {
const res = await serviceApi.getDependencies();
const res = await serviceApi.getDependencies(props.host);
return res;
};
Expand Down
Loading

0 comments on commit 425a7f6

Please sign in to comment.